LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::getPointer(dsemu::cpu::ParamType, bool)
byte *getPointer(ParamType pt, bool hlAsRam = true) {
    switch(pt) {
        case A: return &regAF.hi;
        case B: return &regBC.hi; 
        case C: return &regBC.lo; 
        case D: return &regDE.hi; 
        case E: return &regDE.lo; 
        case H: return &regHL.hi; 
        case L: return &regHL.lo;
        case AF: return &regAF.lo;
        case BC: return &regBC.lo;
        case DE: return &regDE.lo;
        case SP: return &regSP.lo;
        case N: {
            //byte t = memory::ram[(regPC + 1)];
            //unsigned int i = 
            return &memory::ram[(regPC + 1)]; 
        } case HL: {
            return hlAsRam ? &memory::ram[getReg16Value(regHL)] : &regHL.lo;
        }
        default:
            break;
    }

    cout << "ERROR BAD POINTER" << endl;
    exit(-1);

    return nullptr;
}

// Assembly:
cmpl $0xe, %edi
ja 0xe99e
leaq 0x9bd0(%rip), %rax      # 0x184f0
movl %edi, %ecx
leaq 0x4973(%rip), %rdx      # 0x1329c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x9bb9(%rip), %rax      # 0x184f2
retq
leaq 0x9bb3(%rip), %rax      # 0x184f4
retq
leaq 0x9bb3(%rip), %rax      # 0x184fc
retq
leaq 0x9bad(%rip), %rax      # 0x184fe
movzwl (%rax), %eax
leaq 0x19c55(%rip), %rcx     # 0x285b0
addq %rcx, %rax
incq %rax
retq
testb %sil, %sil
je 0xe979
leaq 0x9b88(%rip), %rax      # 0x184f6
movzwl (%rax), %eax
addq 0x9640(%rip), %rax      # 0x17fb8
retq
leaq 0x9b76(%rip), %rax      # 0x184f6
retq
leaq 0x9b6e(%rip), %rax      # 0x184f6
jmp 0xe99a
leaq 0x9b63(%rip), %rax      # 0x184f4
jmp 0xe99a
leaq 0x9b58(%rip), %rax      # 0x184f2
incq %rax
retq
pushq %rax
movq 0x962a(%rip), %rdi      # 0x17fd0
leaq 0x4a18(%rip), %rsi      # 0x133c5
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleLDH(dsemu::cpu::OpCode const&)
int handleLDH(const OpCode &op) {
    bool srcIsA = op.params[1] == A;

    if (srcIsA) {
        byte *p = getPointer(op.params[0]);
        //cout << "READING B: " << Int64((uint64_t)p) << endl;
        //cout << "B: " << Byte(*p) << endl;
        
        bus::write(*p | 0xFF00, regAF.hi);
    } else {
        byte *p = getPointer(op.params[1]);
        regAF.hi = bus::read(*p | 0xFF00);
    }
    return 0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movl 0x20(%rdi), %edi
testl %edi, %edi
je 0xe9f8
movl $0x1, %esi
callq 0xe910
movzbl (%rax), %eax
orl $0xff00, %eax           # imm = 0xFF00
movzwl %ax, %edi
callq 0xb94c
leaq 0x9afd(%rip), %rcx      # 0x184f0
movb %al, 0x1(%rcx)
jmp 0xea20
movl 0x1c(%rax), %edi
movl $0x1, %esi
callq 0xe910
movzbl (%rax), %eax
orl $0xff00, %eax           # imm = 0xFF00
leaq 0x9adc(%rip), %rcx      # 0x184f0
movzbl 0x1(%rcx), %esi
movzwl %ax, %edi
callq 0xb9cd
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::getAddrValue(dsemu::cpu::ParamType, short)
ushort getAddrValue(ParamType op, short srcValue) {
    switch(op) {
        case HL: return getReg16Value(regHL);
        case AF: return getReg16Value(regAF);
        case BC: return getReg16Value(regBC);
        case DE: return getReg16Value(regDE);
        case NN: return srcValue;
        case N: return 0xFF00 | srcValue;
        default: 
            cout << "ERROR BAD ADDR VAL: " << endl;
            exit(-1);
            return 0;
    }
}

// Assembly:
addl $-0x7, %edi
cmpl $0x7, %edi
ja 0xea6c
leaq 0x48a5(%rip), %rax      # 0x132d8
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x9aaf(%rip), %rax      # 0x184f2
jmp 0xea66
orl $0xff00, %esi           # imm = 0xFF00
jmp 0xea69
leaq 0x9a9c(%rip), %rax      # 0x184f0
jmp 0xea66
leaq 0x9a97(%rip), %rax      # 0x184f4
jmp 0xea66
leaq 0x9a90(%rip), %rax      # 0x184f6
movzwl (%rax), %esi
movl %esi, %eax
retq
pushq %rax
movq 0x955c(%rip), %rdi      # 0x17fd0
leaq 0x495c(%rip), %rsi      # 0x133d7
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::conditionalJump(unsigned short, dsemu::cpu::OpCode const&, bool&)
int conditionalJump(ushort location, const OpCode &op, bool &didJump) {
    int diff = jumpCycleMap[op.value];

    if (op.mode == ATypeJ) {
        regPC = location;
        didJump = true;
        return 0;
    } else if (op.mode == ATypeJ_C && getFlag(FlagC)) {
        regPC = location;
        didJump = true;
        return diff;
    } else if (op.mode == ATypeJ_NC && !getFlag(FlagC)) {
        regPC = location;
        didJump = true;
        return diff;
    } else if (op.mode == ATypeJ_NZ && !getFlag(FlagZ)) {
        regPC = location;
        didJump = true;
        return diff;
    } else if (op.mode == ATypeJ_Z && getFlag(FlagZ)) {
        regPC = location;
        didJump = true;
        return diff;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
leaq 0x2950f(%rip), %rdi     # 0x38620
callq 0x10a6a
movq %rax, %rcx
movl 0x18(%r14), %edx
xorl %eax, %eax
addl $-0x6, %edx
cmpl $0x4, %edx
ja 0xf183
movb (%rcx), %cl
leaq 0x41e8(%rip), %rsi      # 0x13318
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
xorl %ecx, %ecx
jmp 0xf173
leaq 0x93ac(%rip), %rdx      # 0x184f0
testb $0x10, (%rdx)
jne 0xf173
jmp 0xf183
leaq 0x939e(%rip), %rdx      # 0x184f0
cmpb $0x0, (%rdx)
jns 0xf183
jmp 0xf173
leaq 0x9390(%rip), %rdx      # 0x184f0
testb $0x10, (%rdx)
je 0xf173
jmp 0xf183
leaq 0x9382(%rip), %rdx      # 0x184f0
cmpb $0x0, (%rdx)
js 0xf183
leaq 0x9384(%rip), %rax      # 0x184fe
movw %bp, (%rax)
movb $0x1, (%rbx)
movzbl %cl, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleJumpRelative(dsemu::cpu::OpCode const&)
int handleJumpRelative(const OpCode &op) {
    char b = bus::read(regPC + 1);

    if ((byte)b == 0xfe) {
        cout << "INF LOOP? " << endl;
        sleep(5);
    }

    ushort location = regPC + b;
    bool didJump;

    return conditionalJump(location, op, didJump);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x9365(%rip), %r15      # 0x184fe
movzwl (%r15), %eax
incl %eax
movzwl %ax, %edi
callq 0xb94c
movl %eax, %ebp
cmpb $-0x2, %al
jne 0xf1f9
movq 0x8e1c(%rip), %r14      # 0x17fd0
leaq 0x427c(%rip), %rsi      # 0x13437
movl $0xa, %edx
movq %r14, %rdi
callq 0x3300
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
movl $0x5, %edi
callq 0x3210
movsbl %bpl, %eax
addw (%r15), %ax
movzwl %ax, %edi
leaq 0x7(%rsp), %rdx
movq %rbx, %rsi
callq 0xf0fe
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleJump(dsemu::cpu::OpCode const&)
int handleJump(const OpCode &op) {
    ushort location = 0;
    bool didJump;

    switch(op.params[0]) {
        case NN:
            location = toShort(bus::read(regPC + 1), bus::read(regPC + 2));
            break;
        case HL:
            location = toShort(regHL.lo, regHL.hi);
            break;
        default:
            cout << "ERRO BAD JUMP" << endl;
            exit(-1);

    }

    return conditionalJump(location - op.length, op, didJump);

/*
    if (op.mode == ATypeJ) {
        regPC = location - op.length;
        return 0;
    } else if (op.mode == ATypeJ_C && getFlag(FlagC)) {
        regPC = location - op.length;
        return 4;
    } else if (op.mode == ATypeJ_NC && !getFlag(FlagC)) {
        regPC = location - op.length;
        return 4;
    } else if (op.mode == ATypeJ_NZ && !getFlag(FlagZ)) {
        regPC = location - op.length;
        return 4;
    } else if (op.mode == ATypeJ_Z && getFlag(FlagZ)) {
        regPC = location - op.length;
        return 4;
    }
    return 0;
*/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x1c(%rdi), %eax
cmpl $0x9, %eax
je 0xf26d
cmpl $0xd, %eax
jne 0xf298
leaq 0x92c4(%rip), %r14      # 0x184fe
movzwl (%r14), %edi
incl %edi
movl $0xffff, %r15d          # imm = 0xFFFF
andl %r15d, %edi
callq 0xb94c
movl %eax, %ebp
movzwl (%r14), %edi
addl $0x2, %edi
andl %r15d, %edi
callq 0xb94c
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %bpl, %eax
orl %ecx, %eax
jmp 0xf277
leaq 0x9282(%rip), %rax      # 0x184f6
movzwl (%rax), %eax
movzbl 0x14(%rbx), %ecx
subl %ecx, %eax
movzwl %ax, %edi
leaq 0x7(%rsp), %rdx
movq %rbx, %rsi
callq 0xf0fe
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8d31(%rip), %rdi      # 0x17fd0
leaq 0x419c(%rip), %rsi      # 0x13442
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handlePOP(dsemu::cpu::OpCode const&)
int handlePOP(const OpCode &op) {
    ushort *p = (ushort *)getPointer(op.params[0], false);
    
    ushort s = spop();
    cout << "POPPED VALUE: " << Short(s) << endl;

    if (p == (ushort *)&regAF) {
        *p = s & 0xFFF0;
    } else {
        *p = s;
    }

    if (op.value == 0xF1) {
        //sleep(2);
    }
    
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x1c(%rdi), %edi
xorl %esi, %esi
callq 0xe910
movq %rax, %r14
callq 0xc554
movl %eax, %ebx
movq 0x8c55(%rip), %r15      # 0x17fd0
leaq 0x40ce(%rip), %rsi      # 0x13450
movl $0xe, %edx
movq %r15, %rdi
callq 0x3300
movq (%r15), %rax
movq -0x18(%rax), %rcx
movl 0x18(%r15,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%r15,%rcx)
movq -0x18(%rax), %rcx
leaq (%r15,%rcx), %r12
cmpb $0x0, 0xe1(%r15,%rcx)
jne 0xf3d2
movq %r12, %rdi
movl $0x20, %esi
callq 0x3280
movb $0x1, 0xe1(%r12)
movq (%r15), %rax
movb $0x30, 0xe0(%r12)
movq -0x18(%rax), %rax
movq $0x4, 0x10(%r15,%rax)
movzwl %bx, %esi
movq %r15, %rdi
callq 0x3190
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
cmpq 0x8b92(%rip), %r14      # 0x17fc8
je 0xf43e
movw %bx, (%r14)
jmp 0xf44e
andl $0xfff0, %ebx           # imm = 0xFFF0
leaq 0x90a5(%rip), %rax      # 0x184f0
movw %bx, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handlePUSH(dsemu::cpu::OpCode const&)
int handlePUSH(const OpCode &op) {
    ushort *p = (ushort *)getPointer(op.params[0], false);

    push(*p);

    cout << "PUSHED: " << Short(*p) << endl;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x1c(%rdi), %edi
xorl %esi, %esi
callq 0xe910
movq %rax, %r14
movzwl (%rax), %edi
callq 0xc490
movq 0x8b53(%rip), %rbx      # 0x17fd0
leaq 0x3fdb(%rip), %rsi      # 0x1345f
movl $0x8, %edx
movq %rbx, %rdi
callq 0x3300
movzwl (%r14), %r14d
movq (%rbx), %rax
movq -0x18(%rax), %rcx
movl 0x18(%rbx,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rbx,%rcx)
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r15
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0xf4d4
movq %r15, %rdi
movl $0x20, %esi
callq 0x3280
movb $0x1, 0xe1(%r15)
movq (%rbx), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x4, 0x10(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3190
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleADC(dsemu::cpu::OpCode const&)
int handleADC(const OpCode &op) {
    byte *val = getPointer(op.params[1]);

    if (op.value == 0xCE) {
        byte t = bus::read(regPC + 1);
        unsigned int i = regAF.hi + t + getFlag(FlagC) >= 0x100;
        //setFlags(regAF.hi, t, true, true);
        setFlag(FlagN, false);
        setFlag(FlagH, ((regAF.hi&0xF) + (t&0xF) + getFlag(FlagC)) >= 0x10);
        regAF.hi = regAF.hi + t + getFlag(FlagC);
        setFlag(FlagC, i);
        setFlag(FlagZ, !regAF.hi);

        return  0;
    }

    unsigned int a = regAF.hi + *val + getFlag(FlagC);

    setFlags(regAF.hi, *val, true, true);

    regAF.hi = a & 0xFF;
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rdi), %edi
movl $0x1, %esi
callq 0xe910
cmpb $-0x32, (%rbx)
jne 0xfd7b
leaq 0x880c(%rip), %rax      # 0x184fe
movzwl (%rax), %eax
incl %eax
movzwl %ax, %edi
callq 0xb94c
leaq 0x87ea(%rip), %rcx      # 0x184f0
movzbl 0x1(%rcx), %edx
movzbl %al, %ebx
movzbl (%rcx), %esi
movl %esi, %edi
shrl $0x4, %edi
andl $0x1, %edi
leal (%rdx,%rdi), %eax
addl %ebx, %eax
andb $-0x61, %sil
movl %edx, %r8d
andl $0xf, %r8d
movl %ebx, %r9d
andl $0xf, %r9d
addl %edi, %r8d
addl %r9d, %r8d
leal 0x20(%rsi), %edi
cmpl $0x10, %r8d
movzbl %sil, %esi
movzbl %dil, %edi
cmovbl %esi, %edi
btl $0x4, %edi
adcb %dl, %bl
movl %edi, %edx
andb $-0x51, %dl
orb $0x10, %dil
cmpl $0x100, %eax            # imm = 0x100
movzbl %dil, %eax
movzbl %dl, %edx
cmovael %eax, %edx
movl %edx, %eax
andb $0x3f, %al
orb $-0x80, %dl
testb %bl, %bl
movzbl %dl, %edx
movzbl %al, %eax
cmovel %edx, %eax
movb %al, (%rcx)
jmp 0xfda4
leaq 0x876e(%rip), %rcx      # 0x184f0
movzbl 0x1(%rcx), %edi
movzbl (%rax), %esi
movzbl (%rcx), %eax
btl $0x4, %eax
movl %esi, %ebx
adcb %dil, %bl
movl $0x1, %edx
movl $0x1, %ecx
callq 0xfbcd
leaq 0x8745(%rip), %rax      # 0x184f0
movb %bl, 0x1(%rax)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleADD(dsemu::cpu::OpCode const&)
int handleADD(const OpCode &op) {
    if (op.params[0] == A) {
        byte *p = getPointer(op.params[1]);
        ushort a = regAF.hi + *p;
        setFlags(regAF.hi, *p, true, false);
        regAF.hi = a & 0x00FF;

    } else if (op.params[0] == SP) {
        char e = bus::read(regPC + 1);
        setFlags(getReg16Value(regSP), e, true, false);
        setReg16Value(regSP, getReg16Value(regSP) + e);
        setFlag(FlagZ, false);
    } else {
        ushort *p = (ushort *)getPointer(op.params[1], false);
        ushort *pHL = (ushort *)&regHL;
        int n = *pHL + *p;

        setFlag(FlagC, n >= 0x10000);
        setFlag(FlagN, false);
        setFlag(FlagH, (n & 0xFFF) < (*pHL & 0xFFF));
        *pHL = n & 0xFFFF;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x1c(%rdi), %eax
cmpl $0xa, %eax
je 0xfdfe
testl %eax, %eax
jne 0xfe41
movl 0x20(%rdi), %edi
movl $0x1, %esi
callq 0xe910
leaq 0x8719(%rip), %r15      # 0x184f0
movzbl 0x1(%r15), %ebx
movzbl (%rax), %r14d
movl %ebx, %edi
movl %r14d, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0xfbcd
leal (%r14,%rbx), %eax
movb %al, 0x1(%r15)
jmp 0xfe9d
leaq 0x86f9(%rip), %rax      # 0x184fe
movzwl (%rax), %eax
incl %eax
movzwl %ax, %edi
callq 0xb94c
leaq 0x86e3(%rip), %r14      # 0x184fc
movzbl (%r14), %edi
movzbl %al, %ebx
movl %ebx, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0xfbcd
movsbl %bl, %eax
addw %ax, (%r14)
leaq 0x86b4(%rip), %rax      # 0x184f0
andb $0x7f, (%rax)
jmp 0xfe9d
movl 0x20(%rdi), %edi
xorl %esi, %esi
callq 0xe910
leaq 0x86a4(%rip), %rsi      # 0x184f6
movzwl (%rsi), %ecx
movzwl (%rax), %edi
addl %ecx, %edi
cmpl $0x10000, %edi          # imm = 0x10000
setae %dl
leaq 0x8686(%rip), %rax      # 0x184f0
movb (%rax), %r8b
andb $-0x51, %r8b
shlb $0x4, %dl
orb %r8b, %dl
movl $0xfff, %r8d            # imm = 0xFFF
movw %di, (%rsi)
andl %r8d, %edi
andl %r8d, %ecx
movl %edx, %esi
andb $-0x61, %sil
orb $0x20, %dl
cmpl %ecx, %edi
movzbl %dl, %ecx
movzbl %sil, %edx
cmovbl %ecx, %edx
movb %dl, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleSUB(dsemu::cpu::OpCode const&)
int handleSUB(const OpCode &op) {
    byte *val = getPointer(op.params[0]);

    short a = regAF.hi - *val;
    setFlags(regAF.hi, *val, false, false);

    regAF.hi = a & 0x00FF;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x1c(%rdi), %edi
movl $0x1, %esi
callq 0xe910
leaq 0x8633(%rip), %r14      # 0x184f0
movzbl 0x1(%r14), %ebx
movzbl (%rax), %ebp
movl %ebx, %edi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xfbcd
subb %bpl, %bl
movb %bl, 0x1(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleSBC(dsemu::cpu::OpCode const&)
int handleSBC(const OpCode &op) {
    byte *val = getPointer(op.params[0]);

    short a = regAF.hi - *val - getFlag(FlagC);
    setFlags(regAF.hi, *val, false, true);

    regAF.hi = a & 0x00FF;
    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl 0x1c(%rdi), %edi
movl $0x1, %esi
callq 0xe910
leaq 0x85f9(%rip), %rbx      # 0x184f0
movzbl 0x1(%rbx), %edi
movzbl (%rax), %esi
movl %edi, %eax
subb %sil, %al
movb (%rbx), %bpl
shlb $0x3, %bpl
sarb $0x7, %bpl
addb %al, %bpl
xorl %edx, %edx
movl $0x1, %ecx
callq 0xfbcd
movb %bpl, 0x1(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleAND(dsemu::cpu::OpCode const&)
int handleAND(const OpCode &op) {
    byte *val = getPointer(op.params[0]);

    regAF.hi &= *val;
    
    setFlag(FlagZ, regAF.hi == 0);
    setFlag(FlagN, false);
    setFlag(FlagH, true);
    setFlag(FlagC, 0);
    return 0;
}

// Assembly:
pushq %rax
movl 0x1c(%rdi), %edi
movl $0x1, %esi
callq 0xe910
movb (%rax), %al
leaq 0x85af(%rip), %rcx      # 0x184f0
andb %al, 0x1(%rcx)
setne %al
movb (%rcx), %dl
andb $0xf, %dl
shlb $0x7, %al
orb %dl, %al
addb $-0x60, %al
movb %al, (%rcx)
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleOR(dsemu::cpu::OpCode const&)
int handleOR(const OpCode &op) {
    byte *val = getPointer(op.params[0]);

    regAF.hi |= *val;
    
    setFlag(FlagZ, regAF.hi == 0);
    setFlag(FlagN, false);
    setFlag(FlagH, false);
    setFlag(FlagC, 0);
    return 0;
}

// Assembly:
pushq %rax
movl 0x1c(%rdi), %edi
movl $0x1, %esi
callq 0xe910
movb (%rax), %al
leaq 0x8580(%rip), %rcx      # 0x184f0
orb %al, 0x1(%rcx)
sete %al
movb (%rcx), %dl
andb $0xf, %dl
shlb $0x7, %al
orb %dl, %al
movb %al, (%rcx)
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleXOR(dsemu::cpu::OpCode const&)
int handleXOR(const OpCode &op) {
    byte *val = getPointer(op.params[0]);

    //cout << "XORING VAL: " << Byte(*val) << endl;

    regAF.hi ^= *val;
    
    setFlag(FlagZ, regAF.hi == 0);
    setFlag(FlagN, false);
    setFlag(FlagH, false);
    setFlag(FlagC, 0);
    return 0;
}

// Assembly:
pushq %rax
movl 0x1c(%rdi), %edi
movl $0x1, %esi
callq 0xe910
movb (%rax), %al
leaq 0x8553(%rip), %rcx      # 0x184f0
movb (%rcx), %dl
movb 0x1(%rcx), %sil
movl %esi, %edi
xorb %al, %dil
movb %dil, 0x1(%rcx)
cmpb %al, %sil
sete %al
andb $0xf, %dl
shlb $0x7, %al
orb %dl, %al
movb %al, (%rcx)
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::getVal(dsemu::cpu::ParamType)
byte getVal(ParamType pt) {
    switch(pt) {
        case A: return regAF.hi; 
        case B: return regBC.hi; 
        case C: return regBC.lo; 
        case D: return regDE.hi; 
        case E: return regDE.lo; 
        case H: return regHL.hi; 
        case L: return regHL.lo; 
        case N: return bus::read(regPC + 1); 
        case HL: return bus::read(toShort(regHL.lo, regHL.hi)); break;
        default:
            cout << "BAD LDD" << endl;
            exit(-1);
            return 0;
    }
}

// Assembly:
cmpl $0xc, %edi
ja 0x1003c
movl %edi, %eax
leaq 0x335e(%rip), %rcx      # 0x1332c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8512(%rip), %rax      # 0x184f0
jmp 0x1002e
leaq 0x8517(%rip), %rax      # 0x184fe
movzwl (%rax), %eax
incl %eax
movzwl %ax, %edi
jmp 0xb94c
leaq 0x84f9(%rip), %rax      # 0x184f4
jmp 0x10039
leaq 0x84f2(%rip), %rax      # 0x184f6
jmp 0x1002e
leaq 0x84e5(%rip), %rax      # 0x184f2
jmp 0x10039
leaq 0x84e0(%rip), %rax      # 0x184f6
movzwl (%rax), %edi
jmp 0xb94c
leaq 0x84cf(%rip), %rax      # 0x184f4
jmp 0x1002e
leaq 0x84c4(%rip), %rax      # 0x184f2
movb 0x1(%rax), %al
retq
leaq 0x84bd(%rip), %rax      # 0x184f6
movb (%rax), %al
retq
pushq %rax
movq 0x7f8c(%rip), %rdi      # 0x17fd0
leaq 0x3462(%rip), %rsi      # 0x134ad
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleLDD(dsemu::cpu::OpCode const&)
int handleLDD(const OpCode &op) {
    handleLD(op);
    ushort *p = (ushort *)&regHL;
    (*p)--;
    return 0;
}

// Assembly:
pushq %rax
callq 0xea92
leaq 0x8487(%rip), %rax      # 0x184f6
decw (%rax)
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleLDI(dsemu::cpu::OpCode const&)
int handleLDI(const OpCode &op) {
    handleLD(op);
    ushort *p = (ushort *)&regHL;
    (*p)++;
    return 0;
}

// Assembly:
pushq %rax
callq 0xea92
leaq 0x8473(%rip), %rax      # 0x184f6
incw (%rax)
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleINC(dsemu::cpu::OpCode const&)
int handleINC(const OpCode &op) {
    ushort val = 0;
    ushort prev = 0;

    switch(op.params[0]) {
        case A: prev = regAF.hi++; val = regAF.hi; break;
        case B: prev = regBC.hi++; val = regBC.hi; break;
        case C: prev = regBC.lo++; val = regBC.lo; break;
        case D: prev = regDE.hi++; val = regDE.hi; break;
        case E: prev = regDE.lo++; val = regDE.lo; break;
        case H: prev = regHL.hi++; val = regHL.hi; break;
        case L: prev = regHL.lo++; val = regHL.lo; break;
        case BC: prev = (*getReg16Pointer(regBC))++; val = (getReg16Value(regBC));  return 0;
        case DE: prev = (*getReg16Pointer(regDE))++; val = (getReg16Value(regDE)); return 0;
        case SP: prev = (*getReg16Pointer(regSP))++; val = (getReg16Value(regSP)); return 0;
        case HL: {
            if (op.mode == ATypeA) {
                byte b = bus::read((getReg16Value(regHL)));
                prev = b++;
                bus::write((getReg16Value(regHL)), b);
                val = b;

            } else {
                prev = (*getReg16Pointer(regHL))++; 
                val = (getReg16Value(regHL)); 
                return 0;
            }
        } break;
        default:
            cout << "INVALID INC FLAG" << endl;
            exit(-1);
            return 0;
    }

    setFlag(FlagZ, val == 0);
    setFlag(FlagN, 0);
    setFlag(FlagH, (prev & 0xF) == 0xF);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x1c(%rdi), %eax
cmpq $0xa, %rax
ja 0x10188
leaq 0x32be(%rip), %rcx      # 0x13360
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x843e(%rip), %rax      # 0x184f0
jmp 0x1011b
leaq 0x8439(%rip), %rax      # 0x184f4
jmp 0x1012e
cmpl $0xc, 0x18(%rdi)
leaq 0x842e(%rip), %r14      # 0x184f6
movzwl (%r14), %eax
jne 0x10180
movzwl %ax, %edi
callq 0xb94c
movl %eax, %ebx
movl %eax, %ebp
incb %bpl
movzwl (%r14), %edi
movzbl %bpl, %esi
callq 0xb9cd
jmp 0x10136
leaq 0x83fb(%rip), %rax      # 0x184f2
jmp 0x1012e
leaq 0x83f4(%rip), %rax      # 0x184f4
jmp 0x1011b
leaq 0x83e9(%rip), %rax      # 0x184f2
jmp 0x10176
leaq 0x83e0(%rip), %rax      # 0x184f2
jmp 0x1011b
leaq 0x83db(%rip), %rax      # 0x184f6
movb 0x1(%rax), %bl
leal 0x1(%rbx), %ebp
movb %bpl, 0x1(%rax)
jmp 0x10136
leaq 0x83c8(%rip), %rax      # 0x184f6
movb (%rax), %bl
leal 0x1(%rbx), %ebp
movb %bpl, (%rax)
testb %bpl, %bpl
sete %al
leaq 0x83ad(%rip), %rcx      # 0x184f0
movb (%rcx), %dl
andb $0x3f, %dl
shlb $0x7, %al
orb %dl, %al
notb %bl
movl %eax, %edx
andb $-0x61, %dl
orb $0x20, %al
testb $0xf, %bl
movzbl %al, %eax
movzbl %dl, %edx
cmovel %eax, %edx
movb %dl, (%rcx)
jmp 0x10179
leaq 0x838f(%rip), %rax      # 0x184fc
jmp 0x10176
leaq 0x837e(%rip), %rax      # 0x184f4
incw (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
incl %eax
movw %ax, (%r14)
jmp 0x10179
movq 0x7e41(%rip), %rdi      # 0x17fd0
leaq 0x331f(%rip), %rsi      # 0x134b5
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleDEC(dsemu::cpu::OpCode const&)
int handleDEC(const OpCode &op) {
    ushort val = 0;

    switch(op.params[0]) {
        case A: regAF.hi--; val = regAF.hi; break;
        case B: regBC.hi--; val = regBC.hi; break;
        case C: regBC.lo--; val = regBC.lo; break;
        case D: regDE.hi--; val = regDE.hi; break;
        case E: regDE.lo--; val = regDE.lo; break;
        case H: regHL.hi--; val = regHL.hi; break;
        case L: regHL.lo--; val = regHL.lo; break;
        case BC: (*getReg16Pointer(regBC))--; val = (getReg16Value(regBC)); return 0;
        case DE: (*getReg16Pointer(regDE))--; val = (getReg16Value(regDE)); return 0;
        case SP: (*getReg16Pointer(regSP))--; val = (getReg16Value(regSP)); return 0;
        case HL: {
            if (op.mode == ATypeA) {
                byte b = bus::read((getReg16Value(regHL)));
                b--;
                bus::write((getReg16Value(regHL)), b);
                val = b;
            } else {
                (*getReg16Pointer(regHL))--; 
                val = (getReg16Value(regHL)); 
                return 0;
            }
        } break;
        default:
            cout << "INVALID DEC FLAG" << endl;
            exit(-1);
            return 0;
    }

    setFlag(FlagZ, val == 0);
    setFlag(FlagN, 1);
    setFlag(FlagH, (val & 0xF) == 0x0F);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x1c(%rdi), %eax
cmpq $0xa, %rax
ja 0x102a8
leaq 0x31c7(%rip), %rcx      # 0x1338c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x831b(%rip), %rax      # 0x184f0
jmp 0x1023a
leaq 0x8316(%rip), %rax      # 0x184f4
jmp 0x1024b
cmpl $0xc, 0x18(%rdi)
leaq 0x830b(%rip), %r14      # 0x184f6
movzwl (%r14), %eax
jne 0x102a0
movzwl %ax, %edi
callq 0xb94c
movl %eax, %ebx
decb %bl
movzwl (%r14), %edi
movzbl %bl, %esi
callq 0xb9cd
jmp 0x10251
leaq 0x82dc(%rip), %rax      # 0x184f2
jmp 0x1024b
leaq 0x82d5(%rip), %rax      # 0x184f4
jmp 0x1023a
leaq 0x82ca(%rip), %rax      # 0x184f2
jmp 0x10293
leaq 0x82c1(%rip), %rax      # 0x184f2
jmp 0x1023a
leaq 0x82bc(%rip), %rax      # 0x184f6
movb 0x1(%rax), %bl
decb %bl
movb %bl, 0x1(%rax)
jmp 0x10251
leaq 0x82ab(%rip), %rax      # 0x184f6
movb (%rax), %bl
decb %bl
movb %bl, (%rax)
testb %bl, %bl
sete %al
leaq 0x8293(%rip), %rcx      # 0x184f0
movb (%rcx), %dl
andb $0x3f, %dl
shlb $0x7, %al
orb %dl, %al
notb %bl
movl %eax, %edx
andb $-0x61, %dl
orb $0x40, %dl
orb $0x60, %al
testb $0xf, %bl
movzbl %al, %eax
movzbl %dl, %edx
cmovel %eax, %edx
movb %dl, (%rcx)
jmp 0x10296
leaq 0x8272(%rip), %rax      # 0x184fc
jmp 0x10293
leaq 0x8261(%rip), %rax      # 0x184f4
decw (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
decl %eax
movw %ax, (%r14)
jmp 0x10296
movq 0x7d21(%rip), %rdi      # 0x17fd0
leaq 0x3210(%rip), %rsi      # 0x134c6
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handleRST(dsemu::cpu::OpCode const&)
int handleRST(const OpCode &op) {
    push((ushort)(regPC + 1));

    switch(op.params[0]) {
        case x00: regPC = 0x00; break;
        case x08: regPC = 0x08; break;
        case x10: regPC = 0x10; break;
        case x18: regPC = 0x18; break;
        case x20: regPC = 0x20; break;
        case x28: regPC = 0x28; break;
        case x30: regPC = 0x30; break;
        case x38: regPC = 0x38; break;
        default: {
            cout << "UNKNOWN RST" << endl;
            exit(-1);
        }
    }

    regPC -= 1;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8127(%rip), %r14      # 0x184fe
movzwl (%r14), %eax
incl %eax
movzwl %ax, %edi
callq 0xc490
movl 0x1c(%rbx), %eax
addl $-0xf, %eax
cmpl $0x8, %eax
jae 0x1040b
movl %eax, %eax
leaq 0x30fd(%rip), %rcx      # 0x134f6
movzwl (%rcx,%rax,2), %eax
movw %ax, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x7bbe(%rip), %rdi      # 0x17fd0
leaq 0x30be(%rip), %rsi      # 0x134d7
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/op_handler.cpp
// Function: dsemu::cpu::handle_op(dsemu::cpu::OpCode&)
int handle_op(OpCode &opCode) {
    std::map<Op, HANDLER>::iterator it = handlerMap.find(opCode.op);

    if (it == handlerMap.end()) {
        cout << "UNKNOWN OP CODE: " << Byte(opCode.value) << endl;
        exit(-1);
    }

    int ret = it->second(opCode);

    if (opCode.op != EI && eiCalled) {
        eiCalled = false;
        interruptsEnabled = true;
    }

    return ret;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x27cc7(%rip), %rdx     # 0x385c8
testq %rdx, %rdx
je 0x1095d
movl 0x10(%rbx), %ecx
leaq 0x27cb0(%rip), %rax     # 0x385c0
xorl %esi, %esi
cmpl %ecx, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rax
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x10910
leaq 0x27c92(%rip), %rdx     # 0x385c0
cmpq %rdx, %rax
je 0x1095d
cmpl 0x20(%rax), %ecx
jl 0x1095d
movq %rbx, %rdi
callq *0x28(%rax)
cmpl $0x1d, 0x10(%rbx)
je 0x1095b
cmpb $0x1, 0x27ccd(%rip)     # 0x38618
jne 0x1095b
movb $0x0, 0x27cc4(%rip)     # 0x38618
movb $0x1, 0x27cbe(%rip)     # 0x38619
popq %rbx
retq
movq 0x766c(%rip), %rdi      # 0x17fd0
leaq 0x2b78(%rip), %rsi      # 0x134e3
callq 0x3290
movl (%rbx), %esi
movq %rax, %rdi
callq 0x10acf
movq %rax, %rdi
callq 0x3150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3310
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/ppu.cpp
// Function: dsemu::ppu::init()
void init() {
    currentFrame = 0;
    currentLine = 0;
    scrollInfo.x = 0;
    scrollInfo.y = 0;
    memset(oamRAM, 0, sizeof(oamRAM));

    videoBuffer = new unsigned long[256 * 256];
    memset(videoBuffer, 0, 256 * 256 * sizeof(unsigned long));

    cout << "VID BUFF: " << Int64((uint64_t)videoBuffer) << endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0x0, 0x2c305(%rip)     # 0x3d678
movb $0x0, 0x2c302(%rip)     # 0x3d67c
movw $0x0, 0x2c2f0(%rip)     # 0x3d673
leaq 0x2c2f6(%rip), %rdi     # 0x3d680
movl $0xa0, %edx
xorl %esi, %esi
callq 0x3170
movl $0x80000, %edi          # imm = 0x80000
callq 0x3030
movq %rax, 0x2c379(%rip)     # 0x3d720
movl $0x80000, %edx          # imm = 0x80000
movq %rax, %rdi
xorl %esi, %esi
callq 0x3170
movq 0x6c13(%rip), %rbx      # 0x17fd0
leaq 0x27e8(%rip), %rsi      # 0x13bac
movl $0xa, %edx
movq %rbx, %rdi
callq 0x3300
movq 0x2c348(%rip), %r14     # 0x3d720
movq (%rbx), %rax
movq -0x18(%rax), %rcx
movl 0x18(%rbx,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rbx,%rcx)
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r15
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x11417
movq %r15, %rdi
movl $0x20, %esi
callq 0x3280
movb $0x1, 0xe1(%r15)
movq (%rbx), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x10, 0x10(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3190
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x31a0
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/ppu.cpp
// Function: dsemu::ppu::getSpritesOnLine(int)
vector<OAMEntry *> getSpritesOnLine(int lineNum) {

    vector<OAMEntry *> entries;

    for (int i=0; i<160; i += 4) {
        OAMEntry *entry = (OAMEntry *)&oamRAM[i];
        
        if (entry->y >= lineNum + 8 && entry->y < lineNum + 16) {
            entries.push_back(entry);
        }
    }

    return entries;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leal 0x8(%r14), %ebp
addl $0x10, %r14d
xorl %r12d, %r12d
leaq 0x2c1b4(%rip), %r13     # 0x3d680
movq %rsp, %r15
leaq (%r12,%r13), %rax
movq %rax, (%rsp)
movzbl (%r12,%r13), %ecx
cmpl %ecx, %ebp
setle %dl
cmpl %ecx, %r14d
setg %cl
andb %dl, %cl
cmpb $0x1, %cl
jne 0x1150d
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x11502
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x1150d
movq %rbx, %rdi
movq %r15, %rdx
callq 0x11a4a
leaq 0x4(%r12), %rax
cmpq $0x9c, %r12
movq %rax, %r12
jb 0x114cf
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x11547
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x3440
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/ui.cpp
// Function: dsemu::ui::displayTile(SDL_Surface*, unsigned short, unsigned short, int, int)
void displayTile(SDL_Surface *surface, ushort startLocation, ushort tileNum, int x, int y) {

    SDL_Rect rc;

    for (int tileY=0; tileY<16; tileY += 2) {
        byte b1 = bus::read(startLocation + (tileNum * 16) + tileY);
        byte b2 = bus::read(startLocation + (tileNum * 16) + 1 + tileY);
        
        for (int bit=7, n=0; bit >= 0; bit--, n++) {
            byte hi = !!(b1 & (1 << bit)) << 1;
            byte lo = !!(b2 & (1 << bit));

            byte color = hi|lo;

            rc.x = x + (n * scale);
            rc.y = y + (tileY / 2 * scale);
            rc.w = scale;
            rc.h = scale;

            SDL_FillRect(surface, &rc, colors[color]);
        }
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
movq %rdi, 0x38(%rsp)
shll $0x4, %edx
leal (%rdx,%rsi), %eax
movq %rax, 0x30(%rsp)
leal (%rdx,%rsi), %eax
incl %eax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
movl 0x8(%rsp), %r13d
movq 0x38(%rsp), %r15
movq 0x30(%rsp), %rax
leal (%r14,%rax), %edi
movl $0xffff, %ebx           # imm = 0xFFFF
andl %ebx, %edi
callq 0xb94c
movl %eax, %r12d
movq 0x28(%rsp), %rax
leal (%rax,%r14), %edi
andl %ebx, %edi
callq 0xb94c
movzbl %r12b, %ecx
movl %ecx, 0x14(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
movq %r14, 0x40(%rsp)
movl %r14d, %ebx
shrl %ebx
movl $0x7, %r12d
xorl %ebp, %ebp
movl 0xc(%rsp), %r14d
movl 0x14(%rsp), %eax
movl %r12d, %ecx
shrl %cl, %eax
andl $0x1, %eax
xorl %ecx, %ecx
movl 0x10(%rsp), %edx
btl %r12d, %edx
setb %cl
leal (%rcx,%rax,2), %eax
movl 0x64d0(%rip), %ecx      # 0x18264
movl %ecx, %edx
imull %ebp, %edx
addl %r13d, %edx
movl %edx, 0x18(%rsp)
movl %ecx, %edx
imull %ebx, %edx
addl %r14d, %edx
movl %edx, 0x1c(%rsp)
movl %ecx, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
leaq 0x1e25(%rip), %rcx      # 0x13be0
movl (%rcx,%rax,8), %edx
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0x3070
incl %ebp
addl $-0x1, %r12d
jb 0x11d72
movq 0x40(%rsp), %rcx
leal 0x2(%rcx), %eax
cmpl $0xe, %ecx
movl %eax, %r14d
jb 0x11d24
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rockytriton[P]dreamsys_emu_gb/src/ui.cpp
// Function: dsemu::ui::updateDebugWindow()
void updateDebugWindow() {
    int xDraw = 0;
    int yDraw = 0;
    int tileNum = 0;

    for (int y=0; y<32; y++) {
        for (int x=0; x<16; x++) {
            displayTile(debugScreen, 0x8000, tileNum, xDraw + (x * scale), yDraw + (y * scale));
            xDraw += (7 * scale);
            tileNum++;
        }
        yDraw += (7 * scale);
        xDraw = 0;
    }


	SDL_UpdateTexture(sdlDebugTexture, NULL, debugScreen->pixels, debugScreen->pitch);
	SDL_RenderClear(sdlDebugRenderer);
	SDL_RenderCopy(sdlDebugRenderer, sdlDebugTexture, NULL, NULL);
	SDL_RenderPresent(sdlDebugRenderer);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebx, %ebx
movl 0x645d(%rip), %r8d      # 0x18264
xorl %r14d, %r14d
xorl %ebp, %ebp
movzwl %r14w, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
leal (%r14,%r15), %eax
movq 0x2b95f(%rip), %rdi     # 0x3d780
movl %r8d, %ecx
imull %r15d, %ecx
addl %r12d, %ecx
imull %ebx, %r8d
addl %ebp, %r8d
movzwl %ax, %edx
movl $0x8000, %esi           # imm = 0x8000
callq 0x11ce6
movl 0x641e(%rip), %r8d      # 0x18264
leal (,%r8,8), %eax
subl %r8d, %eax
addl %eax, %r12d
incl %r15d
cmpl $0x10, %r15d
jne 0x11e16
addl %eax, %ebp
incl %ebx
addl %r15d, %r14d
cmpl $0x20, %ebx
jne 0x11e0c
movq 0x2b908(%rip), %rdi     # 0x3d778
movq 0x2b909(%rip), %rax     # 0x3d780
movq 0x20(%rax), %rdx
movl 0x18(%rax), %ecx
xorl %esi, %esi
callq 0x3200
movq 0x2b8e4(%rip), %rdi     # 0x3d770
callq 0x3270
movq 0x2b8d8(%rip), %rdi     # 0x3d770
movq 0x2b8d9(%rip), %rsi     # 0x3d778
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x32e0
movq 0x2b8c1(%rip), %rdi     # 0x3d770
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3080
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yy_create_buffer(_IO_FILE*, int)
YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
{
	YY_BUFFER_STATE b;
    
	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_buf_size = size;

	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_is_our_buffer = 1;

	yy_init_buffer( b, file );

	return b;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %rbx
movl $0x40, %edi
callq 0x52d0
testq %rax, %rax
je 0x75e4
movq %rax, %r14
movl %r15d, 0x18(%rax)
addl $0x2, %r15d
movslq %r15d, %rdi
callq 0x52d0
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x75e4
movl $0x1, 0x20(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7794
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17880(%rip), %rdi     # 0x1ee6b
callq 0x76c9
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yy_get_previous_state()
static yy_state_type yy_get_previous_state (void)
{
	yy_state_type yy_current_state;
	char *yy_cp;
    
	yy_current_state = (yy_start);

	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
		{
		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			(yy_last_accepting_state) = yy_current_state;
			(yy_last_accepting_cpos) = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 122 )
				yy_c = yy_meta[yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
		}

	return yy_current_state;
}

// Assembly:
movl 0x1fcd6(%rip), %eax     # 0x272cc
movq 0x1fcc3(%rip), %rcx     # 0x272c0
movq 0x1fcdc(%rip), %rdx     # 0x272e0
cmpq %rdx, %rcx
jae 0x76c8
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x1716f(%rip), %rsi     # 0x1e790
leaq 0x173c8(%rip), %rdi     # 0x1e9f0
leaq 0x17261(%rip), %r8      # 0x1e890
leaq 0x175ea(%rip), %r9      # 0x1ec20
leaq 0x174b3(%rip), %r10     # 0x1eaf0
leaq 0x175ac(%rip), %r11     # 0x1ebf0
movzbl (%rcx), %r14d
testq %r14, %r14
je 0x765a
leaq 0x1703c(%rip), %rbx     # 0x1e690
movb (%r14,%rbx), %r14b
jmp 0x765d
movb $0x1, %r14b
movslq %eax, %r15
cmpw $0x0, (%rsi,%r15,2)
je 0x7675
movl %eax, 0x1fc7e(%rip)     # 0x272ec
movq %rcx, 0x1fc7b(%rip)     # 0x272f0
movswq (%rdi,%r15,2), %r13
movzbl %r14b, %r12d
addq %r12, %r13
movswl (%r8,%r13,2), %ebx
cmpl %ebx, %eax
je 0x76b1
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0x7696
movb (%r12,%r11), %r14b
movswl (%r10,%r15,2), %eax
movslq %eax, %r15
movswq (%rdi,%r15,2), %r13
movzbl %r14b, %r12d
addq %r12, %r13
cmpw (%r8,%r13,2), %r15w
jne 0x768a
movswl (%r9,%r13,2), %eax
incq %rcx
cmpq %rdx, %rcx
jne 0x7644
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yyrestart(_IO_FILE*)
void yyrestart  (FILE * input_file )
{
    
	if ( ! YY_CURRENT_BUFFER ){
        yyensure_buffer_stack ();
		YY_CURRENT_BUFFER_LVALUE =
            yy_create_buffer( yyin, YY_BUF_SIZE );
	}

	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
	yy_load_buffer_state(  );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1fbce(%rip), %rax     # 0x272d0
testq %rax, %rax
je 0x7717
movq 0x1fbca(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
jne 0x7742
callq 0x74e6
movq 0x1fb85(%rip), %rdi     # 0x272a8
movl $0x4000, %esi           # imm = 0x4000
callq 0x7588
movq %rax, %rdi
movq 0x1fb99(%rip), %rax     # 0x272d0
movq 0x1fb9a(%rip), %rcx     # 0x272d8
movq %rdi, (%rax,%rcx,8)
movq %rbx, %rsi
callq 0x7794
movq 0x1fb7f(%rip), %rax     # 0x272d0
movq 0x1fb80(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rdx
movl 0x1c(%rdx), %esi
movl %esi, 0x1fb93(%rip)     # 0x272f8
movq 0x10(%rdx), %rdx
movq %rdx, 0x1fb70(%rip)     # 0x272e0
movq %rdx, 0x1fb49(%rip)     # 0x272c0
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, 0x1fb23(%rip)     # 0x272a8
movb (%rdx), %al
movb %al, 0x1fb5b(%rip)      # 0x272e8
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yy_init_buffer(yy_buffer_state*, _IO_FILE*)
static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )

{
	int oerrno = errno;
    
	yy_flush_buffer( b );

	b->yy_input_file = file;
	b->yy_fill_buffer = 1;

    /* If b is the current buffer, then yy_init_buffer was _probably_
     * called from yyrestart() or through yy_get_next_buffer.
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }

        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
    
	errno = oerrno;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
callq 0x5040
movq %rax, %r14
movl (%rax), %r12d
movq %rbx, %rdi
callq 0x7924
movq %r15, (%rbx)
movl $0x1, 0x34(%rbx)
movq 0x1fb07(%rip), %rax     # 0x272d0
testq %rax, %rax
je 0x77db
movq 0x1fb03(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rax
jmp 0x77dd
xorl %eax, %eax
cmpq %rbx, %rax
je 0x77ea
movq $0x1, 0x2c(%rbx)
testq %r15, %r15
je 0x7807
movq %r15, %rdi
callq 0x5220
movl %eax, %edi
callq 0x53c0
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
jmp 0x7809
xorl %ecx, %ecx
movl %ecx, 0x24(%rbx)
movl %r12d, (%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yy_switch_to_buffer(yy_buffer_state*)
void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		yypop_buffer_state();
	 *		yypush_buffer_state(new_buffer);
     */
	yyensure_buffer_stack ();
	if ( YY_CURRENT_BUFFER == new_buffer )
		return;

	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	yy_load_buffer_state(  );

	/* We don't actually know whether we did this switch during
	 * EOF (yywrap()) processing, but the only time this flag
	 * is looked at is after yywrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	(yy_did_buffer_switch_on_eof) = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x74e6
movq 0x1faa3(%rip), %rax     # 0x272d0
testq %rax, %rax
je 0x786d
movq 0x1fa9f(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rdx
cmpq %rbx, %rdx
je 0x78ae
testq %rdx, %rdx
je 0x7879
movb 0x1fa9b(%rip), %dl      # 0x272e8
movq 0x1fa8c(%rip), %rsi     # 0x272e0
movb %dl, (%rsi)
movq (%rax,%rcx,8), %rdx
movq %rsi, 0x10(%rdx)
movl 0x1fa94(%rip), %edx     # 0x272f8
movq (%rax,%rcx,8), %rsi
movl %edx, 0x1c(%rsi)
jmp 0x7879
testq %rbx, %rbx
je 0x78ae
movq 0x1fa5f(%rip), %rcx     # 0x272d8
movq %rbx, (%rax,%rcx,8)
movl 0x1c(%rbx), %edx
movl %edx, 0x1fa72(%rip)     # 0x272f8
movq 0x10(%rbx), %rdx
movq %rdx, 0x1fa4f(%rip)     # 0x272e0
movq %rdx, 0x1fa28(%rip)     # 0x272c0
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, 0x1fa02(%rip)     # 0x272a8
movb (%rdx), %al
movb %al, 0x1fa3a(%rip)      # 0x272e8
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yy_delete_buffer(yy_buffer_state*)
void yy_delete_buffer (YY_BUFFER_STATE  b )
{
    
	if ( ! b )
		return;

	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;

	if ( b->yy_is_our_buffer )
		yyfree( (void *) b->yy_ch_buf  );

	yyfree( (void *) b  );
}

// Assembly:
testq %rdi, %rdi
je 0x78e6
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1f9fc(%rip), %rax     # 0x272d0
testq %rax, %rax
je 0x78e7
movq 0x1f9f8(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rcx
jmp 0x78e9
retq
xorl %ecx, %ecx
cmpq %rbx, %rcx
jne 0x78fd
movq 0x1f9e3(%rip), %rcx     # 0x272d8
movq $0x0, (%rax,%rcx,8)
cmpl $0x0, 0x20(%rbx)
je 0x790c
movq 0x8(%rbx), %rdi
callq 0x5280
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5280
// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/front/compiler.l.c
// Function: yy_flush_buffer(yy_buffer_state*)
void yy_flush_buffer (YY_BUFFER_STATE  b )
{
    	if ( ! b )
		return;

	b->yy_n_chars = 0;

	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;

	b->yy_buf_pos = &b->yy_ch_buf[0];

	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;

	if ( b == YY_CURRENT_BUFFER )
		yy_load_buffer_state(  );
}

// Assembly:
testq %rdi, %rdi
je 0x79ae
pushq %rbp
movq %rsp, %rbp
xorl %ecx, %ecx
movl %ecx, 0x1c(%rdi)
movq 0x8(%rdi), %rax
movb %cl, (%rax)
movq 0x8(%rdi), %rax
movb %cl, 0x1(%rax)
movq 0x8(%rdi), %rax
movq %rax, 0x10(%rdi)
movl $0x1, 0x28(%rdi)
movl %ecx, 0x38(%rdi)
movq 0x1f974(%rip), %rax     # 0x272d0
testq %rax, %rax
je 0x796c
movq 0x1f970(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rcx
cmpq %rdi, %rcx
jne 0x79ad
movq 0x1f960(%rip), %rcx     # 0x272d8
movq (%rax,%rcx,8), %rdx
movl 0x1c(%rdx), %esi
movl %esi, 0x1f973(%rip)     # 0x272f8
movq 0x10(%rdx), %rdx
movq %rdx, 0x1f950(%rip)     # 0x272e0
movq %rdx, 0x1f929(%rip)     # 0x272c0
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, 0x1f903(%rip)     # 0x272a8
movb (%rdx), %al
movb %al, 0x1f93b(%rip)      # 0x272e8
popq %rbp
retq