LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::RRC(unsigned char*)
void CPU::RRC(uint8_t *r8) {                // RRC r8
  // Set Carry flag according to 7th Bit
  this->setCarryFlag((*r8 & 0x01) != 0);

  // Carry 7th Bit over
  *r8 = (*r8 >> 1) | ((this->reg.F & 0x10) << 3);

  // Set Flags
  if (*r8 == 0)
    this->setZeroFlag(true);
  this->setAddSubFlag(false);
  this->setHalfCarryFlag(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzbl (%rsi), %esi
andl $0x1, %esi
callq 0x236b6
movb (%r14), %al
shrb %al
movb 0x11d(%rbx), %cl
shlb $0x3, %cl
andb $-0x80, %cl
orb %al, %cl
movb %cl, (%r14)
jne 0x2edcd
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2367e
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2369a
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::SLA(unsigned char*)
void CPU::SLA(uint8_t *r8) {               // SLA r8
  // Set Carry from Left Shift
  this->setCarryFlag((*r8 & 0x80) != 0);

  // Shift Left
  *r8 = *r8 << 1;

  // Set Flags
  if (*r8 == 0)
    this->setZeroFlag(true);
  this->setAddSubFlag(false);
  this->setHalfCarryFlag(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movb (%rsi), %al
shrb $0x7, %al
movzbl %al, %esi
callq 0x236b6
movb (%r14), %al
addb %al, %al
movb %al, (%r14)
jne 0x2ee8d
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2367e
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2369a
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::SRA(unsigned char*)
void CPU::SRA(uint8_t *r8) {               // SRA r8
  // Set Carry from Right Shift
  this->setCarryFlag((*r8 & 0x01) != 0);

  // Shift Arithmetic Right
  uint8_t topBit = *r8 & 0x80;
  *r8 = topBit | (*r8 >> 1);

  // Set Flags
  if (*r8 == 0)
    this->setZeroFlag(true);
  this->setAddSubFlag(false);
  this->setHalfCarryFlag(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzbl (%rsi), %esi
andl $0x1, %esi
callq 0x236b6
movb (%r14), %al
movl %eax, %ecx
andb $-0x80, %cl
shrb %al
orb %cl, %al
movb %al, (%r14)
jne 0x2ef2c
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2367e
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2369a
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::SRL(unsigned char*)
void CPU::SRL(uint8_t *r8) {                // SRL r8
  // Set Carry from Right Shift
  this->setCarryFlag((*r8 & 0x01) != 0);

  // Shift Logic Right
  *r8 = *r8 >> 1;

  // Set Flags
  if (*r8 == 0)
    this->setZeroFlag(true);
  this->setAddSubFlag(false);
  this->setHalfCarryFlag(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzbl (%rsi), %esi
andl $0x1, %esi
callq 0x236b6
movb (%r14), %al
movl %eax, %ecx
shrb %cl
movb %cl, (%r14)
cmpb $0x1, %al
ja 0x2efc7
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2367e
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2369a
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::LDHLI()
void CPU::LDHLI() {            // LD [HLI], A
  uint16_t HL = (this->reg.H << 8) | this->reg.L;

  this->memory.write(HL, this->reg.A);
  HL++;

  this->reg.H = HL >> 8;
  this->reg.L = HL & 0xFF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzwl 0x11e(%rdi), %r14d
rolw $0x8, %r14w
addq $0x130, %rdi            # imm = 0x130
movzbl 0x118(%rbx), %edx
movzwl %r14w, %esi
callq 0x2fc46
leal 0x1(%r14), %eax
rolw $0x8, %ax
movw %ax, 0x11e(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::LDHLD()
void CPU::LDHLD() {                         // LD [HLD], A
  uint16_t HL = (this->reg.H << 8) | this->reg.L;

  this->memory.write(HL, this->reg.A);
  HL--;

  this->reg.H = HL >> 8;
  this->reg.L = HL & 0xFF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzwl 0x11e(%rdi), %r14d
rolw $0x8, %r14w
addq $0x130, %rdi            # imm = 0x130
movzbl 0x118(%rbx), %edx
movzwl %r14w, %esi
callq 0x2fc46
leal -0x1(%r14), %eax
rolw $0x8, %ax
movw %ax, 0x11e(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::CALL(unsigned short)
void CPU::CALL(uint16_t u16) {                  // CALL, u16
  // Push Address to Stack
  uint16_t offsetAddr = this->PC + 0x03;        // Offset from CALL
  this->PUSH(&offsetAddr);

  // JP to address
  this->PC = u16 - 0x03;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl 0x12c(%rdi), %eax
addl $0x3, %eax
leaq -0x12(%rbp), %rsi
movw %ax, (%rsi)
callq 0x2f210
addl $-0x3, %ebx
movw %bx, 0x12c(%r14)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::CALL(ConditionCode, unsigned short)
void CPU::CALL(ConditionCode cc, uint16_t a16) {   // CALL cc, u16
  this->extraCycles = 3;

  switch (cc) {
    case Z:
      if ((this->reg.F & 0x80) != 0)
        return this->CALL(a16);
      break;
    case NZ:
      if ((this->reg.F & 0x80) == 0)
        return this->CALL(a16);
      break;
    case C:
      if ((this->reg.F & 0x10) != 0)
        return this->CALL(a16);
      break;
    case NC:
      if ((this->reg.F & 0x10) == 0)
        return this->CALL(a16);
      break;
  }

  this->extraCycles = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x3, 0xc(%rdi)
cmpl $0x3, %esi
ja 0x2f2a1
movl %esi, %eax
leaq 0x6cc09(%rip), %rcx     # 0x9be98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x11d(%rdi)
js 0x2f2c6
andl $0x0, 0xc(%rdi)
popq %rbp
retq
testb $0x10, 0x11d(%rdi)
je 0x2f2a1
jmp 0x2f2c6
testb $0x10, 0x11d(%rdi)
jne 0x2f2a1
jmp 0x2f2c6
cmpb $0x0, 0x11d(%rdi)
js 0x2f2a1
movzwl %dx, %esi
popq %rbp
jmp 0x2f1d6
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::JP(ConditionCode, unsigned short)
void CPU::JP(ConditionCode cc, uint16_t a16) {  // JP cc, u16
  this->extraCycles = 1;

  switch (cc) {
    case Z:
      if ((this->reg.F & 0x80) != 0)
        return this->JP(a16);
      break;
    case NZ:
      if ((this->reg.F & 0x80) == 0)
        return this->JP(a16);
      break;
    case C:
      if ((this->reg.F & 0x10) != 0)
        return this->JP(a16);
      break;
    case NC:
      if ((this->reg.F & 0x10) == 0)
        return this->JP(a16);
      break;
  }

  this->extraCycles = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1, 0xc(%rdi)
cmpl $0x3, %esi
ja 0x2f31b
movl %esi, %eax
leaq 0x6cb9f(%rip), %rcx     # 0x9bea8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x11d(%rdi)
js 0x2f340
andl $0x0, 0xc(%rdi)
jmp 0x2f34a
testb $0x10, 0x11d(%rdi)
je 0x2f31b
jmp 0x2f340
testb $0x10, 0x11d(%rdi)
jne 0x2f31b
jmp 0x2f340
cmpb $0x0, 0x11d(%rdi)
js 0x2f31b
addl $-0x3, %edx
movw %dx, 0x12c(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::JR(ConditionCode, signed char)
void CPU::JR(ConditionCode cc, int8_t e8) {     // JR cc, e8
  this->extraCycles = 1;

  switch (cc) {
    case Z:
      if ((this->reg.F & 0x80) != 0)
        return this->JR(e8);
      break;
    case NZ:
      if ((this->reg.F & 0x80) == 0)
        return this->JR(e8);
      break;
    case C:
      if ((this->reg.F & 0x10) != 0)
        return this->JR(e8);
      break;
    case NC:
      if ((this->reg.F & 0x10) == 0)
        return this->JR(e8);
      break;
  }

  this->extraCycles = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1, 0xc(%rdi)
cmpl $0x3, %esi
ja 0x2f385
movl %esi, %eax
leaq 0x6cb45(%rip), %rcx     # 0x9beb8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x11d(%rdi)
js 0x2f3aa
andl $0x0, 0xc(%rdi)
jmp 0x2f3b4
testb $0x10, 0x11d(%rdi)
je 0x2f385
jmp 0x2f3aa
testb $0x10, 0x11d(%rdi)
jne 0x2f385
jmp 0x2f3aa
cmpb $0x0, 0x11d(%rdi)
js 0x2f385
movsbl %dl, %eax
addw %ax, 0x12c(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::RET(ConditionCode)
void CPU::RET(ConditionCode cc) {                 // RET cc
  this->extraCycles = 3;

  switch (cc) {
    case Z:
      if ((this->reg.F & 0x80) != 0)
        return this->RET();
      break;
    case NZ:
      if ((this->reg.F & 0x80) == 0)
        return this->RET();
      break;
    case C:
      if ((this->reg.F & 0x10) != 0)
        return this->RET();
      break;
    case NC:
      if ((this->reg.F & 0x10) == 0)
        return this->RET();
      break;
  }

  this->extraCycles = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x3, 0xc(%rdi)
cmpl $0x3, %esi
ja 0x2f3e1
movl %esi, %eax
leaq 0x6caf9(%rip), %rcx     # 0x9bec8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x11d(%rdi)
js 0x2f406
andl $0x0, 0xc(%rdi)
popq %rbp
retq
testb $0x10, 0x11d(%rdi)
je 0x2f3e1
jmp 0x2f406
testb $0x10, 0x11d(%rdi)
jne 0x2f3e1
jmp 0x2f406
cmpb $0x0, 0x11d(%rdi)
js 0x2f3e1
popq %rbp
jmp 0x2f40c
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::ADDSP(signed char)
void CPU::ADDSP(int8_t e8) {                     // ADD SP, e8
  uint16_t result = this->SP + e8;

  // Set Flags
  this->setZeroFlag(false);
  this->setAddSubFlag(false);
  this->checkHalfCarry(this->SP >> 8, result >> 8);
  this->checkCarry_16(SP, SP + e8);

  this->SP = result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movzwl 0x12e(%rdi), %eax
addw %r14w, %ax
movzwl %ax, %r15d
xorl %esi, %esi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2367e
movzbl 0x12f(%rbx), %esi
movl %r15d, %edx
shrl $0x8, %edx
movq %rbx, %rdi
callq 0x236d2
movzwl 0x12e(%rbx), %esi
addl %esi, %r14d
movzwl %r14w, %edx
movq %rbx, %rdi
callq 0x23720
movw %r15w, 0x12e(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::LDHL(signed char)
void CPU::LDHL(int8_t e8) {                      // LD HL, SP+e8
  uint16_t result = this->SP + e8;

  // Set Flags
  this->setZeroFlag(false);
  this->setAddSubFlag(false);
  this->checkHalfCarry(this->SP >> 8, result >> 8);
  this->checkCarry_16(SP, SP + e8);

  // Store into HL
  this->reg.H = this->SP << 8;
  this->reg.L = this->SP & 0xFF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movzwl 0x12e(%rdi), %eax
addw %r14w, %ax
movzwl %ax, %r15d
xorl %esi, %esi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2367e
movzbl 0x12f(%rbx), %esi
shrl $0x8, %r15d
movq %rbx, %rdi
movl %r15d, %edx
callq 0x236d2
movzwl 0x12e(%rbx), %esi
addl %esi, %r14d
movzwl %r14w, %edx
movq %rbx, %rdi
callq 0x23720
movb $0x0, 0x11e(%rbx)
movb 0x12e(%rbx), %al
movb %al, 0x11f(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::CCF()
void CPU::CCF() {                                // CCF
  // Set Flags
  this->setAddSubFlag(false);
  this->setHalfCarryFlag(false);
  this->reg.F ^= 0x10;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0x2367e
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2369a
xorb $0x10, 0x11d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::CPL()
void CPU::CPL() {                                // CPL
  this->reg.A = ~this->reg.A;

  // Set Flags
  this->setZeroFlag(false);
  this->setHalfCarryFlag(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
notb 0x118(%rdi)
xorl %esi, %esi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2369a
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::DAA()
void CPU::DAA() {                                // DAA
  uint8_t A = this->reg.A;
  bool isAddedSix = false;

  // Addition
  if (!(this->reg.F & 0x40)) {
    if (this->reg.F & 0x20 || (A & 0x0F) > 0x09) {
      A += 0x06;
      isAddedSix = true;
    }
    if (this->reg.F & 0x10 || A > 0x9F || isAddedSix && A < 0x06) { // PATCHED END: If overflow from prev A
      A += 0x60;
      this->setCarryFlag(true);
    }
  }
  
  // Subtraction
  else {
    if (this->reg.F & 0x20) {
      A -= 0x06;
    }
    if (this->reg.F & 0x10) {
      A -= 0x60;
    }
  }

  this->setZeroFlag(A == 0);
  this->setHalfCarryFlag(false);

  // Set the Value
  this->reg.A = A;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb 0x118(%rdi), %cl
movzbl 0x11d(%rdi), %eax
testb $0x40, %al
jne 0x2f841
movl %eax, %esi
andl $0x20, %esi
shrl $0x5, %esi
movl %ecx, %edx
andb $0xe, %dl
cmpb $0xa, %dl
setae %dl
orb %sil, %dl
movzbl %cl, %esi
addb $0x6, %cl
movzbl %cl, %r14d
testb %dl, %dl
cmovel %esi, %r14d
cmpb $0x6, %r14b
setb %cl
testb $0x10, %al
jne 0x2f830
cmpb $-0x61, %r14b
ja 0x2f830
andb %cl, %dl
je 0x2f85c
addb $0x60, %r14b
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x236b6
jmp 0x2f85c
leal -0x6(%rcx), %edx
testb $0x20, %al
movzbl %cl, %ecx
movzbl %dl, %edx
cmovel %ecx, %edx
leal -0x60(%rdx), %ecx
testb $0x10, %al
movzbl %cl, %r14d
cmovel %edx, %r14d
xorl %esi, %esi
testb %r14b, %r14b
sete %sil
movq %rbx, %rdi
callq 0x23662
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2369a
movb %r14b, 0x118(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Instructions.cc
// Function: CPU::SCF()
void CPU::SCF() {                                // SCF
  // Set Flags
  this->setAddSubFlag(false);
  this->setHalfCarryFlag(false);
  this->setCarryFlag(true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0x2367e
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2369a
pushq $0x1
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x236b6
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Memory.cc
// Function: Memory::Memory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Memory::Memory(std::string ROMPath) {
  std::cout << "Dumping ROM...\n";
  dumpROM(ROMPath);

  // Populate Memory
  std::cout << "Populating Memory...\n";
  if (disassembledROM.size() >= 0x7FFF) {
    for (int i = 0; i <= 0x7FFF; i++) {
      memory[i] = disassembledROM[i];
    }
  } else {
    // TODO: Halt, bad dump
  }

  // TODO: Intitial Values
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movl $0x10018, %edx          # imm = 0x10018
movq %r14, %rdi
xorl %esi, %esi
callq 0xc270
movq 0xaf5f7(%rip), %rdi     # 0xdef00
leaq 0x6c5c8(%rip), %rsi     # 0x9bed8
callq 0xc520
leaq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0xc4c0
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x2f9a0
leaq -0x38(%rbp), %rdi
callq 0xc5d0
movq 0xaf5c3(%rip), %rdi     # 0xdef00
leaq 0x6c5a4(%rip), %rsi     # 0x9bee8
callq 0xc520
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
cmpq $0x7fff, %rcx           # imm = 0x7FFF
jb 0x2f974
xorl %ecx, %ecx
cmpq $0x8000, %rcx           # imm = 0x8000
je 0x2f974
movb (%rax,%rcx), %dl
movb %dl, 0x20(%rbx,%rcx)
incq %rcx
jmp 0x2f95f
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0xc5d0
jmp 0x2f990
movq %rax, %rbx
movq %r14, %rdi
callq 0x2d4a4
movq %rbx, %rdi
callq 0xc580
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Memory.cc
// Function: Memory::dumpROM(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Memory::dumpROM(std::string ROMPath) {
  std::ifstream infile;
  infile.open(ROMPath);

  // Check if file exists
  if (!infile) {
    std::cout << "ROM not found" << std::endl;
    return;
  }

  // Allocate Space
  disassembledROM.clear();
  disassembledROM.reserve(1024 * 32);

  uint8_t buffer[1];
  for (int i=0; !infile.eof(); i++) {
    infile.read((char *) buffer, 1);
    if (infile.gcount())
      disassembledROM.push_back(buffer[0]);
  }
  std::cout << "ROM Disassembled!\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x230(%rbp), %r15
movq %r15, %rdi
callq 0xc2f0
pushq $0x8
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc1b0
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x210(%rbp,%rax)
je 0x2fa07
movq 0xaf50f(%rip), %rdi     # 0xdef00
leaq 0x6c506(%rip), %rsi     # 0x9befe
callq 0xc520
movq %rax, %rdi
callq 0xc8b0
jmp 0x2fa82
leaq 0x8(%r14), %rbx
movq 0x8(%r14), %rax
cmpq %rax, 0x10(%r14)
je 0x2fa19
movq %rax, 0x10(%r14)
movl $0x8000, %esi           # imm = 0x8000
movq %rbx, %rdi
callq 0x2fd50
leaq -0x230(%rbp), %r14
leaq -0x21(%rbp), %r15
pushq $0x1
popq %r12
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x210(%rbp,%rax)
jne 0x2fa6f
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xc460
cmpq $0x0, -0x228(%rbp)
je 0x2fa35
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2fdda
jmp 0x2fa35
movq 0xaf48a(%rip), %rdi     # 0xdef00
leaq 0x6c48f(%rip), %rsi     # 0x9bf0c
callq 0xc520
leaq -0x230(%rbp), %rdi
callq 0xc030
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2faa2
jmp 0x2faa2
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
callq 0xc030
movq %rbx, %rdi
callq 0xc580
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Memory.cc
// Function: Memory::dump(std::ostream&)
void Memory::dump(std::ostream &out) {
  std::ios init(nullptr);
  init.copyfmt(out);
  out << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << 0 << ": ";

  int j = 0;
  for (int i = 0; i < 0xFFFF; i++) {
    if (j == 16) {
      j = 0;
      out << "\n" << std::setw(4) << i << ": ";
    }
    j++;
    out << std::setw(2) << (int)memory[i] << (j == 8 ? "\t\t" : " ");
  }
  out.copyfmt(init);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x130(%rbp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xc630
movq (%rbx), %rax
movq -0x18(%rax), %rsi
addq %rbx, %rsi
movq %r15, %rdi
callq 0xc260
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), %rax
orl $0x4000, 0x18(%rbx,%rax) # imm = 0x4000
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0xc680
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0xc280
leaq 0x68542(%rip), %rsi     # 0x98086
movq %rax, %rdi
callq 0xc520
xorl %r15d, %r15d
leaq 0x706da(%rip), %r13     # 0xa0230
xorl %r12d, %r12d
cmpq $0xffff, %r15           # imm = 0xFFFF
je 0x2fbeb
cmpl $0x10, %r12d
jne 0x2fba8
movq %rbx, %rdi
leaq 0x79051(%rip), %rsi     # 0xa8bc7
callq 0xc520
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq %rax, %rdi
movl %r15d, %esi
callq 0xc280
xorl %r12d, %r12d
movq %rax, %rdi
leaq 0x684e3(%rip), %rsi     # 0x98086
callq 0xc520
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x2, 0x10(%rbx,%rax)
movzbl 0x20(%r14,%r15), %esi
movq %rbx, %rdi
callq 0xc280
incl %r12d
cmpl $0x8, %r12d
movq %r13, %rsi
leaq 0x6c348(%rip), %rcx     # 0x9bf1f
cmoveq %rcx, %rsi
movq %rax, %rdi
callq 0xc520
incq %r15
jmp 0x2fb59
movq (%rbx), %rax
addq -0x18(%rax), %rbx
leaq -0x130(%rbp), %rsi
movq %rbx, %rdi
callq 0xc260
leaq -0x130(%rbp), %rdi
callq 0xc620
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2fc23
jmp 0x2fc23
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xc620
movq %rbx, %rdi
callq 0xc580
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Memory.cc
// Function: Memory::write(unsigned short, unsigned char)
void Memory::write(uint16_t address, uint8_t value) {
  // TODO: MBC Switch
  if (address < 0x7FFF) {

  }

  // Output Serial Link
  else if (address == 0xFF02 && value == 0x81) {
//    std::cout << "Serial Link Value: " << std::hex << (int)this->read(0xFF01) << '\n';
    std::cout << (char)this->read(0xFF01);

    // Serial Write Interrupt
    memory[0xFF0F] |= 0x08;
  }

  // VRAM Write
  else if (address >= 0x8000 && address <= 0x9FFF && *(this->LCDMode) != 3) {
    memory[address] = value;
  }

  // Reset DIV if writen to
  else if (address == 0xFF04) {
    memory[0xFF04] = 0;
  }

  // Prohibited Areas, NO.
  else if (!(address >= 0xE000 && address <= 0xFDFF) && !(address >= 0xFEA0 && address <= 0xFEFF)) {
    memory[address] = value;
  }

  else {
    // Writing out of range
    std::cout << "Memory.write [" << std::hex << address << std::dec << "]: INVALID RANGE!\n";
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
cmpw $0x7fff, %bx            # imm = 0x7FFF
jb 0x2fd4a
movq %rdi, %r14
cmpw $0xff02, %bx            # imm = 0xFF02
setne %al
cmpb $-0x7f, %dl
setne %cl
orb %al, %cl
jne 0x2fc90
movsbl 0xff21(%r14), %esi
movq 0xaf282(%rip), %rdi     # 0xdef00
callq 0xc590
orb $0x8, 0xff2f(%r14)
jmp 0x2fd4a
cmpw $0x7fff, %bx            # imm = 0x7FFF
sete %al
cmpw $0xa000, %bx            # imm = 0xA000
setae %cl
orb %al, %cl
jne 0x2fcb5
movq 0x10020(%r14), %rax
cmpb $0x3, (%rax)
je 0x2fcc9
jmp 0x2fd42
cmpw $0xff04, %bx            # imm = 0xFF04
jne 0x2fcc9
movb $0x0, 0xff24(%r14)
jmp 0x2fd4a
leal 0x2000(%rbx), %eax
cmpw $0x1e00, %ax            # imm = 0x1E00
setb %al
leal 0x160(%rbx), %ecx
cmpw $0x60, %cx
setb %cl
orb %al, %cl
je 0x2fd42
movq 0xaf212(%rip), %rdi     # 0xdef00
leaq 0x6c22d(%rip), %rsi     # 0x9bf22
callq 0xc520
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movzwl %bx, %esi
movq %rax, %rdi
callq 0xc290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x6c1fb(%rip), %rsi     # 0x9bf31
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xc520
movzwl %bx, %eax
movb %dl, 0x20(%r14,%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/Opcode.cc
// Function: Opcode::Opcode(unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned short, unsigned short, std::function<void ()>)
Opcode::Opcode(uint8_t opcode, std::string label, uint16_t machineCycles, uint16_t length, std::function<void()> exec) {
    this->opcode = opcode;
    this->label = label;
    this->machineCycles = machineCycles;
    this->length = length;
    this->exec = exec;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movl %r8d, %r12d
movl %ecx, %r13d
movq %rdi, %rbx
leaq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
addq $0x8, %rdi
movb $0x0, 0x18(%rbx)
leaq 0x30(%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movb %sil, (%rbx)
movq %rdi, -0x30(%rbp)
movq %rdx, %rsi
callq 0xc950
movw %r13w, 0x28(%rbx)
movw %r12w, 0x2a(%rbx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2ffe2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x2d07c
movq -0x30(%rbp), %rdi
callq 0xc5d0
movq %rbx, %rdi
callq 0xc580
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/PPU.cc
// Function: PPU::PPU(CPU*, Memory*)
PPU::PPU(CPU *cpu, Memory *memory) {
  this->cpu = cpu;
  this->memory = memory;
  this->LY = 0x90;
  this->currentFrame = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rsi, 0x18(%rdi)
movq %rdx, 0x10(%rdi)
movb $-0x70, 0x20(%rdi)
andq $0x0, 0x8(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/PPU.cc
// Function: PPU::execute()
void PPU::execute() {
  // Set current LY Value for CPU
  if (memory->read(0xFF40) & 0x80) {
    memory->write(0xFF44, this->LY);
  } else {
    memory->write(0xFF44, 0);
  }

  // Determine LCDMode based on LY State
  if (this->LY < 144) {
    if (cpu->cyclesLeft > 94) {
      this->LCDMode = 2;
    } else if (cpu->cyclesLeft > 22) {
      this->LCDMode = 3;
    } else if (cpu->cyclesLeft < 22) {
      this->LCDMode = 0;
    }
  } else {
    this->LCDMode = 1;
  }

  // Update PPU and CPU state based on both
  //  CPU's current States
  if (cpu->cyclesLeft <= 0) { // End of current scanline
    if (this->LY == 143) {
      // VBlank Area
      uint8_t IF = memory->read(0xFF0F);
      IF |= 0x01;
      memory->write(0xFF0F, IF);

      this->LY = 144;
      this->currentFrame++;
      cpu->cyclesLeft += 114;   // Account for Extra Cycles Taken
    } else {
      this->LY = (this->LY + 1) % 154;
      cpu->cyclesLeft += 114;
    }
  }

  // Execute CPU
  cpu->execute();

  // TODO: Perform PPU functions based on current LCD Mode
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movl $0xff40, %esi           # imm = 0xFF40
callq 0x2fc3a
movq 0x10(%rbx), %rdi
sarb $0x7, %al
andb 0x20(%rbx), %al
movzbl %al, %edx
movl $0xff44, %esi           # imm = 0xFF44
callq 0x2fc46
movb 0x20(%rbx), %al
cmpb $-0x71, %al
ja 0x3010b
movq 0x18(%rbx), %rcx
movl 0x8(%rcx), %edx
movb $0x2, %sil
cmpl $0x5e, %edx
jg 0x300ff
movb $0x3, %sil
cmpl $0x16, %edx
jle 0x30154
movb %sil, (%rbx)
addq $0x18, %rbx
movq %rbx, %r14
jmp 0x30173
movb $0x1, (%rbx)
movq 0x18(%rbx), %rcx
movl 0x8(%rcx), %edx
leaq 0x18(%rbx), %r14
testl %edx, %edx
jg 0x30173
cmpb $-0x71, %al
jne 0x3015b
movq 0x10(%rbx), %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x2fc3a
orb $0x1, %al
movq 0x10(%rbx), %rdi
movzbl %al, %edx
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x2fc46
movb $-0x70, 0x20(%rbx)
incq 0x8(%rbx)
movq 0x18(%rbx), %rax
addl $0x72, 0x8(%rax)
jmp 0x30173
je 0x30102
movb $0x0, (%rbx)
jmp 0x30115
cmpb $-0x67, %al
pushq $0x1
popq %rsi
pushq $0x67
popq %rdi
cmovbl %esi, %edi
addb %al, %dil
movb %dil, 0x20(%rbx)
addl $0x72, %edx
movl %edx, 0x8(%rcx)
movq (%r14), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x241be
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/main.cc
// Function: handleEventPolling(CPU*)
void handleEventPolling(CPU *cpu) {
  SDL_Event windowEvent;

  while (SDL_PollEvent(&windowEvent) != 0) {
    ImGui_ImplSDL2_ProcessEvent(&windowEvent);

    // Check if close button was clicked
    if (windowEvent.type == SDL_QUIT) {
      std::cout << "Quitting...\n";
      cpu->stop();
      return;
    }

    switch (windowEvent.type) {
    // Handle Key Presses
    case SDL_KEYDOWN:
      if (windowEvent.key.keysym.sym == SDL_KeyCode::SDLK_s) {
        if (keystate.step_instr_hold == 0)
          keystate.step_instr = true;
        keystate.step_instr_hold++;
      }
      if (windowEvent.key.keysym.sym == SDL_KeyCode::SDLK_m) {
        if (keystate.step_frame_hold == 0)
          keystate.step_frame = true;
        keystate.step_frame_hold++;
      }


      break;
    case SDL_KEYUP:
      // TODO: Key Press Here
      if (windowEvent.key.keysym.sym == SDL_KeyCode::SDLK_s) {
        keystate.step_instr = false;
        keystate.step_instr_hold = 0;
      }
      if (windowEvent.key.keysym.sym == SDL_KeyCode::SDLK_m) {
        keystate.step_frame = false;
        keystate.step_frame_hold = 0;
      }

      break;

    default:
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0xc920
testl %eax, %eax
je 0x30255
movq %r14, %rdi
callq 0x95268
movl -0x48(%rbp), %eax
cmpl $0x300, %eax            # imm = 0x300
je 0x301e1
cmpl $0x301, %eax            # imm = 0x301
je 0x301c4
cmpl $0x100, %eax            # imm = 0x100
jne 0x30192
jmp 0x3023a
movl -0x34(%rbp), %eax
cmpl $0x6d, %eax
je 0x30209
cmpl $0x73, %eax
jne 0x30192
movb $0x0, 0xb3998(%rip)     # 0xe3b70
andl $0x0, 0xb3995(%rip)     # 0xe3b74
jmp 0x30192
movl -0x34(%rbp), %eax
cmpl $0x6d, %eax
je 0x3021c
cmpl $0x73, %eax
jne 0x30192
movl 0xb3980(%rip), %eax     # 0xe3b74
testl %eax, %eax
jne 0x301ff
movb $0x1, 0xb3971(%rip)     # 0xe3b70
incl %eax
movl %eax, 0xb396d(%rip)     # 0xe3b74
jmp 0x30192
movb $0x0, 0xb3961(%rip)     # 0xe3b71
andl $0x0, 0xb3961(%rip)     # 0xe3b78
jmp 0x30192
movl 0xb3956(%rip), %eax     # 0xe3b78
testl %eax, %eax
jne 0x3022d
movb $0x1, 0xb3944(%rip)     # 0xe3b71
incl %eax
movl %eax, 0xb3943(%rip)     # 0xe3b78
jmp 0x30192
movq 0xaecbf(%rip), %rdi     # 0xdef00
leaq 0x6be04(%rip), %rsi     # 0x9c04c
callq 0xc520
movq %rbx, %rdi
callq 0x24576
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/main.cc
// Function: ImGui_NewFrame()
inline void ImGui_NewFrame() {
  // Start the Dear ImGui frame
  ImGui_ImplOpenGL3_NewFrame();
  ImGui_ImplSDL2_NewFrame(window);
  ImGui::NewFrame();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x95e5f
movq 0xb24c1(%rip), %rdi     # 0xe3b68
callq 0x955ee
popq %rbp
jmp 0x38b5e
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/../include/imgui_club/imgui_memory_editor/imgui_memory_editor.h
// Function: MemoryEditor::DrawWindow(char const*, void*, unsigned long, unsigned long)
void DrawWindow(const char* title, void* mem_data, size_t mem_size, size_t base_display_addr = 0x0000)
    {
        Sizes s;
        CalcSizes(s, mem_size, base_display_addr);
        ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(s.WindowWidth, FLT_MAX));

        Open = true;
        if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar))
        {
            if (ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows) && ImGui::IsMouseReleased(ImGuiMouseButton_Right))
                ImGui::OpenPopup("context");
            DrawContents(mem_data, mem_size, base_display_addr);
            if (ContentsWidthChanged)
            {
                CalcSizes(s, mem_size, base_display_addr);
                ImGui::SetWindowSize(ImVec2(s.WindowWidth, ImGui::GetWindowSize().y));
            }
        }
        ImGui::End();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, -0x30(%rbp)
movq %rsi, %r13
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %r12
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
andq $0x0, 0x20(%r12)
movq %r12, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x31838
leaq -0x38(%rbp), %rdi
andq $0x0, (%rdi)
movss 0x24(%r12), %xmm0
leaq -0x40(%rbp), %rsi
movss %xmm0, (%rsi)
movl $0x7f7fffff, 0x4(%rsi)  # imm = 0x7F7FFFFF
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x429f0
movb $0x1, (%r15)
pushq $0x8
popq %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x3bad8
testb %al, %al
je 0x317b4
pushq $0x3
popq %rdi
callq 0x425a6
testb %al, %al
je 0x3175c
pushq $0x1
popq %rdi
callq 0x40253
testb %al, %al
je 0x3175c
leaq 0x6db64(%rip), %rdi     # 0x9f2b9
xorl %esi, %esi
callq 0x446ff
movq %r15, %rdi
movq -0x30(%rbp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3197e
cmpb $0x1, 0x38(%r15)
jne 0x317b4
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x31838
movss 0x24(%r12), %xmm0
movss %xmm0, -0x30(%rbp)
callq 0x4280b
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
leaq -0x38(%rbp), %rdi
movss -0x30(%rbp), %xmm1
movss %xmm1, (%rdi)
movss %xmm0, 0x4(%rdi)
xorl %esi, %esi
callq 0x42824
callq 0x3f958
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/main.cc
// Function: render(ImVec4, ImGuiIO&)
inline void render(ImVec4 clear_color, ImGuiIO& io) {
  ImGui::Render();
  glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
  glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
  glClear(GL_COLOR_BUFFER_BIT);
  ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
  SDL_GL_SwapWindow(window);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movaps %xmm1, -0x30(%rbp)
movaps %xmm0, -0x20(%rbp)
callq 0x3fc4d
cvttss2si 0x8(%rbx), %edx
cvttss2si 0xc(%rbx), %ecx
xorl %edi, %edi
xorl %esi, %esi
callq 0xc3b0
movaps -0x20(%rbp), %xmm0
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movaps -0x30(%rbp), %xmm2
movaps %xmm2, %xmm3
shufps $0x55, %xmm2, %xmm3     # xmm3 = xmm3[1,1],xmm2[1,1]
callq 0xc100
movl $0x4000, %edi           # imm = 0x4000
callq 0xc510
callq 0x37eb6
movq %rax, %rdi
callq 0x961ce
movq 0xb233b(%rip), %rdi     # 0xe3b68
addq $0x28, %rsp
popq %rbx
popq %rbp
jmp 0xc2d0
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/../include/imgui_club/imgui_memory_editor/imgui_memory_editor.h
// Function: MemoryEditor::DrawContents(void*, unsigned long, unsigned long)::UserData::Callback(ImGuiInputTextCallbackData*)
static int Callback(ImGuiInputTextCallbackData* data)
                        {
                            UserData* user_data = (UserData*)data->UserData;
                            if (!data->HasSelection())
                                user_data->CursorPos = data->CursorPos;
                            if (data->SelectionStart == 0 && data->SelectionEnd == data->BufTextLen)
                            {
                                // When not editing a byte, always rewrite its content (this is a bit tricky, since InputText technically "owns" the master copy of the buffer we edit it in there)
                                data->DeleteChars(0, data->BufTextLen);
                                data->InsertChars(0, user_data->CurrentBufOverwrite);
                                data->SelectionStart = 0;
                                data->SelectionEnd = 2;
                                data->CursorPos = 0;
                            }
                            return 0;
                        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movl 0x30(%rdi), %eax
movl 0x34(%rdi), %edx
cmpl %edx, %eax
jne 0x325e5
movl 0x2c(%rbx), %ecx
movl %ecx, 0x4(%r14)
testl %eax, %eax
jne 0x32613
cmpl 0x20(%rbx), %edx
jne 0x32613
movq %rbx, %rdi
xorl %esi, %esi
callq 0x84b9c
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x84c0a
movl $0x2, 0x34(%rbx)
andq $0x0, 0x2c(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/../include/imgui_club/imgui_memory_editor/imgui_memory_editor.h
// Function: MemoryEditor::FormatBinary(unsigned char const*, int) const
const char* FormatBinary(const uint8_t* buf, int width) const
    {
        IM_ASSERT(width <= 64);
        size_t out_n = 0;
        static char out_buf[64 + 8 + 1];
        int n = width / 8;
        for (int j = n - 1; j >= 0; --j)
        {
            for (int i = 0; i < 8; ++i)
                out_buf[out_n++] = (buf[j] & (1 << (7 - i))) ? '1' : '0';
            out_buf[out_n++] = ' ';
        }
        IM_ASSERT(out_n < IM_ARRAYSIZE(out_buf));
        out_buf[out_n] = 0;
        return out_buf;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x41, %edx
jge 0x33167
pushq $0x8
popq %rcx
movl %edx, %eax
cltd
idivl %ecx
movl %eax, %ecx
xorl %edx, %edx
pushq $0x7
popq %rdi
leaq 0xb0b6b(%rip), %rax     # 0xe3c90
testl %ecx, %ecx
jle 0x3315b
decq %rcx
movl %edi, %r8d
cmpl $-0x1, %r8d
je 0x33152
movzbl (%rsi,%rcx), %r9d
btl %r8d, %r9d
setae %r9b
xorb $0x31, %r9b
movb %r9b, (%rdx,%rax)
incq %rdx
decl %r8d
jmp 0x3312f
movb $0x20, (%rdx,%rax)
incq %rdx
jmp 0x33125
cmpq $0x49, %rdx
jae 0x33186
movb $0x0, (%rdx,%rax)
popq %rbp
retq
leaq 0x694f3(%rip), %rdi     # 0x9c661
leaq 0x69217(%rip), %rsi     # 0x9c38c
leaq 0x694f1(%rip), %rcx     # 0x9c66d
movl $0x269, %edx            # imm = 0x269
callq 0xc140
leaq 0x69523(%rip), %rdi     # 0x9c6b0
leaq 0x691f8(%rip), %rsi     # 0x9c38c
leaq 0x694d2(%rip), %rcx     # 0x9c66d
movl $0x273, %edx            # imm = 0x273
callq 0xc140
nop
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/src/../include/imgui_club/imgui_memory_editor/imgui_memory_editor.h
// Function: MemoryEditor::EndianessCopyBigEndian(void*, void*, unsigned long, int)
static void* EndianessCopyBigEndian(void* _dst, void* _src, size_t s, int is_little_endian)
    {
        if (is_little_endian)
        {
            uint8_t* dst = (uint8_t*)_dst;
            uint8_t* src = (uint8_t*)_src + s - 1;
            for (int i = 0, n = (int)s; i < n; ++i)
                memcpy(dst++, src--, 1);
            return _dst;
        }
        else
        {
            return memcpy(_dst, _src, s);
        }
    }

// Assembly:
testl %ecx, %ecx
je 0xc080
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
addq %rsi, %rdx
decq %rdx
cmpl %eax, %ecx
je 0x331d7
movb (%rdx), %sil
movb %sil, (%rdi,%rax)
incq %rax
decq %rdx
jmp 0x331c4
movq %rdi, %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: SetClipboardTextFn_DefaultImpl(void*, char const*)
static void SetClipboardTextFn_DefaultImpl(void*, const char* text)
{
    ImGuiContext& g = *GImGui;
    g.ClipboardHandlerData.clear();
    const char* text_end = text + strlen(text);
    g.ClipboardHandlerData.resize((int)(text_end - text) + 1);
    memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));
    g.ClipboardHandlerData[(int)(text_end - text)] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl $0x30b0, %ebx           # imm = 0x30B0
addq 0xb03fc(%rip), %rbx     # 0xe3ce0
movq %rbx, %rdi
callq 0x4b1ac
movq %r14, %rdi
callq 0xc380
movq %rax, %r15
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x49cb6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x49cf4
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xc080
movq %rbx, %rdi
movl %r15d, %esi
callq 0x49cf4
movb $0x0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGuiIO::AddInputCharacterUTF16(unsigned short)
void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c)
{
    if (c == 0 && InputQueueSurrogate == 0)
        return;

    if ((c & 0xFC00) == 0xD800) // High surrogate, must save
    {
        if (InputQueueSurrogate != 0)
            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
        InputQueueSurrogate = c;
        return;
    }

    ImWchar cp = c;
    if (InputQueueSurrogate != 0)
    {
        if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate
            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
        else if (IM_UNICODE_CODEPOINT_MAX == (0xFFFF)) // Codepoint will not fit in ImWchar (extra parenthesis around 0xFFFF somehow fixes -Wunreachable-code with Clang)
            cp = IM_UNICODE_CODEPOINT_INVALID;
        else
            cp = (ImWchar)(((InputQueueSurrogate - 0xD800) << 10) + (c - 0xDC00) + 0x10000);
        InputQueueSurrogate = 0;
    }
    InputQueueCharacters.push_back(cp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movzwl 0x1544(%rdi), %eax
movl %r14d, %ecx
orw %ax, %cx
je 0x33a0f
movq %rdi, %rbx
movl %r14d, %ecx
andl $0xfc00, %ecx           # imm = 0xFC00
cmpw $0xd800, %cx            # imm = 0xD800
jne 0x339c6
testw %ax, %ax
je 0x339bc
leaq 0x1548(%rbx), %rdi
leaq -0x16(%rbp), %rsi
movw $0xfffd, (%rsi)         # imm = 0xFFFD
callq 0x499c0
movw %r14w, 0x1544(%rbx)
jmp 0x33a0f
movw %r14w, -0x12(%rbp)
testw %ax, %ax
je 0x339fc
cmpw $0xdc00, %cx            # imm = 0xDC00
jne 0x339df
movw $0xfffd, -0x12(%rbp)    # imm = 0xFFFD
jmp 0x339f4
leaq 0x1548(%rbx), %rdi
leaq -0x14(%rbp), %rsi
movw $0xfffd, (%rsi)         # imm = 0xFFFD
callq 0x499c0
andw $0x0, 0x1544(%rbx)
addq $0x1548, %rbx           # imm = 0x1548
leaq -0x12(%rbp), %rsi
movq %rbx, %rdi
callq 0x499c0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGuiIO::AddInputCharactersUTF8(char const*)
void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
{
    while (*utf8_chars != 0)
    {
        unsigned int c = 0;
        utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL);
        if (c != 0)
            InputQueueCharacters.push_back((ImWchar)c);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x1548, %r14           # imm = 0x1548
leaq -0x30(%rbp), %r15
leaq -0x2a(%rbp), %r12
cmpb $0x0, (%rbx)
je 0x33a72
andl $0x0, -0x30(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x33a81
movl %eax, %r13d
movl -0x30(%rbp), %eax
testl %eax, %eax
je 0x33a6a
movw %ax, -0x2a(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x499c0
movslq %r13d, %rax
addq %rax, %rbx
jmp 0x33a3b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImBezierCubicClosestPoint(ImVec2 const&, ImVec2 const&, ImVec2 const&, ImVec2 const&, ImVec2 const&, int)
ImVec2 ImBezierCubicClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments)
{
    IM_ASSERT(num_segments > 0); // Use ImBezierCubicClosestPointCasteljau()
    ImVec2 p_last = p1;
    ImVec2 p_closest;
    float p_closest_dist2 = FLT_MAX;
    float t_step = 1.0f / (float)num_segments;
    for (int i_step = 1; i_step <= num_segments; i_step++)
    {
        ImVec2 p_current = ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step);
        ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);
        float dist2 = ImLengthSqr(p - p_line);
        if (dist2 < p_closest_dist2)
        {
            p_closest = p_line;
            p_closest_dist2 = dist2;
        }
        p_last = p_current;
    }
    return p_closest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
testl %r9d, %r9d
jle 0x33d06
movl %r9d, %ebx
movq %r8, %r14
movq %rsi, %r13
movq %rdi, %r15
movq (%rdi), %rax
leaq -0x38(%rbp), %rcx
cvtsi2ss %r9d, %xmm0
movq %rax, (%rcx)
movss 0x683ae(%rip), %xmm1    # 0x9bff8
divss %xmm0, %xmm1
movss %xmm1, -0x2c(%rbp)
negl %ebx
movss 0x68c13(%rip), %xmm1    # 0x9c870
pushq $0x1
popq %r12
xorps %xmm0, %xmm0
leal (%rbx,%r12), %eax
cmpl $0x1, %eax
je 0x33cf7
movaps %xmm0, -0x60(%rbp)
cvtsi2ss %r12d, %xmm0
mulss -0x2c(%rbp), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
movss %xmm1, -0x30(%rbp)
callq 0x63657
movaps %xmm0, -0x70(%rbp)
movlps %xmm0, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq %r14, %rdx
callq 0x33d25
movss (%r14), %xmm1
movss 0x4(%r14), %xmm2
subss %xmm0, %xmm1
movaps %xmm0, %xmm3
shufps $0x55, %xmm0, %xmm3     # xmm3 = xmm3[1,1],xmm0[1,1]
subss %xmm3, %xmm2
mulss %xmm2, %xmm2
mulss %xmm1, %xmm1
addss %xmm2, %xmm1
movss -0x30(%rbp), %xmm2
ucomiss %xmm1, %xmm2
ja 0x33ce3
movaps -0x60(%rbp), %xmm0
minss %xmm2, %xmm1
movaps -0x70(%rbp), %xmm2
movlps %xmm2, -0x38(%rbp)
incl %r12d
jmp 0x33c64
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x69477(%rip), %rdi     # 0x9d184
leaq 0x69481(%rip), %rsi     # 0x9d195
leaq 0x69492(%rip), %rcx     # 0x9d1ad
movl $0x46d, %edx            # imm = 0x46D
callq 0xc140
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImLineClosestPoint(ImVec2 const&, ImVec2 const&, ImVec2 const&)
ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p)
{
    ImVec2 ap = p - a;
    ImVec2 ab_dir = b - a;
    float dot = ap.x * ab_dir.x + ap.y * ab_dir.y;
    if (dot < 0.0f)
        return a;
    float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y;
    if (dot > ab_len_sqr)
        return b;
    return a + ab_dir * dot / ab_len_sqr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movss (%rdi), %xmm0
movss 0x4(%rdi), %xmm1
movss (%rdx), %xmm4
movss 0x4(%rdx), %xmm5
subss %xmm0, %xmm4
subss %xmm1, %xmm5
movss (%rsi), %xmm3
movss 0x4(%rsi), %xmm2
subss %xmm0, %xmm3
subss %xmm1, %xmm2
mulss %xmm2, %xmm5
mulss %xmm3, %xmm4
addss %xmm5, %xmm4
xorps %xmm5, %xmm5
ucomiss %xmm4, %xmm5
jbe 0x33d6e
movsd (%rdi), %xmm0
jmp 0x33da6
movaps %xmm2, %xmm6
mulss %xmm2, %xmm6
movaps %xmm3, %xmm5
mulss %xmm3, %xmm5
addss %xmm6, %xmm5
ucomiss %xmm5, %xmm4
jbe 0x33d8b
movsd (%rsi), %xmm0
jmp 0x33da6
mulss %xmm4, %xmm3
mulss %xmm4, %xmm2
divss %xmm5, %xmm3
divss %xmm5, %xmm2
addss %xmm3, %xmm0
addss %xmm2, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImBezierCubicClosestPointCasteljau(ImVec2 const&, ImVec2 const&, ImVec2 const&, ImVec2 const&, ImVec2 const&, float)
ImVec2 ImBezierCubicClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol)
{
    IM_ASSERT(tess_tol > 0.0f);
    ImVec2 p_last = p1;
    ImVec2 p_closest;
    float p_closest_dist2 = FLT_MAX;
    ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, tess_tol, 0);
    return p_closest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x33e27
movq (%rdi), %rdi
leaq -0x18(%rbp), %rax
leaq -0x20(%rbp), %rbx
andq $0x0, (%rbx)
movq %rdi, (%rax)
leaq -0xc(%rbp), %r9
movl $0x7f7fffff, (%r9)      # imm = 0x7F7FFFFF
movd %edi, %xmm8
shrq $0x20, %rdi
movd %edi, %xmm1
movss (%rsi), %xmm2
movss 0x4(%rsi), %xmm3
movss (%rdx), %xmm4
movss 0x4(%rdx), %xmm5
movss (%rcx), %xmm6
movss 0x4(%rcx), %xmm7
movss %xmm0, (%rsp)
movq %r8, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movq %r9, %rcx
movdqa %xmm8, %xmm0
xorl %r8d, %r8d
callq 0x33e46
movsd (%rbx), %xmm0
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
leaq 0x693f5(%rip), %rdi     # 0x9d223
leaq 0x69360(%rip), %rsi     # 0x9d195
leaq 0x693f7(%rip), %rcx     # 0x9d233
movl $0x4a7, %edx            # imm = 0x4A7
callq 0xc140