(declare (block) (standard-bindings) (extended-bindings))
(begin
  (declare (not safe))
  (define std/misc/queue#queue::t
    (make-struct-type
     'std/misc/queue#queue::t
     '#f
     '3
     'queue
     '((final: . #t))
     ':init!
     '(front back length)))
  (define std/misc/queue#queue?
    (make-struct-predicate std/misc/queue#queue::t))
  (define std/misc/queue#make-queue
    (lambda _$args117710_
      (apply make-struct-instance std/misc/queue#queue::t _$args117710_)))
  (define std/misc/queue#queue-front
    (make-struct-field-accessor std/misc/queue#queue::t '0))
  (define std/misc/queue#queue-back
    (make-struct-field-accessor std/misc/queue#queue::t '1))
  (define std/misc/queue#queue-length
    (make-struct-field-accessor std/misc/queue#queue::t '2))
  (define std/misc/queue#queue-front-set!
    (make-struct-field-mutator std/misc/queue#queue::t '0))
  (define std/misc/queue#queue-back-set!
    (make-struct-field-mutator std/misc/queue#queue::t '1))
  (define std/misc/queue#queue-length-set!
    (make-struct-field-mutator std/misc/queue#queue::t '2))
  (define std/misc/queue#&queue-front
    (make-struct-field-unchecked-accessor std/misc/queue#queue::t '0))
  (define std/misc/queue#&queue-back
    (make-struct-field-unchecked-accessor std/misc/queue#queue::t '1))
  (define std/misc/queue#&queue-length
    (make-struct-field-unchecked-accessor std/misc/queue#queue::t '2))
  (define std/misc/queue#&queue-front-set!
    (make-struct-field-unchecked-mutator std/misc/queue#queue::t '0))
  (define std/misc/queue#&queue-back-set!
    (make-struct-field-unchecked-mutator std/misc/queue#queue::t '1))
  (define std/misc/queue#&queue-length-set!
    (make-struct-field-unchecked-mutator std/misc/queue#queue::t '2))
  (define std/misc/queue#queue:::init!
    (lambda (_self117708_)
      (if (##fx< '3 (##vector-length _self117708_))
          (begin
            (##vector-set! _self117708_ '1 '())
            (##vector-set! _self117708_ '2 '#f)
            (##vector-set! _self117708_ '3 '0))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self117708_))))
  (bind-method!
   std/misc/queue#queue::t
   ':init!
   std/misc/queue#queue:::init!
   '#f)
  (define std/misc/queue#queue-empty?
    (lambda (_q117583_)
      (null? (##direct-structure-ref
              _q117583_
              '1
              std/misc/queue#queue::t
              '#f))))
  (define std/misc/queue#non-empty-queue?
    (lambda (_q117581_)
      (pair? (##direct-structure-ref
              _q117581_
              '1
              std/misc/queue#queue::t
              '#f))))
  (define std/misc/queue#enqueue!
    (lambda (_q117538_ _v117539_)
      (let* ((_q117540117548_ _q117538_)
             (_E117542117552_
              (lambda () (error '"No clause matching" _q117540117548_)))
             (_K117543117563_
              (lambda (_length117555_ _back117556_ _front117557_)
                (if (null? _front117557_)
                    (let ((_front117559_ (cons _v117539_ '())))
                      (##unchecked-structure-set!
                       _q117538_
                       _front117559_
                       '1
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q117538_
                       _front117559_
                       '2
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q117538_
                       '1
                       '3
                       std/misc/queue#queue::t
                       '#f))
                    (let ((_new-back117561_ (cons _v117539_ '())))
                      (set-cdr! _back117556_ _new-back117561_)
                      (##unchecked-structure-set!
                       _q117538_
                       _new-back117561_
                       '2
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q117538_
                       (fx+ _length117555_ '1)
                       '3
                       std/misc/queue#queue::t
                       '#f))))))
        (if (##structure-direct-instance-of?
             _q117540117548_
             'std/misc/queue#queue::t)
            (let* ((_e117544117566_ (##vector-ref _q117540117548_ '1))
                   (_front117569_ _e117544117566_)
                   (_e117545117571_ (##vector-ref _q117540117548_ '2))
                   (_back117574_ _e117545117571_)
                   (_e117546117576_ (##vector-ref _q117540117548_ '3))
                   (_length117579_ _e117546117576_))
              (_K117543117563_ _length117579_ _back117574_ _front117569_))
            (_E117542117552_)))))
  (define std/misc/queue#enqueue-front!
    (lambda (_q117500_ _v117501_)
      (if (std/misc/queue#queue-empty? _q117500_)
          (std/misc/queue#enqueue! _q117500_ _v117501_)
          (let* ((_q117502117510_ _q117500_)
                 (_E117504117514_
                  (lambda () (error '"No clause matching" _q117502117510_)))
                 (_K117505117522_
                  (lambda (_length117517_ _front117518_)
                    (let ((_new-front117520_ (cons _v117501_ _front117518_)))
                      (##unchecked-structure-set!
                       _q117500_
                       _new-front117520_
                       '1
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q117500_
                       (fx+ _length117517_ '1)
                       '3
                       std/misc/queue#queue::t
                       '#f)))))
            (if (##structure-direct-instance-of?
                 _q117502117510_
                 'std/misc/queue#queue::t)
                (let* ((_e117506117525_ (##vector-ref _q117502117510_ '1))
                       (_front117528_ _e117506117525_)
                       (_e117507117530_ (##vector-ref _q117502117510_ '2))
                       (_e117508117533_ (##vector-ref _q117502117510_ '3))
                       (_length117536_ _e117508117533_))
                  (_K117505117522_ _length117536_ _front117528_))
                (_E117504117514_))))))
  (define std/misc/queue#dequeue!__%
    (lambda (_q117446_ _default117447_)
      (let* ((_q117448117456_ _q117446_)
             (_E117450117460_
              (lambda () (error '"No clause matching" _q117448117456_)))
             (_K117451117472_
              (lambda (_length117463_ _back117464_ _front117465_)
                (if (eq? _front117465_ _back117464_)
                    (let ((_v117467_ (car _front117465_)))
                      (##unchecked-structure-set!
                       _q117446_
                       '()
                       '1
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q117446_
                       '#f
                       '2
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q117446_
                       '0
                       '3
                       std/misc/queue#queue::t
                       '#f)
                      _v117467_)
                    (if (pair? _front117465_)
                        (let ((_v117469_ (car _front117465_))
                              (_new-front117470_ (cdr _front117465_)))
                          (##unchecked-structure-set!
                           _q117446_
                           _new-front117470_
                           '1
                           std/misc/queue#queue::t
                           '#f)
                          (##unchecked-structure-set!
                           _q117446_
                           (fx- _length117463_ '1)
                           '3
                           std/misc/queue#queue::t
                           '#f)
                          _v117469_)
                        (if (eq? _default117447_ absent-obj)
                            (error '"cannot dequeue; empty queue" _q117446_)
                            _default117447_))))))
        (if (##structure-direct-instance-of?
             _q117448117456_
             'std/misc/queue#queue::t)
            (let* ((_e117452117475_ (##vector-ref _q117448117456_ '1))
                   (_front117478_ _e117452117475_)
                   (_e117453117480_ (##vector-ref _q117448117456_ '2))
                   (_back117483_ _e117453117480_)
                   (_e117454117485_ (##vector-ref _q117448117456_ '3))
                   (_length117488_ _e117454117485_))
              (_K117451117472_ _length117488_ _back117483_ _front117478_))
            (_E117450117460_)))))
  (define std/misc/queue#dequeue!__0
    (lambda (_q117493_)
      (let ((_default117495_ absent-obj))
        (std/misc/queue#dequeue!__% _q117493_ _default117495_))))
  (define std/misc/queue#dequeue!
    (lambda _g117713_
      (let ((_g117712_ (length _g117713_)))
        (cond ((##fx= _g117712_ 1)
               (apply std/misc/queue#dequeue!__0 _g117713_))
              ((##fx= _g117712_ 2)
               (apply std/misc/queue#dequeue!__% _g117713_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/queue#dequeue!
                _g117713_))))))
  (define std/misc/queue#queue-peek__%
    (lambda (_q117410_ _default117411_)
      (let* ((_q117412117418_ _q117410_)
             (_E117414117422_
              (lambda () (error '"No clause matching" _q117412117418_)))
             (_K117415117427_
              (lambda (_front117425_)
                (if (pair? _front117425_)
                    (car _front117425_)
                    (if (eq? _default117411_ absent-obj)
                        (error '"cannot peek; empty queue" _q117410_)
                        _default117411_)))))
        (if (##structure-direct-instance-of?
             _q117412117418_
             'std/misc/queue#queue::t)
            (let* ((_e117416117430_ (##vector-ref _q117412117418_ '1))
                   (_front117433_ _e117416117430_))
              (_K117415117427_ _front117433_))
            (_E117414117422_)))))
  (define std/misc/queue#queue-peek__0
    (lambda (_q117438_)
      (let ((_default117440_ absent-obj))
        (std/misc/queue#queue-peek__% _q117438_ _default117440_))))
  (define std/misc/queue#queue-peek
    (lambda _g117715_
      (let ((_g117714_ (length _g117715_)))
        (cond ((##fx= _g117714_ 1)
               (apply std/misc/queue#queue-peek__0 _g117715_))
              ((##fx= _g117714_ 2)
               (apply std/misc/queue#queue-peek__% _g117715_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/queue#queue-peek
                _g117715_))))))
  (define std/misc/queue#queue->list
    (lambda (_q117407_)
      (foldr1 cons
              '()
              (##direct-structure-ref
               _q117407_
               '1
               std/misc/queue#queue::t
               '#f)))))
