// File: /workspace/github_c_makefile_star2_O1/mahrr[P]raven/src/debug.c
// Function: disassemble_instruction
int disassemble_instruction(Chunk *chunk, int offset) {
    printf("%04d", offset);

    int line = chunk_decode_line(chunk, offset);
    int instruction = chunk->opcodes[offset];

    if (offset > 0 && line == chunk_decode_line(chunk, offset - 1)) {
        printf("   | ");
    } else {
        printf("%4d ", line);
    }

    switch (instruction) {
    case OP_PUSH_TRUE:
        return basic_instruction("PUSH_TRUE", offset);

    case OP_PUSH_FALSE:
        return basic_instruction("PUSH_FALSE", offset);

    case OP_PUSH_NIL:
        return basic_instruction("PUSH_NIL", offset);

    case OP_PUSH_CONST:
        return const_instruction("PUSH_CONST", chunk, offset);

    case OP_PUSH_X:
        return basic_instruction("PUSH_X", offset);

    case OP_POP_X:
        return basic_instruction("POP_X", offset);

    case OP_DUP:
        return basic_instruction("DUP", offset);

    case OP_POP:
        return basic_instruction("POP", offset);

    case OP_POPN:
        return byte_instruction("POPN", chunk, offset);

    case OP_ADD:
        return basic_instruction("ADD", offset);

    case OP_SUB:
        return basic_instruction("SUB", offset);

    case OP_MUL:
        return basic_instruction("MUL", offset);

    case OP_DIV:
        return basic_instruction("DIV", offset);

    case OP_MOD:
        return basic_instruction("MOD", offset);

    case OP_NEG:
        return basic_instruction("NEG", offset);

    case OP_EQ:
        return basic_instruction("EQ", offset);

    case OP_NEQ:
        return basic_instruction("NEQ", offset);

    case OP_LT:
        return basic_instruction("LT", offset);

    case OP_LTQ:
        return basic_instruction("LTQ", offset);

    case OP_GT:
        return basic_instruction("GT", offset);

    case OP_GTQ:
        return basic_instruction("GTQ", offset);

    case OP_NOT:
        return basic_instruction("NOT", offset);

    case OP_DEF_GLOBAL:
        return byte_instruction("DEF_GLOBAL", chunk, offset);

    case OP_SET_GLOBAL:
        return byte_instruction("SET_GLOBAL", chunk, offset);

    case OP_GET_GLOBAL:
        return byte_instruction("GET_GLOBAL", chunk, offset);

    case OP_SET_LOCAL:
        return byte_instruction("SET_LOCAL", chunk, offset);

    case OP_GET_LOCAL:
        return byte_instruction("GET_LOCAL", chunk, offset);

    case OP_SET_UPVALUE:
        return byte_instruction("SET_UPVALUE", chunk, offset);

    case OP_GET_UPVALUE:
        return byte_instruction("GET_UPVALUE", chunk, offset);

    case OP_CALL:
        return byte_instruction("CALL", chunk, offset);

    case OP_JMP:
        return jump_instruction("JMP", chunk, 1, offset);

    case OP_JMP_BACK:
        return jump_instruction("JMP_BACK", chunk, -1, offset);

    case OP_JMP_FALSE:
        return jump_instruction("JMP_FALSE", chunk, 1, offset);

    case OP_JMP_POP_FALSE:
        return jump_instruction("JMP_POP_FALSE", chunk, 1, offset);

    case OP_CLOSURE:
        return closure_instruction(chunk, offset);

    case OP_CLOSE_UPVALUE:
        return basic_instruction("CLOSE_UPVALUE", offset);

    case OP_CONCAT:
        return basic_instruction("CONCAT", offset);

    case OP_CONS:
        return basic_instruction("CONS", offset);

    case OP_ARRAY_8:
        return byte_instruction("ARRAY_8", chunk, offset);

    case OP_ARRAY_16:
        return short_instruction("ARRAY_16", chunk, offset);

    case OP_MAP_8:
        return byte_instruction("MAP_8", chunk, offset);

    case OP_MAP_16:
        return short_instruction("MAP_16", chunk, offset);

    case OP_SET_ELEMENT:
        return basic_instruction("SET_ELEMENT", offset);

    case OP_GET_ELEMENT:
        return basic_instruction("GET_ELEMENT", offset);

    case OP_CAR:
        return basic_instruction("CAR", offset);

    case OP_CDR:
        return basic_instruction("CDR", offset);

    case OP_ARRAY_LEN:
        return basic_instruction("ARRAY_LEN", offset);

    case OP_ARRAY_PUSH_ELEMENT:
        return byte_instruction("ARRAY_PUSH_ELEMENT", chunk, offset);

    case OP_MAP_PUSH_ELEMENT:
        return const_instruction("MAP_PUSH_ELEMENT", chunk, offset);

    case OP_IS_PAIR:
        return basic_instruction("IS_PAIR", offset);

    case OP_IS_ARRAY:
        return basic_instruction("IS_ARRAY", offset);

    case OP_IS_MAP:
        return basic_instruction("IS_MAP", offset);

    case OP_RETURN:
        return basic_instruction("RETURN", offset);

    case OP_EXIT:
        return basic_instruction("EXIT", offset);
    }

    assert(!"invalid instruction type");
    return 0; // For Warnings
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x1d98(%rip), %rdi      # 0xbf4c
xorl %eax, %eax
callq 0x20b0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4dcf
movl %eax, %ebp
movq 0x8(%r14), %rax
movslq %ebx, %r15
movzbl (%rax,%r15), %r12d
testl %r15d, %r15d
jle 0xa1f7
leal -0x1(%rbx), %esi
movq %r14, %rdi
callq 0x4dcf
cmpl %eax, %ebp
jne 0xa1f7
leaq 0x1d63(%rip), %rdi      # 0xbf51
xorl %eax, %eax
callq 0x20b0
jmp 0xa207
leaq 0x1f7d(%rip), %rdi      # 0xc17b
movl %ebp, %esi
xorl %eax, %eax
callq 0x20b0
cmpl $0x35, %r12d
ja 0xa644
movl %r12d, %eax
leaq 0x1c59(%rip), %rcx      # 0xbe74
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1d2c(%rip), %rdi      # 0xbf57
jmp 0xa632
leaq 0x1e96(%rip), %rdi      # 0xc0cd
jmp 0xa632
leaq 0x1e40(%rip), %rdi      # 0xc083
jmp 0xa632
leaq 0x1e05(%rip), %rdi      # 0xc054
jmp 0xa632
leaq 0x1e89(%rip), %rdi      # 0xc0e4
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1ee8(%rip), %rdi      # 0xc159
leaq 0x1e29(%rip), %rsi      # 0xc0a1
jmp 0xa60d
leaq 0x1dbb(%rip), %rdi      # 0xc03f
jmp 0xa632
leaq 0x1dbd(%rip), %rdi      # 0xc04d
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1eb3(%rip), %rdi      # 0xc159
leaq 0x1d50(%rip), %rsi      # 0xbffd
jmp 0xa60d
movq %r14, %rdi
movl %ebx, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa6ea
leaq 0x1ce7(%rip), %rdi      # 0xbfb2
jmp 0xa632
leaq 0x1db8(%rip), %rdi      # 0xc08f
jmp 0xa632
leaq 0x1ccb(%rip), %rdi      # 0xbfae
jmp 0xa632
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %eax
leal 0x3(%rbx), %ebp
leal (%rax,%rbx), %ecx
addl $0x3, %ecx
leaq 0x1e5b(%rip), %rdi      # 0xc164
leaq 0x1d21(%rip), %rsi      # 0xc031
jmp 0xa50e
leaq 0x1d98(%rip), %rdi      # 0xc0b4
jmp 0xa3d3
leaq 0x1c7a(%rip), %rdi      # 0xbfa2
jmp 0xa632
leaq 0x1d91(%rip), %rdi      # 0xc0c5
jmp 0xa632
leaq 0x1c40(%rip), %rdi      # 0xbf80
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1e03(%rip), %rdi      # 0xc159
leaq 0x1d0d(%rip), %rsi      # 0xc06a
jmp 0xa60d
leaq 0x1c3d(%rip), %rdi      # 0xbfa6
jmp 0xa632
leaq 0x1c25(%rip), %rdi      # 0xbf9a
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1dce(%rip), %rdi      # 0xc159
leaq 0x1c57(%rip), %rsi      # 0xbfe9
jmp 0xa60d
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1db1(%rip), %rdi      # 0xc159
leaq 0x1c2f(%rip), %rsi      # 0xbfde
jmp 0xa60d
leaq 0x1bb1(%rip), %rdi      # 0xbf6c
jmp 0xa632
leaq 0x1bec(%rip), %rdi      # 0xbfb3
jmp 0xa632
leaq 0x1ba2(%rip), %rdi      # 0xbf75
movq %r14, %rsi
movl %ebx, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa663
leaq 0x1ba5(%rip), %rdi      # 0xbf91
jmp 0xa632
leaq 0x1b69(%rip), %rdi      # 0xbf61
jmp 0xa632
leaq 0x1c1a(%rip), %rdi      # 0xc01e
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %ebx, %ecx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa6ad
leaq 0x1b94(%rip), %rdi      # 0xbfb6
jmp 0xa632
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %edx
leaq 0x1d1a(%rip), %rdi      # 0xc159
leaq 0x1c2a(%rip), %rsi      # 0xc070
jmp 0xa566
leaq 0x1b6e(%rip), %rdi      # 0xbfc0
jmp 0xa632
leaq 0x1b29(%rip), %rdi      # 0xbf87
jmp 0xa632
leaq 0x1b5a(%rip), %rdi      # 0xbfc4
jmp 0xa632
leaq 0x1b34(%rip), %rdi      # 0xbfaa
jmp 0xa632
leaq 0x1b0b(%rip), %rdi      # 0xbf8d
jmp 0xa632
leaq 0x1b2b(%rip), %rdi      # 0xbfb9
jmp 0xa632
leaq 0x1b04(%rip), %rdi      # 0xbf9e
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1ca9(%rip), %rdi      # 0xc159
leaq 0x1ade(%rip), %rsi      # 0xbf95
jmp 0xa60d
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %eax
leal 0x3(%rbx), %ebp
leal (%rax,%rbx), %ecx
addl $0x3, %ecx
leaq 0x1c87(%rip), %rdi      # 0xc164
leaq 0x1b36(%rip), %rsi      # 0xc01a
jmp 0xa50e
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %eax
leal 0x3(%rbx), %ebp
leal (%rax,%rbx), %ecx
addl $0x3, %ecx
leaq 0x1c5d(%rip), %rdi      # 0xc164
leaq 0x1b19(%rip), %rsi      # 0xc027
movl %ebx, %edx
xorl %eax, %eax
callq 0x20b0
movl %ebp, %ebx
jmp 0xa639
leaq 0x1b6e(%rip), %rdi      # 0xc093
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1c1e(%rip), %rdi      # 0xc159
leaq 0x1a86(%rip), %rsi      # 0xbfc8
jmp 0xa60d
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %edx
leaq 0x1bfa(%rip), %rdi      # 0xc159
leaq 0x1afb(%rip), %rsi      # 0xc061
xorl %eax, %eax
callq 0x20b0
addl $0x3, %ebx
jmp 0xa639
leaq 0x1a41(%rip), %rdi      # 0xbfbd
jmp 0xa632
leaq 0x1aef(%rip), %rdi      # 0xc077
jmp 0xa632
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1bbb(%rip), %rdi      # 0xc159
leaq 0x1a2e(%rip), %rsi      # 0xbfd3
jmp 0xa60d
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1ba1(%rip), %rdi      # 0xc159
leaq 0x1a4a(%rip), %rsi      # 0xc009
jmp 0xa60d
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1b87(%rip), %rdi      # 0xc159
leaq 0x1a3c(%rip), %rsi      # 0xc015
jmp 0xa60d
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1b6d(%rip), %rdi      # 0xc159
leaq 0x1a66(%rip), %rsi      # 0xc059
jmp 0xa60d
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1b53(%rip), %rdi      # 0xc159
leaq 0x19e6(%rip), %rsi      # 0xbff3
xorl %eax, %eax
callq 0x20b0
addl $0x2, %ebx
jmp 0xa639
leaq 0x1abd(%rip), %rdi      # 0xc0dd
jmp 0xa632
leaq 0x1a6e(%rip), %rdi      # 0xc097
jmp 0xa632
leaq 0x1aa4(%rip), %rdi      # 0xc0d6
callq 0x2060
incl %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a9e(%rip), %rdi      # 0xc0e9
leaq 0x1ab3(%rip), %rsi      # 0xc105
leaq 0x1ab8(%rip), %rcx      # 0xc111
movl $0xf2, %edx
callq 0x20e0