LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::rorInstMem(unsigned short)
void Cpu::rorInstMem(uint16_t addr) {
  uint8_t t = load(addr);
  uint8_t result = (t >> 1) | (getFlag(CARRY) ? 1u << 7 : 0);
  if (t & 1) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  store(addr, result);
  setZeroAndNeg(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x15ff4
movb 0x18(%r14), %cl
movl %eax, %edx
andb $0x1, %dl
movl %ecx, %esi
andb $-0x2, %sil
orb %dl, %sil
movb %sil, 0x18(%r14)
shrb %al
shlb $0x7, %cl
orb %al, %cl
movzbl %cl, %r15d
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x16002
movq %r14, %rdi
movl %r15d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1603c
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::rtiInst(unsigned short)
void Cpu::rtiInst(uint16_t) {
  uint16_t targetPc;
  status = (popStack() & ~BREAK) | ONE;

  targetPc = popStack();
  targetPc |= ((uint16_t)popStack() << 8);
  pc = targetPc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x16080
andb $-0x31, %al
orb $0x20, %al
movb %al, 0x18(%rbx)
movq %rbx, %rdi
callq 0x16080
movl %eax, %r14d
movq %rbx, %rdi
callq 0x16080
movzbl %al, %eax
shll $0x8, %eax
movzbl %r14b, %ecx
orl %eax, %ecx
movw %cx, 0xc(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::sbcInst(unsigned short)
void Cpu::sbcInst(uint16_t addr) {
  uint8_t v = load(addr);
  int16_t sresult = (int16_t)(int8_t)a - (int16_t)(int8_t)v - (getFlag(CARRY) ? 0 : 1);
  int16_t uresult = (int16_t)a - (int16_t)v - (getFlag(CARRY) ? 0 : 1);

  if (uresult >= 0) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  if (sresult > 127 || sresult < -128) {
    setFlag(OVERFL);
  } else {
    clearFlag(OVERFL);
  }
  a = (uint8_t)uresult;
  setZeroAndNeg(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x15ff4
movzbl 0x8(%rbx), %ecx
movsbl %cl, %edx
movsbl %al, %eax
movb 0x18(%rbx), %sil
xorl %edi, %edi
testb $0x1, %sil
sete %dil
movzbl %al, %r8d
subl %r8d, %ecx
subl %edi, %ecx
andb $-0x42, %sil
testw %cx, %cx
setns %r8b
orb %sil, %r8b
subl %eax, %edx
subl %edi, %edx
movsbl %dl, %eax
cmpl %edx, %eax
setne %al
shlb $0x6, %al
orb %r8b, %al
movb %al, 0x18(%rbx)
movb %cl, 0x8(%rbx)
movzbl %cl, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1603c
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dcpInst(unsigned short)
void Cpu::dcpInst(uint16_t addr) {
  uint8_t result = load(addr) - 1;
  // setZeroAndNeg(result);
  store(addr, result);
  if (x >= result) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x15ff4
decb %al
movzbl %al, %r15d
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x16002
movb 0x18(%r14), %al
cmpb %r15b, 0x9(%r14)
setae %cl
andb $-0x2, %al
orb %cl, %al
movb %al, 0x18(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::runInst()
uint32_t Cpu::runInst() {
  // check for nmi
  if (nmiRequested()) {
    return doNmi();
  }
  // check for lower priority maskable interrupts
  if (intRequested() && !getFlag(INT_DISABLE)) {
    return doInt();
  }

  // load opcode using current pc
  uint8_t opcode = load(pc);

  // look up instruction in the table
  auto itr = instTable.find(opcode);
  if (itr == instTable.end()) {
    assert(0);
    return 0;
  }

  // run the instruction
  const Instruction &ins = itr->second;
  (this->*(ins.func))(ins);

  // update the cycle count
  cycle += ins.cycles;
  return ins.cycles;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x160c8
testb %al, %al
je 0x16d1a
movq %rbx, %rdi
callq 0x1613e
pushq $0x7
popq %rax
jmp 0x16d85
movq %rbx, %rdi
callq 0x160ba
testb %al, %al
je 0x16d36
testb $0x4, 0x18(%rbx)
jne 0x16d36
movq %rbx, %rdi
callq 0x160d6
jmp 0x16d15
movzwl 0xc(%rbx), %esi
movq %rbx, %rdi
callq 0x15ff4
leaq -0x11(%rbp), %rsi
movb %al, (%rsi)
leaq 0x2aa71(%rip), %rdi     # 0x417c0
callq 0x1acb2
testq %rax, %rax
je 0x16d8e
movq %rax, %r14
movq %rax, %rsi
addq $0x10, %rsi
movq 0x38(%rax), %rax
movq 0x40(%r14), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x16d7a
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
movzwl 0x30(%r14), %eax
addq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1370f(%rip), %rdi     # 0x2a4a4
leaq 0x146b6(%rip), %rsi     # 0x2b452
leaq 0x146b7(%rip), %rcx     # 0x2b45a
movl $0x3c7, %edx            # imm = 0x3C7
callq 0xb170
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::reset()
void Cpu::reset() {
  setFlag(INT_DISABLE);
  setFlag(ONE);
  pc = load16(resetBaseAddr);
  sp = stackPointerStart;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
orb $0x24, 0x18(%rdi)
movl $0xfffc, %esi           # imm = 0xFFFC
callq 0x15fb8
movw %ax, 0xc(%rbx)
movb $-0x3, 0xe(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dumpRegs()
void Cpu::dumpRegs() {
  using namespace std;
  cerr << setfill('0') << right;
  cerr << "A:" << setw(2) << (int)a << " ";
  cerr << "X:" << setw(2) << (int)x << " ";
  cerr << "Y:" << setw(2) << (int)y << " ";
  cerr << "P:" << setw(2) << (int)status << " ";
  cerr << "SP:" << setw(2) << (int)sp << " ";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x2a1ff(%rip), %r14     # 0x40fe8
pushq $0x30
popq %rsi
movq %r14, %rdi
callq 0xb590
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rax,%rcx), %edx
orl $0x80, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x14663(%rip), %rsi     # 0x2b478
movq %r14, %rdi
callq 0xb450
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
pushq $0x2
popq %r12
movq %r12, 0x10(%rax,%rcx)
movzbl 0x8(%rbx), %esi
movq %rax, %rdi
callq 0xb2c0
leaq 0x14647(%rip), %r15     # 0x2b487
movq %rax, %rdi
movq %r15, %rsi
callq 0xb450
leaq 0x14629(%rip), %rsi     # 0x2b47b
movq %r14, %rdi
callq 0xb450
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq %r12, 0x10(%rax,%rcx)
movzbl 0x9(%rbx), %esi
movq %rax, %rdi
callq 0xb2c0
movq %rax, %rdi
movq %r15, %rsi
callq 0xb450
leaq 0x145fa(%rip), %rsi     # 0x2b47e
movq %r14, %rdi
callq 0xb450
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq %r12, 0x10(%rax,%rcx)
movzbl 0xa(%rbx), %esi
movq %rax, %rdi
callq 0xb2c0
movq %rax, %rdi
movq %r15, %rsi
callq 0xb450
leaq 0x145cc(%rip), %rsi     # 0x2b482
movq %r14, %rdi
callq 0xb450
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq %r12, 0x10(%rax,%rcx)
movzbl 0x18(%rbx), %esi
movq %rax, %rdi
callq 0xb2c0
movq %rax, %rdi
movq %r15, %rsi
callq 0xb450
leaq 0x14599(%rip), %rsi     # 0x2b481
movq %r14, %rdi
callq 0xb450
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq %r12, 0x10(%rax,%rcx)
movzbl 0xe(%rbx), %esi
movq %rax, %rdi
callq 0xb2c0
movq %rax, %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xb450
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dumpInstructionBytes(int)
void Cpu::dumpInstructionBytes(int bytes) {
  using namespace std;
  cerr << setfill('0') << right;
  for (int i = 0; i < bytes; i++) {
    cerr << setw(2) << uppercase << (int)load(pc + i) << " ";
  }
  for (int i = 0; i < maxInstLength - bytes; i++) {
    cerr << "   ";
  }
  cerr << " ";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r12d
movq %rdi, %r14
movq 0x2a031(%rip), %r15     # 0x40fe8
pushq $0x30
popq %rsi
movq %r15, %rdi
callq 0xb590
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rax,%rcx), %edx
orl $0x80, %edx
movl %edx, 0x18(%rax,%rcx)
xorl %r13d, %r13d
testl %r12d, %r12d
movl $0x0, %ebx
movl %r12d, -0x2c(%rbp)
cmovgl %r12d, %ebx
leaq 0x14491(%rip), %r12     # 0x2b487
cmpl %r13d, %ebx
je 0x17045
movq (%r15), %rax
movq -0x18(%rax), %rcx
movq $0x2, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
orl $0x4000, 0x18(%r15,%rax) # imm = 0x4000
movl 0xc(%r14), %eax
addl %r13d, %eax
movzwl %ax, %esi
movq %r14, %rdi
callq 0x15ff4
movzbl %al, %esi
movq %r15, %rdi
callq 0xb2c0
movq %rax, %rdi
movq %r12, %rsi
callq 0xb450
incl %r13d
jmp 0x16ff6
pushq $0x3
popq %rax
subl -0x2c(%rbp), %eax
xorl %r15d, %r15d
testl %eax, %eax
cmovgl %eax, %r15d
movq 0x29f8d(%rip), %rbx     # 0x40fe8
leaq 0x14423(%rip), %r14     # 0x2b485
subl $0x1, %r15d
jb 0x17075
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb450
jmp 0x17062
movq 0x29f6c(%rip), %rdi     # 0x40fe8
leaq 0x14404(%rip), %rsi     # 0x2b487
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb450
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dumpPPUTiming()
void Cpu::dumpPPUTiming() {
  using namespace std;
  // const int initScanLine = 0;
  cerr << setfill(' ') << right;
  cerr << "CYC:" << dec << setw(3) << (3 * cycle) % 341;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x29f41(%rip), %r14     # 0x40fe8
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0xb590
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rax,%rcx), %edx
orl $0x80, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x143b6(%rip), %rsi     # 0x2b489
movq %r14, %rdi
callq 0xb450
movq %rax, %rdi
movq (%rax), %rax
movq -0x18(%rax), %rcx
movl 0x18(%rdi,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rdi,%rcx)
movq -0x18(%rax), %rax
movq $0x3, 0x10(%rdi,%rax)
imulq $0x3, 0x10(%rbx), %rax
movl $0x155, %ecx            # imm = 0x155
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0xb3f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::save(Rnes::CpuState&)
void Cpu::save(CpuState &pb) {
  // Registers
  pb.set_a(a);
  pb.set_x(x);
  pb.set_y(y);

  // Program counter
  pb.set_pc(pc);

  // stack pointer
  pb.set_sp(sp);

  // cycle count
  pb.set_cycle(cycle);

  // processor status register
  pb.set_status(status);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl 0x8(%rdi), %eax
movl %eax, 0x18(%rsi)
movzbl 0x9(%rdi), %eax
movl %eax, 0x1c(%rsi)
movzbl 0xa(%rdi), %eax
movl %eax, 0x20(%rsi)
movzwl 0xc(%rdi), %eax
movl %eax, 0x24(%rsi)
movzbl 0xe(%rdi), %eax
movl %eax, 0x28(%rsi)
movq 0x10(%rdi), %rax
movq %rax, 0x30(%rsi)
movzbl 0x18(%rdi), %eax
orl $0x7f, 0x10(%rsi)
movl %eax, 0x2c(%rsi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::Cpu(Rnes::Nes*)
Cpu::Cpu(Nes *system) {
  a = 0;
  x = 0;
  y = 0;
  pc = 0;
  status = 0;
  sp = 0;
  cycle = 0;
  nes = system;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andw $0x0, 0x8(%rdi)
xorl %eax, %eax
movb %al, 0xa(%rdi)
andw $0x0, 0xc(%rdi)
movb %al, 0x18(%rdi)
movb %al, 0xe(%rdi)
andq $0x0, 0x10(%rdi)
movq %rsi, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::indexedIndirectFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::indexedIndirectFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1;
  uint8_t immed = load(immediateAddr);
  uint8_t tableAddr = immed + x;
  uint16_t finalAddr = load(tableAddr);
  finalAddr |= (uint16_t)load((tableAddr + 1) & 0xff) << 8;

  std::stringstream str;
  str << std::setfill('0') << std::right;
  str << ins.nemonic << " ($" << std::hex << std::uppercase << std::setw(2) << (int)immed << ",X)";

  instTrace(str.str(), 2);

  pc += 2;
  (this->*fx)(finalAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %r13
movq %rdi, %rbx
movl 0xc(%rdi), %eax
incl %eax
movzwl %ax, %esi
callq 0x15ff4
movl %eax, %r12d
movb 0x9(%rbx), %al
addb %r12b, %al
movzbl %al, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15ff4
movb %al, -0x29(%rbp)
incb %r14b
movzbl %r14b, %esi
movq %rbx, %rdi
callq 0x15ff4
movl %eax, %r15d
leaq -0x1d8(%rbp), %rdi
callq 0xb290
leaq -0x1c8(%rbp), %r14
pushq $0x30
popq %rsi
movq %r14, %rdi
callq 0xb590
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rax,%rcx), %edx
orl $0x80, %edx
movl %edx, 0x18(%rax,%rcx)
movq %r14, %rdi
movq %r13, %rsi
callq 0xb280
leaq 0x140e4(%rip), %rsi     # 0x2b48e
movq %rax, %rdi
callq 0xb450
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl 0x18(%rax,%rdx), %esi
andl $-0x4b, %esi
orl $0x8, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rdx
orl $0x4000, 0x18(%rax,%rdx) # imm = 0x4000
movzbl %r12b, %esi
movq -0x18(%rcx), %rcx
movq $0x2, 0x10(%rax,%rcx)
movq %rax, %rdi
callq 0xb2c0
leaq 0x1409f(%rip), %rsi     # 0x2b492
movq %rax, %rdi
callq 0xb450
leaq -0x1c0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0xb340
movzbl %r15b, %eax
shll $0x8, %eax
movzbl -0x29(%rbp), %r14d
orl %eax, %r14d
leaq -0x50(%rbp), %rdi
callq 0xb9d8
addw $0x2, 0xc(%rbx)
movzwl %r14w, %esi
movq %rbx, %rdi
callq 0x169ca
leaq -0x1d8(%rbp), %rdi
callq 0xb320
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17454
movq %rax, %rbx
leaq -0x1d8(%rbp), %rdi
callq 0xb320
movq %rbx, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::zeroPageFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::zeroPageFormat(const Instruction &ins) {
  uint16_t zeroPageAddr = pc + 1;

  if (debug) {
    int zeroPageLoad = load(zeroPageAddr);
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(2) << zeroPageLoad;
    instTrace(str.str(), 2);
  }
  pc += 2;
  (this->*fx)((uint16_t)load(zeroPageAddr));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %eax
leal 0x1(%rax), %ecx
addl $0x2, %eax
movw %ax, 0xc(%rdi)
movzwl %cx, %esi
callq 0x15ff4
movzbl %al, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x169ca
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::absoluteFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::absoluteFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1;
  uint16_t absAddr = load(immediateAddr);
  absAddr |= ((uint16_t)load(immediateAddr + 1)) << 8;

  if (debug) {
    int immed = load16(immediateAddr);
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(4) << immed;
    instTrace(str.str(), 3);
  }
  pc += 3;
  (this->*fx)(absAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %r14d
leal 0x1(%r14), %esi
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %esi
callq 0x15ff4
movl %eax, %r15d
addl $0x2, %r14d
andl %r12d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15ff4
movzbl %al, %eax
shll $0x8, %eax
movzbl %r15b, %esi
addw $0x3, 0xc(%rbx)
orl %eax, %esi
andl %r12d, %esi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x169ca
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::relativeFormat<&Rnes::Cpu::bplInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::relativeFormat(const Instruction &ins) {
  uint16_t immedAddr = pc + 1;
  int8_t relativeAddr = load(immedAddr);

  if (debug) {
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(4)
        << relativeAddr + pc + 2;
    instTrace(str.str(), 2);
  }
  pc += 2;

  (this->*fx)((int16_t)relativeAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %eax
incl %eax
movzwl %ax, %esi
callq 0x15ff4
addw $0x2, 0xc(%rbx)
movsbl %al, %eax
movzwl %ax, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x16390
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::indirectIndexedFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::indirectIndexedFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1;
  uint8_t immed = load(immediateAddr);

  uint16_t tableAddr = load(immed);
  tableAddr |= (uint16_t)load((immed + 1) & 0xff) << 8;

  uint16_t finalAddr = tableAddr + y;

  if (debug) {
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " ($" << std::hex << std::uppercase << std::setw(2) << (int)immed
        << "),Y";
    instTrace(str.str(), 2);
  }

  // Add a penalty when y causes the table addr and final address to
  // not be on the same page
  if (ins.cycles == 5) {
    if ((tableAddr & 0xff00) != ((tableAddr + y) & 0xff00)) {
      cycle++;
    }
  }

  pc += 2;
  (this->*fx)(finalAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rdi), %eax
incl %eax
movzwl %ax, %esi
callq 0x15ff4
movzbl %al, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ff4
movl %eax, %r12d
incb %r15b
movzbl %r15b, %esi
movq %rbx, %rdi
callq 0x15ff4
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r12b, %edx
orl %ecx, %edx
movzbl 0xa(%rbx), %eax
addl %edx, %eax
cmpw $0x5, 0x20(%r14)
jne 0x1768b
movl %eax, %edx
andl $0xff00, %edx           # imm = 0xFF00
cmpl %edx, %ecx
je 0x1768b
incq 0x10(%rbx)
addw $0x2, 0xc(%rbx)
movzwl %ax, %esi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x169ca
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::zeroPageXFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::zeroPageXFormat(const Instruction &ins) {
  uint16_t zeroPageAddr = pc + 1;

  if (debug) {
    int zeroPageLoad = load(zeroPageAddr);
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(2) << zeroPageLoad
        << ",X";
    instTrace(str.str(), 2);
  }
  pc += 2;
  (this->*fx)((uint16_t)((load(zeroPageAddr) + x) & 0xff));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %eax
leal 0x1(%rax), %ecx
addl $0x2, %eax
movw %ax, 0xc(%rdi)
movzwl %cx, %esi
callq 0x15ff4
addb 0x9(%rbx), %al
movzbl %al, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x169ca
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::absoluteYFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::absoluteYFormat(const Instruction &ins) {
  uint16_t relativeAddr = pc + 1;
  uint16_t absAddr = load(relativeAddr);
  absAddr |= ((uint16_t)load(relativeAddr + 1)) << 8;

  if (debug) {
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(4) << (int)absAddr
        << ",Y";
    instTrace(str.str(), 3);
  }

  // instructions that have a base cycle count of 4, will take a 1 cycle
  // penalty when they cross
  if (ins.cycles == 4) {
    if ((absAddr & 0xff00) != ((absAddr + y) & 0xff00)) {
      cycle++;
    }
  }

  absAddr += y;
  pc += 3;
  (this->*fx)(absAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rdi), %r15d
leal 0x1(%r15), %esi
movl $0xffff, %r13d          # imm = 0xFFFF
andl %r13d, %esi
callq 0x15ff4
movl %eax, %r12d
addl $0x2, %r15d
andl %r13d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ff4
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r12b, %eax
orl %ecx, %eax
cmpw $0x4, 0x20(%r14)
jne 0x17783
movzwl %ax, %edx
movzbl 0xa(%rbx), %ecx
movl %ecx, %esi
addl %edx, %esi
xorl %edx, %esi
testw $0xff00, %si            # imm = 0xFF00
je 0x17786
incq 0x10(%rbx)
jmp 0x17786
movb 0xa(%rbx), %cl
movzbl %cl, %ecx
addw $0x3, 0xc(%rbx)
addl %ecx, %eax
movzwl %ax, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x169ca
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::absoluteXFormat<&Rnes::Cpu::oraInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::absoluteXFormat(const Instruction &ins) {
  uint16_t relativeAddr = pc + 1;
  uint16_t absAddr = load(relativeAddr);
  absAddr |= ((uint16_t)load(relativeAddr + 1)) << 8;

  if (debug) {
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(4) << (int)absAddr
        << ",X";
    instTrace(str.str(), 3);
  }

  // instructions that have a base cycle count of 4, will take a 1 cycle
  // penalty when they cross
  if (ins.cycles == 4) {
    if ((absAddr & 0xff00) != ((absAddr + x) & 0xff00)) {
      cycle++;
    }
  }

  absAddr += x;
  pc += 3;
  (this->*fx)(absAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rdi), %r15d
leal 0x1(%r15), %esi
movl $0xffff, %r13d          # imm = 0xFFFF
andl %r13d, %esi
callq 0x15ff4
movl %eax, %r12d
addl $0x2, %r15d
andl %r13d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ff4
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r12b, %eax
orl %ecx, %eax
cmpw $0x4, 0x20(%r14)
jne 0x1789d
movzwl %ax, %edx
movzbl 0x9(%rbx), %ecx
movl %ecx, %esi
addl %edx, %esi
xorl %edx, %esi
testw $0xff00, %si            # imm = 0xFF00
je 0x178a0
incq 0x10(%rbx)
jmp 0x178a0
movb 0x9(%rbx), %cl
movzbl %cl, %ecx
addw $0x3, 0xc(%rbx)
addl %ecx, %eax
movzwl %ax, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x169ca
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::indirectFormat<&Rnes::Cpu::jmpInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::indirectFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1u;
  uint16_t absAddr = load(immediateAddr);
  absAddr |= ((uint16_t)load(immediateAddr + 1u)) << 8;

  uint16_t finalAddr = load(absAddr);
  // bug in jmp (yes, this needs to work)
  if ((absAddr & 0xff) == 0xff) {
    finalAddr |= ((uint16_t)load(absAddr & 0xff00)) << 8;
  } else {
    finalAddr |= ((uint16_t)load(absAddr + 1u)) << 8;
  }

  if (debug) {
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " ($" << std::hex << std::uppercase << std::setw(4) << (int)absAddr
        << ")";
    instTrace(str.str(), 3);
  }

  pc += 3;
  (this->*fx)(finalAddr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %r14d
leal 0x1(%r14), %esi
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %esi
callq 0x15ff4
movl %eax, %r15d
addl $0x2, %r14d
andl %r12d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15ff4
movzbl %al, %r13d
shll $0x8, %r13d
movzbl %r15b, %r15d
leal (%r15,%r13), %esi
andl %r12d, %esi
movq %rbx, %rdi
callq 0x15ff4
movl %eax, %r14d
cmpb $-0x1, %r15b
leal 0x1(%r13,%r15), %esi
cmovel %r13d, %esi
andl %r12d, %esi
movq %rbx, %rdi
callq 0x15ff4
movzbl %al, %eax
shll $0x8, %eax
movzbl %r14b, %ecx
orl %eax, %ecx
movw %cx, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::zeroPageYFormat<&Rnes::Cpu::stxInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::zeroPageYFormat(const Instruction &ins) {
  uint16_t zeroPageAddr = pc + 1;

  if (debug) {
    int zeroPageLoad = load(zeroPageAddr);
    std::stringstream str;
    str << std::setfill('0') << std::right;
    str << ins.nemonic << " $" << std::hex << std::uppercase << std::setw(2) << zeroPageLoad
        << ",Y";
    instTrace(str.str(), 2);
  }
  pc += 2;
  (this->*fx)((uint16_t)((load(zeroPageAddr) + y)) & 0xff);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %eax
leal 0x1(%rax), %ecx
addl $0x2, %eax
movw %ax, 0xc(%rdi)
movzwl %cx, %esi
callq 0x15ff4
addb 0xa(%rbx), %al
movzbl %al, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x16c74
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Controller::setShiftReg()
void Controller::setShiftReg() {
  sdl->parseInput();
  shiftReg = 0;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_A) ? 1u : 0u) << 0;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_B) ? 1u : 0u) << 1;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_SELECT) ? 1u : 0u) << 2;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_START) ? 1u : 0u) << 3;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_UP) ? 1u : 0u) << 4;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_DOWN) ? 1u : 0u) << 5;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_LEFT) ? 1u : 0u) << 6;
  shiftReg |= (sdl->getButtonState(Sdl::BUTTON_RIGHT) ? 1u : 0u) << 7;

  if (debug) {
    std::cerr << "shiftReg: " << std::hex << (int)shiftReg << "\n";
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x1c184
movb $0x0, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x6
popq %rsi
callq 0x1c272
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x7
popq %rsi
callq 0x1c272
addb %al, %al
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x5
popq %rsi
callq 0x1c272
shlb $0x2, %al
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x4
popq %rsi
callq 0x1c272
shlb $0x3, %al
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x1c272
shlb $0x4, %al
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x1c272
shlb $0x5, %al
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x2
popq %rsi
callq 0x1c272
shlb $0x6, %al
orb %al, 0x9(%rbx)
movq (%rbx), %rdi
pushq $0x3
popq %rsi
callq 0x1c272
shlb $0x7, %al
orb %al, 0x9(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Controller::read()
uint8_t Controller::read() {
  if (control & 0x1) {
    sdl->parseInput();
    return (sdl->getButtonState(Sdl::BUTTON_A) ? 1u : 0u) << 0;
  } else {
    uint8_t ret = 0;
    ret |= shiftReg & 0x1;
    shiftReg >>= 1;
    shiftReg |= 1u << 7;
    return ret;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x1, 0x8(%rdi)
jne 0x1adec
movb 0x9(%rbx), %cl
movl %ecx, %eax
andb $0x1, %al
shrb %cl
orb $-0x80, %cl
movb %cl, 0x9(%rbx)
jmp 0x1adff
movq (%rbx), %rdi
callq 0x1c184
movq (%rbx), %rdi
pushq $0x6
popq %rsi
callq 0x1c272
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::spriteDmaExecute()
uint32_t Nes::spriteDmaExecute() {
  const uint32_t cyclesPerItr = 2;
  assert(spriteDmaMode);
  cpuMemWrite(ppuRegBase + Ppu::SPR_DATA_REG, cpuMemRead(spriteDmaSourceAddr));
  spriteDmaSourceAddr++;
  spriteDmaCycle += cyclesPerItr;
  if (spriteDmaCycleEnd == spriteDmaCycle) {
    spriteDmaMode = false;
  }
  return cyclesPerItr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpb $0x0, 0x30(%rdi)
je 0x1ae50
movq %rdi, %rbx
movzwl 0x38(%rdi), %esi
callq 0x1af10
movzbl %al, %edx
movq %rbx, %rdi
movl $0x2004, %esi           # imm = 0x2004
callq 0x1ae70
incw 0x38(%rbx)
movl 0x34(%rbx), %eax
addl $0x2, %eax
movl %eax, 0x34(%rbx)
cmpl $0x200, %eax            # imm = 0x200
jne 0x1ae46
movb $0x0, 0x30(%rbx)
pushq $0x2
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1071a(%rip), %rdi     # 0x2b571
leaq 0x10721(%rip), %rsi     # 0x2b57f
leaq 0x10722(%rip), %rcx     # 0x2b587
movl $0x83, %edx
callq 0xb170
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::cpuMemWrite(unsigned short, unsigned char)
void Nes::cpuMemWrite(uint16_t addr, uint8_t val) {
  addr = translateCpuWindows(addr);
  if (addr >= ppuRegBase && addr <= ppuRegEnd) {
    ppu->writeReg(addr - ppuRegBase, val);
  } else if (addr == spriteDmaAddr) {
    spriteDmaSetup(val);
  } else if (addr == joypadAddr) {
    pad->write(val);
  } else if (addr >= apuRegBase && addr <= apuRegEnd) {
    apu->writeReg(addr - apuRegBase, val);
  } else {
    cpuMemory->store(addr, val);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movl %esi, %edi
callq 0x1af9b
movzwl %ax, %esi
andl $0xfff8, %eax           # imm = 0xFFF8
cmpw $0x2000, %ax            # imm = 0x2000
jne 0x1aea7
movq 0x58(%r14), %rdi
addl $0xffffe000, %esi       # imm = 0xFFFFE000
movzbl %bl, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x139fa
cmpl $0x4016, %esi           # imm = 0x4016
je 0x1aed1
cmpl $0x4014, %esi           # imm = 0x4014
jne 0x1aee1
movb $0x1, 0x30(%r14)
andl $0x0, 0x34(%r14)
movzbl %bl, %eax
shll $0x8, %eax
movw %ax, 0x38(%r14)
popq %rbx
popq %r14
popq %rbp
retq
movq 0x68(%r14), %rdi
movzbl %bl, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x1ada2
leal -0x4000(%rsi), %eax
cmpw $0x17, %ax
ja 0x1aeff
movq 0x60(%r14), %rdi
movzbl %bl, %edx
movl %eax, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x14774
movq 0x70(%r14), %rdi
movzbl %bl, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x1d246
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::cpuMemRead(unsigned short)
uint8_t Nes::cpuMemRead(uint16_t addr) {
  addr = translateCpuWindows(addr);
  if (addr >= ppuRegBase && addr <= ppuRegEnd) {
    return ppu->readReg(addr - ppuRegBase);
  } else if (addr == joypadAddr) {
    return pad->read();
  } else if (addr >= apuRegBase && addr <= apuRegEnd) {
    return apu->readReg(addr - apuRegBase);
  } else {
    return cpuMemory->load(addr);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %edi
callq 0x1af9b
movzwl %ax, %esi
andl $0xfff8, %eax           # imm = 0xFFF8
cmpw $0x2000, %ax            # imm = 0x2000
jne 0x1af43
movq 0x58(%rbx), %rdi
addl $0xffffe000, %esi       # imm = 0xFFFFE000
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x13b60
cmpl $0x4016, %esi           # imm = 0x4016
jne 0x1af5a
movq 0x68(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1adcc
leal -0x4000(%rsi), %eax
cmpw $0x17, %ax
ja 0x1af77
movq 0x60(%rbx), %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1486c
movq 0x70(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1d1e8
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::translateCpuWindows(unsigned short)
static uint16_t translateCpuWindows(uint16_t addr) {
  // Deal with 3 mirrors of 2k internal RAM: 0x0 - 0x7ff.
  if (addr >= 0x800 && addr < 0x2000) {
    addr = (addr & (0x800 - 1)) + 0x800;
  }
  // Deal with 1023 mirrors of 8 bytes of PPU registers.
  if (addr >= 0x2000 && addr < 0x4000) {
    addr = (addr & (0x8 - 1)) + 0x2000;
  }
  return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leal -0x800(%rdi), %eax
movl %edi, %ecx
andl $0x7ff, %ecx            # imm = 0x7FF
orl $0x800, %ecx            # imm = 0x800
cmpw $0x1800, %ax            # imm = 0x1800
cmovael %edi, %ecx
movl %ecx, %edx
andl $0xe000, %edx           # imm = 0xE000
movl %ecx, %eax
andl $0x2007, %eax           # imm = 0x2007
cmpw $0x2000, %dx            # imm = 0x2000
cmovnel %ecx, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::translatePpuWindows(unsigned short)
static uint16_t translatePpuWindows(uint16_t addr) {
  // Name table mirrors.
  if (addr >= 0x3000 && addr < 0x3f00) {
    addr = (addr & (0xf00 - 1)) + 0x2000;
  }
  // ??
  if (addr >= 0x4000) {
    addr = addr - 0x4000;
  }

  // palette mirroring
  if (addr == 0x3f10) {
    addr = 0x3f00;
  } else if (addr == 0x3f14) {
    addr = 0x3f04;
  } else if (addr == 0x3f18) {
    addr = 0x3f08;
  } else if (addr == 0x3f1c) {
    addr = 0x3f0c;
  }
  return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leal -0x3000(%rdi), %eax
movl %edi, %edx
andl $0x2eff, %edx           # imm = 0x2EFF
cmpw $0xf00, %ax             # imm = 0xF00
cmovael %edi, %edx
leal -0x4000(%rdx), %ecx
cmpw $0x4000, %dx            # imm = 0x4000
cmovbl %edx, %ecx
cmpw $0x3f10, %cx            # imm = 0x3F10
je 0x1b06a
movzwl %cx, %eax
cmpl $0x3f18, %eax           # imm = 0x3F18
je 0x1b064
cmpl $0x3f14, %eax           # imm = 0x3F14
jne 0x1b070
movw $0x3f04, %ax            # imm = 0x3F04
jmp 0x1b07d
movw $0x3f08, %ax            # imm = 0x3F08
jmp 0x1b07d
movw $0x3f00, %ax            # imm = 0x3F00
jmp 0x1b07d
cmpw $0x3f1c, %cx            # imm = 0x3F1C
movl $0x3f0c, %eax           # imm = 0x3F0C
cmovnel %ecx, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::run()
void Nes::run() {
  uint32_t inputCycles = 1 << 16;
  cpu->reset();
  while (1) {
    uint32_t cpuCycles;
    if (!spriteDmaMode) {
      cpuCycles = cpu->runInst();
    } else {
      cpuCycles = spriteDmaExecute();
    }
    apu->run(cpuCycles);
    ppu->run(cpuCycles);

    cycles += cpuCycles;
    if ((cycles % inputCycles) == 0) {
      sdl->parseInput();

      void loadNesState(Nes * nes, std::string saveFile);
      void saveNesState(Nes * nes, std::string saveFile);
      std::string getGameSaveDir(const std::string & romFile);

      if (sdl->getButtonState(Sdl::BUTTON_SAVE)) {
        saveNesState(this, getGameSaveDir(romFile));
      }
      if (sdl->getButtonState(Sdl::BUTTON_RESTORE)) {
        loadNesState(this, getGameSaveDir(romFile));
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
movq 0x50(%rdi), %rdi
callq 0x16dae
leaq 0x10(%r14), %r15
leaq -0x68(%rbp), %rbx
leaq -0x48(%rbp), %r12
cmpb $0x0, 0x30(%r14)
je 0x1b14a
movq %r14, %rdi
callq 0x1ae06
pushq $0x2
popq %r13
jmp 0x1b156
movq 0x50(%r14), %rdi
callq 0x16cf6
movl %eax, %r13d
movq 0x60(%r14), %rdi
movl %r13d, %esi
callq 0x1474c
movq 0x58(%r14), %rdi
movl %r13d, %esi
callq 0x13874
movl %r13d, %eax
addq 0x40(%r14), %rax
movq %rax, 0x40(%r14)
testw %ax, %ax
jne 0x1b135
movq 0x48(%r14), %rdi
callq 0x1c184
movq 0x48(%r14), %rdi
pushq $0x8
popq %rsi
callq 0x1c272
testb %al, %al
je 0x1b1b5
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10409
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1086a
movq %rbx, %rdi
callq 0xb9d8
movq 0x48(%r14), %rdi
pushq $0x9
popq %rsi
callq 0x1c272
testb %al, %al
je 0x1b135
movq %r12, %rdi
movq %r15, %rsi
callq 0x10409
movq %r14, %rdi
movq %r12, %rsi
callq 0x10737
movq %r12, %rdi
callq 0xb9d8
jmp 0x1b135
movq %rax, %r14
movq %r12, %rbx
jmp 0x1b1f7
movq %rax, %r14
movq %rbx, %rdi
callq 0xb9d8
movq %r14, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::save(Rnes::SaveState&)
void Nes::save(SaveState &pb) {
  // date??

  // Dma state
  DmaState *dma = pb.mutable_dma();
  dma->set_spritedmamode(spriteDmaMode);
  dma->set_spritedmacycle(spriteDmaCycle);
  dma->set_spritedmasourceaddr(spriteDmaSourceAddr);

  // 6502 state
  cpu->save(*pb.mutable_cpu());

  // Audio state
  apu->save(*pb.mutable_apu());

  // PPU state
  ppu->save(*pb.mutable_ppu());

  // Controller state.
  pad->save(*pb.mutable_controller());

  // SRAM state.
  cpuMemory->save(*pb.mutable_cpumem());
  videoMemory->save(*pb.mutable_vidmem());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x1bb98
movb 0x30(%r14), %cl
movl 0x10(%rax), %edx
movl %edx, %esi
orl $0x1, %esi
movl %esi, 0x10(%rax)
movb %cl, 0x18(%rax)
movl 0x34(%r14), %ecx
movl %ecx, 0x1c(%rax)
movzwl 0x38(%r14), %ecx
orl $0x7, %edx
movl %edx, 0x10(%rax)
movl %ecx, 0x20(%rax)
movq 0x50(%r14), %r15
movq %rbx, %rdi
callq 0x1bbd2
movq %r15, %rdi
movq %rax, %rsi
callq 0x17122
movq 0x60(%r14), %r15
movq %rbx, %rdi
callq 0x1bc0c
movq %r15, %rdi
movq %rax, %rsi
callq 0x148d2
movq 0x58(%r14), %r15
movq %rbx, %rdi
callq 0x1bc46
movq %r15, %rdi
movq %rax, %rsi
callq 0x135f0
movq 0x68(%r14), %r15
movq %rbx, %rdi
callq 0x1bc80
movzbl 0x8(%r15), %ecx
movl %ecx, 0x18(%rax)
movzbl 0x9(%r15), %ecx
orl $0x3, 0x10(%rax)
movl %ecx, 0x1c(%rax)
movq 0x70(%r14), %r15
movq %rbx, %rdi
callq 0x1bcba
movq %r15, %rdi
movq %rax, %rsi
callq 0x1d2ba
movq 0x78(%r14), %r14
movq %rbx, %rdi
callq 0x1bcf4
movq %r14, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1d3e8
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::restore(Rnes::SaveState const&)
void Nes::restore(const SaveState &pb) {
  // date??

  // Dma State
  spriteDmaMode = pb.dma().spritedmamode();
  spriteDmaCycle = pb.dma().spritedmacycle();
  spriteDmaSourceAddr = pb.dma().spritedmasourceaddr();

  // 6502 state.
  cpu->restore(pb.cpu());

  // Audio state.
  apu->restore(pb.apu());

  // PPU state.
  ppu->restore(pb.ppu());

  // Controller state.
  pad->restore(pb.controller());

  // SRAM state.
  cpuMemory->restore(pb.cpumem());
  videoMemory->restore(pb.vidmem());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x20(%rsi), %rax
testq %rax, %rax
jne 0x1b301
leaq 0x26817(%rip), %rax     # 0x41b18
movb 0x18(%rax), %cl
movb %cl, 0x30(%r14)
movl 0x1c(%rax), %ecx
movl %ecx, 0x34(%r14)
movzwl 0x20(%rax), %eax
movw %ax, 0x38(%r14)
movq 0x50(%r14), %rdi
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
jne 0x1b32c
leaq 0x264dc(%rip), %rsi     # 0x41808
callq 0x1715e
movq 0x60(%r14), %rdi
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
jne 0x1b345
leaq 0x2659b(%rip), %rsi     # 0x418e0
callq 0x14a0a
movq 0x58(%r14), %rdi
movq 0x38(%rbx), %rsi
testq %rsi, %rsi
jne 0x1b35e
leaq 0x2661a(%rip), %rsi     # 0x41978
callq 0x136fc
movq 0x68(%r14), %rax
movq 0x40(%rbx), %rcx
testq %rcx, %rcx
jne 0x1b377
leaq 0x26729(%rip), %rcx     # 0x41aa0
movb 0x18(%rcx), %dl
movb %dl, 0x8(%rax)
movb 0x1c(%rcx), %cl
movb %cl, 0x9(%rax)
movq 0x70(%r14), %rdi
movq 0x48(%rbx), %rsi
testq %rsi, %rsi
jne 0x1b397
leaq 0x26729(%rip), %rsi     # 0x41ac0
callq 0x1d2f4
movq 0x78(%r14), %rdi
movq 0x50(%rbx), %rsi
testq %rsi, %rsi
jne 0x1b3b0
leaq 0x26738(%rip), %rsi     # 0x41ae8
popq %rbx
popq %r14
popq %rbp
jmp 0x1d434
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/nes.cpp
// Function: Rnes::Nes::mapRom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int Nes::mapRom(const std::string &filename) {
  struct stat stats;
  int fd;
  int result = open(filename.c_str(), O_RDWR);
  if (result == -1) {
    return result;
  }
  fd = result;

  result = fstat(fd, &stats);
  if (result == -1) {
    perror(nullptr);
    return result;
  }

  rom = mmap(nullptr, stats.st_size, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0);
  if (rom == MAP_FAILED) {
    perror(nullptr);
    return -1;
  }
  romSize = stats.st_size;

  close(fd);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdi, %r14
movq (%rsi), %rdi
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0xb3c0
pushq $-0x1
popq %rbx
cmpl $-0x1, %eax
je 0x1b42b
movl %eax, %r15d
leaq -0xb0(%rbp), %rsi
movl %eax, %edi
callq 0xb690
cmpl $-0x1, %eax
je 0x1b43d
movq -0x80(%rbp), %r12
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
xorl %edi, %edi
movq %r12, %rsi
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0xb760
movq %rax, (%r14)
cmpq $-0x1, %rax
je 0x1b43d
movq %r12, 0x8(%r14)
movl %r15d, %edi
callq 0xb1d0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0xb270
jmp 0x1b42b
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_dma()
inline ::Rnes::DmaState* SaveState::_internal_mutable_dma() {
  _has_bits_[0] |= 0x00000002u;
  if (dma_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::DmaState>(GetArena());
    dma_ = p;
  }
  return dma_;
}

// Assembly:
orb $0x2, 0x10(%rdi)
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x1bba6
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bbc9
callq 0x265ee
movq %rax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bbb9
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_cpu()
inline ::Rnes::CpuState* SaveState::_internal_mutable_cpu() {
  _has_bits_[0] |= 0x00000004u;
  if (cpu_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::CpuState>(GetArena());
    cpu_ = p;
  }
  return cpu_;
}

// Assembly:
orb $0x4, 0x10(%rdi)
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x1bbe0
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bc03
callq 0x2609a
movq %rax, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bbf3
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_apu()
inline ::Rnes::ApuState* SaveState::_internal_mutable_apu() {
  _has_bits_[0] |= 0x00000008u;
  if (apu_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::ApuState>(GetArena());
    apu_ = p;
  }
  return apu_;
}

// Assembly:
orb $0x8, 0x10(%rdi)
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x1bc1a
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bc3d
callq 0x26206
movq %rax, 0x30(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bc2d
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_ppu()
inline ::Rnes::PpuState* SaveState::_internal_mutable_ppu() {
  _has_bits_[0] |= 0x00000010u;
  if (ppu_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::PpuState>(GetArena());
    ppu_ = p;
  }
  return ppu_;
}

// Assembly:
orb $0x10, 0x10(%rdi)
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x1bc54
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bc77
callq 0x262cc
movq %rax, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bc67
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_controller()
inline ::Rnes::ControllerState* SaveState::_internal_mutable_controller() {
  _has_bits_[0] |= 0x00000020u;
  if (controller_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::ControllerState>(GetArena());
    controller_ = p;
  }
  return controller_;
}

// Assembly:
orb $0x20, 0x10(%rdi)
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x1bc8e
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bcb1
callq 0x264be
movq %rax, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bca1
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_cpumem()
inline ::Rnes::CpuMemoryState* SaveState::_internal_mutable_cpumem() {
  _has_bits_[0] |= 0x00000040u;
  if (cpumem_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::CpuMemoryState>(GetArena());
    cpumem_ = p;
  }
  return cpumem_;
}

// Assembly:
orb $0x40, 0x10(%rdi)
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x1bcc8
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bceb
callq 0x26512
movq %rax, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bcdb
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::SaveState::_internal_mutable_vidmem()
inline ::Rnes::VideoMemoryState* SaveState::_internal_mutable_vidmem() {
  _has_bits_[0] |= 0x00000080u;
  if (vidmem_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::VideoMemoryState>(GetArena());
    vidmem_ = p;
  }
  return vidmem_;
}

// Assembly:
orb $-0x80, 0x10(%rdi)
movq 0x50(%rdi), %rax
testq %rax, %rax
je 0x1bd02
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1bd25
callq 0x26580
movq %rax, 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1bd15
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/sdl.cpp
// Function: Rnes::Sdl::initDisplay()
int Sdl::initDisplay() {
  window = SDL_CreateWindow("rnes", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, displayWidth,
                            displayHeight, 0);
  renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
  texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING,
                              renderWidth, renderHeight);
  SDL_RenderSetLogicalSize(renderer, renderWidth, renderHeight);
  SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
  image = new uint32_t[renderWidth * renderHeight];

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xe070(%rip), %rdi      # 0x2a038
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl $0x400, %ecx            # imm = 0x400
movl $0x3c0, %r8d            # imm = 0x3C0
xorl %r9d, %r9d
callq 0xb370
movq %rax, 0x8(%rbx)
pushq $-0x1
popq %rsi
pushq $0x6
popq %rdx
movq %rax, %rdi
callq 0xb350
movq %rax, 0x10(%rbx)
pushq $0x1
popq %rdx
movq %rax, %rdi
movl $0x16362004, %esi       # imm = 0x16362004
movl $0x100, %ecx            # imm = 0x100
movl $0xf0, %r8d
callq 0xb310
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
movl $0x100, %esi            # imm = 0x100
movl $0xf0, %edx
callq 0xb6b0
leaq 0xf734(%rip), %rdi      # 0x2b768
leaq 0xf746(%rip), %rsi      # 0x2b781
callq 0xb5c0
movl $0x3c000, %edi          # imm = 0x3C000
callq 0xb3e0
movq %rax, 0x20(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/sdl.cpp
// Function: Rnes::Sdl::initAudio()
int Sdl::initAudio() {
  SDL_AudioSpec desired, obtained;

  desired.freq = 44100;
  desired.format = AUDIO_S16SYS;
  desired.channels = 1;
  desired.samples = 2048;
  desired.callback = callback;
  desired.userdata = this;

  if (SDL_OpenAudio(&desired, &obtained) < 0) {
    printf("Fail\n");
    return 1;
  }

  audioFreq = obtained.freq;
  audioBufferSize = obtained.samples;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq -0x48(%rbp), %rdi
movl $0xac44, (%rdi)         # imm = 0xAC44
movw $0x8010, 0x4(%rdi)      # imm = 0x8010
movb $0x1, 0x6(%rdi)
movw $0x800, 0x8(%rdi)       # imm = 0x800
leaq -0x141(%rip), %rax      # 0x1bf44
movq %rax, 0x10(%rdi)
movq %rbx, 0x18(%rdi)
leaq -0x28(%rbp), %rsi
callq 0xb160
testl %eax, %eax
js 0x1c0ab
movl -0x28(%rbp), %eax
movl %eax, 0x48(%rbx)
movzwl -0x20(%rbp), %eax
movl %eax, 0x4c(%rbx)
xorl %eax, %eax
jmp 0x1c0ba
leaq 0xf6d6(%rip), %rdi      # 0x2b788
callq 0xb800
pushq $0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/sdl.cpp
// Function: Rnes::Sdl::Sdl()
Sdl::Sdl() {
  int ret;

  ret = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
  if (ret < 0) {
    return;
  }

  if (initDisplay() < 0) {
    return;
  }

  if (initAudio() < 0) {
    return;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, (%rdi)
andq $0x0, 0x28(%rdi)
andw $0x0, 0x30(%rdi)
pushq $0x30
popq %rdi
callq 0xb960
testl %eax, %eax
js 0x1c0fb
movq %rbx, %rdi
callq 0x1bfb8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1c058
addq $0x8, %rsp
popq %rbx
popq %rbp
retq