/**
 ** This file was automatically generated by the Cyclone scheme compiler
 ** http://justinethier.github.io/cyclone/
 **
 ** (c) 2014-2024 Justin Ethier
 ** Version 0.36.0 
 **
 **/

#define closcall1(td, clo, buf) \
if (obj_is_not_closure(clo)) { \
   Cyc_apply(td, clo, 1, buf ); \
} else { \
   ((clo)->fn)(td, clo, 1, buf); \
;\
}
#define return_closcall1(td, clo,a1) { \
 char top; \
 object buf[1]; buf[0] = a1;\
 if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
     GC(td, clo, buf, 1); \
     return; \
 } else {\
     closcall1(td, (closure) (clo), buf); \
     return;\
 } \
}

#define continue_or_gc1(td, clo,a1) { \
 char *top = alloca(sizeof(char)); \
 if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \
     object buf[1]; buf[0] = a1;\
     GC(td, clo, buf, 1); \
     return; \
 } else {\
     continue;\
 } \
}

#define return_direct1(td, _fn,a1) { \
 char top; \
 object buf[1]; buf[0] = a1; \
 if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
     mclosure0(c1, (function_type) _fn); \
     GC(td, &c1, buf, 1); \
     return; \
 } else { \
     (_fn)(td, (closure)_fn, 1, buf); \
 }}

#define return_direct_with_clo1(td, clo, _fn,a1) { \
 char top; \
 object buf[1]; buf[0] = a1;\
 if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
     GC(td, clo, buf, 1); \
     return; \
 } else { \
     (_fn)(td, (closure)(clo), 1, buf); \
 }}

#define closcall2(td, clo, buf) \
if (obj_is_not_closure(clo)) { \
   Cyc_apply(td, clo, 2, buf ); \
} else { \
   ((clo)->fn)(td, clo, 2, buf); \
;\
}
#define return_closcall2(td, clo,a1,a2) { \
 char top; \
 object buf[2]; buf[0] = a1;buf[1] = a2;\
 if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
     GC(td, clo, buf, 2); \
     return; \
 } else {\
     closcall2(td, (closure) (clo), buf); \
     return;\
 } \
}

#define continue_or_gc2(td, clo,a1,a2) { \
 char *top = alloca(sizeof(char)); \
 if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \
     object buf[2]; buf[0] = a1;buf[1] = a2;\
     GC(td, clo, buf, 2); \
     return; \
 } else {\
     continue;\
 } \
}

#define return_direct2(td, _fn,a1,a2) { \
 char top; \
 object buf[2]; buf[0] = a1;buf[1] = a2; \
 if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
     mclosure0(c1, (function_type) _fn); \
     GC(td, &c1, buf, 2); \
     return; \
 } else { \
     (_fn)(td, (closure)_fn, 2, buf); \
 }}

#define return_direct_with_clo2(td, clo, _fn,a1,a2) { \
 char top; \
 object buf[2]; buf[0] = a1;buf[1] = a2;\
 if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
     GC(td, clo, buf, 2); \
     return; \
 } else { \
     (_fn)(td, (closure)(clo), 2, buf); \
 }}

#include "cyclone/types.h"
object __glo_lib_91init_117schemeprocess_19191context_scheme_process_91context = NULL;
object __glo_get_91environment_91variables_scheme_process_91context = NULL;
object __glo_get_91environment_91variable_scheme_process_91context = NULL;
object __glo_command_91line_scheme_process_91context = NULL;
object __glo_emergency_91exit_scheme_process_91context = NULL;
#include "cyclone/runtime.h"
defsymbol(emergency_91exit);
static void __lambda_1(void *data, object clo, int argc, object *args) ;/*closure _,object k_735*/
static void __lambda_4(void *data, object clo, int argc, object *args) ;/*(void *data, int argc, closure _, object k)*/
static void __lambda_3(void *data, object clo, int argc, object *args) ;/*(void *data, int argc, closure _, object k, object env_var)*/
static void __lambda_2(void *data, object clo, int argc, object *args) ;/*(void *data, int argc, closure _, object k)*/

static void __lambda_1(void *data, object _, int argc, object *args) /* closure _,object k_735 */
 {
object k_735 = args[0];
  Cyc_st_add(data, "scheme/process-context.sld:lib-init:schemeprocess_91context");

object c_7314 = global_set_cps_id(data,  k_735,"__glo_emergency_91exit_scheme_process_91context", __glo_emergency_91exit_scheme_process_91context, primitive_exit);
return_direct_with_clo1(data,  k_735, (((closure)  k_735)->fn),  c_7314);; 
}

static void __lambda_4(void *data, object _, int argc, object *args) {object k = args[0];pack_env_variables(data, k); 
       }
static void __lambda_3(void *data, object _, int argc, object *args) {object k = args[0];object env_var = args[1]; 
        const char *v = NULL;
        Cyc_check_str(data, env_var);
        v = getenv(string_str(env_var));
        if (v == NULL) {
          return_closcall1(data, k, boolean_f);
        } else {
          make_utf8_string(data, str, v);
          return_closcall1(data, k, &str);
        }
       }
static void __lambda_2(void *data, object _, int argc, object *args) {object k = args[0]; int i;
        object lis = NULL;
        for (i = _cyc_argc; i > 0; i--) {
          object ps = alloca(sizeof(string_type));
          object pl = alloca(sizeof(pair_type));
          make_utf8_string(data, s, _cyc_argv[i - 1]);
          memcpy(ps, &s, sizeof(string_type));
          ((list)pl)->hdr.mark = gc_color_red;
          ((list)pl)->hdr.grayed = 0;
          ((list)pl)->hdr.immutable = 0;
          ((list)pl)->tag = pair_tag;
          ((list)pl)->pair_car = ps;
          ((list)pl)->pair_cdr = lis;
          lis = pl;
        }
        return_closcall1(data, k, lis);  }
void c_schemeprocess_91context_inlinable_lambdas(void *data, object clo, int argc, object *args){ 
object buf[1]; object cont = args[0];
buf[0] = NULL; (((closure)cont)->fn)(data, cont, 1, buf);
 } 
void c_schemeprocess_91context_entry_pt_first_lambda(void *data, object clo, int argc, object *args){ 
Cyc_set_globals_changed((gc_thread_data *)data);
  quote_emergency_91exit = find_or_add_symbol("emergency-exit");

  add_global("__glo_lib_91init_117schemeprocess_19191context_scheme_process_91context", (object *) &__glo_lib_91init_117schemeprocess_19191context_scheme_process_91context);
  add_global("__glo_get_91environment_91variables_scheme_process_91context", (object *) &__glo_get_91environment_91variables_scheme_process_91context);
  add_global("__glo_get_91environment_91variable_scheme_process_91context", (object *) &__glo_get_91environment_91variable_scheme_process_91context);
  add_global("__glo_command_91line_scheme_process_91context", (object *) &__glo_command_91line_scheme_process_91context);
  add_global("__glo_emergency_91exit_scheme_process_91context", (object *) &__glo_emergency_91exit_scheme_process_91context);
  mclosure0(c_7310, (function_type)__lambda_1);c_7310.num_args = 0; 
  __glo_lib_91init_117schemeprocess_19191context_scheme_process_91context = &c_7310; 
  mclosure0(c_739, (function_type)__lambda_4);c_739.num_args = 0; 
  __glo_get_91environment_91variables_scheme_process_91context = &c_739; 
  mclosure0(c_738, (function_type)__lambda_3);c_738.num_args = 1; 
  __glo_get_91environment_91variable_scheme_process_91context = &c_738; 
  mclosure0(c_737, (function_type)__lambda_2);c_737.num_args = 0; 
  __glo_command_91line_scheme_process_91context = &c_737; 
  __glo_emergency_91exit_scheme_process_91context = boolean_f; 

  mclosure0(clo_7316, c_schemeprocess_91context_inlinable_lambdas); make_pair(pair_7315, find_or_add_symbol("c_schemeprocess_91context_inlinable_lambdas"), &clo_7316);
  make_cvar(cvar_7317, (object *)&__glo_lib_91init_117schemeprocess_19191context_scheme_process_91context);make_pair(pair_7318, find_or_add_symbol("lib-init:schemeprocess_91context"), &cvar_7317);
  make_cvar(cvar_7319, (object *)&__glo_get_91environment_91variables_scheme_process_91context);make_pair(pair_7320, find_or_add_symbol("get-environment-variables"), &cvar_7319);
  make_cvar(cvar_7321, (object *)&__glo_get_91environment_91variable_scheme_process_91context);make_pair(pair_7322, find_or_add_symbol("get-environment-variable"), &cvar_7321);
  make_cvar(cvar_7323, (object *)&__glo_command_91line_scheme_process_91context);make_pair(pair_7324, find_or_add_symbol("command-line"), &cvar_7323);
  make_cvar(cvar_7325, (object *)&__glo_emergency_91exit_scheme_process_91context);make_pair(pair_7326, find_or_add_symbol("emergency-exit"), &cvar_7325);
make_pair(c_7332, &pair_7315,Cyc_global_variables);
make_pair(c_7331, &pair_7318, &c_7332);
make_pair(c_7330, &pair_7320, &c_7331);
make_pair(c_7329, &pair_7322, &c_7330);
make_pair(c_7328, &pair_7324, &c_7329);
make_pair(c_7327, &pair_7326, &c_7328);
Cyc_global_variables = &c_7327;
object buf[1]; buf[0] = ((closure1_type *)clo)->element;
(((closure)__glo_lib_91init_117schemeprocess_19191context_scheme_process_91context)->fn)(data, buf[0], 1, buf);
}
void c_schemeprocess_91context_entry_pt(void *data, object cont, int argc, object value){ 
  register_library("scheme_process_91context");
  c_schemeprocess_91context_entry_pt_first_lambda(data, cont, argc, value);
}
