(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/srfi/117#make-list
    (lambda (_n555_ . _o556_)
      (let ((_default558_ (if (pair? _o556_) (car _o556_) '#!void)))
        (let _lp560_ ((_n562_ _n555_) (_res563_ '()))
          (if (<= _n562_ '0)
              _res563_
              (_lp560_ (- _n562_ '1) (cons _default558_ _res563_)))))))
  (define std/srfi/117#list-copy
    (lambda (_ls548_)
      (let _lp550_ ((_ls552_ _ls548_) (_res553_ '()))
        (if (pair? _ls552_)
            (_lp550_ (cdr _ls552_) (cons (car _ls552_) _res553_))
            (append (reverse _res553_) _ls552_)))))
  (define std/srfi/117#list-set!
    (lambda (_ls544_ _k545_ _x546_)
      (if (null? _ls544_)
          (error '"invalid list index")
          (if (zero? _k545_)
              (set-car! _ls544_ _x546_)
              (std/srfi/117#list-set! (cdr _ls544_) (- _k545_ '1) _x546_)))))
  (define std/srfi/117#last-pair
    (lambda (_ls542_)
      (if (null? (cdr _ls542_))
          _ls542_
          (std/srfi/117#last-pair (cdr _ls542_)))))
  (define std/srfi/117#map!
    (lambda (_f535_ _lis536_)
      (let _lp538_ ((_lis540_ _lis536_))
        (if (pair? _lis540_)
            (begin
              (set-car! _lis540_ (_f535_ (car _lis540_)))
              (_lp538_ (cdr _lis540_)))
            '#!void))))
  (define std/srfi/117#<list-queue>
    (make-struct-type
     'std/srfi/117#<list-queue>
     '#f
     '2
     '<list-queue>
     '((fields: first last))
     '#f))
  (define std/srfi/117#list-queue?
    (make-struct-predicate std/srfi/117#<list-queue>))
  (define std/srfi/117#get-first
    (make-struct-field-accessor std/srfi/117#<list-queue> '0))
  (define std/srfi/117#get-last
    (make-struct-field-accessor std/srfi/117#<list-queue> '1))
  (define std/srfi/117#set-first!
    (make-struct-field-mutator std/srfi/117#<list-queue> '0))
  (define std/srfi/117#set-last!
    (make-struct-field-mutator std/srfi/117#<list-queue> '1))
  (define std/srfi/117#raw-make-list-queue
    (lambda (_first532_ _last533_)
      (make-struct-instance std/srfi/117#<list-queue> _first532_ _last533_)))
  (define std/srfi/117#make-list-queue__0
    (lambda (_list527_)
      (if (null? _list527_)
          (let ()
            (declare (not safe))
            (##structure std/srfi/117#<list-queue> '() '()))
          (let ((__tmp4163 (std/srfi/117#last-pair _list527_)))
            (declare (not safe))
            (##structure std/srfi/117#<list-queue> _list527_ __tmp4163)))))
  (define std/srfi/117#make-list-queue
    (lambda _g4165_
      (let ((_g4164_ (let () (declare (not safe)) (##length _g4165_))))
        (cond ((let () (declare (not safe)) (##fx= _g4164_ 1))
               (apply std/srfi/117#make-list-queue__0 _g4165_))
              ((let () (declare (not safe)) (##fx= _g4164_ 2))
               (apply (lambda (_list529_ _last530_)
                        (let ()
                          (declare (not safe))
                          (##structure
                           std/srfi/117#<list-queue>
                           _list529_
                           _last530_)))
                      _g4165_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/117#make-list-queue
                _g4165_))))))
  (define std/srfi/117#list-queue
    (lambda _objs525_ (std/srfi/117#make-list-queue__0 _objs525_)))
  (define std/srfi/117#list-queue-copy
    (lambda (_list-queue523_)
      (std/srfi/117#make-list-queue__0
       (std/srfi/117#list-copy
        (##structure-ref _list-queue523_ '1 std/srfi/117#<list-queue> '#f)))))
  (define std/srfi/117#list-queue-empty?
    (lambda (_list-queue521_)
      (null? (##structure-ref
              _list-queue521_
              '1
              std/srfi/117#<list-queue>
              '#f))))
  (define std/srfi/117#list-queue-front
    (lambda (_list-queue519_)
      (if (std/srfi/117#list-queue-empty? _list-queue519_)
          (error '"Empty list-queue")
          (car (##structure-ref
                _list-queue519_
                '1
                std/srfi/117#<list-queue>
                '#f)))))
  (define std/srfi/117#list-queue-back
    (lambda (_list-queue517_)
      (if (std/srfi/117#list-queue-empty? _list-queue517_)
          (error '"Empty list-queue")
          (car (##structure-ref
                _list-queue517_
                '2
                std/srfi/117#<list-queue>
                '#f)))))
  (define std/srfi/117#list-queue-add-front!
    (lambda (_list-queue512_ _elem513_)
      (let ((_new-first515_
             (cons _elem513_
                   (##structure-ref
                    _list-queue512_
                    '1
                    std/srfi/117#<list-queue>
                    '#f))))
        (if (std/srfi/117#list-queue-empty? _list-queue512_)
            (##structure-set!
             _list-queue512_
             _new-first515_
             '2
             std/srfi/117#<list-queue>
             '#f)
            '#!void)
        (##structure-set!
         _list-queue512_
         _new-first515_
         '1
         std/srfi/117#<list-queue>
         '#f))))
  (define std/srfi/117#list-queue-add-back!
    (lambda (_list-queue507_ _elem508_)
      (let ((_new-last510_ (list _elem508_)))
        (if (std/srfi/117#list-queue-empty? _list-queue507_)
            (##structure-set!
             _list-queue507_
             _new-last510_
             '1
             std/srfi/117#<list-queue>
             '#f)
            (set-cdr!
             (##structure-ref _list-queue507_ '2 std/srfi/117#<list-queue> '#f)
             _new-last510_))
        (##structure-set!
         _list-queue507_
         _new-last510_
         '2
         std/srfi/117#<list-queue>
         '#f))))
  (define std/srfi/117#list-queue-remove-front!
    (lambda (_list-queue498_)
      (if (std/srfi/117#list-queue-empty? _list-queue498_)
          (error '"Empty list-queue")
          '#!void)
      (let* ((_old-first500_
              (##structure-ref
               _list-queue498_
               '1
               std/srfi/117#<list-queue>
               '#f))
             (_elem502_ (car _old-first500_))
             (_new-first504_ (cdr _old-first500_)))
        (if (null? _new-first504_)
            (##structure-set!
             _list-queue498_
             '()
             '2
             std/srfi/117#<list-queue>
             '#f)
            '#!void)
        (##structure-set!
         _list-queue498_
         _new-first504_
         '1
         std/srfi/117#<list-queue>
         '#f)
        _elem502_)))
  (define std/srfi/117#list-queue-remove-back!
    (lambda (_list-queue489_)
      (if (std/srfi/117#list-queue-empty? _list-queue489_)
          (error '"Empty list-queue")
          '#!void)
      (let* ((_old-last491_
              (##structure-ref
               _list-queue489_
               '2
               std/srfi/117#<list-queue>
               '#f))
             (_elem493_ (car _old-last491_))
             (_new-last495_
              (std/srfi/117#penult-pair
               (##structure-ref
                _list-queue489_
                '1
                std/srfi/117#<list-queue>
                '#f))))
        (if (null? _new-last495_)
            (##structure-set!
             _list-queue489_
             '()
             '1
             std/srfi/117#<list-queue>
             '#f)
            (set-cdr! _new-last495_ '()))
        (##structure-set!
         _list-queue489_
         _new-last495_
         '2
         std/srfi/117#<list-queue>
         '#f)
        _elem493_)))
  (define std/srfi/117#list-queue-remove-all!
    (lambda (_list-queue485_)
      (let ((_result487_
             (##structure-ref
              _list-queue485_
              '1
              std/srfi/117#<list-queue>
              '#f)))
        (##structure-set! _list-queue485_ '() '1 std/srfi/117#<list-queue> '#f)
        (##structure-set! _list-queue485_ '() '2 std/srfi/117#<list-queue> '#f)
        _result487_)))
  (define std/srfi/117#penult-pair
    (lambda (_lis479_)
      (let _lp481_ ((_lis483_ _lis479_))
        (if (null? (cdr _lis483_))
            '()
            (if (null? (cddr _lis483_)) _lis483_ (_lp481_ (cdr _lis483_)))))))
  (define std/srfi/117#list-queue-append
    (lambda _list-queues477_
      (std/srfi/117#list-queue-concatenate _list-queues477_)))
  (define std/srfi/117#list-queue-concatenate
    (lambda (_list-queues469_)
      (let ((_result471_ (std/srfi/117#list-queue)))
        (for-each
         (lambda (_list-queue473_)
           (for-each
            (lambda (_elem475_)
              (std/srfi/117#list-queue-add-back! _result471_ _elem475_))
            (##structure-ref
             _list-queue473_
             '1
             std/srfi/117#<list-queue>
             '#f)))
         _list-queues469_)
        _result471_)))
  (define std/srfi/117#list-queue-append!__1 (lambda (_queue463_) _queue463_))
  (define std/srfi/117#list-queue-append!__2
    (lambda _queues465_
      (for-each
       (lambda (_queue467_)
         (std/srfi/117#list-queue-join! (car _queues465_) _queue467_))
       (cdr _queues465_))
      (car _queues465_)))
  (define std/srfi/117#list-queue-append!
    (lambda _g4167_
      (let ((_g4166_ (let () (declare (not safe)) (##length _g4167_))))
        (cond ((let () (declare (not safe)) (##fx= _g4166_ 0))
               (apply std/srfi/117#list-queue _g4167_))
              ((let () (declare (not safe)) (##fx= _g4166_ 1))
               (apply std/srfi/117#list-queue-append!__1 _g4167_))
              (#t (apply std/srfi/117#list-queue-append!__2 _g4167_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/117#list-queue-append!
                _g4167_))))))
  (define std/srfi/117#list-queue-join!
    (lambda (_queue1459_ _queue2460_)
      (set-cdr!
       (##structure-ref _queue1459_ '2 std/srfi/117#<list-queue> '#f)
       (##structure-ref _queue2460_ '1 std/srfi/117#<list-queue> '#f))))
  (define std/srfi/117#list-queue-map
    (lambda (_proc456_ _list-queue457_)
      (std/srfi/117#make-list-queue__0
       (map _proc456_
            (##structure-ref
             _list-queue457_
             '1
             std/srfi/117#<list-queue>
             '#f)))))
  (define std/srfi/117#list-queue-unfold__1
    (lambda (_stop?451_ _mapper452_ _successor453_ _seed454_)
      (std/srfi/117#list-queue-unfold*
       _stop?451_
       _mapper452_
       _successor453_
       _seed454_
       (std/srfi/117#list-queue))))
  (define std/srfi/117#list-queue-unfold
    (lambda _g4169_
      (let ((_g4168_ (let () (declare (not safe)) (##length _g4169_))))
        (cond ((let () (declare (not safe)) (##fx= _g4168_ 5))
               (apply std/srfi/117#list-queue-unfold* _g4169_))
              ((let () (declare (not safe)) (##fx= _g4168_ 4))
               (apply std/srfi/117#list-queue-unfold__1 _g4169_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/117#list-queue-unfold
                _g4169_))))))
  (define std/srfi/117#list-queue-unfold*
    (lambda (_stop?435_ _mapper436_ _successor437_ _seed438_ _queue439_)
      (let _loop441_ ((_seed443_ _seed438_))
        (if (not (_stop?435_ _seed443_))
            (std/srfi/117#list-queue-add-front!
             (_loop441_ (_successor437_ _seed443_))
             (_mapper436_ _seed443_))
            '#!void)
        _queue439_)))
  (define std/srfi/117#list-queue-unfold-right__1
    (lambda (_stop?430_ _mapper431_ _successor432_ _seed433_)
      (std/srfi/117#list-queue-unfold-right*
       _stop?430_
       _mapper431_
       _successor432_
       _seed433_
       (std/srfi/117#list-queue))))
  (define std/srfi/117#list-queue-unfold-right
    (lambda _g4171_
      (let ((_g4170_ (let () (declare (not safe)) (##length _g4171_))))
        (cond ((let () (declare (not safe)) (##fx= _g4170_ 5))
               (apply std/srfi/117#list-queue-unfold-right* _g4171_))
              ((let () (declare (not safe)) (##fx= _g4170_ 4))
               (apply std/srfi/117#list-queue-unfold-right__1 _g4171_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/117#list-queue-unfold-right
                _g4171_))))))
  (define std/srfi/117#list-queue-unfold-right*
    (lambda (_stop?414_ _mapper415_ _successor416_ _seed417_ _queue418_)
      (let _loop420_ ((_seed422_ _seed417_))
        (if (not (_stop?414_ _seed422_))
            (std/srfi/117#list-queue-add-back!
             (_loop420_ (_successor416_ _seed422_))
             (_mapper415_ _seed422_))
            '#!void)
        _queue418_)))
  (define std/srfi/117#list-queue-map!
    (lambda (_proc411_ _list-queue412_)
      (std/srfi/117#map!
       _proc411_
       (##structure-ref _list-queue412_ '1 std/srfi/117#<list-queue> '#f))))
  (define std/srfi/117#list-queue-for-each
    (lambda (_proc408_ _list-queue409_)
      (for-each
       _proc408_
       (##structure-ref _list-queue409_ '1 std/srfi/117#<list-queue> '#f))))
  (define std/srfi/117#list-queue-list
    (lambda (_list-queue406_)
      (##structure-ref _list-queue406_ '1 std/srfi/117#<list-queue> '#f)))
  (define std/srfi/117#list-queue-first-last
    (lambda (_list-queue404_)
      (values (##structure-ref
               _list-queue404_
               '1
               std/srfi/117#<list-queue>
               '#f)
              (##structure-ref
               _list-queue404_
               '2
               std/srfi/117#<list-queue>
               '#f))))
  (define std/srfi/117#list-queue-set-list!__0
    (lambda (_list-queue397_ _first398_)
      (##structure-set!
       _list-queue397_
       _first398_
       '1
       std/srfi/117#<list-queue>
       '#f)
      (if (null? _first398_)
          (##structure-set!
           _list-queue397_
           '()
           '2
           std/srfi/117#<list-queue>
           '#f)
          (##structure-set!
           _list-queue397_
           (std/srfi/117#last-pair _first398_)
           '2
           std/srfi/117#<list-queue>
           '#f))))
  (define std/srfi/117#list-queue-set-list!__1
    (lambda (_list-queue400_ _first401_ _last402_)
      (##structure-set!
       _list-queue400_
       _first401_
       '1
       std/srfi/117#<list-queue>
       '#f)
      (##structure-set!
       _list-queue400_
       _last402_
       '2
       std/srfi/117#<list-queue>
       '#f)))
  (define std/srfi/117#list-queue-set-list!
    (lambda _g4173_
      (let ((_g4172_ (let () (declare (not safe)) (##length _g4173_))))
        (cond ((let () (declare (not safe)) (##fx= _g4172_ 2))
               (apply std/srfi/117#list-queue-set-list!__0 _g4173_))
              ((let () (declare (not safe)) (##fx= _g4172_ 3))
               (apply std/srfi/117#list-queue-set-list!__1 _g4173_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/117#list-queue-set-list!
                _g4173_)))))))
