(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/misc/completion#completion::t
    (make-struct-type
     'std/misc/completion#completion::t
     '#f
     '5
     'completion
     '((final: . #t))
     ':init!
     '(mx cv ready? val exn)))
  (define std/misc/completion#completion?
    (make-struct-predicate std/misc/completion#completion::t))
  (define std/misc/completion#make-completion
    (lambda _$args120017_
      (apply make-struct-instance
             std/misc/completion#completion::t
             _$args120017_)))
  (define std/misc/completion#completion-mx
    (make-struct-field-accessor std/misc/completion#completion::t '0))
  (define std/misc/completion#completion-cv
    (make-struct-field-accessor std/misc/completion#completion::t '1))
  (define std/misc/completion#completion-ready?
    (make-struct-field-accessor std/misc/completion#completion::t '2))
  (define std/misc/completion#completion-val
    (make-struct-field-accessor std/misc/completion#completion::t '3))
  (define std/misc/completion#completion-exn
    (make-struct-field-accessor std/misc/completion#completion::t '4))
  (define std/misc/completion#completion-mx-set!
    (make-struct-field-mutator std/misc/completion#completion::t '0))
  (define std/misc/completion#completion-cv-set!
    (make-struct-field-mutator std/misc/completion#completion::t '1))
  (define std/misc/completion#completion-ready?-set!
    (make-struct-field-mutator std/misc/completion#completion::t '2))
  (define std/misc/completion#completion-val-set!
    (make-struct-field-mutator std/misc/completion#completion::t '3))
  (define std/misc/completion#completion-exn-set!
    (make-struct-field-mutator std/misc/completion#completion::t '4))
  (define std/misc/completion#&completion-mx
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '0))
  (define std/misc/completion#&completion-cv
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '1))
  (define std/misc/completion#&completion-ready?
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '2))
  (define std/misc/completion#&completion-val
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '3))
  (define std/misc/completion#&completion-exn
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '4))
  (define std/misc/completion#&completion-mx-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '0))
  (define std/misc/completion#&completion-cv-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '1))
  (define std/misc/completion#&completion-ready?-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '2))
  (define std/misc/completion#&completion-val-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '3))
  (define std/misc/completion#&completion-exn-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '4))
  (define std/misc/completion#completion:::init!
    (lambda (_self120015_)
      (if (##fx< '2 (##vector-length _self120015_))
          (begin
            (##vector-set! _self120015_ '1 (make-mutex 'completion))
            (##vector-set!
             _self120015_
             '2
             (make-condition-variable 'completion)))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self120015_))))
  (bind-method!
   std/misc/completion#completion::t
   ':init!
   std/misc/completion#completion:::init!
   '#f)
  (define std/misc/completion#completion-wait!
    (lambda (_compl119856_)
      (let* ((_compl119857119864_ _compl119856_)
             (_E119859119868_
              (lambda () (error '"No clause matching" _compl119857119864_)))
             (_K119860119880_
              (lambda (_cv119871_ _mx119872_)
                (let _lp119874_ ()
                  (mutex-lock! _mx119872_)
                  (if (##unchecked-structure-ref
                       _compl119856_
                       '3
                       std/misc/completion#completion::t
                       '#f)
                      (begin
                        (mutex-unlock! _mx119872_)
                        (let ((_$e119877_
                               (##unchecked-structure-ref
                                _compl119856_
                                '5
                                std/misc/completion#completion::t
                                '#f)))
                          (if _$e119877_
                              (raise _$e119877_)
                              (##unchecked-structure-ref
                               _compl119856_
                               '4
                               std/misc/completion#completion::t
                               '#f))))
                      (begin
                        (mutex-unlock! _mx119872_ _cv119871_)
                        (_lp119874_)))))))
        (if (##structure-direct-instance-of?
             _compl119857119864_
             'std/misc/completion#completion::t)
            (let* ((_e119861119883_ (##vector-ref _compl119857119864_ '1))
                   (_mx119886_ _e119861119883_)
                   (_e119862119888_ (##vector-ref _compl119857119864_ '2))
                   (_cv119891_ _e119862119888_))
              (_K119860119880_ _cv119891_ _mx119886_))
            (_E119859119868_)))))
  (define std/misc/completion#completion-post!
    (lambda (_compl119822_ _val119823_)
      (let* ((_compl119824119831_ _compl119822_)
             (_E119826119835_
              (lambda () (error '"No clause matching" _compl119824119831_)))
             (_K119827119843_
              (lambda (_cv119838_ _mx119840_)
                (mutex-lock! _mx119840_)
                (if (##unchecked-structure-ref
                     _compl119822_
                     '3
                     std/misc/completion#completion::t
                     '#f)
                    (begin
                      (mutex-unlock! _mx119840_)
                      (error '"Completion has already been posted"
                             _compl119822_))
                    (begin
                      (##unchecked-structure-set!
                       _compl119822_
                       _val119823_
                       '4
                       std/misc/completion#completion::t
                       '#f)
                      (##unchecked-structure-set!
                       _compl119822_
                       '#t
                       '3
                       std/misc/completion#completion::t
                       '#f)
                      (mutex-unlock! _mx119840_)
                      (condition-variable-broadcast! _cv119838_)
                      '#!void)))))
        (if (##structure-direct-instance-of?
             _compl119824119831_
             'std/misc/completion#completion::t)
            (let* ((_e119828119846_ (##vector-ref _compl119824119831_ '1))
                   (_mx119849_ _e119828119846_)
                   (_e119829119851_ (##vector-ref _compl119824119831_ '2))
                   (_cv119854_ _e119829119851_))
              (_K119827119843_ _cv119854_ _mx119849_))
            (_E119826119835_)))))
  (define std/misc/completion#completion-error!
    (lambda (_compl119788_ _exn119789_)
      (let* ((_compl119790119797_ _compl119788_)
             (_E119792119801_
              (lambda () (error '"No clause matching" _compl119790119797_)))
             (_K119793119809_
              (lambda (_cv119804_ _mx119806_)
                (mutex-lock! _mx119806_)
                (if (##unchecked-structure-ref
                     _compl119788_
                     '3
                     std/misc/completion#completion::t
                     '#f)
                    (begin
                      (mutex-unlock! _mx119806_)
                      (error '"Completion has already been posted"
                             _compl119788_))
                    (begin
                      (##unchecked-structure-set!
                       _compl119788_
                       _exn119789_
                       '5
                       std/misc/completion#completion::t
                       '#f)
                      (##unchecked-structure-set!
                       _compl119788_
                       '#t
                       '3
                       std/misc/completion#completion::t
                       '#f)
                      (mutex-unlock! _mx119806_)
                      (condition-variable-broadcast! _cv119804_)
                      '#!void)))))
        (if (##structure-direct-instance-of?
             _compl119790119797_
             'std/misc/completion#completion::t)
            (let* ((_e119794119812_ (##vector-ref _compl119790119797_ '1))
                   (_mx119815_ _e119794119812_)
                   (_e119795119817_ (##vector-ref _compl119790119797_ '2))
                   (_cv119820_ _e119795119817_))
              (_K119793119809_ _cv119820_ _mx119815_))
            (_E119792119801_))))))
