// File: /workspace/github_c_makefile_star2_O3/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 0x2174(%rip), %rdi      # 0xbf8c
xorl %eax, %eax
callq 0x20b0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4baf
movl %eax, %ebp
movq 0x8(%r14), %rax
movslq %ebx, %r15
movzbl (%rax,%r15), %r12d
testl %r15d, %r15d
jle 0x9e5b
leal -0x1(%rbx), %esi
movq %r14, %rdi
callq 0x4baf
cmpl %eax, %ebp
jne 0x9e5b
leaq 0x213f(%rip), %rdi      # 0xbf91
xorl %eax, %eax
callq 0x20b0
jmp 0x9e6b
leaq 0x2359(%rip), %rdi      # 0xc1bb
movl %ebp, %esi
xorl %eax, %eax
callq 0x20b0
cmpl $0x35, %r12d
ja 0xa2b9
movl %r12d, %eax
leaq 0x2035(%rip), %rcx      # 0xbeb4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2108(%rip), %rdi      # 0xbf97
jmp 0xa2a7
leaq 0x2272(%rip), %rdi      # 0xc10d
jmp 0xa2a7
leaq 0x221c(%rip), %rdi      # 0xc0c3
jmp 0xa2a7
leaq 0x21e1(%rip), %rdi      # 0xc094
jmp 0xa2a7
leaq 0x2265(%rip), %rdi      # 0xc124
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x22c4(%rip), %rdi      # 0xc199
leaq 0x2205(%rip), %rsi      # 0xc0e1
jmp 0xa282
leaq 0x2197(%rip), %rdi      # 0xc07f
jmp 0xa2a7
leaq 0x2199(%rip), %rdi      # 0xc08d
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x228f(%rip), %rdi      # 0xc199
leaq 0x212c(%rip), %rsi      # 0xc03d
jmp 0xa282
movq %r14, %rdi
movl %ebx, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa322
leaq 0x20c3(%rip), %rdi      # 0xbff2
jmp 0xa2a7
leaq 0x2194(%rip), %rdi      # 0xc0cf
jmp 0xa2a7
leaq 0x20a7(%rip), %rdi      # 0xbfee
jmp 0xa2a7
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 0x2237(%rip), %rdi      # 0xc1a4
leaq 0x20fd(%rip), %rsi      # 0xc071
jmp 0xa183
leaq 0x2174(%rip), %rdi      # 0xc0f4
jmp 0xa037
leaq 0x2056(%rip), %rdi      # 0xbfe2
jmp 0xa2a7
leaq 0x216d(%rip), %rdi      # 0xc105
jmp 0xa2a7
leaq 0x201c(%rip), %rdi      # 0xbfc0
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x21df(%rip), %rdi      # 0xc199
leaq 0x20e9(%rip), %rsi      # 0xc0aa
jmp 0xa282
leaq 0x2019(%rip), %rdi      # 0xbfe6
jmp 0xa2a7
leaq 0x2001(%rip), %rdi      # 0xbfda
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x21aa(%rip), %rdi      # 0xc199
leaq 0x2033(%rip), %rsi      # 0xc029
jmp 0xa282
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x218d(%rip), %rdi      # 0xc199
leaq 0x200b(%rip), %rsi      # 0xc01e
jmp 0xa282
leaq 0x1f8d(%rip), %rdi      # 0xbfac
jmp 0xa2a7
leaq 0x1fc8(%rip), %rdi      # 0xbff3
jmp 0xa2a7
leaq 0x1f7e(%rip), %rdi      # 0xbfb5
movq %r14, %rsi
movl %ebx, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa2d8
leaq 0x1f81(%rip), %rdi      # 0xbfd1
jmp 0xa2a7
leaq 0x1f45(%rip), %rdi      # 0xbfa1
jmp 0xa2a7
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
leal 0x3(%rbx), %ebp
movzwl %ax, %eax
negl %eax
leal (%rbx,%rax), %ecx
addl $0x3, %ecx
leaq 0x2120(%rip), %rdi      # 0xc1a4
leaq 0x1fd3(%rip), %rsi      # 0xc05e
jmp 0xa183
leaq 0x1f5f(%rip), %rdi      # 0xbff6
jmp 0xa2a7
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %edx
leaq 0x20e5(%rip), %rdi      # 0xc199
leaq 0x1ff5(%rip), %rsi      # 0xc0b0
jmp 0xa1db
leaq 0x1f39(%rip), %rdi      # 0xc000
jmp 0xa2a7
leaq 0x1ef4(%rip), %rdi      # 0xbfc7
jmp 0xa2a7
leaq 0x1f25(%rip), %rdi      # 0xc004
jmp 0xa2a7
leaq 0x1eff(%rip), %rdi      # 0xbfea
jmp 0xa2a7
leaq 0x1ed6(%rip), %rdi      # 0xbfcd
jmp 0xa2a7
leaq 0x1ef6(%rip), %rdi      # 0xbff9
jmp 0xa2a7
leaq 0x1ecf(%rip), %rdi      # 0xbfde
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x2074(%rip), %rdi      # 0xc199
leaq 0x1ea9(%rip), %rsi      # 0xbfd5
jmp 0xa282
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 0x2052(%rip), %rdi      # 0xc1a4
leaq 0x1f01(%rip), %rsi      # 0xc05a
jmp 0xa183
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 0x2028(%rip), %rdi      # 0xc1a4
leaq 0x1ee4(%rip), %rsi      # 0xc067
movl %ebx, %edx
xorl %eax, %eax
callq 0x20b0
movl %ebp, %ebx
jmp 0xa2ae
leaq 0x1f39(%rip), %rdi      # 0xc0d3
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1fe9(%rip), %rdi      # 0xc199
leaq 0x1e51(%rip), %rsi      # 0xc008
jmp 0xa282
movq 0x8(%r14), %rax
movzwl 0x1(%rax,%r15), %eax
rolw $0x8, %ax
movzwl %ax, %edx
leaq 0x1fc5(%rip), %rdi      # 0xc199
leaq 0x1ec6(%rip), %rsi      # 0xc0a1
xorl %eax, %eax
callq 0x20b0
addl $0x3, %ebx
jmp 0xa2ae
leaq 0x1e0c(%rip), %rdi      # 0xbffd
jmp 0xa2a7
leaq 0x1eba(%rip), %rdi      # 0xc0b7
jmp 0xa2a7
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1f86(%rip), %rdi      # 0xc199
leaq 0x1df9(%rip), %rsi      # 0xc013
jmp 0xa282
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1f6c(%rip), %rdi      # 0xc199
leaq 0x1e15(%rip), %rsi      # 0xc049
jmp 0xa282
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1f52(%rip), %rdi      # 0xc199
leaq 0x1e07(%rip), %rsi      # 0xc055
jmp 0xa282
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1f38(%rip), %rdi      # 0xc199
leaq 0x1e31(%rip), %rsi      # 0xc099
jmp 0xa282
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r15), %edx
leaq 0x1f1e(%rip), %rdi      # 0xc199
leaq 0x1db1(%rip), %rsi      # 0xc033
xorl %eax, %eax
callq 0x20b0
addl $0x2, %ebx
jmp 0xa2ae
leaq 0x1e88(%rip), %rdi      # 0xc11d
jmp 0xa2a7
leaq 0x1e39(%rip), %rdi      # 0xc0d7
jmp 0xa2a7
leaq 0x1e6f(%rip), %rdi      # 0xc116
callq 0x2060
incl %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e69(%rip), %rdi      # 0xc129
leaq 0x1e7e(%rip), %rsi      # 0xc145
leaq 0x1e83(%rip), %rcx      # 0xc151
movl $0xf2, %edx
callq 0x20e0