(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define scheme/process-context-impl#get-environment-variable
    (lambda (_var414_) (getenv _var414_ '#f)))
  (c-declare
   "#include <unistd.h>\nextern char **environ;\nstatic int ffi_count_envvars ()\n{\n int x;\n char **env;\n for (env = environ;\n      *env;\n      ++env) ++x;\n return x;\n}\n\nstatic char *ffi_get_envvar (int x)\n{\n return environ[x];\n}")
  (define-macro (define-c-lambda id args ret #!optional (name #f))
    (let ((name (or name (##symbol->string id))))
      `(define ,id (c-lambda ,args ,ret ,name))))
  (define-c-lambda
   scheme/process-context-impl#count-envvars
   ()
   int
   "ffi_count_envvars")
  (define-c-lambda
   scheme/process-context-impl#get-envvar
   (int)
   char-string
   "ffi_get_envvar")
  (define-c-lambda scheme/process-context-impl#_exit (int) void "_exit")
  (define scheme/process-context-impl#get-environment-variables
    (lambda ()
      (letrec ((_envvar401_
                (lambda (_str410_)
                  (let ((_ix412_ (string-index _str410_ '#\=)))
                    (cons (substring _str410_ '0 _ix412_)
                          (substring
                           _str410_
                           (fx+ _ix412_ '1)
                           (string-length _str410_)))))))
        (let ((_count403_ (scheme/process-context-impl#count-envvars)))
          (let _lp405_ ((_x407_ '0) (_vars408_ '()))
            (if (fx< _x407_ _count403_)
                (_lp405_ (fx+ _x407_ '1)
                         (cons (_envvar401_
                                (scheme/process-context-impl#get-envvar
                                 _x407_))
                               _vars408_))
                (reverse _vars408_)))))))
  (define scheme/process-context-impl#r7rs-exit__%
    (lambda (_normally?390_) (exit (if _normally?390_ '0 '1))))
  (define scheme/process-context-impl#r7rs-exit__0
    (lambda ()
      (let ((_normally?396_ '#t))
        (scheme/process-context-impl#r7rs-exit__% _normally?396_))))
  (define scheme/process-context-impl#r7rs-exit
    (lambda _g4015_
      (let ((_g4014_ (let () (declare (not safe)) (##length _g4015_))))
        (cond ((let () (declare (not safe)) (##fx= _g4014_ 0))
               (apply scheme/process-context-impl#r7rs-exit__0 _g4015_))
              ((let () (declare (not safe)) (##fx= _g4014_ 1))
               (apply scheme/process-context-impl#r7rs-exit__% _g4015_))
              (else
               (##raise-wrong-number-of-arguments-exception
                scheme/process-context-impl#r7rs-exit
                _g4015_)))))))
