(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/debug/threads#dump-thread-stack-trace!__%
    (lambda (_thread41650_ _port41651_)
      (let ((_cont41653_ (##thread-continuation-capture _thread41650_)))
        (display-continuation-backtrace _cont41653_ _port41651_ '#t '#f))))
  (define std/debug/threads#dump-thread-stack-trace!__0
    (lambda (_thread41658_)
      (let ((_port41660_ (current-error-port)))
        (std/debug/threads#dump-thread-stack-trace!__%
         _thread41658_
         _port41660_))))
  (define std/debug/threads#dump-thread-stack-trace!
    (lambda _g41665_
      (let ((_g41664_ (length _g41665_)))
        (cond ((##fx= _g41664_ 1)
               (apply std/debug/threads#dump-thread-stack-trace!__0 _g41665_))
              ((##fx= _g41664_ 2)
               (apply std/debug/threads#dump-thread-stack-trace!__% _g41665_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/debug/threads#dump-thread-stack-trace!
                _g41665_))))))
  (define std/debug/threads#dump-thread!__%
    (lambda (_thread41634_ _port41635_)
      (if (eq? _thread41634_ (current-thread))
          '#!void
          (begin
            (display '"thread: " _port41635_)
            (display _thread41634_ _port41635_)
            (let ((_qlen41637_
                   (std/debug/threads#thread-queue-length _thread41634_)))
              (display '" (" _port41635_)
              (display _qlen41637_ _port41635_)
              (display '")" _port41635_))
            (newline _port41635_)
            (std/debug/threads#dump-thread-stack-trace!__%
             _thread41634_
             _port41635_)))))
  (define std/debug/threads#dump-thread!__0
    (lambda (_thread41642_)
      (let ((_port41644_ (current-error-port)))
        (std/debug/threads#dump-thread!__% _thread41642_ _port41644_))))
  (define std/debug/threads#dump-thread!
    (lambda _g41667_
      (let ((_g41666_ (length _g41667_)))
        (cond ((##fx= _g41666_ 1)
               (apply std/debug/threads#dump-thread!__0 _g41667_))
              ((##fx= _g41666_ 2)
               (apply std/debug/threads#dump-thread!__% _g41667_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/debug/threads#dump-thread!
                _g41667_))))))
  (define std/debug/threads#dump-thread-group!__%
    (lambda (_tg41602_ _port41603_ _filter41604_)
      (for-each
       (lambda (_thread41606_)
         (if (_filter41604_ _thread41606_)
             (std/debug/threads#dump-thread!__% _thread41606_ _port41603_)
             '#!void))
       (thread-group->thread-list _tg41602_))))
  (define std/debug/threads#dump-thread-group!__0
    (lambda ()
      (let* ((_tg41612_ (gerbil/gambit/threads#current-thread-group))
             (_port41614_ (current-error-port))
             (_filter41616_ true))
        (std/debug/threads#dump-thread-group!__%
         _tg41612_
         _port41614_
         _filter41616_))))
  (define std/debug/threads#dump-thread-group!__1
    (lambda (_tg41618_)
      (let* ((_port41620_ (current-error-port)) (_filter41622_ true))
        (std/debug/threads#dump-thread-group!__%
         _tg41618_
         _port41620_
         _filter41622_))))
  (define std/debug/threads#dump-thread-group!__2
    (lambda (_tg41624_ _port41625_)
      (let ((_filter41627_ true))
        (std/debug/threads#dump-thread-group!__%
         _tg41624_
         _port41625_
         _filter41627_))))
  (define std/debug/threads#dump-thread-group!
    (lambda _g41669_
      (let ((_g41668_ (length _g41669_)))
        (cond ((##fx= _g41668_ 0)
               (apply std/debug/threads#dump-thread-group!__0 _g41669_))
              ((##fx= _g41668_ 1)
               (apply std/debug/threads#dump-thread-group!__1 _g41669_))
              ((##fx= _g41668_ 2)
               (apply std/debug/threads#dump-thread-group!__2 _g41669_))
              ((##fx= _g41668_ 3)
               (apply std/debug/threads#dump-thread-group!__% _g41669_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/debug/threads#dump-thread-group!
                _g41669_))))))
  (define std/debug/threads#dump-thread-group!*__%
    (lambda (_tg41568_ _port41569_ _filter41570_)
      (std/debug/threads#dump-thread-group!__%
       _tg41568_
       _port41569_
       _filter41570_)
      (for-each
       (lambda (_g4157141573_)
         (std/debug/threads#dump-thread-group!*__%
          _g4157141573_
          _port41569_
          _filter41570_))
       (thread-group->thread-group-list _tg41568_))))
  (define std/debug/threads#dump-thread-group!*__0
    (lambda ()
      (let* ((_tg41580_ (gerbil/gambit/threads#current-thread-group))
             (_port41582_ (current-error-port))
             (_filter41584_ true))
        (std/debug/threads#dump-thread-group!*__%
         _tg41580_
         _port41582_
         _filter41584_))))
  (define std/debug/threads#dump-thread-group!*__1
    (lambda (_tg41586_)
      (let* ((_port41588_ (current-error-port)) (_filter41590_ true))
        (std/debug/threads#dump-thread-group!*__%
         _tg41586_
         _port41588_
         _filter41590_))))
  (define std/debug/threads#dump-thread-group!*__2
    (lambda (_tg41592_ _port41593_)
      (let ((_filter41595_ true))
        (std/debug/threads#dump-thread-group!*__%
         _tg41592_
         _port41593_
         _filter41595_))))
  (define std/debug/threads#dump-thread-group!*
    (lambda _g41671_
      (let ((_g41670_ (length _g41671_)))
        (cond ((##fx= _g41670_ 0)
               (apply std/debug/threads#dump-thread-group!*__0 _g41671_))
              ((##fx= _g41670_ 1)
               (apply std/debug/threads#dump-thread-group!*__1 _g41671_))
              ((##fx= _g41670_ 2)
               (apply std/debug/threads#dump-thread-group!*__2 _g41671_))
              ((##fx= _g41670_ 3)
               (apply std/debug/threads#dump-thread-group!*__% _g41671_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/debug/threads#dump-thread-group!*
                _g41671_))))))
  (define std/debug/threads#dump-all-threads!__%
    (lambda (_port41549_ _filter41550_)
      (std/debug/threads#dump-thread-group!*__%
       (std/misc/threads#primordial-thread-group)
       _port41549_
       _filter41550_)))
  (define std/debug/threads#dump-all-threads!__0
    (lambda ()
      (let* ((_port41556_ (current-error-port)) (_filter41558_ true))
        (std/debug/threads#dump-all-threads!__% _port41556_ _filter41558_))))
  (define std/debug/threads#dump-all-threads!__1
    (lambda (_port41560_)
      (let ((_filter41562_ true))
        (std/debug/threads#dump-all-threads!__% _port41560_ _filter41562_))))
  (define std/debug/threads#dump-all-threads!
    (lambda _g41673_
      (let ((_g41672_ (length _g41673_)))
        (cond ((##fx= _g41672_ 0)
               (apply std/debug/threads#dump-all-threads!__0 _g41673_))
              ((##fx= _g41672_ 1)
               (apply std/debug/threads#dump-all-threads!__1 _g41673_))
              ((##fx= _g41672_ 2)
               (apply std/debug/threads#dump-all-threads!__% _g41673_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/debug/threads#dump-all-threads!
                _g41673_))))))
  (define std/debug/threads#dump-all-threads/queue!__%
    (lambda (_port41535_)
      (std/debug/threads#dump-all-threads!__%
       _port41535_
       (lambda (_$obj41537_)
         (not (std/debug/threads#thread-queue-empty? _$obj41537_))))))
  (define std/debug/threads#dump-all-threads/queue!__0
    (lambda ()
      (let ((_port41544_ (current-error-port)))
        (std/debug/threads#dump-all-threads/queue!__% _port41544_))))
  (define std/debug/threads#dump-all-threads/queue!
    (lambda _g41675_
      (let ((_g41674_ (length _g41675_)))
        (cond ((##fx= _g41674_ 0)
               (apply std/debug/threads#dump-all-threads/queue!__0 _g41675_))
              ((##fx= _g41674_ 1)
               (apply std/debug/threads#dump-all-threads/queue!__% _g41675_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/debug/threads#dump-all-threads/queue!
                _g41675_))))))
  (define std/debug/threads#thread-queue-length
    (lambda (_thread41525_)
      (let ((_$e41527_ (macro-thread-mailbox _thread41525_)))
        (if _$e41527_
            ((lambda (_mb41530_)
               (let ((_fifo41532_ (macro-mailbox-fifo _mb41530_)))
                 (length (cdr _fifo41532_))))
             _$e41527_)
            '0))))
  (define std/debug/threads#thread-queue-empty?
    (lambda (_thread41516_)
      (let ((_$e41518_ (macro-thread-mailbox _thread41516_)))
        (if _$e41518_
            ((lambda (_mb41521_)
               (let ((_fifo41523_ (macro-mailbox-fifo _mb41521_)))
                 (null? (cdr _fifo41523_))))
             _$e41518_)
            '#t)))))
