LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::PopSP16()
uint16_t CPU::PopSP16() {
    uint16_t addr = stackPointer++;
    stackPointer++;
    uint16_t n = mmu->Read16Bit(addr);
    //mmu->Write(addr, (uint16_t)0x00);
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw 0x1a(%rax), %cx
movw %cx, %dx
addw $0x1, %dx
movw %dx, 0x1a(%rax)
movw %cx, -0xa(%rbp)
movw 0x1a(%rax), %cx
addw $0x1, %cx
movw %cx, 0x1a(%rax)
movq 0x10(%rax), %rdi
movzwl -0xa(%rbp), %esi
callq 0x336e0
movw %ax, -0xc(%rbp)
movw -0xc(%rbp), %ax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::PushSP(unsigned short)
void CPU::PushSP(uint16_t value) {
    uint8_t hi = (uint8_t)((value >> 8) & 0xFF);
    uint8_t lo = (uint8_t)((value) & 0xFF);
    PushSP(hi);
    PushSP(lo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movzwl -0xa(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0xb(%rbp)
movzwl -0xa(%rbp), %eax
andl $0xff, %eax
movb %al, -0xc(%rbp)
movzbl -0xb(%rbp), %esi
callq 0x2e5c0
movq -0x18(%rbp), %rdi
movzbl -0xc(%rbp), %esi
callq 0x2e5c0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::Read()
void CPU::Read() {
    if (!halt) {
        // uint16_t pc = programCounter;
        uint8_t opcode = ReadPC();

        // if (pc == 0xC04F) {
        //     loopCounter++;
        // }

        // if (mmu->enableDebugger && loopCounter > 5) {
        //     std::fprintf(stderr, "%.4X: %.2X\n", pc, opcode);
        // }
        CheckOpcode(opcode);
    } else {
        cycles = 4;
    }

    if (imeNext) {
        imeNext = false;
        IME = 0xFF;
    }

    if (haltNext) {
        haltNext = false;
        halt = true;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
testb $0x1, 0x1d(%rax)
jne 0x2e695
movq -0x18(%rbp), %rdi
callq 0x2e4a0
movq -0x18(%rbp), %rdi
movb %al, -0x9(%rbp)
movzbl -0x9(%rbp), %esi
callq 0x2e6d0
jmp 0x2e69d
movq -0x18(%rbp), %rax
movb $0x4, 0x8(%rax)
movq -0x18(%rbp), %rax
testb $0x1, 0x1f(%rax)
je 0x2e6b3
movq -0x18(%rbp), %rax
movb $0x0, 0x1f(%rax)
movb $-0x1, 0x9(%rax)
movq -0x18(%rbp), %rax
testb $0x1, 0x1e(%rax)
je 0x2e6c9
movq -0x18(%rbp), %rax
movb $0x0, 0x1e(%rax)
movb $0x1, 0x1d(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::FullRegisterParse(unsigned char)
FULL_REGISTERS CPU::FullRegisterParse(uint8_t opcode) {
    uint8_t shft = opcode >> 4;
    uint8_t and3 = shft & 3;
    FULL_REGISTERS r = (FULL_REGISTERS)and3;

    return r; // 4 max full registers
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movzbl -0x9(%rbp), %eax
sarl $0x4, %eax
movb %al, -0xa(%rbp)
movzbl -0xa(%rbp), %eax
andl $0x3, %eax
movb %al, -0xb(%rbp)
movzbl -0xb(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::MMU(Cartridge*)
MMU::MMU(Cartridge* crt) {
    for (uint32_t ii = 0; ii < 0x8000; ii++) {
        cart[ii] = crt->Read(ii);
    }

    palette[0] = 0;
    palette[1] = 1;
    palette[2] = 2;
    palette[3] = 3;

    readBios = true;
    enableDebugger = false;

    Write(0xFF00, (uint8_t)0x1);
    Write(0xFF41, (uint8_t)3);

    loadBootrom();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x692d(%rip), %rcx      # 0x3983c
movq %rcx, 0xe380(%rax)
leaq 0x6b20(%rip), %rcx      # 0x39a3d
movq %rcx, 0xe388(%rax)
leaq 0x6b73(%rip), %rcx      # 0x39a9e
movq %rcx, 0xe390(%rax)
movl $0x0, -0x14(%rbp)
cmpl $0x8000, -0x14(%rbp)    # imm = 0x8000
jae 0x32f65
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x33f30
movb %al, %dl
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x32f39
movq -0x20(%rbp), %rdi
movb $0x0, 0xe39a(%rdi)
movb $0x1, 0xe39b(%rdi)
movb $0x2, 0xe39c(%rdi)
movb $0x3, 0xe39d(%rdi)
movb $0x1, 0xe398(%rdi)
movb $0x0, 0xe399(%rdi)
movl $0xff00, %esi           # imm = 0xFF00
movl $0x1, %edx
callq 0x32fd0
movq -0x20(%rbp), %rdi
movl $0xff41, %esi           # imm = 0xFF41
movl $0x3, %edx
callq 0x32fd0
movq -0x20(%rbp), %rdi
callq 0x33c80
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::Read16Bit(unsigned short)
std::uint16_t MMU::Read16Bit(uint16_t addr) {
    uint16_t value = 0;

    uint16_t lo = (uint16_t)Read(addr);
    uint16_t hi = (uint16_t)Read(addr+1);
    value = (hi << 8) | lo;
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movw $0x0, -0xc(%rbp)
movzwl -0xa(%rbp), %esi
callq 0x334c0
movq -0x18(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0xe(%rbp)
movzwl -0xa(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x334c0
movzbl %al, %eax
movw %ax, -0x10(%rbp)
movzwl -0x10(%rbp), %eax
shll $0x8, %eax
movzwl -0xe(%rbp), %ecx
orl %ecx, %eax
movw %ax, -0xc(%rbp)
movw -0xc(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::UpdateTile(unsigned short)
void MMU::UpdateTile(uint16_t address) {
	address &= 0x1FFE;

	uint16_t tile = (address >> 4) & 511;
	uint16_t y = (address >> 1) & 7;

	uint8_t x, bitIndex;
	for(x = 0; x < 8; x++) {
		bitIndex = 1 << (7 - x);

		//((unsigned char (*)[8][8])tiles)[tile][y][x] = ((vram[address] & bitIndex) ? 1 : 0) + ((vram[address + 1] & bitIndex) ? 2 : 0);
		tiles[tile][y][x] = ((vram[address] & bitIndex)     != 0 ? 1 : 0) +
                            ((vram[address + 1] & bitIndex) != 0 ? 2 : 0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movzwl -0xa(%rbp), %eax
andl $0x1ffe, %eax           # imm = 0x1FFE
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
sarl $0x4, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movw %ax, -0xc(%rbp)
movzwl -0xa(%rbp), %eax
sarl %eax
andl $0x7, %eax
movw %ax, -0xe(%rbp)
movb $0x0, -0xf(%rbp)
movzbl -0xf(%rbp), %eax
cmpl $0x8, %eax
jge 0x33835
movq -0x18(%rbp), %rax
movzbl -0xf(%rbp), %edx
movl $0x7, %ecx
subl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
movb %cl, -0x10(%rbp)
movzwl -0xa(%rbp), %ecx
movzbl 0xa100(%rax,%rcx), %esi
movzbl -0x10(%rbp), %ecx
andl %ecx, %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
movzwl -0xa(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl 0xa100(%rax,%rdx), %edi
movzbl -0x10(%rbp), %edx
andl %edx, %edi
xorl %edx, %edx
movl $0x2, %esi
cmpl $0x0, %edi
cmovnel %esi, %edx
addl %edx, %ecx
movb %cl, %dl
addq $0xe3aa, %rax           # imm = 0xE3AA
movzwl -0xc(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movzwl -0xe(%rbp), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movzbl -0xf(%rbp), %ecx
movb %dl, (%rax,%rcx)
movb -0xf(%rbp), %al
addb $0x1, %al
movb %al, -0xf(%rbp)
jmp 0x33795
popq %rbp
retq
nopw (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/MMU.h
// Function: MMU::loadBootrom()
void loadBootrom() {
        uint16_t x = 0x0000;
        for(unsigned int i = 0; i < strlen(bootrom); i += 2) {
            uint8_t out = Utils::ParseCharsToHex(bootrom[i], bootrom[i + 1]);

            bios[x] = out;
            x++;
        }

        //loadDebugLogo();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movw $0x0, -0xa(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x20(%rbp), %rax
movl -0x10(%rbp), %ecx
movq %rcx, -0x28(%rbp)
movq 0xe380(%rax), %rdi
callq 0x5190
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0x33d1e
movq -0x20(%rbp), %rax
movq 0xe380(%rax), %rcx
movl -0x10(%rbp), %edx
movb (%rcx,%rdx), %dl
movq 0xe380(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsbl %dl, %edi
movsbl (%rax,%rcx), %esi
callq 0x33d30
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, -0x11(%rbp)
movb -0x11(%rbp), %dl
movzwl -0xa(%rbp), %ecx
movb %dl, 0xe281(%rax,%rcx)
movw -0xa(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xa(%rbp)
movl -0x10(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
jmp 0x33ca1
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: RegulusImpact[P]sadboy/src/Utils.h
// Function: Utils::ParseCharsToHex(char, char)
inline uint8_t ParseCharsToHex(const char h, const char l) {
        uint8_t hi = h > '9' ? h - 'A' + 10 : h - '0';
        uint8_t lo = l > '9' ? l - 'A' + 10 : l - '0';

        uint8_t out= (hi << 4 ) | lo;

        return out;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, %al
movb %dil, %cl
movb %cl, -0x1(%rbp)
movb %al, -0x2(%rbp)
movsbl -0x1(%rbp), %eax
cmpl $0x39, %eax
jle 0x33d58
movsbl -0x1(%rbp), %eax
subl $0x41, %eax
addl $0xa, %eax
movl %eax, -0xc(%rbp)
jmp 0x33d62
movsbl -0x1(%rbp), %eax
subl $0x30, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movb %al, -0x3(%rbp)
movsbl -0x2(%rbp), %eax
cmpl $0x39, %eax
jle 0x33d80
movsbl -0x2(%rbp), %eax
subl $0x41, %eax
addl $0xa, %eax
movl %eax, -0x10(%rbp)
jmp 0x33d8a
movsbl -0x2(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movb %al, -0x4(%rbp)
movzbl -0x3(%rbp), %eax
shll $0x4, %eax
movzbl -0x4(%rbp), %ecx
orl %ecx, %eax
movb %al, -0x5(%rbp)
movb -0x5(%rbp), %al
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: RegulusImpact[P]sadboy/src/Cartridge.cpp
// Function: Cartridge::Cartridge(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Cartridge::Cartridge(std::string fileName) {
    std::FILE* file;
    file = fopen (fileName.c_str() , "rb");
    if (file==NULL) {fputs ("File error",stderr); exit (1);}

    // obtain file size:
    fseek (file , 0 , SEEK_END);
    fileSize = ftell (file);
    rewind (file);

    // allocate memory to contain the whole file:
    rom = new uint8_t[fileSize];
    if (rom == NULL) {fputs ("Memory error",stderr); exit (2);}

    // copy the file into the buffer:
    uint32_t result = fread (rom,1,fileSize,file);
    if (result != fileSize) {fputs ("Reading error",stderr); exit (3);}
    fclose (file);

    printf("File loaded: %s\n", fileName.c_str());

    fileLoaded = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %rax
movq -0x38(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x5170
movq %rax, %rdi
leaq 0x5d65(%rip), %rsi      # 0x39b4b
callq 0x5570
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x33e16
movq 0x181cb(%rip), %rax     # 0x4bfc8
movq (%rax), %rsi
leaq 0x5d47(%rip), %rdi      # 0x39b4e
callq 0x5540
movl $0x1, %edi
callq 0x5590
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x5520
movq -0x18(%rbp), %rdi
callq 0x5030
movq %rax, %rcx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x18(%rbp), %rdi
callq 0x5090
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %edi
callq 0x5040
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, (%rax)
jne 0x33e82
movq 0x1815f(%rip), %rax     # 0x4bfc8
movq (%rax), %rsi
leaq 0x5ce6(%rip), %rdi      # 0x39b59
callq 0x5540
movl $0x2, %edi
callq 0x5590
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movl 0xc(%rax), %eax
movl %eax, %edx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0x56b0
movq -0x28(%rbp), %rcx
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0xc(%rcx), %eax
je 0x33ecb
movq 0x18116(%rip), %rax     # 0x4bfc8
movq (%rax), %rsi
leaq 0x5caa(%rip), %rdi      # 0x39b66
callq 0x5540
movl $0x3, %edi
callq 0x5590
movq -0x18(%rbp), %rdi
callq 0x5470
movq -0x30(%rbp), %rdi
callq 0x5170
movq %rax, %rsi
leaq 0x5c8d(%rip), %rdi      # 0x39b74
movb $0x0, %al
callq 0x5070
movq -0x28(%rbp), %rax
movb $0x1, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::DisableHalt()
void InterruptService::DisableHalt() {
    uint8_t ie = mmu->Read(IE);
    uint8_t flags = mmu->Read(IFLAGS);

    // if any interrupt enable bit and corresponding flags are set
    // regardless of the IME, disable HALT
    if (((ie & flags & vBlankBit)  > 0) ||
        ((ie & flags & lcdStatBit) > 0) ||
        ((ie & flags & timerBit)   > 0) ||
        ((ie & flags & serialBit)  > 0) ||
        ((ie & flags & joyPadBit)  > 0))
    {
        if (cpu->halt) {
            cpu->AddCycles(4);
        }

        cpu->halt = false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq (%rax), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x9(%rbp)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, -0xa(%rbp)
movzbl -0x9(%rbp), %eax
movzbl -0xa(%rbp), %ecx
andl %ecx, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jg 0x34084
movzbl -0x9(%rbp), %eax
movzbl -0xa(%rbp), %ecx
andl %ecx, %eax
andl $0x2, %eax
cmpl $0x0, %eax
jg 0x34084
movzbl -0x9(%rbp), %eax
movzbl -0xa(%rbp), %ecx
andl %ecx, %eax
andl $0x4, %eax
cmpl $0x0, %eax
jg 0x34084
movzbl -0x9(%rbp), %eax
movzbl -0xa(%rbp), %ecx
andl %ecx, %eax
andl $0x8, %eax
cmpl $0x0, %eax
jg 0x34084
movzbl -0x9(%rbp), %eax
movzbl -0xa(%rbp), %ecx
andl %ecx, %eax
andl $0x10, %eax
cmpl $0x0, %eax
jle 0x340b0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x1d(%rax)
je 0x340a4
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x4, %esi
callq 0x2e270
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0x1d(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::CheckInterrupts()
bool InterruptService::CheckInterrupts() {
    DisableHalt();
    if (cpu->GetIME() != 0x00) {
        uint8_t ie = mmu->Read(IE);
        uint8_t flags = mmu->Read(IFLAGS);

        // if bit0 (vBlankBit) is enable on IE and 0xFF0F
        if ((ie & flags & vBlankBit) > 0) {
            dispatch = vBlankBit;
            return true;
        }

        // if bit1 (lcdStatBit) is enable on IE and 0xFF0F
        if ((ie & flags & lcdStatBit) > 0) {
            dispatch = lcdStatBit;
            return true;
        }

        // if bit2 (timerBit) is enable on IE and 0xFF0F
        if ((ie & flags & timerBit) > 0) {
            dispatch = timerBit;
            return true;
        }

        // if bit3 (serialBit) is enable on IE and 0xFF0F
        if ((ie & flags & serialBit) > 0) {
            dispatch = serialBit;
            return true;
        }

        // if bit4 (joyPadBit) is enable on IE and 0xFF0F
        if ((ie & flags & joyPadBit) > 0) {
            dispatch = joyPadBit;
            return true;
        }
    }

    dispatch = 0xFF;
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x33ff0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2e1f0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x341c1
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x334c0
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, -0x11(%rbp)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, -0x12(%rbp)
movzbl -0x11(%rbp), %eax
movzbl -0x12(%rbp), %ecx
andl %ecx, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jle 0x3413f
movq -0x20(%rbp), %rax
movb $0x1, 0x10(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x341cd
movzbl -0x11(%rbp), %eax
movzbl -0x12(%rbp), %ecx
andl %ecx, %eax
andl $0x2, %eax
cmpl $0x0, %eax
jle 0x3415f
movq -0x20(%rbp), %rax
movb $0x2, 0x10(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x341cd
movzbl -0x11(%rbp), %eax
movzbl -0x12(%rbp), %ecx
andl %ecx, %eax
andl $0x4, %eax
cmpl $0x0, %eax
jle 0x3417f
movq -0x20(%rbp), %rax
movb $0x4, 0x10(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x341cd
movzbl -0x11(%rbp), %eax
movzbl -0x12(%rbp), %ecx
andl %ecx, %eax
andl $0x8, %eax
cmpl $0x0, %eax
jle 0x3419f
movq -0x20(%rbp), %rax
movb $0x8, 0x10(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x341cd
movzbl -0x11(%rbp), %eax
movzbl -0x12(%rbp), %ecx
andl %ecx, %eax
andl $0x10, %eax
cmpl $0x0, %eax
jle 0x341bf
movq -0x20(%rbp), %rax
movb $0x10, 0x10(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x341cd
jmp 0x341c1
movq -0x20(%rbp), %rax
movb $-0x1, 0x10(%rax)
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::Dispatch()
void InterruptService::Dispatch() {
    if ((cpu->GetIME() != 0x00)) {
        switch (dispatch) {
            case vBlankBit: {
                VBlankInterrupt();
            }
                break;
            case lcdStatBit: {
                LCDStatInterrupt();
            }
                break;
            case timerBit: {
                TimerInterrupt();
            }
                break;
            case serialBit: {
                SerialInterrupt();
            }
                break;
            case joyPadBit: {
                JoyPadInterrupt();
            }
                break;
            default:
                break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq 0x8(%rax), %rdi
callq 0x2e1f0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x34269
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0xf, %eax
ja 0x34265
movq -0x18(%rbp), %rax
leaq 0x5963(%rip), %rcx      # 0x39b88
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
callq 0x34270
jmp 0x34267
movq -0x10(%rbp), %rdi
callq 0x34300
jmp 0x34267
movq -0x10(%rbp), %rdi
callq 0x34390
jmp 0x34267
movq -0x10(%rbp), %rdi
callq 0x34420
jmp 0x34267
movq -0x10(%rbp), %rdi
callq 0x344b0
jmp 0x34267
jmp 0x34267
jmp 0x34269
addq $0x20, %rsp
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::VBlankInterrupt()
void InterruptService::VBlankInterrupt() {
    uint8_t flags = mmu->Read(IFLAGS);
    flags &= ~vBlankBit;
    cpu->SetIME(0x00);
    cpu->PushSP(cpu->programCounter);
    cpu->AddCycles(20);
    cpu->programCounter = vBlankISR;
    mmu->Write(IFLAGS, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x9(%rbp)
movzbl -0x9(%rbp), %ecx
andl $-0x2, %ecx
movb %cl, -0x9(%rbp)
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x2e210
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movzwl 0x18(%rax), %esi
callq 0x2e600
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x14, %esi
callq 0x2e270
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movw $0x40, 0x18(%rcx)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
movzbl -0x9(%rbp), %edx
callq 0x32fd0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::LCDStatInterrupt()
void InterruptService::LCDStatInterrupt() {
    uint8_t flags = mmu->Read(IFLAGS);
    flags &= ~lcdStatBit;
    cpu->SetIME(0x00);
    cpu->PushSP(cpu->programCounter);
    cpu->AddCycles(20);
    cpu->programCounter = lcdStatISR;
    mmu->Write(IFLAGS, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x9(%rbp)
movzbl -0x9(%rbp), %ecx
andl $-0x3, %ecx
movb %cl, -0x9(%rbp)
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x2e210
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movzwl 0x18(%rax), %esi
callq 0x2e600
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x14, %esi
callq 0x2e270
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movw $0x48, 0x18(%rcx)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
movzbl -0x9(%rbp), %edx
callq 0x32fd0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/InterruptService.cpp
// Function: InterruptService::SerialInterrupt()
void InterruptService::SerialInterrupt() {
    uint8_t flags = mmu->Read(IFLAGS);
    flags &= ~serialBit;
    cpu->SetIME(0x00);
    cpu->PushSP(cpu->programCounter);
    cpu->AddCycles(20);
    cpu->programCounter = serialISR;
    mmu->Write(IFLAGS, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x9(%rbp)
movzbl -0x9(%rbp), %ecx
andl $-0x9, %ecx
movb %cl, -0x9(%rbp)
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x2e210
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x8(%rax), %rax
movzwl 0x18(%rax), %esi
callq 0x2e600
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x14, %esi
callq 0x2e270
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movw $0x58, 0x18(%rcx)
movq (%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
movzbl -0x9(%rbp), %edx
callq 0x32fd0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::Increment()
void TimerService::Increment() {
    uint16_t cycles = cpu->GetCycles();

    // counter mess
    timaClock += cycles;
    CheckTima();

    // divider clock
    divClock += cycles;
    CheckDiv();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x18(%rax), %rdi
callq 0x2e230
movq -0x18(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
addl 0x10(%rdi), %eax
movl %eax, 0x10(%rdi)
callq 0x34690
movq -0x18(%rbp), %rdi
movzwl -0xa(%rbp), %eax
addl 0xc(%rdi), %eax
movl %eax, 0xc(%rdi)
callq 0x34760
addq $0x20, %rsp
popq %rbp
retq
// File: RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::CheckTima()
void TimerService::CheckTima() {
    uint8_t control = mmu->Read(controlAddr);
    uint32_t clockSpeed;

    if (control & runningBit) {
         // divide the operation speed of the cpu clock by the speed set in the control to get the "clockSpeed" variable value
        switch (control & speedBits) {
            case 0: // 4096hz
                clockSpeed = 1024;
                break;
            case 1: // 262144hz
                clockSpeed = 16;
                break;
            case 2: // 65536hz
                clockSpeed = 64;
                break;
            case 3: // 16384hz
                clockSpeed = 256;
                break;
        }

        bool trig = false;
        while (timaClock >= clockSpeed) {
            timaClock -= clockSpeed;
            StepTima();
            trig = true;
        }

        if (trig) {
            timaClock = 0;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq 0x20(%rax), %rdi
movzwl 0x6(%rax), %esi
callq 0x334c0
movq -0x20(%rbp), %rcx
movb %al, -0x9(%rbp)
movzbl -0x9(%rbp), %eax
movzbl 0x9(%rcx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x34755
movq -0x20(%rbp), %rcx
movb -0x9(%rbp), %al
movb 0x8(%rcx), %cl
andb %cl, %al
movzbl %al, %ecx
movq %rcx, -0x28(%rbp)
subb $0x3, %al
ja 0x34718
movq -0x28(%rbp), %rax
leaq 0x54db(%rip), %rcx      # 0x39bc8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x400, -0x10(%rbp)     # imm = 0x400
jmp 0x34718
movl $0x10, -0x10(%rbp)
jmp 0x34718
movl $0x40, -0x10(%rbp)
jmp 0x34718
movl $0x100, -0x10(%rbp)     # imm = 0x100
movb $0x0, -0x11(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
cmpl -0x10(%rbp), %eax
jb 0x34742
movq -0x20(%rbp), %rdi
movl -0x10(%rbp), %ecx
movl 0x10(%rdi), %eax
subl %ecx, %eax
movl %eax, 0x10(%rdi)
callq 0x347d0
movb $0x1, -0x11(%rbp)
jmp 0x3471c
testb $0x1, -0x11(%rbp)
je 0x34753
movq -0x20(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0x34755
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::CheckDiv()
void TimerService::CheckDiv() {
    if (divClock >= 0xFF) {
        uint8_t div = mmu->Read(divAddr);
        div++;
        mmu->WriteTimers(divAddr, div);
        divClock %= 256; // we want to keep ALL OF THE CLOCKS
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpl $0xff, 0xc(%rax)
jb 0x347c5
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
movzwl (%rax), %esi
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x9(%rbp)
movb -0x9(%rbp), %cl
addb $0x1, %cl
movb %cl, -0x9(%rbp)
movq 0x20(%rax), %rdi
movw (%rax), %cx
movzbl -0x9(%rbp), %eax
movzwl %cx, %esi
movzwl %ax, %edx
callq 0x33930
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0xff, %ecx
movl %ecx, 0xc(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::StepTima()
void TimerService::StepTima() {
    uint16_t tima = mmu->Read(timaAddr);
    tima++;

    if (tima > 255) {
        tima = mmu->Read(moduloAddr);
        cpu->AddCycles(4);
        TimaInterrupt();
    }

    mmu->Write(timaAddr, (uint8_t)(tima & 0xFF));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x20(%rax), %rdi
movzwl 0x2(%rax), %esi
callq 0x334c0
movzbl %al, %eax
movw %ax, -0xa(%rbp)
movw -0xa(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
cmpl $0xff, %eax
jle 0x34844
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
movzwl 0x4(%rax), %esi
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movzbl %cl, %ecx
movw %cx, -0xa(%rbp)
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x2e270
movq -0x18(%rbp), %rdi
callq 0x34870
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
movw 0x2(%rax), %cx
movzwl -0xa(%rbp), %eax
andl $0xff, %eax
movzwl %cx, %esi
movzbl %al, %edx
callq 0x32fd0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/TimerService.cpp
// Function: TimerService::TimaInterrupt()
void TimerService::TimaInterrupt() {
    uint8_t flags = mmu->Read(InterruptService::IFLAGS);
    flags |= InterruptService::timerBit;
    mmu->Write(InterruptService::IFLAGS, flags);
    cpu->AddCycles(4);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x20(%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x9(%rbp)
movzbl -0x9(%rbp), %ecx
orl $0x4, %ecx
movb %cl, -0x9(%rbp)
movq 0x20(%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
movzbl -0x9(%rbp), %edx
callq 0x32fd0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x2e270
addq $0x20, %rsp
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::XGPU(MMU*, unsigned char)
XGPU::XGPU(MMU* m, uint8_t ws = 1){
    mmu = m;
    windowScalar = ws;
    init_x();
    init_palette();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x30(%rbp)
callq 0x36030
movq -0x30(%rbp), %rdi
leaq 0x16ccb(%rip), %rax     # 0x4bbf8
movq %rax, (%rdi)
movq -0x10(%rbp), %rax
movq %rax, 0x5a98(%rdi)
movb -0x11(%rbp), %al
movb %al, 0x5a90(%rdi)
callq 0x348d0
jmp 0x34f4b
movq -0x30(%rbp), %rdi
callq 0x34bd0
jmp 0x34f56
addq $0x30, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x36050
movq -0x20(%rbp), %rdi
callq 0x5780
nopw (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::Sync()
void XGPU::Sync() {
    // control
    control = GetControl();
        lcdOperation = (control & Utils::BIT_7) != 0;
        windowTilemap = (control & Utils::BIT_6) != 0;
        windowDisplay = (control & Utils::BIT_5) != 0;
        bgTile = (control & Utils::BIT_4) != 0;
        bgMap = (control & Utils::BIT_3) != 0;
        spriteSize = (control & Utils::BIT_2) != 0;
        spriteDisplay = (control & Utils::BIT_1) != 0;
        bgDisplay = (control & Utils::BIT_0) != 0;

    // lcdc stats
    lcdStat = GetLCDStat();
        useLYC = (lcdStat & Utils::BIT_6) != 0;
        coincidence = (lcdStat & Utils::BIT_2) != 0;
        // bit 1 - 0 -mode flag
        mode = (GPU_MODE)(lcdStat & (Utils::BIT_1 | Utils::BIT_0));

    // scroll y
    scrollY = GetScrollY();

    // scroll X
    scrollX = GetScrollX();

    // LY (scanline)
    scanline = GetScanline();

    // LYC
    lyc = GetLYC();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x10(%rbp), %rdi
movb %al, 0x5a0c(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x80, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a0d(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a0e(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x20, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a0f(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x10, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a10(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a11(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a12(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a13(%rdi)
movzbl 0x5a0c(%rdi), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a14(%rdi)
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x10(%rbp), %rdi
movb %al, 0x5a15(%rdi)
movzbl 0x5a15(%rdi), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a16(%rdi)
movzbl 0x5a15(%rdi), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x5a17(%rdi)
movzbl 0x5a15(%rdi), %eax
andl $0x3, %eax
movl %eax, 0x5a18(%rdi)
movq (%rdi), %rax
callq *0x28(%rax)
movq -0x10(%rbp), %rdi
movb %al, 0x5a1c(%rdi)
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x10(%rbp), %rdi
movb %al, 0x5a1d(%rdi)
movq (%rdi), %rax
callq *0x30(%rax)
movq -0x10(%rbp), %rdi
movb %al, 0x5a1e(%rdi)
movq (%rdi), %rax
callq *0x38(%rax)
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x5a1f(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::SyncMemory()
void XGPU::SyncMemory() {
    // lcdc stats
    // clear bits; conditionally clear the coincidence
    lcdStat = lcdStat & ~(Utils::BIT_1 | Utils::BIT_0) & ~(useLYC ? Utils::BIT_2 : 0x00);
    lcdStat |= mode;
    lcdStat |= (scanline == lyc) ? Utils::BIT_2 : 0x00;

    if (scanline == lyc) {
        TriggerLCDStat(Utils::BIT_6); // trigger hblank lcdc status interrupt
    }
    SetLCDStat(lcdStat);

    // LY (scanline)
    SetScanline(scanline);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x10(%rbp)
movzbl 0x5a15(%rcx), %eax
andl $-0x4, %eax
movb 0x5a16(%rcx), %dil
xorl %edx, %edx
movl $0x4, %esi
testb $0x1, %dil
cmovnel %esi, %edx
xorl $-0x1, %edx
andl %edx, %eax
movb %al, 0x5a15(%rcx)
movl 0x5a18(%rcx), %edx
movzbl 0x5a15(%rcx), %eax
orl %edx, %eax
movb %al, 0x5a15(%rcx)
movzbl 0x5a1e(%rcx), %esi
movzbl 0x5a1f(%rcx), %edi
xorl %edx, %edx
movl $0x4, %eax
cmpl %edi, %esi
cmovel %eax, %edx
movzbl 0x5a15(%rcx), %eax
orl %edx, %eax
movb %al, 0x5a15(%rcx)
movzbl 0x5a1e(%rcx), %eax
movzbl 0x5a1f(%rcx), %ecx
cmpl %ecx, %eax
jne 0x354dc
movq -0x10(%rbp), %rdi
movl $0x40, %esi
callq 0x35510
movq -0x10(%rbp), %rdi
movb 0x5a15(%rdi), %cl
movq (%rdi), %rax
movzbl %cl, %esi
callq *0x48(%rax)
movq -0x10(%rbp), %rdi
movb 0x5a1e(%rdi), %cl
movq (%rdi), %rax
movzbl %cl, %esi
callq *0x60(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::TriggerLCDStat(unsigned char)
void XGPU::TriggerLCDStat(uint8_t statusBit) {
    uint8_t flags = mmu->Read(InterruptService::IFLAGS);
    flags |= InterruptService::lcdStatBit;
    mmu->Write(InterruptService::IFLAGS, flags);


    lcdStat &=~ Utils::BIT_6;
    lcdStat &=~ Utils::BIT_5;
    lcdStat &=~ Utils::BIT_4;
    lcdStat &=~ Utils::BIT_3;

    lcdStat |= statusBit;
    SetLCDStat(lcdStat);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x5a98(%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x334c0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0xa(%rbp)
movzbl -0xa(%rbp), %ecx
orl $0x2, %ecx
movb %cl, -0xa(%rbp)
movq 0x5a98(%rax), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
movzbl -0xa(%rbp), %edx
callq 0x32fd0
movq -0x18(%rbp), %rdi
movzbl 0x5a15(%rdi), %eax
andl $-0x41, %eax
movb %al, 0x5a15(%rdi)
movzbl 0x5a15(%rdi), %eax
andl $-0x21, %eax
movb %al, 0x5a15(%rdi)
movzbl 0x5a15(%rdi), %eax
andl $-0x11, %eax
movb %al, 0x5a15(%rdi)
movzbl 0x5a15(%rdi), %eax
andl $-0x9, %eax
movb %al, 0x5a15(%rdi)
movzbl -0x9(%rbp), %ecx
movzbl 0x5a15(%rdi), %eax
orl %ecx, %eax
movb %al, 0x5a15(%rdi)
movb 0x5a15(%rdi), %cl
movq (%rdi), %rax
movzbl %cl, %esi
callq *0x48(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::RenderScanline()
void XGPU::RenderScanline() {
    // which line of tiles to use in which map
    uint16_t bgmapOffset = bgMap ? 0x1C00 : 0x1800;
    bgmapOffset += (((scanline + scrollY) & 0xFF) >> 3) << 5;
    bgmapOffset += 0x8000;

    // which tile
    uint8_t lineOffset = (scrollX >> 3);

    // which line of pixels in the tile
    uint8_t y = (scanline + scrollY) & 7;

    // which in the tileline to start
    uint8_t x = (scrollX & 7);

    // where to render on canvas
    uint8_t color;
    uint8_t tile = mmu->Read((bgmapOffset + lineOffset));
    size_t offset = MAX_X * scanline;

    // if (bgTile && tile < 128) tile += 256;

    for (int ii = 0; ii < MAX_X; ii++) {
        color = mmu->tiles[tile][y][x];
        // color = mmu->bgp[color];
        framebuffer[offset] = mmu->bgp[color];
        offset++;

        x++;
        if (x == 8) {
            x = 0;
            lineOffset = (lineOffset + 1) & 31;
            tile = mmu->Read((bgmapOffset + lineOffset));
            // if (bgTile && tile < 128) tile += 256;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movb 0x5a11(%rax), %sil
movl $0x1800, %ecx           # imm = 0x1800
movl $0x1c00, %edx           # imm = 0x1C00
testb $0x1, %sil
cmovnel %edx, %ecx
movw %cx, -0xa(%rbp)
movzbl 0x5a1e(%rax), %edx
movzbl 0x5a1c(%rax), %ecx
addl %ecx, %edx
andl $0xff, %edx
sarl $0x3, %edx
shll $0x5, %edx
movzwl -0xa(%rbp), %ecx
addl %edx, %ecx
movw %cx, -0xa(%rbp)
movzwl -0xa(%rbp), %ecx
addl $0x8000, %ecx           # imm = 0x8000
movw %cx, -0xa(%rbp)
movzbl 0x5a1d(%rax), %ecx
sarl $0x3, %ecx
movb %cl, -0xb(%rbp)
movzbl 0x5a1e(%rax), %ecx
movzbl 0x5a1c(%rax), %edx
addl %edx, %ecx
andl $0x7, %ecx
movb %cl, -0xc(%rbp)
movzbl 0x5a1d(%rax), %ecx
andl $0x7, %ecx
movb %cl, -0xd(%rbp)
movq 0x5a98(%rax), %rdi
movzwl -0xa(%rbp), %eax
movzbl -0xb(%rbp), %ecx
addl %ecx, %eax
movzwl %ax, %esi
callq 0x334c0
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, -0xf(%rbp)
movzbl 0x5a1e(%rax), %eax
imull $0xa0, %eax, %eax
cltq
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0xa0, -0x1c(%rbp)
jge 0x35997
movq -0x28(%rbp), %rax
movq 0x5a98(%rax), %rcx
addq $0xe3aa, %rcx           # imm = 0xE3AA
movzbl -0xf(%rbp), %edx
shlq $0x6, %rdx
addq %rdx, %rcx
movzbl -0xc(%rbp), %edx
shlq $0x3, %rdx
addq %rdx, %rcx
movzbl -0xd(%rbp), %edx
movb (%rcx,%rdx), %cl
movb %cl, -0xe(%rbp)
movq 0x5a98(%rax), %rcx
movzbl -0xe(%rbp), %edx
movb 0xe39e(%rcx,%rdx), %dl
movq -0x18(%rbp), %rcx
movb %dl, 0xc(%rax,%rcx)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movb -0xd(%rbp), %al
addb $0x1, %al
movb %al, -0xd(%rbp)
movzbl -0xd(%rbp), %eax
cmpl $0x8, %eax
jne 0x35987
movq -0x28(%rbp), %rax
movb $0x0, -0xd(%rbp)
movzbl -0xb(%rbp), %ecx
addl $0x1, %ecx
andl $0x1f, %ecx
movb %cl, -0xb(%rbp)
movq 0x5a98(%rax), %rdi
movzwl -0xa(%rbp), %eax
movzbl -0xb(%rbp), %ecx
addl %ecx, %eax
movzwl %ax, %esi
callq 0x334c0
movb %al, -0xf(%rbp)
jmp 0x35989
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x358e0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::RenderFrame()
void XGPU::RenderFrame() {
    for (int y = 0; y < MAX_Y; y++) {
        for (int x = 0; x < MAX_X; x++) {
            size_t offset = (MAX_X * y) + x;
            uint8_t color = framebuffer[offset];
            Draw(color, y, x);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x90, -0xc(%rbp)
jge 0x35a29
movl $0x0, -0x10(%rbp)
cmpl $0xa0, -0x10(%rbp)
jge 0x35a1c
movq -0x28(%rbp), %rdi
imull $0xa0, -0xc(%rbp), %eax
addl -0x10(%rbp), %eax
cltq
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb 0xc(%rdi,%rax), %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %sil
movl -0xc(%rbp), %eax
movb %al, %dl
movl -0x10(%rbp), %eax
movb %al, %cl
movq (%rdi), %rax
movzbl %sil, %esi
movzbl %dl, %edx
movzbl %cl, %ecx
callq *0x78(%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x359cb
jmp 0x35a1e
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x359bb
addq $0x30, %rsp
popq %rbp
retq
nop
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::Draw(XColor, unsigned char, unsigned char)
void XGPU::Draw(XColor color, uint8_t y, uint8_t x) {
    XSetForeground(display, gc, color.pixel);
    XFillRectangle(
        display,
        window,
        gc,
        (x*windowScalar), // x
        (y*windowScalar), // y
        (1*windowScalar), // width
        (1*windowScalar) // height
    );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %r8b, %al
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movb %cl, -0x19(%rbp)
movb %al, -0x1a(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq 0x5a20(%rax), %rdi
movq 0x5a38(%rax), %rsi
movq -0x10(%rbp), %rdx
callq 0x5120
movq -0x28(%rbp), %rax
movq 0x5a20(%rax), %rdi
movq 0x5a30(%rax), %rsi
movq 0x5a38(%rax), %rdx
movzbl -0x1a(%rbp), %ecx
movzbl 0x5a90(%rax), %r8d
imull %r8d, %ecx
movzbl -0x19(%rbp), %r8d
movzbl 0x5a90(%rax), %r9d
imull %r9d, %r8d
movzbl 0x5a90(%rax), %r9d
shll $0x0, %r9d
movzbl 0x5a90(%rax), %eax
shll $0x0, %eax
movl %eax, (%rsp)
callq 0x5220
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: RegulusImpact[P]sadboy/src/Graphics/XGPU.cpp
// Function: XGPU::DumpTiles()
void XGPU::DumpTiles() {
    uint16_t tileRow = 3;
    uint16_t tile = 0;

	for (uint16_t t = 0; t < 32; t++) {
	    if (15 < tile) {
	        tileRow++;
	        tile = 0;
	    }

	    for (uint8_t y = 0; y < 8; y++) {
    	    for (uint8_t x = 0; x < 8; x++) {
    	        uint8_t p = mmu->tiles[t][y][x];
                Draw(mmu->bgp[p], (tileRow*9)+y, (tile*10)+x);
    	    }
    	}

    	tile++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movw $0x3, -0xa(%rbp)
movw $0x0, -0xc(%rbp)
movw $0x0, -0xe(%rbp)
movzwl -0xe(%rbp), %eax
cmpl $0x20, %eax
jge 0x35c5b
movzwl -0xc(%rbp), %ecx
movl $0xf, %eax
cmpl %ecx, %eax
jge 0x35b92
movw -0xa(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xa(%rbp)
movw $0x0, -0xc(%rbp)
movb $0x0, -0xf(%rbp)
movzbl -0xf(%rbp), %eax
cmpl $0x8, %eax
jge 0x35c3e
movb $0x0, -0x10(%rbp)
movzbl -0x10(%rbp), %eax
cmpl $0x8, %eax
jge 0x35c2f
movq -0x20(%rbp), %rdi
movq 0x5a98(%rdi), %rax
addq $0xe3aa, %rax           # imm = 0xE3AA
movzwl -0xe(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movzbl -0xf(%rbp), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movzbl -0x10(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x11(%rbp)
movq 0x5a98(%rdi), %rax
movzbl -0x11(%rbp), %ecx
movb 0xe39e(%rax,%rcx), %sil
movzwl -0xa(%rbp), %eax
imull $0x9, %eax, %eax
movzbl -0xf(%rbp), %ecx
addl %ecx, %eax
movb %al, %dl
movzwl -0xc(%rbp), %eax
imull $0xa, %eax, %eax
movzbl -0x10(%rbp), %ecx
addl %ecx, %eax
movb %al, %cl
movq (%rdi), %rax
movzbl %sil, %esi
movzbl %dl, %edx
movzbl %cl, %ecx
callq *0x78(%rax)
movb -0x10(%rbp), %al
addb $0x1, %al
movb %al, -0x10(%rbp)
jmp 0x35ba7
jmp 0x35c31
movb -0xf(%rbp), %al
addb $0x1, %al
movb %al, -0xf(%rbp)
jmp 0x35b96
movw -0xc(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xc(%rbp)
movw -0xe(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xe(%rbp)
jmp 0x35b66
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: IHorvalds[P]RomAna/./processing/special_characters.hpp
// Function: specialChars::isPunctuation(char*)
int isPunctuation(char* str) {
    // TODO: Alex the problem is: str[1] can be ngative, so it moves the sign-bit forward and changes everything.
    // Encore un problem: str[0] is a byte. When you shift by 8...
    int hash = (str[0] << 8) ^ str[1];
    for (unsigned i = 0; i < count_punctuation_2byte; i++)
      if (hash == punctuation_2byte[i])
        return 2;
    if (strlen(str) == 2)
      return 0;
    
    hash = (hash << 8) ^ str[2];
    for (unsigned i = 0; i < count_punctuation_3byte; i++)
      if (hash == punctuation_3byte[i])
        return 3;
    return 0;
  }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movsbl (%rax), %eax
shll $0x8, %eax
movq 0x18(%rsp), %rcx
movsbl 0x1(%rcx), %ecx
xorl %ecx, %eax
movl %eax, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
cmpl $0x2, 0x10(%rsp)
jae 0x4b44
movl 0x14(%rsp), %eax
movl 0x10(%rsp), %ecx
movl %ecx, %edx
leaq 0x1786d(%rip), %rcx     # 0x1c390
cmpl (%rcx,%rdx,4), %eax
jne 0x4b35
movl $0x2, 0x24(%rsp)
jmp 0x4bba
jmp 0x4b37
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x4b0b
movq 0x18(%rsp), %rdi
callq 0x4180
cmpq $0x2, %rax
jne 0x4b5e
movl $0x0, 0x24(%rsp)
jmp 0x4bba
movl 0x14(%rsp), %eax
shll $0x8, %eax
movq 0x18(%rsp), %rcx
movsbl 0x2(%rcx), %ecx
xorl %ecx, %eax
movl %eax, 0x14(%rsp)
movl $0x0, 0xc(%rsp)
cmpl $0x4, 0xc(%rsp)
jae 0x4bb2
movl 0x14(%rsp), %eax
movl 0xc(%rsp), %ecx
movl %ecx, %edx
leaq 0x1780c(%rip), %rcx     # 0x1c3a0
cmpl (%rcx,%rdx,4), %eax
jne 0x4ba3
movl $0x3, 0x24(%rsp)
jmp 0x4bba
jmp 0x4ba5
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x4b7c
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: IHorvalds[P]RomAna/./processing/InflexEngineCore.cpp
// Function: InflexEngine::staticTrieAccess(unsigned int)
InflexEngineNode* InflexEngine::staticTrieAccess(uint32_t ptr) {
// Performs a black-box access on the modified trie, when it gets expanded
  // Included in staticTrie?
  if (ptr < size)
    return staticTrie + ptr;
  
  // No? Then use auxTrie
  int32_t index = ptr - size;
  int32_t oldSize = auxTrieSize;
  
  // Is index contained in the old auxInflexEngine?
  if (index >= oldSize) {
    // Check for the first entrance in this case (auxTrieSize == 0)
    auxTrieSize = (!auxTrieSize) ? EXPAND_TRIE_CONSTANT : (auxTrieSize * EXPAND_TRIE_CONSTANT);
    
    // Realloc the entire auxTrie
    auxTrie = (InflexEngineNode*)realloc(auxTrie, auxTrieSize * sizeof(InflexEngineNode));
    
    // Init the new allocated enInflexEngines
    for (unsigned i = oldSize; i < auxTrieSize; i++) {
      auxTrie[i].code = 0;
      auxTrie[i].parent = 0;      
      auxTrie[i].sons = new uint32_t[sigma]();
      auxTrie[i].configuration = fullBits; // 31 bits
    }
  }
  return auxTrie + index;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq 0x38(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x18(%rcx), %eax
jae 0x4c0e
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x34(%rsp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
jmp 0x4d65
movq 0x20(%rsp), %rax
movl 0x34(%rsp), %ecx
subl 0x18(%rax), %ecx
movl %ecx, 0x30(%rsp)
movl 0x1c(%rax), %eax
movl %eax, 0x2c(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jl 0x4d4b
movq 0x20(%rsp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x4c49
movl $0x10, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4c58
movq 0x20(%rsp), %rax
movl 0x1c(%rax), %eax
shll $0x4, %eax
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
movl %ecx, 0x1c(%rax)
movq 0x10(%rax), %rdi
movl 0x1c(%rax), %eax
imulq $0x14, %rax, %rsi
callq 0x45b0
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rax)
movl 0x2c(%rsp), %eax
movl %eax, 0x28(%rsp)
movq 0x20(%rsp), %rcx
movl 0x28(%rsp), %eax
cmpl 0x1c(%rcx), %eax
jae 0x4d49
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rcx
movl 0x28(%rsp), %edx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, (%rcx)
movq 0x10(%rax), %rcx
movl 0x28(%rsp), %edx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x4(%rcx)
movl 0x20(%rax), %eax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, 0x8(%rsp)
callq 0x4030
movq 0x8(%rsp), %rdx
movq %rax, %rdi
movq %rdi, 0x10(%rsp)
xorl %esi, %esi
callq 0x41b0
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rcx
movl 0x28(%rsp), %esi
imulq $0x14, %rsi, %rsi
addq %rsi, %rcx
movq %rdx, 0xc(%rcx)
movl 0x24(%rax), %ecx
movq 0x10(%rax), %rax
movl 0x28(%rsp), %edx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x4c88
jmp 0x4d4b
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x30(%rsp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
nop
// File: IHorvalds[P]RomAna/./processing/InflexEngineCore.cpp
// Function: InflexEngine::updateFreqOfPointer(int)
void InflexEngine::updateFreqOfPointer(int32_t ptr) {
  // If derivated, increase frequency for root
  // If root, increase frequency for itself
  // Reminder: the first bit of code is occupied - that's why += 2!
  if (!(staticTrieAccess(ptr)->code & 1))
    staticTrieAccess(staticTrieAccess(ptr)->code >> 1)->code += 2;
  else
    staticTrieAccess(ptr)->code += 2;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
movl 0xc(%rsp), %esi
callq 0x4bd0
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x4dbc
movq (%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x4bd0
movq (%rsp), %rdi
movl (%rax), %esi
shrl %esi
callq 0x4bd0
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
jmp 0x4dd0
movq (%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x4bd0
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)