LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/value.c
// Function: value_to_str
const char* value_to_str(Value v) {
    static char str[UINT8_MAX + 1] = "";
    memset(str, 0, UINT8_MAX + 1);

    switch (v.type) {
        case VAL_BOOL:
            snprintf(str, UINT8_MAX, "%s", v.as.boolean ? "true" : "false");
            break;
        case VAL_NIL:
            snprintf(str, UINT8_MAX, "nil");
            break;
        case VAL_NUMBER:
            snprintf(str, UINT8_MAX, "%g", v.as.number);
            break;
        case VAL_OBJ:
            switch (AS_OBJ(v)->type) {
                case OBJ_STRING:
                    snprintf(str, UINT8_MAX, "%.*s", (int)AS_STRING(v)->len,
                             AS_CSTRING(v));
                    break;
                case OBJ_FUNCTION:
                    snprintf(str, UINT8_MAX, "fn@%.*s", (int)AS_FN(v)->name_len,
                             AS_FN(v)->name);
                    break;
                case OBJ_NATIVE:
                    snprintf(str, UINT8_MAX, "fn@<native>");
                    break;
            }
            break;
    }
    return str;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x8797(%rip), %rdi      # 0xc230
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x1100
cmpl $0x3, %ebp
ja 0x3b89
movl %ebp, %eax
leaq 0x31f1(%rip), %rcx      # 0x6ca8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3227(%rip), %rax      # 0x6cee
leaq 0x3225(%rip), %rcx      # 0x6cf3
testb $0x1, %bl
cmovneq %rax, %rcx
leaq 0x8754(%rip), %rdi      # 0xc230
leaq 0x3208(%rip), %rdx      # 0x6ceb
movl $0xff, %esi
xorl %eax, %eax
callq 0x10d0
jmp 0x3b89
movq %rbx, %xmm0
leaq 0x8730(%rip), %rdi      # 0xc230
leaq 0x31f2(%rip), %rdx      # 0x6cf9
movl $0xff, %esi
movb $0x1, %al
callq 0x10d0
jmp 0x3b89
movl (%rbx), %eax
cmpl $0x2, %eax
je 0x3b6e
cmpl $0x1, %eax
je 0x3b48
testl %eax, %eax
jne 0x3b89
movl 0x10(%rbx), %ecx
addq $0x18, %rbx
leaq 0x86fd(%rip), %rdi      # 0xc230
leaq 0x31c5(%rip), %rdx      # 0x6cff
jmp 0x3b5d
movl $0x6c696e, 0x86ea(%rip) # imm = 0x6C696E
jmp 0x3b89
movl 0x30(%rbx), %ecx
addq $0x38, %rbx
leaq 0x86da(%rip), %rdi      # 0xc230
leaq 0x319f(%rip), %rdx      # 0x6cfc
movl $0xff, %esi
movq %rbx, %r8
xorl %eax, %eax
callq 0x10d0
jmp 0x3b89
movabsq $0x6974616e3c406e66, %rax # imm = 0x6974616E3C406E66
movq %rax, 0x86b1(%rip)      # 0xc230
movl $0x3e6576, 0x86af(%rip) # imm = 0x3E6576
leaq 0x86a0(%rip), %rax      # 0xc230
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/value.c
// Function: value_to_str_debug
const char* value_to_str_debug(Value v) {
    static char str[UINT8_MAX + 1] = "";
    memset(str, 0, UINT8_MAX + 1);

    switch (v.type) {
        case VAL_BOOL:
            snprintf(str, UINT8_MAX, "boolean (%s)",
                     v.as.boolean ? "true" : "false");
            break;
        case VAL_NIL:
            snprintf(str, UINT8_MAX, "nil");
            break;
        case VAL_NUMBER:
            snprintf(str, UINT8_MAX, "number (%g)", v.as.number);
            break;
        case VAL_OBJ:
            switch (AS_OBJ(v)->type) {
                case OBJ_STRING:
                    snprintf(str, UINT8_MAX, "string (\"%.*s\")",
                             (int)AS_STRING(v)->len, AS_CSTRING(v));
                    break;
                case OBJ_FUNCTION:
                    snprintf(str, UINT8_MAX, "function (fn@%.*s)",
                             (int)AS_FN(v)->name_len, AS_FN(v)->name);
                    break;
                case OBJ_NATIVE:
                    snprintf(str, UINT8_MAX, "fn@<native>");
                    break;
            }
            break;
    }
    return str;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x878a(%rip), %rdi      # 0xc330
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x1100
cmpl $0x3, %ebp
ja 0x3c96
movl %ebp, %eax
leaq 0x30f4(%rip), %rcx      # 0x6cb8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x311a(%rip), %rax      # 0x6cee
leaq 0x3118(%rip), %rcx      # 0x6cf3
testb $0x1, %bl
cmovneq %rax, %rcx
leaq 0x8747(%rip), %rdi      # 0xc330
leaq 0x3120(%rip), %rdx      # 0x6d10
movl $0xff, %esi
xorl %eax, %eax
callq 0x10d0
jmp 0x3c96
movq %rbx, %xmm0
leaq 0x8723(%rip), %rdi      # 0xc330
leaq 0x3109(%rip), %rdx      # 0x6d1d
movl $0xff, %esi
movb $0x1, %al
callq 0x10d0
jmp 0x3c96
movl (%rbx), %eax
cmpl $0x2, %eax
je 0x3c7b
cmpl $0x1, %eax
je 0x3c55
testl %eax, %eax
jne 0x3c96
movl 0x10(%rbx), %ecx
addq $0x18, %rbx
leaq 0x86f0(%rip), %rdi      # 0xc330
leaq 0x30e2(%rip), %rdx      # 0x6d29
jmp 0x3c6a
movl $0x6c696e, 0x86dd(%rip) # imm = 0x6C696E
jmp 0x3c96
movl 0x30(%rbx), %ecx
addq $0x38, %rbx
leaq 0x86cd(%rip), %rdi      # 0xc330
leaq 0x30cf(%rip), %rdx      # 0x6d39
movl $0xff, %esi
movq %rbx, %r8
xorl %eax, %eax
callq 0x10d0
jmp 0x3c96
movabsq $0x6974616e3c406e66, %rax # imm = 0x6974616E3C406E66
movq %rax, 0x86a4(%rip)      # 0xc330
movl $0x3e6576, 0x86a2(%rip) # imm = 0x3E6576
leaq 0x8693(%rip), %rax      # 0xc330
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: read_u8
static Result read_u8(Vm* vm, uint8_t* byte) {
    assert(vm->frame_len > 0);
    CallFrame* const frame = &vm->frames[vm->frame_len - 1];
    assert(frame->ip <=
           frame->fn->chunk.opcodes + buf_size(frame->fn->chunk.opcodes));

    *byte = *frame->ip++;

    return RES_OK;
}

// Assembly:
pushq %rax
movsbq 0x40618(%rdi), %rax
testq %rax, %rax
jle 0x3f3e
decl %eax
imulq $0x18, %rax, %rcx
movq 0x40018(%rdi,%rcx), %rdx
movq 0x40020(%rdi,%rcx), %rax
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
je 0x3f1b
movq -0x8(%rdx), %r8
jmp 0x3f1e
xorl %r8d, %r8d
addq %r8, %rdx
cmpq %rdx, %rax
ja 0x3f5d
addq %rdi, %rcx
addq $0x40018, %rcx          # imm = 0x40018
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rcx)
movb (%rax), %al
movb %al, (%rsi)
popq %rax
retq
leaq 0x400b(%rip), %rdi      # 0x7f50
leaq 0x4016(%rip), %rsi      # 0x7f62
leaq 0x42a2(%rip), %rcx      # 0x81f5
movl $0x90, %edx
callq 0x10f0
leaq 0x42b1(%rip), %rdi      # 0x8215
leaq 0x3ff7(%rip), %rsi      # 0x7f62
leaq 0x4283(%rip), %rcx      # 0x81f5
movl $0x93, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: get_location
static const Location* get_location(const Vm* vm) {
    assert(vm->frame_len > 0);
    const CallFrame* const frame = &vm->frames[vm->frame_len - 1];

    return &frame->fn->chunk
                .locations[frame->ip - frame->fn->chunk.opcodes - 1];
}

// Assembly:
movsbq 0x40618(%rdi), %rax
testq %rax, %rax
jle 0x3fb6
decl %eax
imulq $0x18, %rax, %rax
movq 0x40018(%rdi,%rax), %rcx
movq 0x18(%rcx), %rdx
notq %rdx
shlq $0x4, %rdx
addq 0x20(%rcx), %rdx
movq 0x40020(%rdi,%rax), %rax
shlq $0x4, %rax
addq %rdx, %rax
retq
pushq %rax
leaq 0x3f92(%rip), %rdi      # 0x7f50
leaq 0x3f9d(%rip), %rsi      # 0x7f62
leaq 0x4294(%rip), %rcx      # 0x8260
pushq $0x36
popq %rdx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: read_constant
static Result read_constant(Vm* vm, Value* v) {
    assert(vm->frame_len > 0);
    const CallFrame* const frame = &vm->frames[vm->frame_len - 1];

    uint8_t value_index = 0;
    RETURN_IF_ERR(read_u8(vm, &value_index));
    LOG("constant index=%d constants size=%zu\n", value_index,
        buf_size(frame->fn->chunk.constants));
    assert(value_index < buf_size(frame->fn->chunk.constants));
    *v = frame->fn->chunk.constants[value_index];

    return RES_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsbq 0x40618(%rdi), %rax
testq %rax, %rax
jle 0x4052
movq %rsi, %rbx
movq %rdi, %r14
decl %eax
imulq $0x18, %rax, %r15
leaq 0xf(%rsp), %rsi
movb $0x0, (%rsi)
callq 0x3ee8
movq 0x40018(%r14,%r15), %rax
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x4033
movzbl 0xf(%rsp), %ecx
cmpq %rcx, -0x8(%rax)
jbe 0x4033
shll $0x4, %ecx
movups (%rax,%rcx), %xmm0
movups %xmm0, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x4273(%rip), %rdi      # 0x82ad
leaq 0x3f21(%rip), %rsi      # 0x7f62
leaq 0x4241(%rip), %rcx      # 0x8289
movl $0xa2, %edx
callq 0x10f0
leaq 0x3ef7(%rip), %rdi      # 0x7f50
leaq 0x3f02(%rip), %rsi      # 0x7f62
leaq 0x4222(%rip), %rcx      # 0x8289
movl $0x9b, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: read_u16
static Result read_u16(Vm* vm, uint16_t* u16) {
    uint8_t b1 = 0;
    RETURN_IF_ERR(read_u8(vm, &b1));

    uint8_t b2 = 0;
    RETURN_IF_ERR(read_u8(vm, &b2));

    *u16 = (uint16_t)(b1 << (uint8_t)8) | b2;
    return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
leaq 0xf(%rsp), %r15
movb %bpl, (%r15)
movq %r15, %rsi
callq 0x3ee8
leaq 0xe(%rsp), %r12
movb %bpl, (%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0x3ee8
movzbl (%r15), %eax
shll $0x8, %eax
movzbl (%r12), %ecx
orl %eax, %ecx
movw %cx, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: stack_pop
static Result stack_pop(Vm* vm, Value* v) {
    assert(stack_len(vm) > 0);

    vm->stack_top--;
    *v = *vm->stack_top;
    LOG("popped %s%s\n", "", value_to_str_debug(*v));

    return RES_OK;
}

// Assembly:
movq 0x40000(%rdi), %rax
cmpq %rdi, %rax
je 0x4c87
leaq -0x10(%rax), %rcx
movq %rcx, 0x40000(%rdi)
movups -0x10(%rax), %xmm0
movups %xmm0, (%rsi)
retq
pushq %rax
leaq 0x3651(%rip), %rdi      # 0x82e0
leaq 0x32cc(%rip), %rsi      # 0x7f62
leaq 0x3655(%rip), %rcx      # 0x82f2
movl $0x86, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: stack_push
static Result stack_push(Vm* vm, Value v) {
    assert(stack_len(vm) < STACK_MAX - 1);

    *vm->stack_top = v;
    vm->stack_top++;

    LOG("push stack=%s\n", value_to_str_debug(v));

    return RES_OK;
}

// Assembly:
movq 0x40000(%rdi), %rax
movq %rax, %rcx
subq %rdi, %rcx
cmpq $0x3fff0, %rcx          # imm = 0x3FFF0
jae 0x4ccc
movl %esi, (%rax)
movq %rdx, 0x8(%rax)
addq $0x10, 0x40000(%rdi)
retq
pushq %rax
leaq 0x363e(%rip), %rdi      # 0x8312
leaq 0x3287(%rip), %rsi      # 0x7f62
leaq 0x364e(%rip), %rcx      # 0x8330
pushq $0x6f
popq %rdx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: stack_trace_print
static void stack_trace_print(const Vm* vm) {
    assert(vm->frame_len > 0);

    for (int i = vm->frame_len - 1; i > 0; i--) {
        const CallFrame* const frame = &vm->frames[i];

        const Location* const loc =
            &frame->fn->chunk
                 .locations[frame->ip - frame->fn->chunk.opcodes - 1];
        fprintf(stderr, "%zu:%zu: in %.*s()\n", loc->line, loc->column,
                (int)frame->fn->name_len, frame->fn->name);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movsbq 0x40618(%rdi), %r14
testq %r14, %r14
jle 0x4d70
imulq $0x18, %r14, %rax
leaq (%rax,%rdi), %r15
addq $0x40008, %r15          # imm = 0x40008
movq 0x72db(%rip), %r12      # 0xbff0
leaq 0x3656(%rip), %rbx      # 0x8372
cmpq $0x1, %r14
jle 0x4d64
decq %r14
movq -0x8(%r15), %r9
movq (%r15), %rax
movq 0x18(%r9), %rcx
notq %rcx
shlq $0x4, %rcx
addq 0x20(%r9), %rcx
shlq $0x4, %rax
movq (%r12), %rdi
movq (%rax,%rcx), %rdx
movq 0x8(%rax,%rcx), %rcx
movl 0x30(%r9), %r8d
addq $0x38, %r9
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1140
addq $-0x18, %r15
jmp 0x4d1c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x31d9(%rip), %rdi      # 0x7f50
leaq 0x31e4(%rip), %rsi      # 0x7f62
leaq 0x35ca(%rip), %rcx      # 0x834f
pushq $0x4f
popq %rdx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: stack_peek_from_top_at
static Result stack_peek_from_top_at(const Vm* vm, Value* v,
                                     intmax_t distance) {
    assert(stack_len(vm) < STACK_MAX - 1);
    assert((size_t)distance < stack_len(vm));

    *v = vm->stack_top[-1 - distance];

    LOG("peek stack distance=%jd v=%s\n", distance, value_to_str_debug(*v));

    return RES_OK;
}

// Assembly:
pushq %rax
movq 0x40000(%rdi), %rax
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x4, %rcx
cmpq $0x3fff, %rcx           # imm = 0x3FFF
jae 0x4dbd
cmpq %rdx, %rcx
jbe 0x4dd6
notq %rdx
shlq $0x4, %rdx
movups (%rax,%rdx), %xmm0
movups %xmm0, (%rsi)
popq %rax
retq
leaq 0x354e(%rip), %rdi      # 0x8312
leaq 0x3197(%rip), %rsi      # 0x7f62
leaq 0x35fc(%rip), %rcx      # 0x83ce
pushq $0x7b
jmp 0x4ded
leaq 0x362e(%rip), %rdi      # 0x840b
leaq 0x317e(%rip), %rsi      # 0x7f62
leaq 0x35e3(%rip), %rcx      # 0x83ce
pushq $0x7c
popq %rdx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: vm_interpret
Result vm_interpret(char* source, size_t source_len,
                    Result (*bytecode_fn)(Vm*)) {
    Vm vm = {.globals = ht_init(UINT8_MAX, NULL)};
    vm.stack_top = vm.stack;

    fn_define_native(&vm, "clock", fn_native_clock);
    fn_define_native(&vm, "readLine", fn_native_read_line);
    fn_define_native(&vm, "parseNumber", fn_native_parse_number);

    Result result = RES_OK;

    ObjFunction* fn = NULL;
    if ((result = parser_compile(source, source_len, &fn, &vm)) != RES_OK) {
        return result;
    }

    LOG("parsing successful%s\n", "");

    stack_push(&vm, OBJ_VAL(fn));

    fn_call(&vm, fn, 0);
    result = bytecode_fn(&vm);

    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40628, %rsp          # imm = 0x40628
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
leaq 0x8(%rsp), %r15
movl $0x40620, %edx          # imm = 0x40620
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
movl $0xff, %edi
xorl %esi, %esi
callq 0x130c
movq %rax, 0x40010(%r15)
movq %r15, 0x40000(%r15)
leaq 0x336a(%rip), %rsi      # 0x81a9
leaq 0x136(%rip), %rdx       # 0x4f7c
movq %r15, %rdi
callq 0x4ec9
leaq 0x335a(%rip), %rsi      # 0x81af
leaq 0x1c6(%rip), %rdx       # 0x5022
movq %r15, %rdi
callq 0x4ec9
leaq 0x334d(%rip), %rsi      # 0x81b8
leaq 0x2d9(%rip), %rdx       # 0x514b
movq %r15, %rdi
callq 0x4ec9
movq %rsp, %rdx
andq $0x0, (%rdx)
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x2060
testl %eax, %eax
jne 0x4eba
movq (%rsp), %rdx
leaq 0x8(%rsp), %r14
pushq $0x3
popq %rsi
movq %r14, %rdi
callq 0x4ca7
movq (%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x52fd
movq %r14, %rdi
callq *%rbx
addq $0x40628, %rsp          # imm = 0x40628
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: fn_define_native
static Result fn_define_native(Vm* vm, char name[], NativeFn fn) {
    const size_t name_len = strlen(name);
    ObjString* const os = value_make_string(&vm->objects, name_len);
    memcpy(os->s, name, name_len);
    RETURN_IF_ERR(stack_push(vm, OBJ_VAL(os)));

    RETURN_IF_ERR(stack_push(vm, OBJ_VAL(value_make_fn_native(fn))));
    Value* v = vm->stack_top - 1;

    ht_insert(vm->globals, name, name_len, v, sizeof(*v));

    Value dummy;
    RETURN_IF_ERR(stack_pop(vm, &dummy));
    RETURN_IF_ERR(stack_pop(vm, &dummy));

    return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x10a0
movq %rax, %r15
leaq 0x40008(%rbx), %rdi
movq %rax, %rsi
callq 0x399c
movq %rax, %r13
leaq 0x18(%rax), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1160
pushq $0x3
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x4ca7
movq %r12, %rdi
callq 0x3a52
movq %rbx, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x4ca7
movq 0x40000(%rbx), %rcx
movq 0x40010(%rbx), %rdi
addq $-0x10, %rcx
pushq $0x10
popq %r8
movq %r14, %rsi
movq %r15, %rdx
callq 0x1401
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4c68
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4c68
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: fn_native_clock
static Result fn_native_clock(Vm* vm, Value* args, uint8_t args_len,
                              Value* ret) {
    (void)args;
    if (args_len > 0) {
        VM_ERROR(vm, get_location(vm),
                 "Wrong arity in function call: expected 0, got: %d", args_len);
    }

    struct timeval tp = {0};
    gettimeofday(&tp, NULL);

    *ret = NUMBER_VAL(tp.tv_sec * 1000 + tp.tv_usec / 1000);

    return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
testl %edx, %edx
jne 0x4fda
movq %rcx, %r14
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
xorl %ebx, %ebx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10e0
imulq $0x3e8, (%r15), %rcx    # imm = 0x3E8
movq 0x8(%r15), %rax
movl $0x3e8, %esi            # imm = 0x3E8
cqto
idivq %rsi
addq %rcx, %rax
cvtsi2sd %rax, %xmm0
movl $0x2, (%r14)
movsd %xmm0, 0x8(%r14)
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movzbl %dl, %ebp
movq 0x7009(%rip), %rax      # 0xbff0
movq (%rax), %r14
callq 0x3f7c
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %rcx
leaq 0x345d(%rip), %rsi      # 0x8462
movq %r14, %rdi
movq %r15, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x4cea
pushq $0x2
popq %rbx
jmp 0x4fcd
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: fn_native_read_line
static Result fn_native_read_line(Vm* vm, Value* args, uint8_t args_len,
                                  Value* ret) {
    (void)args;
    if (args_len > 0) {
        VM_ERROR(vm, get_location(vm),
                 "Wrong arity in function call: expected 0, got: %d", args_len);
    }

    char* source = NULL;
    ssize_t source_len = 0;
    size_t line_cap = UINT32_MAX;

    if ((source_len = getline(&source, &line_cap, stdin)) <= 0) {
        VM_ERROR(vm, get_location(vm),
                 "Could not read from stdin: errno=%s error=%d\n",
                 strerror(errno), errno);
    }

    ObjString* const os =
        value_make_string(&vm->objects, (size_t)source_len - 1);
    memcpy(os->s, source, (size_t)(source_len - 1));  // Trim trailing newline
    *ret = OBJ_VAL(os);

    return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testl %edx, %edx
jne 0x50b0
movq %rcx, %r14
leaq 0x8(%rsp), %rdi
andq $0x0, (%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq 0x6f79(%rip), %rax      # 0xbfd0
movq (%rax), %rdx
callq 0x11d0
testq %rax, %rax
jle 0x50ed
movq %rax, %r15
addq $0x40008, %rbx          # imm = 0x40008
decq %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x399c
movq %rax, %rbx
leaq 0x18(%rax), %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x1160
movl $0x3, (%r14)
movq %rbx, 0x8(%r14)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl %dl, %ebp
movq 0x6f36(%rip), %rax      # 0xbff0
movq (%rax), %r14
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %rcx
leaq 0x3387(%rip), %rsi      # 0x8462
movq %r14, %rdi
movq %r15, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x1140
jmp 0x513b
movq 0x6efc(%rip), %rax      # 0xbff0
movq (%rax), %r14
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %r12
callq 0x1050
movq %rax, %r13
movl (%rax), %edi
callq 0x11f0
movl (%r13), %r9d
leaq 0x3375(%rip), %rsi      # 0x849d
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x4cea
pushq $0x2
popq %rax
jmp 0x50a1
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: fn_native_parse_number
static Result fn_native_parse_number(Vm* vm, Value* args, uint8_t args_len,
                                     Value* ret) {
    if (args_len != 1) {
        VM_ERROR(vm, get_location(vm),
                 "Wrong arity in function call: expected 1, got: %d", args_len);
    }

    const Value* const v = &args[0];

    if (!IS_STRING(*v)) {
        VM_ERROR(vm, get_location(vm), "Expected a string, got: %s",
                 value_to_str_debug(*v));
    }

    char* s_nul = NULL;
    const size_t s_len = AS_STRING(*v)->len;
    REALLOC_SAFE(&s_nul, s_len + 1);
    memcpy(s_nul, AS_CSTRING(*v), s_len);
    s_nul[s_len] = '\0';

    char* err = NULL;
    const double num = strtod(s_nul, &err);

    if (s_len > 0 && *err != '\0') {
        VM_ERROR(vm, get_location(vm), "Cannot convert %s to number: %s",
                 value_to_str_debug(*v), strerror(errno));
    }
    *ret = NUMBER_VAL(num);

    return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpl $0x1, %edx
jne 0x520b
movq %rcx, %r15
movq %rsi, %r14
movl (%rsi), %edi
movq 0x8(%rsi), %rsi
xorl %edx, %edx
callq 0x398e
testb %al, %al
je 0x524b
leaq 0x10(%rsp), %r13
andq $0x0, (%r13)
movq 0x8(%r14), %rax
movq 0x10(%rax), %r12
leaq 0x1(%r12), %rsi
leaq 0x3395(%rip), %rdx      # 0x8533
movq %r13, %rdi
movl $0x176, %ecx            # imm = 0x176
callq 0x367c
movq (%r13), %rdi
movq 0x8(%r14), %rsi
addq $0x18, %rsi
movq %r12, %rdx
callq 0x1160
movq (%r13), %rax
movb $0x0, (%rax,%r12)
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
movq (%r13), %rdi
callq 0x1080
testq %r12, %r12
je 0x51ed
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x5294
movl $0x2, (%r15)
movsd %xmm0, 0x8(%r15)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl %dl, %ebp
movq 0x6ddb(%rip), %rax      # 0xbff0
movq (%rax), %r14
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %rcx
leaq 0x329e(%rip), %rsi      # 0x84d4
movq %r14, %rdi
movq %r15, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x1140
jmp 0x52ed
movq 0x6d9e(%rip), %rax      # 0xbff0
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r12
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %r13
movl (%r14), %edi
movq 0x8(%r14), %rsi
callq 0x3b97
leaq 0x3290(%rip), %rsi      # 0x850f
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x1140
jmp 0x52ed
movq 0x6d55(%rip), %rax      # 0xbff0
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r12
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %r13
movl (%r14), %edi
movq 0x8(%r14), %rsi
callq 0x3b97
movq %rax, %r14
callq 0x1050
movl (%rax), %edi
callq 0x11f0
leaq 0x3273(%rip), %rsi      # 0x854a
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
movq %r14, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x4cea
pushq $0x2
popq %rax
jmp 0x51fc
// File: /workspace/github_c_makefile_star2_O2/gaultier[P]lox-c/vm.c
// Function: fn_call
static Result fn_call(Vm* vm, ObjFunction* fn, uint8_t arg_count) {
    if (fn->arity != arg_count) {
        VM_ERROR(vm, get_location(vm),
                 "Wrong arity in function call: expected %d, got: %d",
                 fn->arity, arg_count);
    }

    if ((vm->frame_len + 1) == FRAMES_MAX) {
        VM_ERROR(vm, get_location(vm), "Reached maximum number of frames: %d",
                 FRAMES_MAX);
    }

    CallFrame* frame = &vm->frames[vm->frame_len++];

    LOG("frames=%d\n", vm->frame_len);
    frame->fn = fn;

    frame->ip = fn->chunk.opcodes;
    frame->slots = vm->stack_top - arg_count - 1;

    return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
cmpb %dl, 0x10(%rsi)
jne 0x536a
movsbq 0x40618(%rbx), %rax
cmpq $0x3f, %rax
je 0x53ac
leal 0x1(%rax), %ecx
movb %cl, 0x40618(%rbx)
imulq $0x18, %rax, %rax
movq %r14, 0x40018(%rbx,%rax)
movq 0x18(%r14), %rcx
movq %rcx, 0x40020(%rbx,%rax)
movq 0x40000(%rbx), %rcx
movzbl %dl, %edx
shll $0x4, %edx
subq %rdx, %rcx
addq $-0x10, %rcx
movq %rcx, 0x40028(%rbx,%rax)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movzbl %dl, %ebp
movq 0x6c7c(%rip), %rax      # 0xbff0
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r12
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %rcx
movzbl 0x10(%r14), %r8d
leaq 0x31d9(%rip), %rsi      # 0x8573
movq %r15, %rdi
movq %r12, %rdx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x1140
jmp 0x53e5
movq 0x6c3d(%rip), %rax      # 0xbff0
movq (%rax), %r14
movq %rbx, %rdi
callq 0x3f7c
movq (%rax), %r15
movq %rbx, %rdi
callq 0x3f7c
movq 0x8(%rax), %rcx
leaq 0x31db(%rip), %rsi      # 0x85af
pushq $0x40
popq %r8
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x4cea
pushq $0x2
popq %rax
jmp 0x5361
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/main.c
// Function: args_next_fname
char *args_next_fname(bool pop)
{
	char *fname = remaining_fnames ? *remaining_fnames : NULL;
	if(pop && fname)
		remaining_fnames++;
	return fname;
}

// Assembly:
movq 0x11d65(%rip), %rcx     # 0x163c8
testq %rcx, %rcx
je 0x4685
movq (%rcx), %rax
testq %rax, %rax
setne %dl
andb %dil, %dl
cmpb $0x1, %dl
jne 0x4687
addq $0x8, %rcx
movq %rcx, 0x11d44(%rip)     # 0x163c8
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/main.c
// Function: main
int main(int argc, char **argv)
{
	int i;
	unsigned offset = 0;
	enum init_args initargs = INIT_NONE;

	for(i = 1; i < argc; i++){
		if(!strcmp(argv[i], "-O")){
			initargs = INIT_VALL;
		}else if(!strcmp(argv[i], "-o")){
			initargs = INIT_HALL;
		}else if(*argv[i] == '+'){
			char *p = argv[i] + 1;

			while(isdigit(*p))
				p++;

			if(*p == '\0' && sscanf(argv[i]+1, "%u", &offset) == 1){
				/* continue */
				if(offset > 0)
					offset--; /* 1-base -> 0-base */
			}else{
				break;
			}
		}else{
			break;
		}
	}
	remaining_fnames = argv + i;

	ui_init(); /* must be before buffers_init() */

	tabs_init(initargs, offset);

	int r = ui_main();
	ui_term();

	tabs_term();

	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x4(%rsp), %rax
andl $0x0, (%rax)
movq %rsi, %rbx
movslq %edi, %r14
cmpl $0x2, %r14d
pushq $0x1
popq %r13
cmovgel %r14d, %r13d
pushq $0x1
popq %r15
xorl %ebp, %ebp
cmpq %r14, %r15
jge 0x4751
movq (%rbx,%r15,8), %r12
movzbl (%r12), %eax
cmpl $0x2b, %eax
je 0x46f7
cmpl $0x2d, %eax
jne 0x474e
cmpb $0x4f, 0x1(%r12)
jne 0x46e2
cmpb $0x0, 0x2(%r12)
pushq $0x1
popq %rax
je 0x4744
cmpb $0x6f, 0x1(%r12)
jne 0x474e
cmpb $0x0, 0x2(%r12)
pushq $0x2
popq %rax
je 0x4744
jmp 0x474e
callq 0x4540
movq (%rax), %rax
leaq 0x1(%r12), %rcx
movsbq (%rcx), %rdx
incq %rcx
testb $0x8, 0x1(%rax,%rdx,2)
jne 0x4704
testb %dl, %dl
jne 0x474e
incq %r12
movq %r12, %rdi
leaq 0x98e1(%rip), %rsi      # 0xe004
leaq 0x4(%rsp), %rdx
xorl %eax, %eax
callq 0x43d0
cmpl $0x1, %eax
jne 0x474e
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x4742
decl %eax
movl %eax, 0x4(%rsp)
movl %ebp, %eax
incq %r15
movl %eax, %ebp
jmp 0x46b3
movl %r15d, %r13d
movl %r13d, %eax
leaq (%rbx,%rax,8), %rax
movq %rax, 0x11c69(%rip)     # 0x163c8
callq 0x5147
movl 0x4(%rsp), %esi
movl %ebp, %edi
callq 0xd298
callq 0x53d3
movl %eax, %ebx
callq 0x5554
callq 0xd49e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ncurses.c
// Function: nc_init
void nc_init()
{
	static int init = 0;

	if(!init){
		init = 1;

		initscr();
		noecho();
		cbreak();
		raw();
		scrollok(stdscr, 1);

		nonl();
		intrflush(stdscr, 0);

		set_escdelay(0);

		if(has_colors()){
			start_color();
			use_default_colors();

			init_pair(1 + COLOR_BLACK,   COLOR_BLACK,   -1);
			init_pair(1 + COLOR_GREEN,   COLOR_GREEN,   -1);
			init_pair(1 + COLOR_WHITE,   COLOR_WHITE,   -1);
			init_pair(1 + COLOR_RED,     COLOR_RED,     -1);
			init_pair(1 + COLOR_CYAN,    COLOR_CYAN,    -1);
			init_pair(1 + COLOR_MAGENTA, COLOR_MAGENTA, -1);
			init_pair(1 + COLOR_BLUE,    COLOR_BLUE,    -1);
			init_pair(1 + COLOR_YELLOW,  COLOR_YELLOW,  -1);

			init_pair(9 + COLOR_BLACK,   -1, COLOR_BLACK);
			init_pair(9 + COLOR_GREEN,   -1, COLOR_GREEN);
			init_pair(9 + COLOR_WHITE,   -1, COLOR_WHITE);
			init_pair(9 + COLOR_RED,     -1, COLOR_RED);
			init_pair(9 + COLOR_CYAN,    -1, COLOR_CYAN);
			init_pair(9 + COLOR_MAGENTA, -1, COLOR_MAGENTA);
			init_pair(9 + COLOR_BLUE,    -1, COLOR_BLUE);
			init_pair(9 + COLOR_YELLOW,  -1, COLOR_YELLOW);
		}
	}else{
		refresh();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x11c2a(%rip)     # 0x163d0
je 0x47c5
movq 0x117f9(%rip), %rax     # 0x15fa8
movq (%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4230
movb $0x1, 0x11c04(%rip)     # 0x163d0
callq 0x4220
callq 0x4180
callq 0x43b0
callq 0x4330
movq 0x117c1(%rip), %rbx     # 0x15fa8
movq (%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x40b0
callq 0x40d0
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x43a0
xorl %edi, %edi
callq 0x4140
callq 0x4030
testb %al, %al
je 0x490f
callq 0x4260
callq 0x41f0
pushq $0x1
popq %rbp
pushq $-0x1
popq %rbx
movl %ebp, %edi
xorl %esi, %esi
movl %ebx, %edx
callq 0x43c0
pushq $0x3
popq %rdi
pushq $0x2
popq %r15
movl %r15d, %esi
movl %ebx, %edx
callq 0x43c0
pushq $0x8
popq %rdi
pushq $0x7
popq %r14
movl %r14d, %esi
movl %ebx, %edx
callq 0x43c0
movl %r15d, %edi
movl %ebp, %esi
movl %ebx, %edx
callq 0x43c0
pushq $0x6
popq %r12
movl %r14d, %edi
movl %r12d, %esi
movl %ebx, %edx
callq 0x43c0
pushq $0x5
popq %r13
movl %r12d, %edi
movl %r13d, %esi
movl %ebx, %edx
callq 0x43c0
pushq $0x4
popq %rbp
movl %r13d, %edi
movl %ebp, %esi
movl %ebx, %edx
callq 0x43c0
movl %ebp, %edi
pushq $0x3
popq %rsi
movl %ebx, %edx
callq 0x43c0
pushq $0x9
popq %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x43c0
pushq $0xb
popq %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x43c0
pushq $0x10
popq %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x43c0
pushq $0xa
popq %rdi
movl %ebx, %esi
pushq $0x1
popq %rdx
callq 0x43c0
pushq $0xf
popq %rdi
movl %ebx, %esi
movl %r12d, %edx
callq 0x43c0
pushq $0xe
popq %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0x43c0
pushq $0xd
popq %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x43c0
pushq $0xc
popq %rdi
movl %ebx, %esi
pushq $0x3
popq %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ncurses.c
// Function: nc_status
void nc_status(const char *fmt, int right)
{
	scrollok(stdscr, 0);

	int x = 0;
	if(right)
		x = COLS / 2;

	move(LINES - 1, x);
	clrtoeol();
	addstr(fmt);

	scrollok(stdscr, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq 0x11647(%rip), %r15     # 0x15fa8
movq (%r15), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x40b0
testl %r14d, %r14d
je 0x4983
movq 0x11657(%rip), %rax     # 0x15fd0
movl (%rax), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %ebp
movq (%r15), %rdi
movq 0x1164b(%rip), %rax     # 0x15fd8
movl (%rax), %esi
decl %esi
movl %ebp, %edx
callq 0x4460
movq (%r15), %rdi
callq 0x4470
movq (%r15), %rdi
pushq $-0x1
popq %rdx
movq %rbx, %rsi
callq 0x4500
movq (%r15), %rdi
pushq $0x1
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x40b0
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ncurses.c
// Function: nc_charlen
int nc_charlen(int ch)
{
	int l = 1;
	switch(ch){
		case '\r':
			l++; /* ^M */
			break;
		case '\t':
			break;
		default:
			if(!isprint(ch))
				l++; /* ^X */
	}
	return l;
}

// Assembly:
cmpl $0x9, %edi
je 0x4a0a
pushq %rbx
movl %edi, %ebx
cmpl $0xd, %edi
jne 0x4a0e
pushq $0x2
popq %rax
jmp 0x4a28
pushq $0x1
popq %rax
retq
callq 0x4540
movq (%rax), %rax
movslq %ebx, %rcx
movb 0x1(%rax,%rcx,2), %cl
andb $0x40, %cl
xorl %eax, %eax
cmpb $0x1, %cl
adcl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ncurses.c
// Function: nc_getch
int nc_getch(bool mapraw, bool *wasraw)
{
	/* TODO: interrupts, winch */
	bool ctrl_v = false;
	int ch;
restart:
	errno = 0;
	ch = getch();
	if(ch < 0 && errno == EINTR)
		goto restart;

	if(ctrl_v)
		return ch;

	if(ch == CTRL_AND('z')){
		raise(SIGTSTP);
		goto restart;
	}
	if(mapraw){
		if(ch == '\r'){
			ch = '\n';
		}else if(ch == CTRL_AND('v')){
			if(wasraw)
				*wasraw = true;
			ctrl_v = true;
			goto restart;
		}
		if(wasraw)
			*wasraw = false;
	}
	return ch;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
xorl %r13d, %r13d
callq 0x40a0
movq %rax, %r14
movq 0x1155c(%rip), %r12     # 0x15fa8
pushq $0x14
popq %r15
andl $0x0, (%r14)
movq (%r12), %rdi
callq 0x4120
testl %eax, %eax
jns 0x4a67
cmpl $0x4, (%r14)
je 0x4a50
testb $0x1, %r13b
jne 0x4aa3
cmpl $0x1a, %eax
jne 0x4a7c
movl %r15d, %edi
callq 0x4070
jmp 0x4a50
testb %bpl, %bpl
je 0x4aa3
cmpl $0x16, %eax
jne 0x4a93
movb $0x1, %r13b
testq %rbx, %rbx
je 0x4a50
movb $0x1, (%rbx)
jmp 0x4a50
cmpl $0xd, %eax
jne 0x4a9b
pushq $0xa
popq %rax
testq %rbx, %rbx
je 0x4aa3
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ncurses.c
// Function: nc_addch
void nc_addch(char c)
{
	if(c == '\t'){
		c = ' ';
	}else if(c == '\r'){
		/* TODO: all non-printables */
		addch('^');
		addch('M');
		return;
	}

	addch(c & 0xff);
}

// Assembly:
pushq %rax
cmpl $0x9, %edi
je 0x4ad3
cmpl $0xd, %edi
jne 0x4ad8
movq 0x114e4(%rip), %rax     # 0x15fa8
movq (%rax), %rdi
pushq $0x5e
popq %rsi
callq 0x4480
pushq $0x4d
jmp 0x4ad5
pushq $0x20
popq %rsi
jmp 0x4adc
movzbl %dil, %esi
movq 0x114c5(%rip), %rax     # 0x15fa8
movq (%rax), %rdi
popq %rax
jmp 0x4480
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_set_bufmode
void ui_set_bufmode(enum buf_mode m)
{
	window *win = windows_cur();

	if(window_setmode(win, m)){
		ui_err("bad mode 0x%x", m);
	}else{
		ui_redraw();
		ui_cur_changed();
		nc_style(COL_BROWN);
		ui_status("%s", ui_bufmode_str(win->ui_mode));
		nc_style(0);
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
callq 0xd170
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
callq 0xcfbf
testl %eax, %eax
je 0x4ba5
leaq 0x9492(%rip), %rdi      # 0xe028
movl %ebp, %esi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4c34
callq 0x4cc7
callq 0x501c
pushq $0x4
popq %rdi
callq 0x4aec
movl 0x40(%rbx), %eax
leal -0x1(%rax), %ecx
cmpl $0x7, %ecx
ja 0x4bdb
leaq 0x943f(%rip), %rax      # 0xe008
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x9471(%rip), %rsi      # 0xe04a
jmp 0x4c19
cmpl $0x10, %eax
je 0x4c12
cmpl $0x20, %eax
jne 0x4bee
leaq 0x9480(%rip), %rsi      # 0xe06c
jmp 0x4c19
leaq 0x9490(%rip), %rsi      # 0xe085
jmp 0x4c19
leaq 0x9467(%rip), %rsi      # 0xe065
jmp 0x4c19
leaq 0x9457(%rip), %rsi      # 0xe05e
jmp 0x4c19
leaq 0x9441(%rip), %rsi      # 0xe051
jmp 0x4c19
leaq 0x945f(%rip), %rsi      # 0xe078
leaq 0x9e5f(%rip), %rdi      # 0xea7f
xorl %eax, %eax
callq 0x50b5
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4aec
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_cur_changed
void ui_cur_changed()
{
	int need_redraw = 0;
	window *win = windows_cur();
	const int nl = win->screen_coord.h;

	if(win->ui_start.y < 0)
		win->ui_start.y = 0;
	if(win->ui_start.x < 0)
		win->ui_start.x = 0;

	if(win->ui_pos->x < 0)
		win->ui_pos->x = 0;

	if(win->ui_pos->y < 0)
		win->ui_pos->y = 0;

	if(win->ui_pos->y > win->ui_start.y + nl - 1){
		win->ui_start.y = win->ui_pos->y - nl + 1;
		need_redraw = 1;
	}else if(win->ui_pos->y < win->ui_start.y){
		win->ui_start.y = win->ui_pos->y;
		need_redraw = 1;
	}

	if(win->ui_mode & UI_VISUAL_ANY)
		need_redraw = 1;

	if(ui_match_paren(win))
		need_redraw = 1;

	if(need_redraw)
		ui_redraw();

	point_t cursor = window_toscreen(win, win->ui_pos);
	nc_set_yx(cursor.y, cursor.x);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
callq 0xd170
movq %rax, %rbx
movl 0xc(%rax), %eax
testl %eax, %eax
jns 0x5035
andl $0x0, 0xc(%rbx)
xorl %eax, %eax
cmpl $0x0, 0x8(%rbx)
jns 0x503f
andl $0x0, 0x8(%rbx)
movl 0x1c(%rbx), %ecx
movq 0x30(%rbx), %rsi
cmpl $0x0, (%rsi)
jns 0x504e
andl $0x0, (%rsi)
movl 0x4(%rsi), %edx
testl %edx, %edx
jns 0x505e
andl $0x0, 0x4(%rsi)
movl 0xc(%rbx), %eax
xorl %edx, %edx
leal (%rax,%rcx), %esi
cmpl %esi, %edx
jge 0x506d
cmpl %eax, %edx
jl 0x5071
xorl %ebp, %ebp
jmp 0x5077
subl %ecx, %edx
incl %edx
movl %edx, 0xc(%rbx)
movb $0x1, %bpl
movl 0x40(%rbx), %r14d
movq %rbx, %rdi
callq 0x5343
testb %al, %al
jne 0x5092
testb %bpl, %bpl
jne 0x5092
andl $0x38, %r14d
je 0x5097
callq 0x4cc7
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0xcf2b
movq %rax, %rdi
shrq $0x20, %rdi
movl %eax, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x49e5
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_vstatus
static
void ui_vstatus(bool err, const char *fmt, va_list l, int right)
{
	int y, x;

	nc_get_yx(&y, &x);

	if(err)
		nc_style(COL_BG_RED);

	char *message = ustrvprintf(fmt, l);
	/* just truncate in the middle if too long */
	const size_t msglen = strlen(message);
	const int cols = nc_COLS();

	if(msglen >= (unsigned)cols){
		const int dotslen = 3;
		int half = (cols - dotslen) / 2;
		char *replace = umalloc(msglen + 1);

		snprintf(replace, msglen + 1, "%.*s...%s",
				half, message, message + msglen - half);

		free(message);
		message = replace;
	}

	nc_status(message, right);
	if(err)
		nc_style(0);

	nc_set_yx(y, x);

	free(message);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebx
leaq 0x14(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x49c3
testl %ebx, %ebx
je 0x517f
pushq $0x8
popq %rdi
callq 0x4aec
movq %r15, %rdi
movq %r14, %rsi
callq 0x5758
movq %rax, %r14
movq %rax, %rdi
callq 0x4170
movq %rax, %r15
callq 0x4b58
movl %eax, %ecx
cmpq %rcx, %r15
jb 0x51fd
addl $-0x3, %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %r12d
leaq 0x1(%r15), %r13
movq %r13, %rdi
callq 0x5648
movl %ebp, 0xc(%rsp)
movq %rax, %rbp
movq %r14, %rax
addq %r15, %rax
movl %r12d, %ecx
negl %ecx
movslq %ecx, %r9
addq %rax, %r9
leaq 0x8eac(%rip), %rdx      # 0xe087
movq %rbp, %rdi
movq %r13, %rsi
movl %r12d, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x41e0
movq %r14, %rdi
callq 0x4080
movq %rbp, %r14
movl 0xc(%rsp), %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x494d
testb %bl, %bl
je 0x5212
xorl %edi, %edi
callq 0x4aec
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %esi
callq 0x49e5
movq %r14, %rdi
callq 0x4080
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_normal_1
void ui_normal_1(unsigned *repeat, enum io io_mode)
{
	window *win = windows_cur();
	const bool ins = win->ui_mode & UI_INSERT_ANY;

	if(!ins){
		const motion *m = motion_read(repeat, /*map:*/true);
		if(m){
			motion_apply_win(m, *repeat, win);

			/* check if we're now on a paren */
			if(ui_match_paren(win))
				ui_redraw();

			return;
		} /* else no motion */
	} /* else insert */

	ui_handle_next_ch(io_mode, *repeat);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r14
callq 0xd170
testb $0x6, 0x40(%rax)
je 0x529f
movl (%r14), %ebx
leaq 0x8e70(%rip), %rax      # 0xe0c8
movl (%rax), %edx
leaq 0xf4ff(%rip), %r14      # 0x14760
pushq $0x40
popq %r8
pushq $0x38
popq %r9
movl %ebp, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x6890
cmpl $-0x1, %eax
je 0x52d9
cltq
shlq $0x6, %rax
leaq (%r14,%rax), %rdi
addq $0x10, %rdi
movq -0x10(%rdi), %rax
movq -0x8(%rdi), %rcx
movsbl (%rax), %edx
movl %ebx, %esi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmpq *%rcx
movq %rax, %rbx
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x6a57
testq %rax, %rax
je 0x524e
movl (%r14), %esi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xb26b
movq %rbx, %rdi
callq 0x5343
testb %al, %al
je 0x533a
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4cc7
leaq 0xf(%rsp), %rsi
pushq $0x1
popq %rdx
xorl %edi, %edi
callq 0xbbc8
movl %eax, %ebx
testl %eax, %eax
setne %al
cmpb $-0x1, %bl
setne %cl
testb %cl, %al
jne 0x5303
movl $0x2, 0x110d1(%rip)     # 0x163d4
callq 0xd170
testb $0x6, 0x40(%rax)
je 0x5325
movsbl %bl, %esi
movq %rax, %rdi
callq 0xd039
callq 0x4cc7
callq 0x501c
jmp 0x533a
cmpl $0x1b, %ebx
je 0x533a
leaq 0x8d60(%rip), %rdi      # 0xe091
movl %ebx, %esi
xorl %eax, %eax
callq 0x4c34
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_match_paren
static bool ui_match_paren(window *win)
{
	list_t *l = window_current_line(win, false);
	int x = win->ui_pos->x;
	bool redraw = false;

	if(win->ui_paren.x != -1)
		redraw = true;

	win->ui_paren = (point_t){ -1, -1 };

	if(!l || (size_t)x >= l->len_line)
		goto out;

	char ch = l->line[x];
	char other;
	if(!paren_match(ch, &other))
		goto out;

	motion opposite = {
		.func = m_paren,
		.arg.i = other,
		.how = M_EXCLUSIVE
	};
	point_t loc;
	if(!motion_apply_win_dry(&opposite, 0, win, &loc))
		goto out;

	win->ui_paren = loc;
	redraw = true;

out:
	return redraw;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
xorl %esi, %esi
callq 0xcef6
movq 0x30(%r14), %rcx
movslq (%rcx), %rcx
cmpl $-0x1, 0x38(%r14)
setne %bl
orl $-0x1, 0x38(%r14)
orl $-0x1, 0x3c(%r14)
testq %rax, %rax
je 0x53c9
cmpq %rcx, 0x8(%rax)
jbe 0x53c9
movq (%rax), %rax
movsbl (%rax,%rcx), %edi
leaq 0x7(%rsp), %rsi
callq 0xb64a
testb %al, %al
je 0x53c9
leaq 0x5bd6(%rip), %rax      # 0xaf6a
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movsbl 0x7(%rsp), %eax
movl %eax, 0x8(%rdi)
movl $0x2, 0x10(%rdi)
leaq 0x8(%rsp), %rcx
xorl %esi, %esi
movq %r14, %rdx
callq 0xb238
testl %eax, %eax
je 0x53c9
movq 0x8(%rsp), %rax
movq %rax, 0x38(%r14)
movb $0x1, %bl
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_main
int ui_main()
{
	ui_redraw(); /* this first, to frame buf_sel */
	ui_cur_changed(); /* this, in case there's an initial buf offset */

	while(1){
		ui_wait_return();

		switch(ui_run){
			case UI_RUNNING: break;
			case UI_EXIT_0: return 0;
			case UI_EXIT_1: return 1;
		}

		window *win = windows_cur();

		if(win->ui_mode & UI_VISUAL_ANY){
			point_t *alt = window_uipos_alt(win);

			ui_rstatus("%d,%d - %d,%d %dx%d",
					win->ui_pos->y, win->ui_pos->x,
					alt->y, alt->x,
					1 + abs(win->ui_pos->x - alt->x),
					1 + abs(win->ui_pos->y - alt->y));
		}

		const enum io io_mode = bufmode_to_iomap(win->ui_mode);

		unsigned repeat = 0;
		ui_normal_1(&repeat, io_mode | IO_MAPRAW);
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
callq 0x4cc7
callq 0x501c
leaq 0x14(%rsp), %rbx
callq 0x547e
movl 0x10fe0(%rip), %eax     # 0x163d4
cmpl $0x1, %eax
je 0x5474
cmpl $0x2, %eax
je 0x546f
callq 0xd170
movl 0x40(%rax), %edi
testb $0x38, %dil
je 0x5453
movq %rax, %r14
movq %rax, %rdi
callq 0xcee5
movq 0x30(%r14), %rcx
movl (%rcx), %edx
movl 0x4(%rcx), %esi
movl (%rax), %r8d
movl 0x4(%rax), %ecx
movl %edx, %eax
subl %r8d, %eax
movl %eax, %r9d
negl %r9d
cmovsl %eax, %r9d
incl %r9d
movl %esi, %eax
subl %ecx, %eax
movl %eax, %edi
negl %edi
cmovsl %eax, %edi
incl %edi
movl %edi, (%rsp)
xorl %eax, %eax
callq 0x54c0
movl 0x40(%r14), %edi
callq 0xbbb0
andl $0x0, 0x14(%rsp)
orl $0x10, %eax
movq %rbx, %rdi
movl %eax, %esi
callq 0x5236
jmp 0x53e9
pushq $0x1
popq %rax
jmp 0x5476
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_wait_return
void ui_wait_return(void)
{
	if(!want_return)
		return;

	want_return = false;

	bool raw;
	int ch = io_getch(IO_NOMAP, &raw, true);
	(void)raw; /* pushed straight back */
	if(!isnewline(ch))
		io_ungetch(ch, false);

	ui_redraw();
	ui_cur_changed();
}

// Assembly:
cmpb $0x1, 0x10f53(%rip)     # 0x163d8
jne 0x54bf
pushq %rax
movb $0x0, 0x10f49(%rip)     # 0x163d8
leaq 0x7(%rsp), %rsi
pushq $0x1
popq %rdi
movl %edi, %edx
callq 0xbbc8
cmpl $0xa, %eax
je 0x54b1
cmpl $0xd, %eax
je 0x54b1
movl %eax, %edi
xorl %esi, %esi
callq 0xbcd8
callq 0x4cc7
callq 0x501c
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/ui.c
// Function: ui_print
void ui_print(const char *s, size_t n)
{
	nc_set_yx(nc_LINES() - 1, 0);
	while(n --> 0)
		nc_addch(*s++);
	nc_addch('\n');
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4b4e
leal -0x1(%rax), %edi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x49e5
cmpq %r15, %rbx
je 0x5632
movsbl (%r14,%r15), %edi
callq 0x4ab2
incq %r15
jmp 0x561e
pushq $0xa
popq %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4ab2
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/mem.c
// Function: umalloc
void *umalloc(size_t l)
{
	void *p = malloc(l);
	if(!p)
		abort();
	memset(p, 0, l);
	return p;
}

// Assembly:
pushq %rax
movq %rdi, %rsi
pushq $0x1
popq %rdi
callq 0x42d0
testq %rax, %rax
je 0x565b
popq %rcx
retq
callq 0x4090
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/mem.c
// Function: urealloc
void *urealloc(void *p, size_t l)
{
	void *r = realloc(p, l);
	if(!r)
		abort();
	return r;
}

// Assembly:
pushq %rax
callq 0x43e0
testq %rax, %rax
je 0x566d
popq %rcx
retq
callq 0x4090
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/mem.c
// Function: ustrdup_len
char *ustrdup_len(const char *s, size_t len)
{
	char *r = umalloc(len + 1);
	memcpy(r, s, len);
	r[len] = '\0';
	return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1(%rsi), %rdi
callq 0x5648
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4360
movb $0x0, (%r15,%rbx)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/mem.c
// Function: join
char *join(const char *sep, char **vec, int n)
{
	const int len_sep = strlen(sep);
	int len = 1;

	for(int i = 0; i < n; i++)
		len += len_sep + strlen(vec[i]);

	char *p, *r = p = umalloc(len);
	const char *sep_actual = "";

	for(int i = 0; i < n; i++){
		p += sprintf(p, "%s%s", sep_actual, vec[i]);
		sep_actual = sep;
	}

	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
callq 0x4170
movq %rax, %r12
xorl %r13d, %r13d
testl %ebx, %ebx
cmovlel %r13d, %ebx
pushq $0x1
popq %rbp
cmpq %r13, %rbx
je 0x5702
movq (%r14,%r13,8), %rdi
callq 0x4170
addl %r12d, %ebp
addl %eax, %ebp
incq %r13
jmp 0x56ea
movslq %ebp, %rdi
callq 0x5648
movq %rax, %rbp
leaq 0x9035(%rip), %rdx      # 0xe749
leaq 0x898f(%rip), %r13      # 0xe0aa
xorl %r12d, %r12d
movq %rax, (%rsp)
cmpq %r12, %rbx
je 0x5745
movq (%r14,%r12,8), %rcx
movq %rbp, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x44a0
cltq
addq %rax, %rbp
incq %r12
movq %r15, %rdx
jmp 0x5722
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/mem.c
// Function: ustrvprintf
char *ustrvprintf(const char *fmt, va_list l)
{
	char *buf = NULL;
	int len = 8, ret;

	do{
		va_list lcp;

		len *= 2;
		buf = urealloc(buf, len);

		va_copy(lcp, l);
		ret = vsnprintf(buf, len, fmt, lcp);
		va_end(lcp);

	}while(ret >= len);

	return buf;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x8
popq %rbp
xorl %r12d, %r12d
movq %rsp, %r15
addl %ebp, %ebp
movslq %ebp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x5660
movq %rax, %r12
movups (%rbx), %xmm0
movaps %xmm0, (%rsp)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4100
cmpl %r13d, %eax
jge 0x5775
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq