LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movzwl 0xc(%rdi), %eax
addl $0x1, %eax
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movb %al, -0x13(%rbp)
movzbl -0x13(%rbp), %eax
movzwl %ax, %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0x16(%rbp)
movzbl -0x13(%rbp), %eax
addl $0x1, %eax
andl $0xff, %eax
movzwl %ax, %esi
callq 0x2dd90
movq -0x20(%rbp), %rcx
movzbl %al, %eax
movzwl %ax, %edx
shll $0x8, %edx
movzwl -0x16(%rbp), %eax
orl %edx, %eax
movw %ax, -0x16(%rbp)
movzwl -0x16(%rbp), %eax
movzbl 0xa(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x20(%rax), %eax
cmpl $0x5, %eax
jne 0x32933
movq -0x20(%rbp), %rdx
movzwl -0x16(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
movzwl -0x16(%rbp), %ecx
movzbl 0xa(%rdx), %edx
addl %edx, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
cmpl %ecx, %eax
je 0x32931
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x32933
movq -0x20(%rbp), %rax
movzwl 0xc(%rax), %ecx
addl $0x2, %ecx
movw %cx, 0xc(%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x3294a
jmp 0x32966
movq -0x20(%rbp), %rax
movq (%rax), %rax
leaq -0x3258(%rip), %rcx     # 0x2f700
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, -0x28(%rbp)
jmp 0x32973
leaq -0x326d(%rip), %rax     # 0x2f700
movq %rax, -0x28(%rbp)
jmp 0x32973
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movzwl -0x18(%rbp), %esi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movzwl 0xc(%rax), %ecx
addl $0x1, %ecx
movw %cx, -0x12(%rbp)
movzwl 0xc(%rax), %ecx
addl $0x2, %ecx
movw %cx, 0xc(%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x329c6
jmp 0x329e2
movq -0x20(%rbp), %rax
movq (%rax), %rax
leaq -0x32d4(%rip), %rcx     # 0x2f700
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, -0x28(%rbp)
jmp 0x329ef
leaq -0x32e9(%rip), %rax     # 0x2f700
movq %rax, -0x28(%rbp)
jmp 0x329ef
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movzwl -0x12(%rbp), %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movb %al, %cl
movq -0x30(%rbp), %rax
movzbl %cl, %ecx
movzbl 0x9(%rdi), %edx
addl %edx, %ecx
andl $0xff, %ecx
movzwl %cx, %esi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movzwl 0xc(%rdi), %eax
addl $0x1, %eax
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0x14(%rbp)
movzwl -0x12(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x2dd90
movzbl %al, %eax
movzwl %ax, %ecx
shll $0x8, %ecx
movzwl -0x14(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x20(%rax), %eax
cmpl $0x4, %eax
jne 0x32be9
movq -0x20(%rbp), %rdx
movzwl -0x14(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
movzwl -0x14(%rbp), %ecx
movzbl 0xa(%rdx), %edx
addl %edx, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
cmpl %ecx, %eax
je 0x32be7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x32be9
movq -0x20(%rbp), %rax
movzbl 0xa(%rax), %edx
movzwl -0x14(%rbp), %ecx
addl %edx, %ecx
movw %cx, -0x14(%rbp)
movzwl 0xc(%rax), %ecx
addl $0x3, %ecx
movw %cx, 0xc(%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x32c0e
jmp 0x32c2a
movq -0x20(%rbp), %rax
movq (%rax), %rax
leaq -0x351c(%rip), %rcx     # 0x2f700
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, -0x28(%rbp)
jmp 0x32c37
leaq -0x3531(%rip), %rax     # 0x2f700
movq %rax, -0x28(%rbp)
jmp 0x32c37
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movzwl -0x14(%rbp), %esi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::absoluteXFormat<&Rnes::Cpu::nopInst(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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movzwl 0xc(%rdi), %eax
addl $0x1, %eax
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0x14(%rbp)
movzwl -0x12(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x2dd90
movzbl %al, %eax
movzwl %ax, %ecx
shll $0x8, %ecx
movzwl -0x14(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x20(%rax), %eax
cmpl $0x4, %eax
jne 0x32d69
movq -0x20(%rbp), %rdx
movzwl -0x14(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
movzwl -0x14(%rbp), %ecx
movzbl 0x9(%rdx), %edx
addl %edx, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
cmpl %ecx, %eax
je 0x32d67
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x32d69
movq -0x20(%rbp), %rax
movzbl 0x9(%rax), %edx
movzwl -0x14(%rbp), %ecx
addl %edx, %ecx
movw %cx, -0x14(%rbp)
movzwl 0xc(%rax), %ecx
addl $0x3, %ecx
movw %cx, 0xc(%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x32d8e
jmp 0x32daa
movq -0x20(%rbp), %rax
movq (%rax), %rax
leaq -0x36bc(%rip), %rcx     # 0x2f6e0
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, -0x28(%rbp)
jmp 0x32db7
leaq -0x36d1(%rip), %rax     # 0x2f6e0
movq %rax, -0x28(%rbp)
jmp 0x32db7
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movzwl -0x14(%rbp), %esi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movzwl 0xc(%rdi), %eax
addl $0x1, %eax
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0x14(%rbp)
movzwl -0x12(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movzwl %ax, %ecx
shll $0x8, %ecx
movzwl -0x14(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x14(%rbp)
movzwl -0x14(%rbp), %esi
callq 0x2dd90
movzbl %al, %eax
movw %ax, -0x16(%rbp)
movzwl -0x14(%rbp), %eax
andl $0xff, %eax
cmpl $0xff, %eax
jne 0x353a7
movq -0x20(%rbp), %rdi
movzwl -0x14(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
movzwl %ax, %esi
callq 0x2dd90
movzbl %al, %eax
movzwl %ax, %ecx
shll $0x8, %ecx
movzwl -0x16(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x16(%rbp)
jmp 0x353cd
movq -0x20(%rbp), %rdi
movzwl -0x14(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x2dd90
movzbl %al, %eax
movzwl %ax, %ecx
shll $0x8, %ecx
movzwl -0x16(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x16(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xc(%rax), %ecx
addl $0x3, %ecx
movw %cx, 0xc(%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x353e4
jmp 0x35400
movq -0x20(%rbp), %rax
movq (%rax), %rax
leaq -0x5fc2(%rip), %rcx     # 0x2f430
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, -0x28(%rbp)
jmp 0x3540d
leaq -0x5fd7(%rip), %rax     # 0x2f430
movq %rax, -0x28(%rbp)
jmp 0x3540d
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movzwl -0x16(%rbp), %esi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movzwl 0xc(%rax), %ecx
addl $0x1, %ecx
movw %cx, -0x12(%rbp)
movzwl 0xc(%rax), %ecx
addl $0x2, %ecx
movw %cx, 0xc(%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x366f6
jmp 0x36712
movq -0x20(%rbp), %rax
movq (%rax), %rax
leaq -0x6974(%rip), %rcx     # 0x2fd90
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, -0x28(%rbp)
jmp 0x3671f
leaq -0x6989(%rip), %rax     # 0x2fd90
movq %rax, -0x28(%rbp)
jmp 0x3671f
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movzwl -0x12(%rbp), %esi
callq 0x2dd90
movq -0x20(%rbp), %rdi
movb %al, %cl
movq -0x30(%rbp), %rax
movzbl %cl, %ecx
movzbl 0xa(%rdi), %edx
addl %edx, %ecx
movzwl %cx, %ecx
andl $0xff, %ecx
movzwl %cx, %esi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq (%rax), %rdi
callq 0x41810
movq -0x10(%rbp), %rax
movb $0x0, 0x9(%rax)
movq (%rax), %rdi
movl $0x6, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x0, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
movl $0x7, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
movl $0x5, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x2, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
movl $0x4, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x3, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
xorl %esi, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x4, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
movl $0x1, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x5, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
movl $0x2, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x6, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
movq (%rax), %rdi
movl $0x3, %esi
callq 0x419f0
movb %al, %sil
movq -0x10(%rbp), %rax
xorl %edx, %edx
movl $0x1, %ecx
testb $0x1, %sil
cmovnel %ecx, %edx
shll $0x7, %edx
movzbl 0x9(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x9(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movzbl 0x8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3c224
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x41810
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl $0x6, %esi
callq 0x419f0
movb %al, %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
shll $0x0, %eax
movb %al, -0x1(%rbp)
jmp 0x3c258
movq -0x20(%rbp), %rax
movb $0x0, -0x11(%rbp)
movzbl 0x9(%rax), %edx
andl $0x1, %edx
movzbl -0x11(%rbp), %ecx
orl %edx, %ecx
movb %cl, -0x11(%rbp)
movzbl 0x9(%rax), %ecx
sarl %ecx
movb %cl, 0x9(%rax)
movzbl 0x9(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0x9(%rax)
movb -0x11(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x2, -0xc(%rbp)
testb $0x1, 0x30(%rax)
je 0x3c293
jmp 0x3c2b2
leaq 0x2d6d6(%rip), %rdi     # 0x69970
leaq 0x2d6dd(%rip), %rsi     # 0x6997e
movl $0x83, %edx
leaq 0x2d6d9(%rip), %rcx     # 0x69986
callq 0xe240
movq -0x18(%rbp), %rax
movq %rax, %rdi
movzwl 0x38(%rax), %esi
callq 0x3c430
movq -0x18(%rbp), %rdi
movl $0x2004, %esi           # imm = 0x2004
movzbl %al, %edx
callq 0x3c310
movq -0x18(%rbp), %rcx
movw 0x38(%rcx), %ax
addw $0x1, %ax
movw %ax, 0x38(%rcx)
movl 0x34(%rcx), %eax
addl $0x2, %eax
movl %eax, 0x34(%rcx)
movl $0x200, %eax            # imm = 0x200
cmpl 0x34(%rcx), %eax
jne 0x3c2fe
movq -0x18(%rbp), %rax
movb $0x0, 0x30(%rax)
movl $0x2, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
subq $0x20, %rsp
movb %dl, %al
movw %si, %cx
movq %rdi, -0x8(%rbp)
movw %cx, -0xa(%rbp)
movb %al, -0xb(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movzwl -0xa(%rbp), %edi
callq 0x3c550
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
jl 0x3c37b
movzwl -0xa(%rbp), %eax
cmpl $0x2007, %eax           # imm = 0x2007
jg 0x3c37b
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
callq 0x3d9d0
movq %rax, %rdi
movzwl -0xa(%rbp), %esi
subl $0x2000, %esi           # imm = 0x2000
movzbl -0xb(%rbp), %edx
callq 0x23f50
jmp 0x3c41f
movzwl -0xa(%rbp), %eax
cmpl $0x4014, %eax           # imm = 0x4014
jne 0x3c398
movq -0x18(%rbp), %rdi
movzbl -0xb(%rbp), %esi
callq 0x3c520
jmp 0x3c41d
movzwl -0xa(%rbp), %eax
cmpl $0x4016, %eax           # imm = 0x4016
jne 0x3c3be
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
callq 0x3d9f0
movq %rax, %rdi
movzbl -0xb(%rbp), %esi
callq 0x3c180
jmp 0x3c41b
movzwl -0xa(%rbp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jl 0x3c3f9
movzwl -0xa(%rbp), %eax
cmpl $0x4017, %eax           # imm = 0x4017
jg 0x3c3f9
movq -0x18(%rbp), %rdi
addq $0x60, %rdi
callq 0x3da10
movq %rax, %rdi
movzwl -0xa(%rbp), %esi
subl $0x4000, %esi           # imm = 0x4000
movzbl -0xb(%rbp), %edx
callq 0x26520
jmp 0x3c419
movq -0x18(%rbp), %rdi
addq $0x70, %rdi
callq 0x3da30
movq %rax, %rdi
movw -0xa(%rbp), %ax
movzwl %ax, %esi
movzbl -0xb(%rbp), %edx
callq 0x44de0
jmp 0x3c41b
jmp 0x3c41d
jmp 0x3c41f
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
subq $0x20, %rsp
movw %si, %ax
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movzwl -0x12(%rbp), %edi
callq 0x3c550
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
jl 0x3c492
movzwl -0x12(%rbp), %eax
cmpl $0x2007, %eax           # imm = 0x2007
jg 0x3c492
movq -0x20(%rbp), %rdi
addq $0x58, %rdi
callq 0x3d9d0
movq %rax, %rdi
movzwl -0x12(%rbp), %esi
subl $0x2000, %esi           # imm = 0x2000
callq 0x241c0
movb %al, -0x1(%rbp)
jmp 0x3c50d
movzwl -0x12(%rbp), %eax
cmpl $0x4016, %eax           # imm = 0x4016
jne 0x3c4b7
movq -0x20(%rbp), %rdi
addq $0x68, %rdi
callq 0x3d9f0
movq %rax, %rdi
callq 0x3c1d0
movb %al, -0x1(%rbp)
jmp 0x3c50d
movzwl -0x12(%rbp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jl 0x3c4f1
movzwl -0x12(%rbp), %eax
cmpl $0x4017, %eax           # imm = 0x4017
jg 0x3c4f1
movq -0x20(%rbp), %rdi
addq $0x60, %rdi
callq 0x3da10
movq %rax, %rdi
movzwl -0x12(%rbp), %esi
subl $0x4000, %esi           # imm = 0x4000
callq 0x26740
movb %al, -0x1(%rbp)
jmp 0x3c50d
movq -0x20(%rbp), %rdi
addq $0x70, %rdi
callq 0x3da30
movq %rax, %rdi
movzwl -0x12(%rbp), %esi
callq 0x44d40
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movw %di, %ax
movw %ax, -0x2(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jl 0x3c583
movzwl -0x2(%rbp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
jge 0x3c583
movzwl -0x2(%rbp), %eax
andl $0x7ff, %eax            # imm = 0x7FF
addl $0x800, %eax            # imm = 0x800
movw %ax, -0x2(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
jl 0x3c5a9
movzwl -0x2(%rbp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jge 0x3c5a9
movzwl -0x2(%rbp), %eax
andl $0x7, %eax
addl $0x2000, %eax           # imm = 0x2000
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
popq %rbp
retq
nop
// File: 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
movw %di, %ax
movw %ax, -0x2(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x3000, %eax           # imm = 0x3000
jl 0x3c663
movzwl -0x2(%rbp), %eax
cmpl $0x3f00, %eax           # imm = 0x3F00
jge 0x3c663
movzwl -0x2(%rbp), %eax
andl $0xeff, %eax            # imm = 0xEFF
addl $0x2000, %eax           # imm = 0x2000
movw %ax, -0x2(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jl 0x3c67b
movzwl -0x2(%rbp), %eax
subl $0x4000, %eax           # imm = 0x4000
movw %ax, -0x2(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x3f10, %eax           # imm = 0x3F10
jne 0x3c68e
movw $0x3f00, -0x2(%rbp)     # imm = 0x3F00
jmp 0x3c6cb
movzwl -0x2(%rbp), %eax
cmpl $0x3f14, %eax           # imm = 0x3F14
jne 0x3c6a1
movw $0x3f04, -0x2(%rbp)     # imm = 0x3F04
jmp 0x3c6c9
movzwl -0x2(%rbp), %eax
cmpl $0x3f18, %eax           # imm = 0x3F18
jne 0x3c6b4
movw $0x3f08, -0x2(%rbp)     # imm = 0x3F08
jmp 0x3c6c7
movzwl -0x2(%rbp), %eax
cmpl $0x3f1c, %eax           # imm = 0x3F1C
jne 0x3c6c5
movw $0x3f0c, -0x2(%rbp)     # imm = 0x3F0C
jmp 0x3c6c7
jmp 0x3c6c9
jmp 0x3c6cb
movw -0x2(%rbp), %ax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
movl $0x10000, -0xc(%rbp)    # imm = 0x10000
addq $0x50, %rdi
callq 0x3dad0
movq %rax, %rdi
callq 0x30060
movq -0x68(%rbp), %rax
testb $0x1, 0x30(%rax)
jne 0x3c873
movq -0x68(%rbp), %rdi
addq $0x50, %rdi
callq 0x3dad0
movq %rax, %rdi
callq 0x2ff00
movl %eax, -0x10(%rbp)
jmp 0x3c87f
movq -0x68(%rbp), %rdi
callq 0x3c270
movl %eax, -0x10(%rbp)
movq -0x68(%rbp), %rdi
addq $0x60, %rdi
callq 0x3da10
movq %rax, %rdi
movl -0x10(%rbp), %esi
callq 0x264e0
movq -0x68(%rbp), %rdi
addq $0x58, %rdi
callq 0x3d9d0
movq %rax, %rdi
movl -0x10(%rbp), %esi
callq 0x23d50
movq -0x68(%rbp), %rax
movl -0x10(%rbp), %ecx
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movq 0x40(%rax), %rax
movl -0xc(%rbp), %ecx
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
jne 0x3c9b7
movq -0x68(%rbp), %rdi
addq $0x48, %rdi
callq 0x3daf0
movq %rax, %rdi
callq 0x41810
movq -0x68(%rbp), %rdi
addq $0x48, %rdi
callq 0x3daf0
movq %rax, %rdi
movl $0x8, %esi
callq 0x419f0
testb $0x1, %al
jne 0x3c909
jmp 0x3c94f
movq -0x68(%rbp), %rsi
addq $0x10, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x184c0
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x18bb0
jmp 0x3c92d
leaq -0x30(%rbp), %rdi
callq 0xed78
jmp 0x3c94f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xed78
jmp 0x3c9bc
movq -0x68(%rbp), %rdi
addq $0x48, %rdi
callq 0x3daf0
movq %rax, %rdi
movl $0x9, %esi
callq 0x419f0
testb $0x1, %al
jne 0x3c96f
jmp 0x3c9b5
movq -0x68(%rbp), %rsi
addq $0x10, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x184c0
movq -0x68(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x18980
jmp 0x3c993
leaq -0x60(%rbp), %rdi
callq 0xed78
jmp 0x3c9b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xed78
jmp 0x3c9bc
jmp 0x3c9b7
jmp 0x3c84f
movq -0x38(%rbp), %rdi
callq 0xe700
nopw %cs:(%rax,%rax)
// File: 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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3db10
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movb 0x30(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x3db30
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rdi
movl 0x34(%rax), %esi
callq 0x3db60
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rdi
movzwl 0x38(%rax), %esi
callq 0x3db90
movq -0x28(%rbp), %rdi
addq $0x50, %rdi
callq 0x3dad0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dbc0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x30520
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
callq 0x3da10
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dbe0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x26850
movq -0x28(%rbp), %rdi
addq $0x58, %rdi
callq 0x3d9d0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dc00
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x237e0
movq -0x28(%rbp), %rdi
addq $0x68, %rdi
callq 0x3d9f0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dc20
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x3bf50
movq -0x28(%rbp), %rdi
addq $0x70, %rdi
callq 0x3da30
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dc40
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x44e90
movq -0x28(%rbp), %rdi
addq $0x78, %rdi
callq 0x3da50
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dc60
movq -0x20(%rbp), %rdi
movq %rax, %rsi
callq 0x45130
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dc80
movq %rax, %rdi
callq 0x3dca0
movb %al, %cl
movq -0x20(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x30(%rax)
movq -0x10(%rbp), %rdi
callq 0x3dc80
movq %rax, %rdi
callq 0x3dcc0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rdi
callq 0x3dc80
movq %rax, %rdi
callq 0x3dce0
movq -0x20(%rbp), %rdi
movw %ax, 0x38(%rdi)
addq $0x50, %rdi
callq 0x3dad0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dd00
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x305c0
movq -0x20(%rbp), %rdi
addq $0x60, %rdi
callq 0x3da10
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dd20
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x26a00
movq -0x20(%rbp), %rdi
addq $0x58, %rdi
callq 0x3d9d0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dd40
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x23980
movq -0x20(%rbp), %rdi
addq $0x68, %rdi
callq 0x3d9f0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dd60
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x3bf90
movq -0x20(%rbp), %rdi
addq $0x70, %rdi
callq 0x3da30
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dd80
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x44ee0
movq -0x20(%rbp), %rdi
addq $0x78, %rdi
callq 0x3da50
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3dda0
movq -0x18(%rbp), %rdi
movq %rax, %rsi
callq 0x451a0
addq $0x50, %rsp
popq %rbp
retq
nop
// File: 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
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rdi
callq 0xe140
movq %rax, %rdi
movl $0x2, %esi
movb $0x0, %al
callq 0xe580
movl %eax, -0xb0(%rbp)
cmpl $-0x1, -0xb0(%rbp)
jne 0x3ccc3
movl -0xb0(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3cd72
movl -0xb0(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %edi
leaq -0xa8(%rbp), %rsi
callq 0xe900
movl %eax, -0xb0(%rbp)
cmpl $-0x1, -0xb0(%rbp)
jne 0x3cd04
xorl %eax, %eax
movl %eax, %edi
callq 0xe3d0
movl -0xb0(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3cd72
movq -0x78(%rbp), %rsi
movl -0xac(%rbp), %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, %edx
movl $0x2, %ecx
movq %r9, %rdi
callq 0xea00
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq %rcx, (%rax)
movq $-0x1, %rcx
cmpq %rcx, (%rax)
jne 0x3cd51
xorl %eax, %eax
movl %eax, %edi
callq 0xe3d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3cd72
movq -0xb8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0xac(%rbp), %edi
callq 0xe2f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nop
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x2, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x20(%rax)
jne 0x3e782
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3e790
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x4, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x28(%rax)
jne 0x3e8e2
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3e8f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x8, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x30(%rax)
jne 0x3e972
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3e980
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x10, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x38(%rax)
jne 0x3ea02
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3ea10
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x38(%rax)
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x20, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x40(%rax)
jne 0x3ea92
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3eaa0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x40, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x48(%rax)
jne 0x3eb22
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3eb30
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x48(%rax)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
orl $0x80, %esi
movl %esi, (%rcx,%rdx,4)
cmpq $0x0, 0x50(%rax)
jne 0x3ebb5
movq -0x28(%rbp), %rdi
callq 0x284d0
movq %rax, %rdi
callq 0x3ebd0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: 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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x26b52(%rip), %rdi     # 0x6805d
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl $0x400, %ecx            # imm = 0x400
movl $0x3c0, %r8d            # imm = 0x3C0
xorl %r9d, %r9d
movl %edx, %esi
callq 0xe510
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x6, %edx
callq 0xe4e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rax), %rdi
movl $0x16362004, %esi       # imm = 0x16362004
movl $0x1, %edx
movl $0x100, %ecx            # imm = 0x100
movl $0xf0, %r8d
callq 0xe4b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq 0x10(%rax), %rdi
movl $0x100, %esi            # imm = 0x100
movl $0xf0, %edx
callq 0xe920
leaq 0x28553(%rip), %rdi     # 0x69ae4
leaq 0x28565(%rip), %rsi     # 0x69afd
callq 0xe7f0
movl $0x3c000, %edi          # imm = 0x3C000
callq 0xe5b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0xac44, -0x30(%rbp)    # imm = 0xAC44
movw $0x8010, -0x2c(%rbp)    # imm = 0x8010
movb $0x1, -0x2a(%rbp)
movw $0x800, -0x28(%rbp)     # imm = 0x800
leaq -0x242(%rip), %rcx      # 0x413b0
movq %rcx, -0x20(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xe230
cmpl $0x0, %eax
jge 0x41623
leaq 0x284f1(%rip), %rdi     # 0x69b04
movb $0x0, %al
callq 0xe0a0
movl $0x1, -0x4(%rbp)
jmp 0x4163b
movq -0x58(%rbp), %rax
movl -0x50(%rbp), %ecx
movl %ecx, 0x48(%rax)
movzwl -0x48(%rbp), %ecx
movl %ecx, 0x4c(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, (%rax)
movq %rax, %rcx
addq $0x28, %rcx
movb $0x0, 0x28(%rax)
movq %rcx, %rax
addq $0x1, %rax
addq $0xa, %rcx
movq %rcx, -0x20(%rbp)
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movb $0x0, (%rax)
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x18(%rbp)
jne 0x41689
movl $0x30, %edi
callq 0xecd0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x416b6
jmp 0x416d6
movq -0x28(%rbp), %rdi
callq 0x414f0
cmpl $0x0, %eax
jge 0x416c6
jmp 0x416d6
movq -0x28(%rbp), %rdi
callq 0x415c0
cmpl $0x0, %eax
jge 0x416d6
jmp 0x416d6
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: mindbeast[P]rnes/sdl.cpp
// Function: Rnes::Sdl::setPixel(int, int, unsigned char, unsigned char, unsigned char)
void Sdl::setPixel(int x, int y, uint8_t r, uint8_t g, uint8_t b) {
  uint32_t pixel = 0;
  pixel |= 255 << 24;
  pixel |= (uint32_t)r << 16;
  pixel |= (uint32_t)g << 8;
  pixel |= (uint32_t)b << 0;
  image[x + y * renderWidth] = pixel;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %r8d, -0x28(%rbp)
movl %ecx, %eax
movl -0x28(%rbp), %ecx
movl %eax, -0x24(%rbp)
movl %edx, %eax
movl -0x24(%rbp), %edx
movl %eax, -0x20(%rbp)
movl %esi, %eax
movl -0x20(%rbp), %esi
movl %eax, -0x1c(%rbp)
movq %rdi, %r8
movl -0x1c(%rbp), %edi
movb %r9b, %al
movq %r8, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movb %dl, -0x11(%rbp)
movb %cl, -0x12(%rbp)
movb %al, -0x13(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
movl %ecx, -0x18(%rbp)
movzbl -0x11(%rbp), %ecx
shll $0x10, %ecx
orl -0x18(%rbp), %ecx
movl %ecx, -0x18(%rbp)
movzbl -0x12(%rbp), %ecx
shll $0x8, %ecx
orl -0x18(%rbp), %ecx
movl %ecx, -0x18(%rbp)
movzbl -0x13(%rbp), %ecx
shll $0x0, %ecx
orl -0x18(%rbp), %ecx
movl %ecx, -0x18(%rbp)
movl -0x18(%rbp), %edx
movq 0x20(%rax), %rax
movl -0xc(%rbp), %ecx
movl -0x10(%rbp), %esi
shll $0x8, %esi
addl %esi, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: mindbeast[P]rnes/mmc.cpp
// Function: Rnes::MmcNone::MmcNone(std::vector<unsigned char*, std::allocator<unsigned char*>> const&, std::vector<unsigned char*, std::allocator<unsigned char*>> const&, unsigned int, bool)
MmcNone::MmcNone(const std::vector<uint8_t *> &prgRoms, const std::vector<uint8_t *> &chrRoms,
                 uint32_t prgRam, bool vertMirror)
    : progRoms{prgRoms}, charRoms{chrRoms}, numPrgRam{prgRam}, verticalMirror{vertMirror} {
  assert(numPrgRam == 0 || numPrgRam == 1);
  assert(prgRoms.size() <= 2);
  assert(chrRoms.size() <= 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
andb $0x1, %al
movb %al, -0x1d(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x434f0
movq -0x40(%rbp), %rdi
leaq 0x4f2b9(%rip), %rax     # 0x90d00
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0x38(%rbp)
movq -0x10(%rbp), %rsi
callq 0x43510
jmp 0x41a5d
movq -0x40(%rbp), %rdi
addq $0x20, %rdi
movq -0x18(%rbp), %rsi
callq 0x43510
jmp 0x41a70
movq -0x40(%rbp), %rcx
movl -0x1c(%rbp), %eax
movl %eax, 0x38(%rcx)
movb -0x1d(%rbp), %al
andb $0x1, %al
movb %al, 0x3c(%rcx)
movb $0x1, %al
cmpl $0x0, 0x38(%rcx)
movb %al, -0x41(%rbp)
je 0x41a9b
movq -0x40(%rbp), %rax
cmpl $0x1, 0x38(%rax)
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x41aa4
jmp 0x41aa6
jmp 0x41aea
leaq 0x280a9(%rip), %rdi     # 0x69b56
leaq 0x280c3(%rip), %rsi     # 0x69b77
movl $0x3a, %edx
leaq 0x280bf(%rip), %rcx     # 0x69b7f
callq 0xe240
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x41b50
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x3dfd0
jmp 0x41b50
movq -0x10(%rbp), %rdi
callq 0x3fb30
cmpq $0x2, %rax
ja 0x41afb
jmp 0x41b1a
leaq 0x280e4(%rip), %rdi     # 0x69be6
leaq 0x2806e(%rip), %rsi     # 0x69b77
movl $0x3b, %edx
leaq 0x2806a(%rip), %rcx     # 0x69b7f
callq 0xe240
movq -0x18(%rbp), %rdi
callq 0x3fb30
cmpq $0x1, %rax
ja 0x41b2b
jmp 0x41b4a
leaq 0x280c8(%rip), %rdi     # 0x69bfa
leaq 0x2803e(%rip), %rsi     # 0x69b77
movl $0x3c, %edx
leaq 0x2803a(%rip), %rcx     # 0x69b7f
callq 0xe240
addq $0x50, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x43e10
movq -0x28(%rbp), %rdi
callq 0xe700
nopw %cs:(%rax,%rax)