(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/misc/channel#channel::t
    (make-struct-type
     'std/misc/channel#channel::t
     '#f
     '5
     'channel
     '((final: . #t))
     ':init!
     '(q mx cv limit eof)))
  (define std/misc/channel#channel?
    (make-struct-predicate std/misc/channel#channel::t))
  (define std/misc/channel#make-channel
    (lambda _$args181104_
      (apply make-struct-instance std/misc/channel#channel::t _$args181104_)))
  (define std/misc/channel#channel-q
    (make-struct-field-accessor std/misc/channel#channel::t '0))
  (define std/misc/channel#channel-mx
    (make-struct-field-accessor std/misc/channel#channel::t '1))
  (define std/misc/channel#channel-cv
    (make-struct-field-accessor std/misc/channel#channel::t '2))
  (define std/misc/channel#channel-limit
    (make-struct-field-accessor std/misc/channel#channel::t '3))
  (define std/misc/channel#channel-eof
    (make-struct-field-accessor std/misc/channel#channel::t '4))
  (define std/misc/channel#channel-q-set!
    (make-struct-field-mutator std/misc/channel#channel::t '0))
  (define std/misc/channel#channel-mx-set!
    (make-struct-field-mutator std/misc/channel#channel::t '1))
  (define std/misc/channel#channel-cv-set!
    (make-struct-field-mutator std/misc/channel#channel::t '2))
  (define std/misc/channel#channel-limit-set!
    (make-struct-field-mutator std/misc/channel#channel::t '3))
  (define std/misc/channel#channel-eof-set!
    (make-struct-field-mutator std/misc/channel#channel::t '4))
  (define std/misc/channel#&channel-q
    (make-struct-field-unchecked-accessor std/misc/channel#channel::t '0))
  (define std/misc/channel#&channel-mx
    (make-struct-field-unchecked-accessor std/misc/channel#channel::t '1))
  (define std/misc/channel#&channel-cv
    (make-struct-field-unchecked-accessor std/misc/channel#channel::t '2))
  (define std/misc/channel#&channel-limit
    (make-struct-field-unchecked-accessor std/misc/channel#channel::t '3))
  (define std/misc/channel#&channel-eof
    (make-struct-field-unchecked-accessor std/misc/channel#channel::t '4))
  (define std/misc/channel#&channel-q-set!
    (make-struct-field-unchecked-mutator std/misc/channel#channel::t '0))
  (define std/misc/channel#&channel-mx-set!
    (make-struct-field-unchecked-mutator std/misc/channel#channel::t '1))
  (define std/misc/channel#&channel-cv-set!
    (make-struct-field-unchecked-mutator std/misc/channel#channel::t '2))
  (define std/misc/channel#&channel-limit-set!
    (make-struct-field-unchecked-mutator std/misc/channel#channel::t '3))
  (define std/misc/channel#&channel-eof-set!
    (make-struct-field-unchecked-mutator std/misc/channel#channel::t '4))
  (define std/misc/channel#channel:::init!__%
    (lambda (_self181091_ _limit181092_)
      (if (##fx< '5 (##vector-length _self181091_))
          (begin
            (##vector-set!
             _self181091_
             '1
             (let ((__obj181106 (make-object std/misc/queue#queue::t '3)))
               (std/misc/queue#queue:::init! __obj181106)
               __obj181106))
            (##vector-set! _self181091_ '2 (make-mutex 'channel))
            (##vector-set! _self181091_ '3 (make-condition-variable 'channel))
            (##vector-set! _self181091_ '4 _limit181092_)
            (##vector-set! _self181091_ '5 '#f))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self181091_))))
  (define std/misc/channel#channel:::init!__0
    (lambda (_self181097_)
      (let ((_limit181099_ '#f))
        (std/misc/channel#channel:::init!__% _self181097_ _limit181099_))))
  (define std/misc/channel#channel:::init!
    (lambda _g181109_
      (let ((_g181108_ (length _g181109_)))
        (cond ((##fx= _g181108_ 1)
               (apply std/misc/channel#channel:::init!__0 _g181109_))
              ((##fx= _g181108_ 2)
               (apply std/misc/channel#channel:::init!__% _g181109_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/channel#channel:::init!
                _g181109_))))))
  (bind-method!
   std/misc/channel#channel::t
   ':init!
   std/misc/channel#channel:::init!
   '#f)
  (define std/misc/channel#channel-put__%
    (lambda (_ch180901_ _val180902_ _timeo180903_)
      (let* ((_timeo180905_ (std/misc/timeout#make-timeout__0 _timeo180903_))
             (_ch180906180915_ _ch180901_)
             (_E180908180919_
              (lambda () (error '"No clause matching" _ch180906180915_)))
             (_K180909180933_
              (lambda (_limit180922_ _cv180923_ _mx180924_ _q180925_)
                (let _lp180927_ ()
                  (mutex-lock! _mx180924_)
                  (if (##unchecked-structure-ref
                       _ch180901_
                       '5
                       std/misc/channel#channel::t
                       '#f)
                      (begin
                        (mutex-unlock! _mx180924_)
                        (std/error#raise-io-error
                         'channel-put
                         '"channel is closed"
                         _ch180901_))
                      (if (or (not _limit180922_)
                              (##fx< (##direct-structure-ref
                                      _q180925_
                                      '3
                                      std/misc/queue#queue::t
                                      '#f)
                                     _limit180922_))
                          (begin
                            (std/misc/queue#enqueue! _q180925_ _val180902_)
                            (if (##fx= (##direct-structure-ref
                                        _q180925_
                                        '3
                                        std/misc/queue#queue::t
                                        '#f)
                                       '1)
                                (condition-variable-broadcast! _cv180923_)
                                '#!void)
                            (mutex-unlock! _mx180924_)
                            '#t)
                          (if (mutex-unlock!
                               _mx180924_
                               _cv180923_
                               _timeo180905_)
                              (_lp180927_)
                              '#f)))))))
        (if (##structure-direct-instance-of?
             _ch180906180915_
             'std/misc/channel#channel::t)
            (let* ((_e180910180936_ (##vector-ref _ch180906180915_ '1))
                   (_q180939_ _e180910180936_)
                   (_e180911180941_ (##vector-ref _ch180906180915_ '2))
                   (_mx180944_ _e180911180941_)
                   (_e180912180946_ (##vector-ref _ch180906180915_ '3))
                   (_cv180949_ _e180912180946_)
                   (_e180913180951_ (##vector-ref _ch180906180915_ '4))
                   (_limit180954_ _e180913180951_))
              (_K180909180933_ _limit180954_ _cv180949_ _mx180944_ _q180939_))
            (_E180908180919_)))))
  (define std/misc/channel#channel-put__0
    (lambda (_ch180959_ _val180960_)
      (let ((_timeo180962_ '#f))
        (std/misc/channel#channel-put__%
         _ch180959_
         _val180960_
         _timeo180962_))))
  (define std/misc/channel#channel-put
    (lambda _g181111_
      (let ((_g181110_ (length _g181111_)))
        (cond ((##fx= _g181110_ 2)
               (apply std/misc/channel#channel-put__0 _g181111_))
              ((##fx= _g181110_ 3)
               (apply std/misc/channel#channel-put__% _g181111_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/channel#channel-put
                _g181111_))))))
  (define std/misc/channel#channel-try-put
    (lambda (_ch180851_ _val180852_)
      (let* ((_ch180853180862_ _ch180851_)
             (_E180855180866_
              (lambda () (error '"No clause matching" _ch180853180862_)))
             (_K180856180877_
              (lambda (_limit180869_ _cv180870_ _mx180871_ _q180872_)
                (mutex-lock! _mx180871_)
                (if (##unchecked-structure-ref
                     _ch180851_
                     '5
                     std/misc/channel#channel::t
                     '#f)
                    (begin
                      (mutex-unlock! _mx180871_)
                      (std/error#raise-io-error
                       'channel-try-put
                       '"channel is closed"
                       _ch180851_))
                    (if (or (not _limit180869_)
                            (##fx< (##direct-structure-ref
                                    _q180872_
                                    '3
                                    std/misc/queue#queue::t
                                    '#f)
                                   _limit180869_))
                        (begin
                          (std/misc/queue#enqueue! _q180872_ _val180852_)
                          (if (##fx= (##direct-structure-ref
                                      _q180872_
                                      '3
                                      std/misc/queue#queue::t
                                      '#f)
                                     '1)
                              (condition-variable-broadcast! _cv180870_)
                              '#!void)
                          (mutex-unlock! _mx180871_)
                          '#t)
                        (begin (mutex-unlock! _mx180871_) '#f))))))
        (if (##structure-direct-instance-of?
             _ch180853180862_
             'std/misc/channel#channel::t)
            (let* ((_e180857180880_ (##vector-ref _ch180853180862_ '1))
                   (_q180883_ _e180857180880_)
                   (_e180858180885_ (##vector-ref _ch180853180862_ '2))
                   (_mx180888_ _e180858180885_)
                   (_e180859180890_ (##vector-ref _ch180853180862_ '3))
                   (_cv180893_ _e180859180890_)
                   (_e180860180895_ (##vector-ref _ch180853180862_ '4))
                   (_limit180898_ _e180860180895_))
              (_K180856180877_ _limit180898_ _cv180893_ _mx180888_ _q180883_))
            (_E180855180866_)))))
  (define std/misc/channel#channel-sync
    (lambda (_ch180801_ . _vals180802_)
      (let* ((_ch180803180812_ _ch180801_)
             (_E180805180816_
              (lambda () (error '"No clause matching" _ch180803180812_)))
             (_K180806180828_
              (lambda (_limit180819_ _cv180820_ _mx180821_ _q180822_)
                (mutex-lock! _mx180821_)
                (if (##unchecked-structure-ref
                     _ch180801_
                     '5
                     std/misc/channel#channel::t
                     '#f)
                    (begin
                      (mutex-unlock! _mx180821_)
                      (std/error#raise-io-error
                       'channel-sync
                       '"channel is closed"
                       _ch180801_))
                    (begin
                      (if (null? _vals180802_)
                          '#!void
                          (begin
                            (for-each
                             (lambda (_g180823180825_)
                               (std/misc/queue#enqueue!
                                _q180822_
                                _g180823180825_))
                             _vals180802_)
                            (condition-variable-broadcast! _cv180820_)))
                      (mutex-unlock! _mx180821_))))))
        (if (##structure-direct-instance-of?
             _ch180803180812_
             'std/misc/channel#channel::t)
            (let* ((_e180807180831_ (##vector-ref _ch180803180812_ '1))
                   (_q180834_ _e180807180831_)
                   (_e180808180836_ (##vector-ref _ch180803180812_ '2))
                   (_mx180839_ _e180808180836_)
                   (_e180809180841_ (##vector-ref _ch180803180812_ '3))
                   (_cv180844_ _e180809180841_)
                   (_e180810180846_ (##vector-ref _ch180803180812_ '4))
                   (_limit180849_ _e180810180846_))
              (_K180806180828_ _limit180849_ _cv180844_ _mx180839_ _q180834_))
            (_E180805180816_)))))
  (define std/misc/channel#channel-get__%
    (lambda (_ch180729_ _timeo180730_ _default180731_)
      (let* ((_timeo180733_ (std/misc/timeout#make-timeout__0 _timeo180730_))
             (_ch180734180743_ _ch180729_)
             (_E180736180747_
              (lambda () (error '"No clause matching" _ch180734180743_)))
             (_K180737180760_
              (lambda (_limit180750_ _cv180751_ _mx180752_ _q180753_)
                (let _lp180755_ ()
                  (mutex-lock! _mx180752_)
                  (if (std/misc/queue#queue-empty? _q180753_)
                      (if (##unchecked-structure-ref
                           _ch180729_
                           '5
                           std/misc/channel#channel::t
                           '#f)
                          (begin (mutex-unlock! _mx180752_) '#!eof)
                          (if (mutex-unlock!
                               _mx180752_
                               _cv180751_
                               _timeo180733_)
                              (_lp180755_)
                              _default180731_))
                      (let ((_next180758_
                             (std/misc/queue#dequeue!__0 _q180753_)))
                        (if (and _limit180750_
                                 (##fx= (##direct-structure-ref
                                         _q180753_
                                         '3
                                         std/misc/queue#queue::t
                                         '#f)
                                        (##fx- _limit180750_ '1)))
                            (condition-variable-broadcast! _cv180751_)
                            '#!void)
                        (mutex-unlock! _mx180752_)
                        _next180758_))))))
        (if (##structure-direct-instance-of?
             _ch180734180743_
             'std/misc/channel#channel::t)
            (let* ((_e180738180763_ (##vector-ref _ch180734180743_ '1))
                   (_q180766_ _e180738180763_)
                   (_e180739180768_ (##vector-ref _ch180734180743_ '2))
                   (_mx180771_ _e180739180768_)
                   (_e180740180773_ (##vector-ref _ch180734180743_ '3))
                   (_cv180776_ _e180740180773_)
                   (_e180741180778_ (##vector-ref _ch180734180743_ '4))
                   (_limit180781_ _e180741180778_))
              (_K180737180760_ _limit180781_ _cv180776_ _mx180771_ _q180766_))
            (_E180736180747_)))))
  (define std/misc/channel#channel-get__0
    (lambda (_ch180786_)
      (let* ((_timeo180788_ '#f) (_default180790_ '#f))
        (std/misc/channel#channel-get__%
         _ch180786_
         _timeo180788_
         _default180790_))))
  (define std/misc/channel#channel-get__1
    (lambda (_ch180792_ _timeo180793_)
      (let ((_default180795_ '#f))
        (std/misc/channel#channel-get__%
         _ch180792_
         _timeo180793_
         _default180795_))))
  (define std/misc/channel#channel-get
    (lambda _g181113_
      (let ((_g181112_ (length _g181113_)))
        (cond ((##fx= _g181112_ 1)
               (apply std/misc/channel#channel-get__0 _g181113_))
              ((##fx= _g181112_ 2)
               (apply std/misc/channel#channel-get__1 _g181113_))
              ((##fx= _g181112_ 3)
               (apply std/misc/channel#channel-get__% _g181113_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/channel#channel-get
                _g181113_))))))
  (define std/misc/channel#channel-try-get__%
    (lambda (_ch180670_ _default180671_)
      (let* ((_ch180672180681_ _ch180670_)
             (_E180674180685_
              (lambda () (error '"No clause matching" _ch180672180681_)))
             (_K180675180695_
              (lambda (_limit180688_ _cv180689_ _mx180690_ _q180691_)
                (mutex-lock! _mx180690_)
                (if (std/misc/queue#queue-empty? _q180691_)
                    (begin
                      (mutex-unlock! _mx180690_)
                      (if (##unchecked-structure-ref
                           _ch180670_
                           '5
                           std/misc/channel#channel::t
                           '#f)
                          '#!eof
                          _default180671_))
                    (let ((_next180693_
                           (std/misc/queue#dequeue!__0 _q180691_)))
                      (if (and _limit180688_
                               (##fx= (##direct-structure-ref
                                       _q180691_
                                       '3
                                       std/misc/queue#queue::t
                                       '#f)
                                      (##fx- _limit180688_ '1)))
                          (condition-variable-broadcast! _cv180689_)
                          '#!void)
                      (mutex-unlock! _mx180690_)
                      _next180693_)))))
        (if (##structure-direct-instance-of?
             _ch180672180681_
             'std/misc/channel#channel::t)
            (let* ((_e180676180698_ (##vector-ref _ch180672180681_ '1))
                   (_q180701_ _e180676180698_)
                   (_e180677180703_ (##vector-ref _ch180672180681_ '2))
                   (_mx180706_ _e180677180703_)
                   (_e180678180708_ (##vector-ref _ch180672180681_ '3))
                   (_cv180711_ _e180678180708_)
                   (_e180679180713_ (##vector-ref _ch180672180681_ '4))
                   (_limit180716_ _e180679180713_))
              (_K180675180695_ _limit180716_ _cv180711_ _mx180706_ _q180701_))
            (_E180674180685_)))))
  (define std/misc/channel#channel-try-get__0
    (lambda (_ch180721_)
      (let ((_default180723_ '#f))
        (std/misc/channel#channel-try-get__% _ch180721_ _default180723_))))
  (define std/misc/channel#channel-try-get
    (lambda _g181115_
      (let ((_g181114_ (length _g181115_)))
        (cond ((##fx= _g181114_ 1)
               (apply std/misc/channel#channel-try-get__0 _g181115_))
              ((##fx= _g181114_ 2)
               (apply std/misc/channel#channel-try-get__% _g181115_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/channel#channel-try-get
                _g181115_))))))
  (define std/misc/channel#channel-close
    (lambda (_ch180620_)
      (let* ((_ch180621180631_ _ch180620_)
             (_E180623180635_
              (lambda () (error '"No clause matching" _ch180621180631_)))
             (_K180624180643_
              (lambda (_eof180638_ _cv180639_ _mx180640_ _q180641_)
                (if _eof180638_
                    '#!void
                    (begin
                      (mutex-lock! _mx180640_)
                      (##unchecked-structure-set!
                       _ch180620_
                       '#t
                       '5
                       std/misc/channel#channel::t
                       '#f)
                      (condition-variable-broadcast!
                       (##direct-structure-ref
                        _ch180620_
                        '3
                        std/misc/channel#channel::t
                        '#f))
                      (mutex-unlock! _mx180640_))))))
        (if (##structure-direct-instance-of?
             _ch180621180631_
             'std/misc/channel#channel::t)
            (let* ((_e180625180646_ (##vector-ref _ch180621180631_ '1))
                   (_q180649_ _e180625180646_)
                   (_e180626180651_ (##vector-ref _ch180621180631_ '2))
                   (_mx180654_ _e180626180651_)
                   (_e180627180656_ (##vector-ref _ch180621180631_ '3))
                   (_cv180659_ _e180627180656_)
                   (_e180628180661_ (##vector-ref _ch180621180631_ '4))
                   (_e180629180664_ (##vector-ref _ch180621180631_ '5))
                   (_eof180667_ _e180629180664_))
              (_K180624180643_ _eof180667_ _cv180659_ _mx180654_ _q180649_))
            (_E180623180635_)))))
  (define std/misc/channel#channel::destroy std/misc/channel#channel-close)
  (bind-method!
   std/misc/channel#channel::t
   'destroy
   std/misc/channel#channel::destroy
   '#f)
  (define std/misc/channel#channel-closed?
    (lambda (_ch180496_)
      (##direct-structure-ref _ch180496_ '5 std/misc/channel#channel::t '#f)))
  (define std/misc/channel#:iter::channel
    (lambda (_ch180494_) (std/misc/channel#iter-channel _ch180494_)))
  (std/generic/dispatch#generic-bind!
   std/iter#:iter::t
   (cons (std/generic/dispatch#type-linearize-class
          std/misc/channel#channel::t)
         '())
   std/misc/channel#:iter::channel)
  (define std/misc/channel#iter-channel
    (lambda (_ch180398_)
      (letrec ((_next180400_
                (lambda (_it180402_)
                  (let* ((_it180403180409_ _it180402_)
                         (_E180405180413_
                          (lambda ()
                            (error '"No clause matching" _it180403180409_)))
                         (_K180406180420_
                          (lambda (_ch180416_)
                            (let ((_val180418_
                                   (std/misc/channel#channel-get__0
                                    _ch180416_)))
                              (if (eof-object? _val180418_)
                                  std/iter#iter-end
                                  _val180418_)))))
                    (if (##structure-direct-instance-of?
                         _it180403180409_
                         'std/iter#iterator::t)
                        (let* ((_e180407180423_
                                (##vector-ref _it180403180409_ '1))
                               (_ch180426_ _e180407180423_))
                          (_K180406180420_ _ch180426_))
                        (_E180405180413_))))))
        (let ((__obj181107 (make-object std/iter#iterator::t '3)))
          (std/iter#iterator:::init!__0 __obj181107 _ch180398_ _next180400_)
          __obj181107)))))
