(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 _$args693_
      (apply make-struct-instance std/misc/queue#queue::t _$args693_)))
  (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 (_self691_)
      (if (##fx< '3 (##vector-length _self691_))
          (begin
            (##vector-set! _self691_ '1 '())
            (##vector-set! _self691_ '2 '#f)
            (##vector-set! _self691_ '3 '0))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self691_))))
  (bind-method!
   std/misc/queue#queue::t
   ':init!
   std/misc/queue#queue:::init!
   '#f)
  (define std/misc/queue#queue-empty?
    (lambda (_q565_)
      (null? (##direct-structure-ref _q565_ '1 std/misc/queue#queue::t '#f))))
  (define std/misc/queue#non-empty-queue?
    (lambda (_q563_)
      (pair? (##direct-structure-ref _q563_ '1 std/misc/queue#queue::t '#f))))
  (define std/misc/queue#enqueue!
    (lambda (_q520_ _v521_)
      (let* ((_q522530_ _q520_)
             (_E524534_ (lambda () (error '"No clause matching" _q522530_)))
             (_K525545_
              (lambda (_length537_ _back538_ _front539_)
                (if (null? _front539_)
                    (let ((_front541_ (cons _v521_ '())))
                      (##unchecked-structure-set!
                       _q520_
                       _front541_
                       '1
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q520_
                       _front541_
                       '2
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q520_
                       '1
                       '3
                       std/misc/queue#queue::t
                       '#f))
                    (let ((_new-back543_ (cons _v521_ '())))
                      (set-cdr! _back538_ _new-back543_)
                      (##unchecked-structure-set!
                       _q520_
                       _new-back543_
                       '2
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q520_
                       (fx+ _length537_ '1)
                       '3
                       std/misc/queue#queue::t
                       '#f))))))
        (if (##structure-direct-instance-of?
             _q522530_
             'std/misc/queue#queue::t)
            (let* ((_e526548_ (##vector-ref _q522530_ '1))
                   (_front551_ _e526548_)
                   (_e527553_ (##vector-ref _q522530_ '2))
                   (_back556_ _e527553_)
                   (_e528558_ (##vector-ref _q522530_ '3))
                   (_length561_ _e528558_))
              (_K525545_ _length561_ _back556_ _front551_))
            (_E524534_)))))
  (define std/misc/queue#enqueue-front!
    (lambda (_q482_ _v483_)
      (if (std/misc/queue#queue-empty? _q482_)
          (std/misc/queue#enqueue! _q482_ _v483_)
          (let* ((_q484492_ _q482_)
                 (_E486496_
                  (lambda () (error '"No clause matching" _q484492_)))
                 (_K487504_
                  (lambda (_length499_ _front500_)
                    (let ((_new-front502_ (cons _v483_ _front500_)))
                      (##unchecked-structure-set!
                       _q482_
                       _new-front502_
                       '1
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q482_
                       (fx+ _length499_ '1)
                       '3
                       std/misc/queue#queue::t
                       '#f)))))
            (if (##structure-direct-instance-of?
                 _q484492_
                 'std/misc/queue#queue::t)
                (let* ((_e488507_ (##vector-ref _q484492_ '1))
                       (_front510_ _e488507_)
                       (_e489512_ (##vector-ref _q484492_ '2))
                       (_e490515_ (##vector-ref _q484492_ '3))
                       (_length518_ _e490515_))
                  (_K487504_ _length518_ _front510_))
                (_E486496_))))))
  (define std/misc/queue#dequeue!__%
    (lambda (_q428_ _default429_)
      (let* ((_q430438_ _q428_)
             (_E432442_ (lambda () (error '"No clause matching" _q430438_)))
             (_K433454_
              (lambda (_length445_ _back446_ _front447_)
                (if (eq? _front447_ _back446_)
                    (let ((_v449_ (car _front447_)))
                      (##unchecked-structure-set!
                       _q428_
                       '()
                       '1
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q428_
                       '#f
                       '2
                       std/misc/queue#queue::t
                       '#f)
                      (##unchecked-structure-set!
                       _q428_
                       '0
                       '3
                       std/misc/queue#queue::t
                       '#f)
                      _v449_)
                    (if (pair? _front447_)
                        (let ((_v451_ (car _front447_))
                              (_new-front452_ (cdr _front447_)))
                          (##unchecked-structure-set!
                           _q428_
                           _new-front452_
                           '1
                           std/misc/queue#queue::t
                           '#f)
                          (##unchecked-structure-set!
                           _q428_
                           (fx- _length445_ '1)
                           '3
                           std/misc/queue#queue::t
                           '#f)
                          _v451_)
                        (if (eq? _default429_ absent-obj)
                            (error '"cannot dequeue; empty queue" _q428_)
                            _default429_))))))
        (if (##structure-direct-instance-of?
             _q430438_
             'std/misc/queue#queue::t)
            (let* ((_e434457_ (##vector-ref _q430438_ '1))
                   (_front460_ _e434457_)
                   (_e435462_ (##vector-ref _q430438_ '2))
                   (_back465_ _e435462_)
                   (_e436467_ (##vector-ref _q430438_ '3))
                   (_length470_ _e436467_))
              (_K433454_ _length470_ _back465_ _front460_))
            (_E432442_)))))
  (define std/misc/queue#dequeue!__0
    (lambda (_q475_)
      (let ((_default477_ absent-obj))
        (std/misc/queue#dequeue!__% _q475_ _default477_))))
  (define std/misc/queue#dequeue!
    (lambda _g4294_
      (let ((_g4293_ (##length _g4294_)))
        (cond ((##fx= _g4293_ 1) (apply std/misc/queue#dequeue!__0 _g4294_))
              ((##fx= _g4293_ 2) (apply std/misc/queue#dequeue!__% _g4294_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/queue#dequeue!
                _g4294_))))))
  (define std/misc/queue#queue-peek__%
    (lambda (_q392_ _default393_)
      (let* ((_q394400_ _q392_)
             (_E396404_ (lambda () (error '"No clause matching" _q394400_)))
             (_K397409_
              (lambda (_front407_)
                (if (pair? _front407_)
                    (car _front407_)
                    (if (eq? _default393_ absent-obj)
                        (error '"cannot peek; empty queue" _q392_)
                        _default393_)))))
        (if (##structure-direct-instance-of?
             _q394400_
             'std/misc/queue#queue::t)
            (let* ((_e398412_ (##vector-ref _q394400_ '1))
                   (_front415_ _e398412_))
              (_K397409_ _front415_))
            (_E396404_)))))
  (define std/misc/queue#queue-peek__0
    (lambda (_q420_)
      (let ((_default422_ absent-obj))
        (std/misc/queue#queue-peek__% _q420_ _default422_))))
  (define std/misc/queue#queue-peek
    (lambda _g4296_
      (let ((_g4295_ (##length _g4296_)))
        (cond ((##fx= _g4295_ 1) (apply std/misc/queue#queue-peek__0 _g4296_))
              ((##fx= _g4295_ 2) (apply std/misc/queue#queue-peek__% _g4296_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/misc/queue#queue-peek
                _g4296_))))))
  (define std/misc/queue#queue->list
    (lambda (_q389_)
      (foldr1 cons
              '()
              (##direct-structure-ref
               _q389_
               '1
               std/misc/queue#queue::t
               '#f)))))
