// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x23e9(%rip), %rdi      # 0x9f90
xorl %eax, %eax
callq 0x20b0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4a2e
movl %eax, %ebp
movq 0x8(%r14), %rax
movslq %ebx, %r12
movzbl (%rax,%r12), %r15d
testl %r12d, %r12d
jle 0x7bea
leal -0x1(%rbx), %esi
movq %r14, %rdi
callq 0x4a2e
cmpl %eax, %ebp
jne 0x7bea
leaq 0x23b4(%rip), %rdi      # 0x9f95
xorl %eax, %eax
callq 0x20b0
jmp 0x7bfa
leaq 0x25ce(%rip), %rdi      # 0xa1bf
movl %ebp, %esi
xorl %eax, %eax
callq 0x20b0
cmpl $0x35, %r15d
ja 0x7f67
movl %r15d, %eax
leaq 0x22aa(%rip), %rcx      # 0x9eb8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x237d(%rip), %rdi      # 0x9f9b
jmp 0x7f4f
leaq 0x24e7(%rip), %rdi      # 0xa111
jmp 0x7f4f
leaq 0x2491(%rip), %rdi      # 0xa0c7
jmp 0x7f4f
leaq 0x2456(%rip), %rdi      # 0xa098
jmp 0x7f4f
leaq 0x24da(%rip), %rdi      # 0xa128
jmp 0x7f4f
leaq 0x248b(%rip), %rdi      # 0xa0e5
jmp 0x7f1e
leaq 0x241d(%rip), %rdi      # 0xa083
jmp 0x7f4f
leaq 0x241f(%rip), %rdi      # 0xa091
jmp 0x7f4f
leaq 0x23c3(%rip), %rdi      # 0xa041
jmp 0x7f1e
movq 0x8(%r14), %rax
movzbl 0x1(%rax,%r12), %edx
movq 0x20(%r14,%rdx,8), %r15
leaq 0x2520(%rip), %rdi      # 0xa1b9
leaq 0x2524(%rip), %rsi      # 0xa1c4
xorl %eax, %eax
callq 0x20b0
movq %r15, %rdi
callq 0x56a8
pushq $0xa
popq %rdi
callq 0x2040
movabsq $0x3ffffffffffff, %r13  # imm = 0x3FFFFFFFFFFFF
andq %r15, %r13
addq $0x3, %r12
addl $0x2, %ebx
leaq 0x24fa(%rip), %r15      # 0xa1cc
xorl %ebp, %ebp
cmpl 0x1c(%r13), %ebp
jge 0x7f56
movq 0x8(%r14), %rax
addq %r12, %rax
cmpb $0x0, -0x1(%rax,%rbp,2)
movzbl (%rax,%rbp,2), %ecx
leaq 0x24fd(%rip), %rdx      # 0xa1f2
leaq 0x24fc(%rip), %rax      # 0xa1f8
cmoveq %rax, %rdx
movq %r15, %rdi
movl %ebx, %esi
xorl %eax, %eax
callq 0x20b0
incq %rbp
addl $0x2, %ebx
jmp 0x7cd4
leaq 0x22db(%rip), %rdi      # 0x9ff6
jmp 0x7f4f
leaq 0x23ac(%rip), %rdi      # 0xa0d3
jmp 0x7f4f
leaq 0x22bf(%rip), %rdi      # 0x9ff2
jmp 0x7f4f
leaq 0x2336(%rip), %rdi      # 0xa075
jmp 0x7e92
leaq 0x23ad(%rip), %rdi      # 0xa0f8
jmp 0x7dcc
leaq 0x2292(%rip), %rdi      # 0x9fe6
jmp 0x7f4f
leaq 0x23a9(%rip), %rdi      # 0xa109
jmp 0x7f4f
leaq 0x2258(%rip), %rdi      # 0x9fc4
jmp 0x7f4f
leaq 0x2336(%rip), %rdi      # 0xa0ae
jmp 0x7f1e
leaq 0x2266(%rip), %rdi      # 0x9fea
jmp 0x7f4f
leaq 0x224e(%rip), %rdi      # 0x9fde
jmp 0x7f4f
leaq 0x2291(%rip), %rdi      # 0xa02d
jmp 0x7f1e
leaq 0x227a(%rip), %rdi      # 0xa022
jmp 0x7f1e
leaq 0x21fc(%rip), %rdi      # 0x9fb0
jmp 0x7f4f
leaq 0x2237(%rip), %rdi      # 0x9ff7
jmp 0x7f4f
leaq 0x21ed(%rip), %rdi      # 0x9fb9
movq %r14, %rsi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7f86
leaq 0x21ea(%rip), %rdi      # 0x9fd5
jmp 0x7f4f
leaq 0x21ae(%rip), %rdi      # 0x9fa5
jmp 0x7f4f
leaq 0x225f(%rip), %rdi      # 0xa062
pushq $-0x1
jmp 0x7e94
leaq 0x21e9(%rip), %rdi      # 0x9ffa
jmp 0x7f4f
leaq 0x2297(%rip), %rdi      # 0xa0b4
jmp 0x7ec9
leaq 0x21db(%rip), %rdi      # 0xa004
jmp 0x7f4f
leaq 0x2196(%rip), %rdi      # 0x9fcb
jmp 0x7f4f
leaq 0x21c7(%rip), %rdi      # 0xa008
jmp 0x7f4f
leaq 0x21a1(%rip), %rdi      # 0x9fee
jmp 0x7f4f
leaq 0x2178(%rip), %rdi      # 0x9fd1
jmp 0x7f4f
leaq 0x2198(%rip), %rdi      # 0x9ffd
jmp 0x7f4f
leaq 0x2171(%rip), %rdi      # 0x9fe2
jmp 0x7f4f
leaq 0x215c(%rip), %rdi      # 0x9fd9
jmp 0x7f1e
leaq 0x21d5(%rip), %rdi      # 0xa05e
jmp 0x7e92
leaq 0x21d9(%rip), %rdi      # 0xa06b
pushq $0x1
popq %rdx
movq %r14, %rsi
movl %ebx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7ff6
leaq 0x2223(%rip), %rdi      # 0xa0d7
jmp 0x7f4f
leaq 0x214c(%rip), %rdi      # 0xa00c
jmp 0x7f1e
leaq 0x21dc(%rip), %rdi      # 0xa0a5
movq %r14, %rsi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8033
leaq 0x2119(%rip), %rdi      # 0xa001
jmp 0x7f4f
leaq 0x21ca(%rip), %rdi      # 0xa0bb
jmp 0x7f4f
leaq 0x211d(%rip), %rdi      # 0xa017
jmp 0x7f1e
leaq 0x214a(%rip), %rdi      # 0xa04d
jmp 0x7f1e
leaq 0x214d(%rip), %rdi      # 0xa059
jmp 0x7f1e
leaq 0x2188(%rip), %rdi      # 0xa09d
jmp 0x7f1e
leaq 0x2119(%rip), %rdi      # 0xa037
movq %r14, %rsi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7fce
leaq 0x21e4(%rip), %rdi      # 0xa121
jmp 0x7f4f
leaq 0x2195(%rip), %rdi      # 0xa0db
jmp 0x7f4f
leaq 0x21cb(%rip), %rdi      # 0xa11a
callq 0x2060
incl %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x21bf(%rip), %rdi      # 0xa12d
leaq 0x21d4(%rip), %rsi      # 0xa149
leaq 0x21d9(%rip), %rcx      # 0xa155
movl $0xf2, %edx
callq 0x20e0