LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/core.c
// Function: builtin_vec_ref
static value_t builtin_vec_ref(vm_t *vm, env_t *env, value_t args) {
    // (vector-ref! <vec> <k>)
    value_t eargs = eval_list(vm, env, args);
    arity_check(vm, "vector-ref", eargs, 2, false);
    value_t first = AS_CONS(eargs)->car;
    value_t second = AS_CONS(AS_CONS(eargs)->cdr)->car;
    if (!IS_VECTOR(first)) {
        error_runtime(vm, "vector-ref: first argument must be a vector");
        return UNDEFINED_VAL;
    }
    vector_t *vec = AS_VECTOR(first);
    if (!IS_INT(second) ||
        !(AS_INT(second) >= 0 && AS_INT(second) < vec->count)) {
        error_runtime(
            vm, "vector-ref: second argument must be a valid integer in range");
        return UNDEFINED_VAL;
    }
    return vec->data[AS_INT(second)];
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5457
movq %rax, %r15
movq %rax, %rdi
callq 0x4a8d
cmpl $0x2, %eax
je 0x32e7
leaq 0x2d7a(%rip), %rsi      # 0x6048
leaq 0x2f10(%rip), %rdx      # 0x61e5
movq %rbx, %rdi
movl $0x2, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4cc4
movabsq $0x7ffc000000000000, %r14 # imm = 0x7FFC000000000000
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %r15
movq 0x10(%r15), %r12
movq %r12, %rcx
shrq $0x32, %rcx
cmpl $0x3fff, %ecx           # imm = 0x3FFF
jb 0x3365
andq %rax, %r12
cmpl $0x6, (%r12)
jne 0x3365
andq 0x18(%r15), %rax
movq 0x10(%rax), %rax
movq %rax, %rcx
notq %rcx
testq %rcx, %r14
je 0x336e
movq %rax, %xmm0
movq %xmm0, (%rsp)
callq 0x1050
ucomisd (%rsp), %xmm0
jne 0x336e
jp 0x336e
cvttsd2si %xmm0, %rax
testq %rax, %rax
js 0x336e
movl 0x14(%r12), %ecx
cmpq %rcx, %rax
jae 0x336e
movq 0x18(%r12), %rcx
movq (%rcx,%rax,8), %r14
jmp 0x3383
leaq 0x323a(%rip), %rsi      # 0x65a6
jmp 0x3375
leaq 0x325d(%rip), %rsi      # 0x65d2
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4cc4
addq $0x4, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/core.c
// Function: builtin_vec_set
static value_t builtin_vec_set(vm_t *vm, env_t *env, value_t args) {
    // (vector-set! <vec> <k> <obj>)
    value_t eargs = eval_list(vm, env, args);
    arity_check(vm, "vector-set!", eargs, 3, false);
    value_t first = AS_CONS(eargs)->car;
    value_t second = AS_CONS(AS_CONS(eargs)->cdr)->car;
    value_t third = AS_CONS(AS_CONS(AS_CONS(eargs)->cdr)->cdr)->car;
    if (!IS_VECTOR(first)) {
        error_runtime(vm, "vector-set!: first argument must be a vector");
        return UNDEFINED_VAL;
    }
    vector_t *vec = AS_VECTOR(first);
    if (!IS_INT(second) ||
        !(AS_INT(second) >= 0 && AS_INT(second) < vec->count)) {
        error_runtime(
            vm,
            "vector-set!: second argument must be a valid integer in range");
        return UNDEFINED_VAL;
    }
    vec->data[AS_INT(second)] = third;
    return VOID_VAL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5457
movq %rax, %r15
movq %rax, %rdi
callq 0x4a8d
cmpl $0x3, %eax
je 0x33d2
leaq 0x2c8f(%rip), %rsi      # 0x6048
leaq 0x2e30(%rip), %rdx      # 0x61f0
movq %rbx, %rdi
movl $0x3, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4cc4
movabsq $0x7ffc000000000000, %r14 # imm = 0x7FFC000000000000
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %r15
movq 0x10(%r15), %r12
movq %r12, %rcx
shrq $0x32, %rcx
cmpl $0x3fff, %ecx           # imm = 0x3FFF
jb 0x345f
andq %rax, %r12
cmpl $0x6, (%r12)
jne 0x345f
movq 0x18(%r15), %rcx
andq %rax, %rcx
movq 0x10(%rcx), %rdx
movq %rdx, %rsi
notq %rsi
testq %rsi, %r14
je 0x3468
andq 0x18(%rcx), %rax
movq 0x10(%rax), %r15
movq %rdx, %xmm0
movq %xmm0, (%rsp)
callq 0x1050
ucomisd (%rsp), %xmm0
jne 0x3468
jp 0x3468
cvttsd2si %xmm0, %rax
testq %rax, %rax
js 0x3468
movl 0x14(%r12), %ecx
cmpq %rcx, %rax
jae 0x3468
movq 0x18(%r12), %rcx
movq %r15, (%rcx,%rax,8)
addq $0x5, %r14
jmp 0x347d
leaq 0x31a9(%rip), %rsi      # 0x660f
jmp 0x346f
leaq 0x31cd(%rip), %rsi      # 0x663c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4cc4
addq $0x4, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/core.c
// Function: builtin_vec_make
static value_t builtin_vec_make(vm_t *vm, env_t *env, value_t args) {
    // (make-vector <k> <fill>)
    value_t eargs = eval_list(vm, env, args);
    arity_check(vm, "make-vector", eargs, 2, false);
    value_t first = AS_CONS(eargs)->car;
    value_t second = AS_CONS(AS_CONS(eargs)->cdr)->car;
    if (!IS_INT(first) || AS_INT(first) < 0) {
        error_runtime(
            vm, "make-vector: first argument must be a positive integer!");
        return UNDEFINED_VAL;
    }
    uint32_t count = AS_INT(first);
    vector_t *vec = vector_new(vm, count);
    for (uint32_t i = 0; i < count; i++) {
        vec->data[i] = second;
    }
    return PTR_VAL(vec);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x5457
movq %rax, %r15
movq %rax, %rdi
callq 0x4a8d
cmpl $0x2, %eax
je 0x34cc
leaq 0x2b95(%rip), %rsi      # 0x6048
leaq 0x2d42(%rip), %rdx      # 0x61fc
movq %r14, %rdi
movl $0x2, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4cc4
movabsq $0x7ffc000000000000, %rbx # imm = 0x7FFC000000000000
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %r15
movq 0x10(%r15), %rcx
movq %rcx, %rdx
notq %rdx
testq %rbx, %rdx
je 0x35e7
andq 0x18(%r15), %rax
movq 0x10(%rax), %r12
movq %rcx, %xmm0
movq %xmm0, (%rsp)
callq 0x1050
ucomisd (%rsp), %xmm0
jne 0x35e7
jp 0x35e7
cvttsd2si %xmm0, %r15
testq %r15, %r15
js 0x35e7
movq %r14, %rdi
movl %r15d, %esi
callq 0x493b
movq %rax, %rbx
testl %r15d, %r15d
je 0x35d8
movq 0x18(%rbx), %rax
movl %r15d, %edx
leaq 0x1(%rdx), %rcx
andq $-0x2, %rcx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x2aa9(%rip), %xmm1     # 0x6010
xorl %edx, %edx
movdqa 0x2aaf(%rip), %xmm2     # 0x6020
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x2aaf(%rip), %xmm4     # 0x6030
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0x35b7
movq %r12, (%rax,%rdx,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x35cb
movq %r12, 0x8(%rax,%rdx,8)
addq $0x2, %rdx
paddq %xmm4, %xmm1
cmpq %rdx, %rcx
jne 0x3581
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %rbx
jmp 0x35fc
leaq 0x308c(%rip), %rsi      # 0x667a
movq %r14, %rdi
xorl %eax, %eax
callq 0x4cc4
addq $0x4, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/core.c
// Function: builtin_error
static value_t builtin_error(vm_t *vm, env_t *env, value_t args) {
    value_t eargs = eval_list(vm, env, args);
    arity_check(vm, "error", eargs, 1, false);
    value_t arg = AS_CONS(eargs)->car;
    if (!IS_STRING(arg)) {
        error_runtime(vm, "error: argument must be a string");
        return UNDEFINED_VAL;
    }
    error_runtime(vm, AS_STRING(arg)->value);
    return VOID_VAL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x5457
movq %rax, %r15
movq %rax, %rdi
callq 0x4a8d
cmpl $0x1, %eax
je 0x3648
leaq 0x2a19(%rip), %rsi      # 0x6048
leaq 0x2bd2(%rip), %rdx      # 0x6208
movq %rbx, %rdi
movl $0x1, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4cc4
movabsq $0x7ffc000000000004, %r14 # imm = 0x7FFC000000000004
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %r15
movq 0x10(%r15), %rcx
movq %rcx, %rdx
shrq $0x32, %rdx
cmpl $0x3fff, %edx           # imm = 0x3FFF
jb 0x3691
andq %rax, %rcx
leaq 0x18(%rcx), %rax
leaq 0x1(%r14), %rdx
cmpl $0x1, (%rcx)
leaq 0x302b(%rip), %rsi      # 0x66b2
cmoveq %rax, %rsi
cmoveq %rdx, %r14
jmp 0x3698
leaq 0x301a(%rip), %rsi      # 0x66b2
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4cc4
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/core.c
// Function: builtin_exit
static value_t builtin_exit(vm_t *vm, env_t *env, value_t args) {
    // (exit <status>)
    value_t eargs = eval_list(vm, env, args);
    arity_check(vm, "exit", eargs, 1, false);
    value_t arg = AS_CONS(eargs)->car;
    if (!IS_INT(arg)) {
        error_runtime(vm, "exit: argument must be an integer");
        return UNDEFINED_VAL;
    }
    int exit_status = AS_INT(arg);
    vm_free(vm);
    exit(exit_status);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x5457
movq %rax, %r15
movq %rax, %rdi
callq 0x4a8d
cmpl $0x1, %eax
je 0x3732
leaq 0x292f(%rip), %rsi      # 0x6048
leaq 0x2afb(%rip), %rdx      # 0x621b
movq %rbx, %rdi
movl $0x1, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4cc4
movabsq $0x7ffc000000000000, %r14 # imm = 0x7FFC000000000000
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %r15
movq 0x10(%r15), %rax
movq %rax, %rcx
notq %rcx
testq %r14, %rcx
je 0x3772
movq %rax, %xmm0
movq %xmm0, 0x8(%rsp)
callq 0x1050
ucomisd 0x8(%rsp), %xmm0
jne 0x3772
jnp 0x3794
leaq 0x2f5a(%rip), %rsi      # 0x66d3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4cc4
addq $0x4, %r14
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
cvttsd2si %xmm0, %r14
movq %rbx, %rdi
callq 0x4eaa
movl %r14d, %edi
callq 0x11b0
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/core.c
// Function: builtin_hash
static value_t builtin_hash(vm_t *vm, env_t *env, value_t args) {
    value_t eargs = eval_list(vm, env, args);
    arity_check(vm, "hash", eargs, 1, false);

    value_t arg = AS_CONS(eargs)->car;
    if (IS_VAL(arg) || IS_STRING(arg) || IS_SYMBOL(arg)) {
        return NUM_VAL(hash_value(arg));
    }
    error_runtime(vm, "hash: cannot hash non-immutable type");
    return UNDEFINED_VAL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5457
movq %rax, %r14
movq %rax, %rdi
callq 0x4a8d
cmpl $0x1, %eax
je 0x37e5
leaq 0x287c(%rip), %rsi      # 0x6048
leaq 0x2a4d(%rip), %rdx      # 0x6220
movq %rbx, %rdi
movl $0x1, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4cc4
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %r14
movq 0x10(%r14), %rdi
movq %rdi, %rcx
shrq $0x32, %rcx
cmpl $0x3fff, %ecx           # imm = 0x3FFF
jb 0x3811
andq %rdi, %rax
movl (%rax), %eax
decl %eax
cmpl $0x1, %eax
ja 0x3824
callq 0x466f
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %xmm0, %rax
jmp 0x383f
leaq 0x2eca(%rip), %rsi      # 0x66f5
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4cc4
movabsq $0x7ffc000000000004, %rax # imm = 0x7FFC000000000004
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/read.c
// Function: next_token
static void next_token(reader_t *reader) {
    eat_whitespace(reader);

    if ((*reader->cur) == '(') {
        reader->toktype = TOK_LPAREN;
        reader->tokstart = reader->cur;
    } else if ((*reader->cur) == ')') {
        reader->toktype = TOK_RPAREN;
        reader->tokstart = reader->cur;
    } else if ((*reader->cur) == '#') {
        reader->toktype = TOK_HASH;
        reader->tokstart = reader->cur;
    } else if ((*reader->cur) == '.') {
        reader->toktype = TOK_DOT;
        reader->tokstart = reader->cur;
    } else if ((*reader->cur) == '\'') {
        reader->toktype = TOK_QUOTE;
        reader->tokstart = reader->cur;
    } else if ((*reader->cur) == '\"') {
        reader->toktype = TOK_STRING;
        reader->tokstart = reader->cur;
    } else if (is_digit(*reader->cur)) {
        reader->toktype = TOK_NUMBER;
        reader->tokstart = reader->cur;
    } else if (((*reader->cur) == '-') && is_digit(peek_next_char(reader))) {
        reader->toktype = TOK_NUMBER;
        reader->tokstart = reader->cur;
    } else if (((*reader->cur) == '+') && is_digit(peek_next_char(reader))) {
        reader->toktype = TOK_NUMBER;
        reader->tokstart = reader->cur;
    } else if ((*reader->cur) == '\0') {
        reader->toktype = TOK_EOF;
        reader->tokstart = reader->cur;
    } else if (is_symbol(*reader->cur)) {
        reader->toktype = TOK_SYMBOL;
        reader->tokstart = reader->cur;
    } else {
        error_print(reader, "Unknown token (starts with '%c')",
                    *reader->tokstart);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x3fb4
movq 0x10(%rbx), %rax
movzbl (%rax), %ecx
leal -0x22(%rcx), %edx
cmpl $0xc, %edx
ja 0x3921
leaq 0x2e1f(%rip), %rsi      # 0x671c
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl $0x6, 0x30(%rbx)
jmp 0x394b
movl $0x5, 0x30(%rbx)
jmp 0x394b
movl $0x4, 0x30(%rbx)
jmp 0x394b
leal -0x30(%rcx), %edx
cmpb $0x9, %dl
ja 0x3951
movl $0x9, 0x30(%rbx)
jmp 0x394b
movl $0x8, 0x30(%rbx)
jmp 0x394b
movl $0x2, 0x30(%rbx)
jmp 0x394b
movl $0x3, 0x30(%rbx)
movq %rax, 0x18(%rbx)
popq %rbx
retq
testl %ecx, %ecx
je 0x396c
cmpl $0x2b, %ecx
je 0x395f
cmpl $0x2d, %ecx
jne 0x3975
movb 0x1(%rax), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
jbe 0x3929
jmp 0x399a
movl $0x0, 0x30(%rbx)
jmp 0x394b
movl %ecx, %edx
andb $-0x21, %dl
addb $-0x41, %dl
cmpb $0x1a, %dl
jb 0x399a
leal -0x21(%rcx), %edx
cmpl $0x3e, %edx
ja 0x39a3
movabsq $0x600000007a005639, %rsi # imm = 0x600000007A005639
btq %rdx, %rsi
jae 0x39a3
movl $0x7, 0x30(%rbx)
jmp 0x394b
cmpl $0x7e, %ecx
je 0x399a
movq 0x18(%rbx), %rax
movsbl (%rax), %edx
leaq 0x2dc2(%rip), %rsi      # 0x6778
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
jmp 0x4035
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/read.c
// Function: eat_whitespace
static void eat_whitespace(reader_t *reader) {
    while (is_space(*reader->cur) && (*reader->cur) != '\0') {
        next_char(reader);
    }
    if ((*reader->cur) == ';') {
        while (*reader->cur != '\n' && *reader->cur != '\0') {
            next_char(reader);
        }
        next_char(reader);
    }

    if ((*reader->cur) == '\0') {
        reader->toktype = TOK_EOF;
    }
}

// Assembly:
movq 0x10(%rdi), %rax
incq %rax
movabsq $0x100002600, %rdx      # imm = 0x100002600
movzbl -0x1(%rax), %ecx
cmpq $0x3b, %rcx
ja 0x4028
btq %rcx, %rdx
jae 0x3ff0
movq %rax, 0x10(%rdi)
incl 0x24(%rdi)
cmpb $0xa, %cl
jne 0x3feb
incl 0x20(%rdi)
movl $0x1, 0x24(%rdi)
incq %rax
jmp 0x3fc5
cmpq $0x3b, %rcx
jne 0x4028
testb %cl, %cl
je 0x4010
movzbl %cl, %edx
cmpl $0xa, %edx
je 0x4010
movq %rax, 0x10(%rdi)
incl 0x24(%rdi)
movb (%rax), %cl
incq %rax
jmp 0x3ff6
movq %rax, 0x10(%rdi)
incl 0x24(%rdi)
cmpb $0xa, %cl
jne 0x4026
incl 0x20(%rdi)
movl $0x1, 0x24(%rdi)
movb (%rax), %cl
testb %cl, %cl
je 0x402d
retq
movl $0x0, 0x30(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/read.c
// Function: read_vector
static void read_vector(reader_t *reader) {
    next_char(reader);  // consumes '#'
    next_char(reader);  // consumes '('

    vector_t *vec = vector_new(reader->vm, 0);
    while (reader->toktype != TOK_EOF) {
        next_token(reader);
        if (reader->toktype == TOK_RPAREN) {
            reader->tokval = PTR_VAL(vec);
            next_char(reader);
            return;
        } else {
            read1(reader);
            value_t elem = reader->tokval;
            vector_push(reader->vm, vec, elem);
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movb (%rax), %dl
leaq 0x1(%rax), %rcx
movq %rcx, 0x10(%rdi)
movl 0x24(%rdi), %ecx
incl %ecx
movl %ecx, 0x24(%rdi)
cmpb $0xa, %dl
jne 0x412d
incl 0x20(%rbx)
movl $0x1, 0x24(%rbx)
movl $0x1, %ecx
movb 0x1(%rax), %dl
addq $0x2, %rax
movq %rax, 0x10(%rbx)
incl %ecx
movl %ecx, 0x24(%rbx)
cmpb $0xa, %dl
jne 0x414c
incl 0x20(%rbx)
movl $0x1, 0x24(%rbx)
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x493b
cmpl $0x0, 0x30(%rbx)
je 0x41bc
movq %rax, %r14
movq %rbx, %rdi
callq 0x38de
cmpl $0x3, 0x30(%rbx)
je 0x418c
movq %rbx, %rdi
callq 0x39c1
movq (%rbx), %rdi
movq 0x28(%rbx), %rdx
movq %r14, %rsi
callq 0x4b39
cmpl $0x0, 0x30(%rbx)
jne 0x415f
jmp 0x41bc
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %r14
movq %r14, 0x28(%rbx)
movq 0x10(%rbx), %rax
movb (%rax), %cl
incq %rax
movq %rax, 0x10(%rbx)
incl 0x24(%rbx)
cmpb $0xa, %cl
jne 0x41bc
incl 0x20(%rbx)
movl $0x1, 0x24(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/scheme.c
// Function: file_load
void file_load(vm_t *vm, env_t *env, const char *path) {
#if DEBUG
    fprintf(stdout, "DEBUG: Loading script %s!\n", path);
#endif  // DEBUG
    char *source = file_read(path);
    if (source == NULL) {
        fprintf(stderr, "ERROR: Could not find script %s!\n", path);
        exit(66);  // EX_NOINPUT
    }
    value_t val = read_source(vm, source);
    eval(vm, env, val);

    free(source);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, %rdi
callq 0x4219
testq %rax, %rax
je 0x4211
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x3848
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x5627
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
movq %r12, %rdi
callq 0x11e0
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/scheme.c
// Function: file_read
static char *file_read(const char *filename) {
    FILE *f = fopen(filename, "rb");
    if (f == NULL) return NULL;

    fseek(f, 0, SEEK_END);
    size_t fsize = ftell(f);
    rewind(f);

    char *buffer = (char *) malloc(fsize + 1);
    if (buffer == NULL) {
        fprintf(stderr, "ERROR: Could not read file %s (buffer alloc fail)!\n",
                filename);
        exit(74);  // EX_IOERR
    }

    size_t read = fread(buffer, sizeof(char), fsize, f);
    if (read < fsize) {
        fprintf(stderr, "ERROR: Could not read file %s (whole not read)!\n",
                filename);
        exit(74);  // EX_IOERR
    }

    buffer[read] = '\0';

    fclose(f);
    return buffer;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x2744(%rip), %rsi      # 0x696f
callq 0x11a0
testq %rax, %rax
je 0x4293
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1180
movq %r14, %rdi
callq 0x1140
movq %rax, %r12
movq %r14, %rdi
callq 0x10b0
leaq 0x1(%r12), %rdi
callq 0x1160
testq %rax, %rax
je 0x42a5
movq %rax, %r15
movl $0x1, %esi
movq %rax, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x1060
cmpq %r12, %rax
jb 0x42ad
movb $0x0, (%r15,%rax)
movq %r14, %rdi
callq 0x10a0
jmp 0x4296
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x1228
movq %rbx, %rdi
callq 0x1204
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/scheme.c
// Function: file_run
void file_run(const char *filename) {
    char *source = file_read(filename);
    if (source == NULL) {
        fprintf(stderr, "ERROR: Could not find file %s!\n", filename);
        exit(66);  // EX_NOINPUT
    }

    vm_t *vm = vm_init();
    env_t *env = scm_env_default(vm);

    value_t val = read_source(vm, source);
    eval(vm, env, val);

    vm_free(vm);
    free(source);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %r14
callq 0x4219
testq %rax, %rax
je 0x4340
movq %rax, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x4d8c
leaq 0x28f(%rip), %rax       # 0x456f
movq %rax, 0x8(%r14)
leaq -0x127(%rip), %rax      # 0x41c4
movq %rax, 0x10(%r14)
movq $0x4000000, 0x18(%r14)  # imm = 0x4000000
movq %r14, %rdi
callq 0x4dcf
movq %rax, %r14
movq %rax, %rdi
callq 0x13d9
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3848
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5627
movq %r14, %rdi
callq 0x4eaa
movq %rbx, %rdi
callq 0x1030
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x124c
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/scheme.c
// Function: repl_run
void repl_run() {
    vm_t *vm = vm_init();
    env_t *env = scm_env_default(vm);

    fprintf(stdout, " _  __     \n"
                    "(_ /  |\\/|\n"
                    "__)\\__|  |\n"
                    "  v%s  \n\n"
                    "Welcome to the REPL!\n"
                    "Ctrl+D to exit!\n\n",
            SCM_VERSION_STRING);

    char line[1024];

    while (true) {
        fprintf(stdout, ">> ");

        if (!fgets(line, 1024, stdin)) {
            fprintf(stdout, "\n");
            break;
        }

        value_t val = read_source(vm, line);
        value_t result = eval(vm, env, val);

        if (!IS_VOID(result)) {
            display(stdout, result);
            fprintf(stdout, "\n");
        }
    }

    fprintf(stdout, "Quitting!\n");
    vm_free(vm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x4d8c
leaq 0x204(%rip), %rax       # 0x456f
movq %rax, 0x8(%rbx)
leaq -0x1b2(%rip), %rax      # 0x41c4
movq %rax, 0x10(%rbx)
movq $0x4000000, 0x18(%rbx)  # imm = 0x4000000
movq %rbx, %rdi
callq 0x4dcf
movq %rax, %rbx
movq %rax, %rdi
callq 0x13d9
movq %rax, %r14
movq 0x5c31(%rip), %r13      # 0x9fd0
movq (%r13), %rdi
leaq 0x24f0(%rip), %rsi      # 0x689a
leaq 0x253b(%rip), %rdx      # 0x68ec
xorl %eax, %eax
callq 0x1130
movq (%r13), %rcx
leaq 0x252f(%rip), %rdi      # 0x68f2
movl $0x3, %esi
movl $0x1, %edx
callq 0x11c0
movq 0x5bff(%rip), %rax      # 0x9fd8
movq (%rax), %rdx
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x1110
testq %rax, %rax
je 0x446c
movq %rsp, %r15
movabsq $0x7ffc000000000005, %rbp # imm = 0x7FFC000000000005
leaq 0x24f0(%rip), %r12      # 0x68f2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3848
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5627
cmpq %rbp, %rax
je 0x443a
movq (%r13), %rdi
movq %rax, %rsi
callq 0x5e3b
movq (%r13), %rsi
movl $0xa, %edi
callq 0x1100
movq (%r13), %rcx
movl $0x3, %esi
movl $0x1, %edx
movq %r12, %rdi
callq 0x11c0
movq 0x5b81(%rip), %rax      # 0x9fd8
movq (%rax), %rdx
movq %r15, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x1110
testq %rax, %rax
jne 0x4402
movq (%r13), %rsi
movl $0xa, %edi
callq 0x1100
movq (%r13), %rcx
leaq 0x2471(%rip), %rdi      # 0x68f6
movl $0xa, %esi
movl $0x1, %edx
callq 0x11c0
movq %rbx, %rdi
callq 0x4eaa
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/scheme.c
// Function: main
int main(int argc, char *argv[]) {
    // TODO: Add support for cmdline arguments for scripts
    if (argc == 2) {
        if (strcmp(argv[1], "--help") == 0) {
            fprintf(stdout, "Usage: scheme.out [file]\n");
            fprintf(stdout, "  --help    : Show this help\n");
            fprintf(stdout, "  --version : Show version\n");
            return 0;
        } else if (strcmp(argv[1], "--version") == 0) {
            fprintf(stdout, "SCM v%s\n", SCM_VERSION_STRING);
            return 0;
        }
    }

    if (argc == 1) {
        repl_run();
    } else {
        file_run(argv[1]);
    }

    return 0;
}

// Assembly:
pushq %rbx
cmpl $0x1, %edi
je 0x4504
cmpl $0x2, %edi
jne 0x450b
movq 0x8(%rsi), %rbx
leaq 0x243d(%rip), %rsi      # 0x6901
movq %rbx, %rdi
callq 0x1120
testl %eax, %eax
je 0x4519
leaq 0x2485(%rip), %rsi      # 0x695c
movq %rbx, %rdi
callq 0x1120
testl %eax, %eax
jne 0x450f
movq 0x5ae6(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
leaq 0x2472(%rip), %rsi      # 0x6966
leaq 0x23f1(%rip), %rdx      # 0x68ec
xorl %eax, %eax
callq 0x1130
jmp 0x456b
callq 0x4348
jmp 0x456b
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
callq 0x42b5
jmp 0x456b
movq 0x5ab0(%rip), %rbx      # 0x9fd0
movq (%rbx), %rcx
leaq 0x23de(%rip), %rdi      # 0x6908
movl $0x19, %esi
movl $0x1, %edx
callq 0x11c0
movq (%rbx), %rcx
leaq 0x23df(%rip), %rdi      # 0x6922
movl $0x1d, %esi
movl $0x1, %edx
callq 0x11c0
movq (%rbx), %rcx
leaq 0x23e4(%rip), %rdi      # 0x6940
movl $0x1b, %esi
movl $0x1, %edx
callq 0x11c0
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/scheme.c
// Function: error_report
static void error_report(vm_t *vm, int line, int column, const char *message) {
    if (line > 0) {
        fprintf(stderr, "ERROR @ [%d:%d]: %s\n", line, column, message);
    } else if (line == -1) {
        fprintf(stderr, "ERROR @ runtime: %s\n", message);
    }
}

// Assembly:
movq %rcx, %r8
movl %edx, %ecx
movl %esi, %edx
testl %esi, %esi
jg 0x4580
cmpl $-0x1, %edx
je 0x4598
retq
movq 0x5a71(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x2446(%rip), %rsi      # 0x69d7
xorl %eax, %eax
jmp 0x1130
movq 0x5a59(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x2443(%rip), %rsi      # 0x69ec
movq %r8, %rdx
xorl %eax, %eax
jmp 0x1130
nop
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: ptr_free
void ptr_free(vm_t *vm, ptrvalue_t *ptr) {
    if (ptr->type == T_STRING) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_CONS) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_SYMBOL) {
        symbol_t *ptr_sym = (symbol_t *) ptr;
        symbol_t *prev = NULL;
        symbol_t *s = vm->symbol_table;
        while (s != NULL) {
            if (s->len == ptr_sym->len &&
                memcmp(s->name, ptr_sym->name, s->len * sizeof(char)) == 0) {
                if (prev != NULL) {
                    prev->next = s->next;
                    vm->symbol_table = prev;
                } else {
                    vm->symbol_table = s->next;
                }
                break;
            }
            prev = s;
            s = s->next;
        }
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_PRIMITIVE) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_FUNCTION || ptr->type == T_MACRO) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_VECTOR) {
        vector_t *vec = (vector_t *) ptr;

        vm_realloc(vm, vec->data, 0, 0);

        vec->data = NULL;
        vec->capacity = 0;
        vec->count = 0;

        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_ENV) {
        vm_realloc(vm, ptr, 0, 0);
    }
}

// Assembly:
movl (%rsi), %eax
cmpl $0x7, %eax
ja 0x4653
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0xbb, %ecx
btl %eax, %ecx
jae 0x45f7
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f06
cmpl $0x2, %eax
jne 0x463a
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x45da
movl 0x10(%rbx), %r15d
leaq 0x20(%rbx), %r12
xorl %r13d, %r13d
movq %rax, %rbp
cmpl %r15d, 0x10(%rax)
jne 0x462c
leaq 0x20(%rbp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1170
testl %eax, %eax
je 0x4654
movq 0x18(%rbp), %rax
movq %rbp, %r13
testq %rax, %rax
jne 0x4610
jmp 0x45da
movq 0x18(%rbx), %rsi
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4f06
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
jmp 0x45da
retq
movq 0x18(%rbp), %rax
testq %r13, %r13
je 0x4663
movq %rax, 0x18(%r13)
jmp 0x4666
movq %rax, %r13
movq %r13, 0x18(%r14)
jmp 0x45da
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: hash_value
uint32_t hash_value(value_t val) {
#if NANTAG
    if (IS_PTR(val)) {
        return hash_ptr(AS_PTR(val));
    } else {
        value_conv_t data;
        data.bits = val;
        return hash_number(data.bits);
    }
#else   // ! NANTAG
    switch (val.type) {
        case V_NIL:
            return 0;
        case V_TRUE:
            return 1;
        case V_FALSE:
            return 2;
        case V_UNDEFINED:
            return 3;
        case V_NUM:
            return hash_number(AS_NUM(val));
        case V_PTR:
            return hash_ptr(AS_PTR(val));
        default:
            return 0;
    }
#endif  // NANTAG
}

// Assembly:
movq %rdi, %rax
shrq $0x32, %rax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jb 0x469c
movabsq $0x3ffffffffffff, %rax  # imm = 0x3FFFFFFFFFFFF
andq %rax, %rdi
movl (%rdi), %ecx
cmpl $0x2, %ecx
je 0x46bf
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0x46be
movl 0x14(%rdi), %eax
retq
movq %rdi, -0x8(%rsp)
movl $0x811c9dc5, %eax       # imm = 0x811C9DC5
xorl %ecx, %ecx
movzbl -0x8(%rsp,%rcx), %edx
incq %rcx
xorl %eax, %edx
imull $0x1000193, %edx, %eax  # imm = 0x1000193
cmpq $0x8, %rcx
jne 0x46a8
retq
movl 0x10(%rdi), %ecx
movl $0x811c9dc5, %eax       # imm = 0x811C9DC5
testq %rcx, %rcx
je 0x46be
xorl %edx, %edx
movsbl 0x20(%rdi,%rdx), %esi
xorl %eax, %esi
imull $0x1000193, %esi, %eax  # imm = 0x1000193
incq %rdx
cmpq %rdx, %rcx
jne 0x46ce
jmp 0x46be
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: string_new
string_t *string_new(vm_t *vm, const char *text, size_t len) {
    string_t *str = (string_t *) vm_realloc(
        vm, NULL, 0, sizeof(string_t) + sizeof(char) * (len + 1));

    ptr_init(vm, &str->p, T_STRING);

    str->len = (uint32_t) len;
    str->value[len] = '\0';

    if (len > 0 && text != NULL) {
        memcpy(str->value, text, len);
    }

    hash_string(str);

    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq 0x19(%rdx), %rcx
xorl %r13d, %r13d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movq %rax, %rbx
movl $0x1, (%rax)
movb %r13b, 0x4(%rax)
movq (%r14), %rax
movq %rax, 0x8(%rbx)
movq %rbx, (%r14)
movl %r15d, 0x10(%rbx)
movb %r13b, 0x18(%rbx,%r15)
movq %rbx, %r14
addq $0x18, %r14
testq %r15, %r15
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x4786
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1150
movl 0x10(%rbx), %eax
movl $0x811c9dc5, %ecx       # imm = 0x811C9DC5
testq %rax, %rax
je 0x47aa
xorl %edx, %edx
movsbl (%r14,%rdx), %esi
xorl %ecx, %esi
imull $0x1000193, %esi, %ecx  # imm = 0x1000193
incq %rdx
cmpq %rdx, %rax
jne 0x4795
movl %ecx, 0x14(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: symbol_new
symbol_t *symbol_new(vm_t *vm, const char *name, size_t len) {
    if (len == 0 || name == NULL) {
        error_runtime(vm, "NULL or 0-length symbols are not allowed!");
        return NULL;
    }

    symbol_t *sym = (symbol_t *) vm_realloc(
        vm, NULL, 0, sizeof(symbol_t) + sizeof(char) * (len + 1));

    ptr_init(vm, &sym->p, T_SYMBOL);

    sym->len = (uint32_t) len;
    sym->name[len] = '\0';
    sym->next = NULL;

    memcpy(sym->name, name, len);

    return sym;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r12
testq %rdx, %rdx
setne %al
testq %rsi, %rsi
setne %cl
testb %al, %cl
jne 0x47ec
leaq 0x222f(%rip), %rsi      # 0x6a0c
xorl %r15d, %r15d
movq %r12, %rdi
xorl %eax, %eax
callq 0x4cc4
jmp 0x483e
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x21(%rdx), %rcx
xorl %r13d, %r13d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movq %rax, %r15
movl $0x2, (%rax)
movb %r13b, 0x4(%rax)
movq (%r12), %rax
movq %rax, 0x8(%r15)
movq %r15, (%r12)
movl %ebx, 0x10(%r15)
leaq 0x20(%r15), %rdi
movb %r13b, 0x20(%r15,%rbx)
movq $0x0, 0x18(%r15)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1150
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: primitive_new
primitive_t *primitive_new(vm_t *vm, primitive_fn fn) {
    primitive_t *prim =
        (primitive_t *) vm_realloc(vm, NULL, 0, sizeof(primitive_t));

    ptr_init(vm, &prim->p, T_PRIMITIVE);

    prim->name = NULL;
    prim->fn = fn;

    return prim;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x20, %ecx
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movl $0x3, (%rax)
movb $0x0, 0x4(%rax)
movq (%r14), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%r14)
movq $0x0, 0x10(%rax)
movq %rbx, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: vector_new
vector_t *vector_new(vm_t *vm, uint32_t count) {
    value_t *data = NULL;
    if (count > 0) {
        data = (value_t *) vm_realloc(vm, NULL, 0, sizeof(value_t) * count);
    }

    vector_t *vec = (vector_t *) vm_realloc(vm, NULL, 0, sizeof(vector_t));

    ptr_init(vm, &vec->p, T_VECTOR);

    vec->capacity = count;
    vec->count = count;
    vec->data = data;

    return vec;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
testl %esi, %esi
je 0x4960
movl %ebx, %ecx
shlq $0x3, %rcx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movq %rax, %r15
jmp 0x4963
xorl %r15d, %r15d
movl $0x20, %ecx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movl $0x6, (%rax)
movb $0x0, 0x4(%rax)
movq (%r14), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%r14)
movl %ebx, 0x10(%rax)
movl %ebx, 0x14(%rax)
movq %r15, 0x18(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: env_new
env_t *env_new(vm_t *vm, value_t variables, env_t *up) {
    env_t *env = (env_t *) vm_realloc(vm, NULL, 0, sizeof(env_t));

    ptr_init(vm, &env->p, T_ENV);

    env->variables = variables;
    env->up = up;

    vm->env = env;

    return env;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x20, %ecx
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movl $0x7, (%rax)
movb $0x0, 0x4(%rax)
movq (%r15), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%r15)
movq %r14, 0x10(%rax)
movq %rbx, 0x18(%rax)
movq %rax, 0x50(%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: symbol_intern
symbol_t *symbol_intern(vm_t *vm, const char *name, size_t len) {
    for (symbol_t *s = vm->symbol_table; s != NULL; s = s->next) {
        if (s->len == len && memcmp(s->name, name, len * sizeof(char)) == 0) {
            return s;
        }
    }

    symbol_t *sym = symbol_new(vm, name, len);

    sym->next = vm->symbol_table;
    vm->symbol_table = sym;

    return sym;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x18(%rdi), %r14
testq %r14, %r14
je 0x4a16
movl 0x10(%r14), %eax
cmpq %r15, %rax
jne 0x4a10
leaq 0x20(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1170
testl %eax, %eax
je 0x4a33
movq 0x18(%r14), %r14
jmp 0x49ef
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x47ba
movq %rax, %r14
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movq %r14, 0x18(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: cons_fn
value_t cons_fn(vm_t *vm, value_t a, value_t b) {
    cons_t *result = cons_new(vm);
    result->car = a;
    result->cdr = b;
    return PTR_VAL(result);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x20, %ecx
xorl %esi, %esi
xorl %edx, %edx
callq 0x4f06
movl $0x0, (%rax)
movb $0x0, 0x4(%rax)
movq (%r15), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%r15)
movq %r14, 0x10(%rax)
movq %rbx, 0x18(%rax)
movabsq $-0x4000000000000, %rcx # imm = 0xFFFC000000000000
orq %rcx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: cons_len
int32_t cons_len(value_t val) {
    int32_t len = 0;

    // Uses Floyd's cycle finding algorithm
    value_t fast, slow;
    fast = slow = val;

    while (true) {
        if (IS_NIL(fast)) {
            return len;
        }
        if (IS_CONS(fast) && !IS_NIL(AS_CONS(fast)->cdr) &&
            !IS_CONS(AS_CONS(fast)->cdr)) {
            return -2 - len;
        }
        fast = AS_CONS(fast)->cdr;
        ++len;
        if (IS_NIL(fast)) {
            return len;
        }
        if (IS_CONS(fast) && !IS_NIL(AS_CONS(fast)->cdr) &&
            !IS_CONS(AS_CONS(fast)->cdr)) {
            return -2 - len;
        }
        fast = AS_CONS(fast)->cdr;
        slow = AS_CONS(slow)->cdr;
        ++len;
        if (IS_EQ(fast, slow)) {
            return -1;
        }
    }
}

// Assembly:
movabsq $-0x4000000000001, %rcx # imm = 0xFFFBFFFFFFFFFFFF
movabsq $0x7ffc000000000001, %rdx # imm = 0x7FFC000000000001
xorl %eax, %eax
movabsq $0x3ffffffffffff, %rsi  # imm = 0x3FFFFFFFFFFFF
movq %rdi, %r8
cmpq %rdx, %rdi
je 0x4b24
movq %rdi, %r9
andq %rsi, %r9
cmpq %rcx, %rdi
jbe 0x4adc
cmpl $0x0, (%r9)
jne 0x4adc
movq 0x18(%r9), %rdi
cmpq %rdx, %rdi
je 0x4adc
cmpq %rcx, %rdi
jbe 0x4b28
andq %rsi, %rdi
cmpl $0x0, (%rdi)
jne 0x4b28
movq 0x18(%r9), %r9
cmpq %rdx, %r9
je 0x4b25
movq %r9, %rdi
andq %rsi, %rdi
cmpq %rcx, %r9
jbe 0x4b0c
cmpl $0x0, (%rdi)
jne 0x4b0c
movq 0x18(%rdi), %r9
cmpq %rdx, %r9
je 0x4b0c
cmpq %rcx, %r9
jbe 0x4b2f
andq %rsi, %r9
cmpl $0x0, (%r9)
jne 0x4b2f
movq 0x18(%rdi), %rdi
andq %rsi, %r8
movq 0x18(%r8), %r8
addl $0x2, %eax
cmpq %r8, %rdi
jne 0x4ab0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
incl %eax
retq
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
jmp 0x4b34
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
subl %eax, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.c
// Function: vector_push
void vector_push(vm_t *vm, vector_t *vec, value_t val) {
    if (vec->count + 1 > vec->capacity) {
        uint32_t capacity = vec->capacity ? vec->capacity << 1 : 2;
        vec->data = (value_t *) vm_realloc(vm, vec->data,
                                           vec->capacity * sizeof(value_t),
                                           capacity * sizeof(value_t));
        vec->capacity = capacity;
    }
    vec->data[vec->count++] = val;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl 0x10(%rsi), %edx
movl 0x14(%rsi), %ecx
leal 0x1(%rcx), %esi
cmpl %edx, %esi
jbe 0x4b87
leal (%rdx,%rdx), %eax
testq %rdx, %rdx
movl $0x2, %r15d
cmovnel %eax, %r15d
movq 0x18(%r14), %rsi
shlq $0x3, %rdx
leaq (,%r15,8), %rcx
callq 0x4f06
movq %rax, 0x18(%r14)
movl %r15d, 0x10(%r14)
movl 0x14(%r14), %ecx
leal 0x1(%rcx), %esi
jmp 0x4b8b
movq 0x18(%r14), %rax
movl %esi, 0x14(%r14)
movl %ecx, %ecx
movq %rbx, (%rax,%rcx,8)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/value.h
// Function: val_equal
static inline bool val_eq(value_t a, value_t b) {
#if NANTAG
    return a == b;
#else   // !NANTAG
    if (a.type != b.type) return false;
    if (a.type == V_NUM) return (a.v.num == b.v.num);
    return a.v.ptr == b.v.ptr;
#endif  // NANTAG
}

// Assembly:
cmpq %rsi, %rdi
jne 0x4ba3
movb $0x1, %al
retq
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movabsq $-0x4000000000001, %r15 # imm = 0xFFFBFFFFFFFFFFFF
movabsq $0x3ffffffffffff, %r12  # imm = 0x3FFFFFFFFFFFF
xorl %eax, %eax
cmpq %r15, %r14
jbe 0x4cb1
cmpq %r15, %rbx
jbe 0x4cb1
andq %r12, %r14
andq %r12, %rbx
movl (%r14), %eax
cmpl (%rbx), %eax
jne 0x4caf
testl %eax, %eax
jne 0x4c17
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
callq 0x4b9b
testb %al, %al
je 0x4caf
movq 0x18(%r14), %r14
movq 0x18(%rbx), %rbx
cmpq %rbx, %r14
jne 0x4bc5
movb $0x1, %al
jmp 0x4cb1
cmpl $0x1, %eax
je 0x4c63
cmpl $0x2, %eax
je 0x4c8f
cmpl $0x6, %eax
jne 0x4caf
movl 0x14(%r14), %ecx
cmpl 0x14(%rbx), %ecx
jne 0x4caf
movb $0x1, %al
testl %ecx, %ecx
je 0x4cb1
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x4b9b
testb %al, %al
je 0x4cb1
incq %r15
movl 0x14(%r14), %ecx
cmpq %rcx, %r15
jb 0x4c3c
jmp 0x4cb1
movl 0x10(%r14), %edx
cmpl 0x10(%rbx), %edx
jne 0x4caf
movl 0x14(%r14), %eax
cmpl 0x14(%rbx), %eax
jne 0x4caf
addq $0x18, %r14
addq $0x18, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1170
testl %eax, %eax
sete %al
jmp 0x4cb1
movl 0x10(%r14), %edx
cmpl 0x10(%rbx), %edx
jne 0x4caf
addq $0x20, %r14
addq $0x20, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1170
testl %eax, %eax
je 0x4cbd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x1270
jmp 0x4caf
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/vm.c
// Function: scm_config_default
void scm_config_default(scm_config_t *config) {
    config->realloc_fn = scm_realloc_default;
    config->error_fn = NULL;
    config->load_fn = NULL;

    // TODO: tweak the initial and min heap sizes
    config->heap_size_initial = 512 * 1024;  // 512 kB
    config->heap_size_min = 64 * 1024;       //  64 kB
    config->heap_growth = 0.5;               //  50%
}

// Assembly:
leaq 0x29(%rip), %rax        # 0x4dbc
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq $0x80000, 0x18(%rdi)    # imm = 0x80000
movq $0x10000, 0x20(%rdi)    # imm = 0x10000
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x28(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/vm.c
// Function: vm_new
vm_t *vm_new(scm_config_t *config) {
    scm_realloc_fn reallocate = scm_realloc_default;
    if (config != NULL) reallocate = config->realloc_fn;

    vm_t *vm = (vm_t *) reallocate(NULL, sizeof(vm_t));

    memset(vm, 0, sizeof(vm_t));

    if (config != NULL) {
        memcpy(&vm->config, config, sizeof(scm_config_t));
    } else {
        scm_config_default(&vm->config);
    }

    vm->allocated = 0;
    vm->gc_threshold = vm->config.heap_size_initial;

    vm->symbol_table = NULL;

    vm->env = NULL;
    vm->reader = NULL;

    vm->top_env = NULL;

    vm->curval = NIL_VAL;
    vm->gensym_count = 0;

    vm->has_error = false;

    return vm;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4e17
movq %rdi, %r14
movl $0x888, %esi            # imm = 0x888
xorl %edi, %edi
callq *(%r14)
movq %rax, %rbx
movl $0x888, %edx            # imm = 0x888
movq %rax, %rdi
xorl %esi, %esi
callq 0x10e0
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm1, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm2, 0x40(%rbx)
movq 0x38(%rbx), %rax
jmp 0x4e6a
movl $0x888, %esi            # imm = 0x888
xorl %edi, %edi
callq 0x4dbc
movq %rax, %rbx
leaq -0x71(%rip), %r14       # 0x4dbc
movl $0x888, %edx            # imm = 0x888
movq %rax, %rdi
xorl %esi, %esi
callq 0x10e0
movq %r14, 0x20(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rbx)
movq $0x80000, 0x38(%rbx)    # imm = 0x80000
movq $0x10000, 0x40(%rbx)    # imm = 0x10000
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x48(%rbx)
movl $0x80000, %eax          # imm = 0x80000
xorl %ecx, %ecx
movq %rcx, 0x8(%rbx)
movq %rax, 0x10(%rbx)
movq %rcx, 0x18(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movq %rcx, 0x60(%rbx)
movabsq $0x7ffc000000000001, %rax # imm = 0x7FFC000000000001
movq %rax, 0x68(%rbx)
movl $0x0, 0x70(%rbx)
movb $0x0, 0x880(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/vm.c
// Function: vm_free
void vm_free(vm_t *vm) {
    ptrvalue_t *ptr = vm->head;
    while (ptr != NULL) {
        ptrvalue_t *next = ptr->next;
        ptr_free(vm, ptr);
        ptr = next;
    }

    vm_realloc(vm, vm, 0, 0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rsi
testq %rsi, %rsi
je 0x4ecd
movq 0x8(%rsi), %r14
movq %rbx, %rdi
callq 0x45b4
movq %r14, %rsi
testq %r14, %r14
jne 0x4eb9
cmpq $0x2000001, 0x8(%rbx)   # imm = 0x2000001
jb 0x4ef4
leaq 0x1bf2(%rip), %rsi      # 0x6ad0
movq %rbx, %rdi
movl $0x2000000, %edx        # imm = 0x2000000
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4cc4
movq 0x20(%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/vm.c
// Function: vm_realloc
void *vm_realloc(vm_t *vm, void *ptr, size_t old_size, size_t new_size) {
    vm->allocated += new_size - old_size;

    if (new_size > 0 && vm->allocated > vm->gc_threshold) {
        vm_gc(vm);
    }
#if !NOGC
    if (vm->allocated > MAX_ALLOCATED) {
        error_runtime(
            vm,
            "Can't allocate - already allocated more than %d (MAX_ALLOCATED)!",
            MAX_ALLOCATED);
        vm->allocated -= new_size;
        return NULL;
    }
#endif  // !NOGC
    return vm->config.realloc_fn(ptr, new_size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rcx, %rax
subq %rdx, %rax
addq 0x8(%rdi), %rax
movq %rax, 0x8(%rdi)
testq %rcx, %rcx
je 0x4f39
cmpq 0x10(%r14), %rax
jbe 0x4f39
movq %r14, %rdi
callq 0x4f74
movq 0x8(%r14), %rax
cmpq $0x2000001, %rax        # imm = 0x2000001
jb 0x4f63
leaq 0x1b88(%rip), %rsi      # 0x6ad0
movq %r14, %rdi
movl $0x2000000, %edx        # imm = 0x2000000
xorl %eax, %eax
callq 0x4cc4
subq %rbx, 0x8(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x20(%r14), %rax
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/vm.c
// Function: vm_push_temp
void vm_push_temp(vm_t *vm, ptrvalue_t *ptr) {
    if (ptr == NULL) {
        error_runtime(vm, "Cannot have a NULL as a temporary root!");
    }
    if (vm->num_temp >= MAX_NUM_TEMP) {
        error_runtime(
            vm, "Trying to add a temporary root that is over limit (%d is max)",
            MAX_NUM_TEMP);
    }
    vm->temp[vm->num_temp++] = ptr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
jne 0x5124
leaq 0x19f7(%rip), %rsi      # 0x6b11
movq %r14, %rdi
xorl %eax, %eax
callq 0x4cc4
movq 0x78(%r14), %rax
cmpq $0x100, %rax            # imm = 0x100
jb 0x514a
leaq 0x1a02(%rip), %rsi      # 0x6b39
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %eax, %eax
callq 0x4cc4
movq 0x78(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x78(%r14)
movq %rbx, 0x80(%r14,%rax,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jiribenes[P]scheme/src/vm.c
// Function: env_push
env_t *env_push(vm_t *vm, env_t *env, value_t vars, value_t vals) {
    value_t alist = NIL_VAL;
    value_t vars_iter, vals_iter;

    // TODO: should we create a macro - like SCM_ASSOC_FOREACH?
    for (vars_iter = vars, vals_iter = vals; IS_CONS(vars_iter);
         vars_iter = AS_CONS(vars_iter)->cdr,
        vals_iter = AS_CONS(vals_iter)->cdr) {
        if (!IS_CONS(vals_iter)) {
            // TODO: Add proper function arity?
            error_runtime(vm, "Number of arguments doesn't match!");
        }

        value_t par = AS_CONS(vars_iter)->car;
        value_t arg = AS_CONS(vals_iter)->car;

        value_t pair = cons_fn(vm, par, arg);
        value_t temp = cons_fn(vm, pair, alist);

        alist = temp;
    }
    if (!IS_NIL(vars_iter)) {
        value_t pair = cons_fn(vm, vars_iter, vals_iter);
        value_t temp = cons_fn(vm, pair, alist);

        alist = temp;
    }
    env_t *new_env = env_new(vm, alist, env);
    return new_env;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %r14
movabsq $0x7ffc000000000001, %r15 # imm = 0x7FFC000000000001
movq %rdx, %rax
shrq $0x32, %rax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jb 0x5263
movabsq $-0x4000000000001, %rbp # imm = 0xFFFBFFFFFFFFFFFF
movabsq $0x3ffffffffffff, %r13  # imm = 0x3FFFFFFFFFFFF
movq %rdx, %rbx
andq %r13, %rbx
cmpl $0x0, (%rbx)
jne 0x5272
movq %rcx, %r12
andq %r13, %r12
cmpq %rbp, %rcx
jbe 0x5222
cmpl $0x0, (%r12)
je 0x5233
movq %r14, %rdi
leaq 0x196f(%rip), %rsi      # 0x6b9b
xorl %eax, %eax
callq 0x4cc4
movq 0x10(%rbx), %rsi
movq 0x10(%r12), %rdx
movq %r14, %rdi
callq 0x4a42
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4a42
movq %rax, %r15
movq 0x18(%rbx), %rdx
movq 0x18(%r12), %rcx
cmpq %rbp, %rdx
ja 0x5205
movabsq $0x7ffc000000000001, %rax # imm = 0x7FFC000000000001
cmpq %rax, %rdx
je 0x5291
movq %r14, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x4a42
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4a42
movq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
movq (%rsp), %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4998