// File: /workspace/github_c_makefile_star2_O1/jiribenes[P]scheme/src/core.c
// Function: scm_env_default
env_t *scm_env_default(vm_t *vm) {
    env_t *env = env_new(vm, NIL_VAL, NULL);
    vm->top_env = env;

    /* numeric functions */
    symbol_t *pi_sym = symbol_intern(vm, "pi", 2);
    variable_add(vm, env, pi_sym, NUM_VAL(3.14159265358979323846));
    primitive_add(vm, env, "builtin+", 8, builtin_add);
    primitive_add(vm, env, "builtin*", 8, builtin_mul);
    primitive_add(vm, env, "builtin-", 8, builtin_sub);
    primitive_add(vm, env, "builtin/", 8, builtin_div);
    primitive_add(vm, env, "remainder", 9, builtin_rem);

    primitive_add(vm, env, "builtin>", 8, builtin_num_gt);
    primitive_add(vm, env, "builtin<", 8, builtin_num_lt);
    primitive_add(vm, env, "builtin=", 8, builtin_num_eq);

    /* types and predicates */
    primitive_add(vm, env, "eq?", 3, eq);
    primitive_add(vm, env, "equal?", 6, equal);

    primitive_add(vm, env, "cons?", 5, builtin_is_cons);
    primitive_add(vm, env, "integer?", 8, builtin_is_integer);
    primitive_add(vm, env, "number?", 7, builtin_is_number);
    primitive_add(vm, env, "string?", 7, builtin_is_string);
    primitive_add(vm, env, "symbol?", 7, builtin_is_symbol);
    primitive_add(vm, env, "procedure?", 10, builtin_is_procedure);
    primitive_add(vm, env, "vector?", 7, builtin_is_vector);
    primitive_add(vm, env, "environment?", 12, builtin_is_environment);
    primitive_add(vm, env, "void", 4, builtin_void);
    primitive_add(vm, env, "undefined", 9, builtin_undefined);
    symbol_t *eof_sym = symbol_intern(vm, "eof", 3);
    variable_add(vm, env, eof_sym, EOF_VAL);

    /* special constructs - flow control */
    primitive_add(vm, env, "begin", 5, begin);
    primitive_add(vm, env, "define", 6, builtin_define);
    primitive_add(vm, env, "lambda", 6, lambda);
    primitive_add(vm, env, "if", 2, builtin_if);
    primitive_add(vm, env, "set!", 4, builtin_set);
    primitive_add(vm, env, "let", 3, builtin_let);

    /* I/O */
    primitive_add(vm, env, "write", 5, builtin_write);
    primitive_add(vm, env, "display", 7, builtin_display);
    primitive_add(vm, env, "newline", 7, builtin_newline);
    primitive_add(vm, env, "read", 4, builtin_read);
    if (vm->config.load_fn != NULL) {
        primitive_add(vm, env, "load", 4, builtin_load);
    }

    /* or/and */
    primitive_add(vm, env, "or", 2, builtin_or);
    primitive_add(vm, env, "and", 3, builtin_and);

    /* macros, eval */
    primitive_add(vm, env, "define-macro", 12, define_macro);
    primitive_add(vm, env, "eval", 4, builtin_eval);
    primitive_add(vm, env, "apply", 5, builtin_apply);
    primitive_add(vm, env, "expand", 6, builtin_expand);
    primitive_add(vm, env, "gensym", 6, builtin_gensym);
    primitive_add(vm, env, "quote", 5, quote);

    /* list functions */
    primitive_add(vm, env, "cons", 4, builtin_cons);
    primitive_add(vm, env, "car", 3, builtin_car);
    primitive_add(vm, env, "cdr", 3, builtin_cdr);
    primitive_add(vm, env, "builtin-length", 14, builtin_length);

    /* vector functions */
    primitive_add(vm, env, "vector-length", 13, builtin_vec_length);
    primitive_add(vm, env, "vector-ref", 10, builtin_vec_ref);
    primitive_add(vm, env, "vector-set!", 11, builtin_vec_set);
    primitive_add(vm, env, "make-vector", 11, builtin_vec_make);

    /* other library functions */
    primitive_add(vm, env, "error", 5, builtin_error);
    primitive_add(vm, env, "current-time", 12, builtin_time);
    primitive_add(vm, env, "exit", 4, builtin_exit);
    primitive_add(vm, env, "hash", 4, builtin_hash);

#ifdef DEBUG
    primitive_add(vm, env, "current-environment", 19, builtin_env_cur);
    primitive_add(vm, env, "top-level-environment", 21, builtin_env_top);
    primitive_add(vm, env, "environment-variables", 21, builtin_env_vars);
    primitive_add(vm, env, "environment-parent", 18, builtin_env_up);

    primitive_add(vm, env, "gc", 2, builtin_gc);
#endif

    // Automatically loads the stdlib if a load function is present
    if (vm->config.load_fn != NULL) {
        vm->config.load_fn(vm, env, "src/stdlib.scm");
    }

    return env;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movabsq $0x7ffc000000000001, %r15 # imm = 0x7FFC000000000001
movq %r15, %rsi
xorl %edx, %edx
callq 0x4ab2
movq %rax, %r14
movq %rax, 0x60(%rbx)
leaq 0x5ca0(%rip), %rsi      # 0x70a3
movl $0x2, %edx
movq %rbx, %rdi
callq 0x4af4
movabsq $0x400921fb54442d18, %rcx # imm = 0x400921FB54442D18
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x529e
leaq 0x5c77(%rip), %rdx      # 0x70a6
leaq 0x63d(%rip), %r8        # 0x1a73
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5c62(%rip), %rdx      # 0x70af
leaq 0x6c7(%rip), %r8        # 0x1b1b
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5c4d(%rip), %rdx      # 0x70b8
leaq 0x751(%rip), %r8        # 0x1bc3
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5c38(%rip), %rdx      # 0x70c1
leaq 0x7db(%rip), %r8        # 0x1c6b
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5c23(%rip), %rdx      # 0x70ca
leaq 0x865(%rip), %r8        # 0x1d13
movl $0x9, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5c0f(%rip), %rdx      # 0x70d4
leaq 0x8f3(%rip), %r8        # 0x1dbf
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5bfa(%rip), %rdx      # 0x70dd
leaq 0x984(%rip), %r8        # 0x1e6e
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5be5(%rip), %rdx      # 0x70e6
leaq 0xa15(%rip), %r8        # 0x1f1d
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5bd0(%rip), %rdx      # 0x70ef
leaq 0xaaa(%rip), %r8        # 0x1fd0
movl $0x3, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5bb6(%rip), %rdx      # 0x70f3
leaq 0xaf3(%rip), %r8        # 0x2037
movl $0x6, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b9f(%rip), %rdx      # 0x70fa
leaq 0xb49(%rip), %r8        # 0x20ab
movl $0x5, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b87(%rip), %rdx      # 0x7100
leaq 0xba7(%rip), %r8        # 0x2127
movl $0x8, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b72(%rip), %rdx      # 0x7109
leaq 0xc20(%rip), %r8        # 0x21be
movl $0x7, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b5c(%rip), %rdx      # 0x7111
leaq 0xc73(%rip), %r8        # 0x222f
movl $0x7, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b46(%rip), %rdx      # 0x7119
leaq 0xcd1(%rip), %r8        # 0x22ab
movl $0x7, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b30(%rip), %rdx      # 0x7121
leaq 0xd2f(%rip), %r8        # 0x2327
movl $0xa, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b1d(%rip), %rdx      # 0x712c
leaq 0xdad(%rip), %r8        # 0x23c3
movl $0x7, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5b07(%rip), %rdx      # 0x7134
leaq 0xe0b(%rip), %r8        # 0x243f
movl $0xc, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5af6(%rip), %rdx      # 0x7141
leaq 0xe69(%rip), %r8        # 0x24bb
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5add(%rip), %rdx      # 0x7146
leaq 0xe56(%rip), %r8        # 0x24c6
movl $0x9, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5ac9(%rip), %rsi      # 0x7150
movl $0x3, %edx
movq %rbx, %rdi
callq 0x4af4
addq $0x5, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r15, %rcx
callq 0x529e
leaq 0x5aa4(%rip), %rdx      # 0x7154
leaq 0x4319(%rip), %r8       # 0x59d0
movl $0x5, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5a8c(%rip), %rdx      # 0x715a
leaq 0xdfc(%rip), %r8        # 0x24d1
movl $0x6, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5a75(%rip), %rdx      # 0x7161
leaq 0xeda(%rip), %r8        # 0x25cd
movl $0x6, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5a5e(%rip), %rdx      # 0x7168
leaq 0xf73(%rip), %r8        # 0x2684
movl $0x2, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5acf(%rip), %rdx      # 0x71f7
leaq 0x100d(%rip), %r8       # 0x273c
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5a25(%rip), %rdx      # 0x716b
leaq 0x10ca(%rip), %r8       # 0x2817
movl $0x3, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5a0b(%rip), %rdx      # 0x716f
leaq 0x1306(%rip), %r8       # 0x2a71
movl $0x5, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x59f3(%rip), %rdx      # 0x7175
leaq 0x1356(%rip), %r8       # 0x2adf
movl $0x7, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x59dd(%rip), %rdx      # 0x717d
leaq 0x13a6(%rip), %r8       # 0x2b4d
movl $0x7, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x59c7(%rip), %rdx      # 0x7185
leaq 0x13d5(%rip), %r8       # 0x2b9a
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
cmpq $0x0, 0x30(%rbx)
je 0x17fa
leaq 0x59a7(%rip), %rdx      # 0x718a
leaq 0x1420(%rip), %r8       # 0x2c0a
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5a0a(%rip), %rdx      # 0x720b
leaq 0x14aa(%rip), %r8       # 0x2cb2
movl $0x2, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x598b(%rip), %rdx      # 0x71aa
leaq 0x153f(%rip), %r8       # 0x2d65
movl $0x3, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5952(%rip), %rdx      # 0x718f
leaq 0x15d7(%rip), %r8       # 0x2e1b
movl $0xc, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5941(%rip), %rdx      # 0x719c
leaq 0x1655(%rip), %r8       # 0x2eb7
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5928(%rip), %rdx      # 0x71a1
leaq 0x16c7(%rip), %r8       # 0x2f47
movl $0x5, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5910(%rip), %rdx      # 0x71a7
leaq 0x171b(%rip), %r8       # 0x2fb9
movl $0x6, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x58f9(%rip), %rdx      # 0x71ae
leaq 0x1759(%rip), %r8       # 0x3015
movl $0x6, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x58e2(%rip), %rdx      # 0x71b5
leaq 0x17b5(%rip), %r8       # 0x308f
movl $0x5, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x58ca(%rip), %rdx      # 0x71bb
leaq 0x17e7(%rip), %r8       # 0x30df
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x58b1(%rip), %rdx      # 0x71c0
leaq 0x1851(%rip), %r8       # 0x3167
movl $0x3, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5897(%rip), %rdx      # 0x71c4
leaq 0x18b8(%rip), %r8       # 0x31ec
movl $0x3, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x587d(%rip), %rdx      # 0x71c8
leaq 0x191f(%rip), %r8       # 0x3271
movl $0xe, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x586e(%rip), %rdx      # 0x71d7
leaq 0x1964(%rip), %r8       # 0x32d4
movl $0xd, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x585e(%rip), %rdx      # 0x71e5
leaq 0x19dc(%rip), %r8       # 0x336a
movl $0xa, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x584b(%rip), %rdx      # 0x71f0
leaq 0x1aa9(%rip), %r8       # 0x3455
movl $0xb, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5839(%rip), %rdx      # 0x71fc
leaq 0x1b85(%rip), %r8       # 0x354f
movl $0xb, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x5827(%rip), %rdx      # 0x7208
leaq 0x1ce6(%rip), %r8       # 0x36ce
movl $0x5, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x580f(%rip), %rdx      # 0x720e
leaq 0x1d5b(%rip), %r8       # 0x3761
movl $0xc, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x57fe(%rip), %rdx      # 0x721b
leaq 0x1d83(%rip), %r8       # 0x37a7
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
leaq 0x57e5(%rip), %rdx      # 0x7220
leaq 0x1e1d(%rip), %r8       # 0x385f
movl $0x4, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53c3
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x1a6a
leaq 0x57c3(%rip), %rdx      # 0x7225
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq