// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movabsq $0x7ffc000000000001, %r12 # imm = 0x7FFC000000000001
movq %r12, %rsi
xorl %edx, %edx
callq 0x42a1
movq %rax, %r14
movq %rax, 0x60(%rbx)
leaq 0x4d12(%rip), %rsi      # 0x606b
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x42e1
movabsq $0x400921fb54442d18, %rcx # imm = 0x400921FB54442D18
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4a76
leaq 0x4ceb(%rip), %rdx      # 0x606e
leaq 0x60b(%rip), %r8        # 0x1995
pushq $0x8
popq %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4cd4(%rip), %rdx      # 0x6077
leaq 0x67e(%rip), %r8        # 0x1a28
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4cc1(%rip), %rdx      # 0x6080
leaq 0x6f5(%rip), %r8        # 0x1abb
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4cae(%rip), %rdx      # 0x6089
leaq 0x76c(%rip), %r8        # 0x1b4e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4c9b(%rip), %rdx      # 0x6092
leaq 0x7e3(%rip), %r8        # 0x1be1
pushq $0x9
popq %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4b8b
leaq 0x4c85(%rip), %rdx      # 0x609c
leaq 0x863(%rip), %r8        # 0x1c81
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4c72(%rip), %rdx      # 0x60a5
leaq 0x8e1(%rip), %r8        # 0x1d1b
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4c5f(%rip), %rdx      # 0x60ae
leaq 0x95f(%rip), %r8        # 0x1db5
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4c4c(%rip), %rdx      # 0x60b7
leaq 0x9e1(%rip), %r8        # 0x1e53
pushq $0x3
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4c34(%rip), %rdx      # 0x60bb
leaq 0xa39(%rip), %r8        # 0x1ec7
pushq $0x6
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
leaq 0x4c1c(%rip), %rdx      # 0x60c2
leaq 0xa98(%rip), %r8        # 0x1f45
pushq $0x5
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4c06(%rip), %rdx      # 0x60c8
leaq 0xaee(%rip), %r8        # 0x1fb7
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4bf3(%rip), %rdx      # 0x60d1
leaq 0xb5d(%rip), %r8        # 0x2042
pushq $0x7
popq %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4bdb(%rip), %rdx      # 0x60d9
leaq 0xb99(%rip), %r8        # 0x209e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4bc7(%rip), %rdx      # 0x60e1
leaq 0xbef(%rip), %r8        # 0x2110
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4bb3(%rip), %rdx      # 0x60e9
leaq 0xc45(%rip), %r8        # 0x2182
pushq $0xa
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4ba2(%rip), %rdx      # 0x60f4
leaq 0xca7(%rip), %r8        # 0x2200
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4b8e(%rip), %rdx      # 0x60fc
leaq 0xcfd(%rip), %r8        # 0x2272
pushq $0xc
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4b7f(%rip), %rdx      # 0x6109
leaq 0xd53(%rip), %r8        # 0x22e4
pushq $0x4
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4b68(%rip), %rdx      # 0x610e
leaq 0xd42(%rip), %r8        # 0x22ef
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4b8b
leaq 0x4b56(%rip), %rsi      # 0x6118
movq %rbx, %rdi
pushq $0x3
popq %r13
movq %r13, %rdx
callq 0x42e1
addq $0x5, %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r12, %rcx
callq 0x4a76
leaq 0x4b2f(%rip), %rdx      # 0x611c
leaq 0x3a92(%rip), %r8       # 0x5086
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x5
popq %r12
movq %r12, %rcx
callq 0x4b8b
leaq 0x4b15(%rip), %rdx      # 0x6122
leaq 0xce6(%rip), %r8        # 0x22fa
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
leaq 0x4b00(%rip), %rdx      # 0x6129
leaq 0xdbe(%rip), %r8        # 0x23ee
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
leaq 0x4aeb(%rip), %rdx      # 0x6130
leaq 0xe52(%rip), %r8        # 0x249e
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2
popq %rcx
callq 0x4b8b
leaq 0x4b5e(%rip), %rdx      # 0x61bf
leaq 0xed6(%rip), %r8        # 0x253e
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x4
popq %rbp
movq %rbp, %rcx
callq 0x4b8b
leaq 0x4ab3(%rip), %rdx      # 0x6133
leaq 0xf7a(%rip), %r8        # 0x2601
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4b8b
leaq 0x4a9b(%rip), %rdx      # 0x6137
leaq 0x1161(%rip), %r8       # 0x2804
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x4b8b
leaq 0x4a85(%rip), %rdx      # 0x613d
leaq 0x119e(%rip), %r8       # 0x285d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4a71(%rip), %rdx      # 0x6145
leaq 0x11db(%rip), %r8       # 0x28b6
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4a5d(%rip), %rdx      # 0x614d
leaq 0x11ef(%rip), %r8       # 0x28e6
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
cmpq $0x0, 0x30(%rbx)
je 0x1728
leaq 0x4a3f(%rip), %rdx      # 0x6152
leaq 0x1224(%rip), %r8       # 0x293e
pushq $0x4
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4aa4(%rip), %rdx      # 0x61d3
leaq 0x129a(%rip), %r8       # 0x29d0
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4a27(%rip), %rdx      # 0x6172
leaq 0x131f(%rip), %r8       # 0x2a71
pushq $0x3
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
leaq 0x49ed(%rip), %rdx      # 0x6157
leaq 0x139c(%rip), %r8       # 0x2b0d
pushq $0xc
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x49de(%rip), %rdx      # 0x6164
leaq 0x141c(%rip), %r8       # 0x2ba9
pushq $0x4
popq %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x49c3(%rip), %rdx      # 0x6169
leaq 0x1478(%rip), %r8       # 0x2c25
pushq $0x5
popq %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4b8b
leaq 0x49a9(%rip), %rdx      # 0x616f
leaq 0x14af(%rip), %r8       # 0x2c7c
pushq $0x6
popq %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x4b8b
leaq 0x4990(%rip), %rdx      # 0x6176
leaq 0x14d0(%rip), %r8       # 0x2cbd
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x4b8b
leaq 0x497b(%rip), %rdx      # 0x617d
leaq 0x151a(%rip), %r8       # 0x2d23
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4b8b
leaq 0x4965(%rip), %rdx      # 0x6183
leaq 0x1527(%rip), %r8       # 0x2d4c
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x494e(%rip), %rdx      # 0x6188
leaq 0x1578(%rip), %r8       # 0x2db9
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
leaq 0x4936(%rip), %rdx      # 0x618c
leaq 0x15c9(%rip), %r8       # 0x2e26
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x4b8b
leaq 0x491e(%rip), %rdx      # 0x6190
leaq 0x161a(%rip), %r8       # 0x2e93
pushq $0xe
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4911(%rip), %rdx      # 0x619f
leaq 0x164c(%rip), %r8       # 0x2ee1
pushq $0xd
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x4903(%rip), %rdx      # 0x61ad
leaq 0x16b0(%rip), %r8       # 0x2f61
pushq $0xa
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4b8b
leaq 0x48f2(%rip), %rdx      # 0x61b8
leaq 0x1772(%rip), %r8       # 0x303f
pushq $0xb
popq %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x4b8b
leaq 0x48de(%rip), %rdx      # 0x61c4
leaq 0x183f(%rip), %r8       # 0x312c
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x4b8b
leaq 0x48ce(%rip), %rdx      # 0x61d0
leaq 0x18f6(%rip), %r8       # 0x31ff
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4b8b
leaq 0x48b8(%rip), %rdx      # 0x61d6
leaq 0x196e(%rip), %r8       # 0x3293
movq %rbx, %rdi
movq %r14, %rsi
pushq $0xc
popq %rcx
callq 0x4b8b
leaq 0x48a9(%rip), %rdx      # 0x61e3
leaq 0x197d(%rip), %r8       # 0x32be
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
leaq 0x4892(%rip), %rdx      # 0x61e8
leaq 0x1a03(%rip), %r8       # 0x3360
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4b8b
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x1983
leaq 0x4872(%rip), %rdx      # 0x61ed
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq