LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/sdl.cpp
// Function: Rnes::Sdl::parseInput()
void Sdl::parseInput() {
  SDL_Event event;
  int button;

  while (SDL_PollEvent(&event)) {
    switch (event.type) {
    case SDL_KEYDOWN:
    case SDL_KEYUP:
      switch (event.key.keysym.sym) {
      case SDLK_UP:
      case SDLK_w:
        button = BUTTON_UP;
        break;
      case SDLK_DOWN:
      case SDLK_s:
        button = BUTTON_DOWN;
        break;
      case SDLK_LEFT:
      case SDLK_a:
        button = BUTTON_LEFT;
        break;
      case SDLK_RIGHT:
      case SDLK_d:
        button = BUTTON_RIGHT;
        break;
      case SDLK_RETURN:
      case SDLK_KP_ENTER:
        button = BUTTON_START;
        break;
      case SDLK_RSHIFT:
      case SDLK_LSHIFT:
        button = BUTTON_SELECT;
        break;
      case SDLK_z:
      case SDLK_n:
        button = BUTTON_A;
        break;
      case SDLK_x:
      case SDLK_m:
        button = BUTTON_B;
        break;
      case SDLK_k:
        button = BUTTON_SAVE;
        break;
      case SDLK_l:
        button = BUTTON_RESTORE;
        break;
      default:
        continue;
      }
      if (event.type == SDL_KEYDOWN) {
        buttonState[button] = true;
      } else {
        buttonState[button] = false;
      }
      break;
    case SDL_QUIT:
      exit(1);
      break;
    default:
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq -0x60(%rbp), %r14
leaq 0xf57d(%rip), %r12      # 0x2b720
leaq 0xf596(%rip), %r13      # 0x2b740
leaq 0xf537(%rip), %r15      # 0x2b6e8
movq %r14, %rdi
callq 0xb890
testl %eax, %eax
je 0x1c25b
movl -0x60(%rbp), %eax
leal -0x300(%rax), %ecx
cmpl $0x2, %ecx
jae 0x1c1f8
movl -0x4c(%rbp), %edx
leal -0x61(%rdx), %ecx
cmpl $0xd, %ecx
jbe 0x1c201
xorl %ecx, %ecx
leal -0x4000004f(%rdx), %esi
cmpl $0x9, %esi
jbe 0x1c20e
leal -0x73(%rdx), %esi
cmpl $0x7, %esi
ja 0x1c21c
movslq (%r12,%rsi,4), %rdx
addq %r12, %rdx
jmpq *%rdx
cmpl $0x100, %eax            # imm = 0x100
jne 0x1c1b1
jmp 0x1c26a
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
pushq $0x8
jmp 0x1c24b
movslq (%r13,%rsi,4), %rdx
addq %r13, %rdx
jmpq *%rdx
pushq $0x3
jmp 0x1c24b
cmpl $0xd, %edx
je 0x1c245
cmpl $0x400000e1, %edx       # imm = 0x400000E1
je 0x1c231
cmpl $0x400000e5, %edx       # imm = 0x400000E5
jne 0x1c1b1
pushq $0x5
jmp 0x1c24b
pushq $0x2
jmp 0x1c24b
pushq $0x7
jmp 0x1c24b
pushq $0x6
jmp 0x1c24b
pushq $0x1
jmp 0x1c24b
pushq $0x4
jmp 0x1c24b
pushq $0x9
popq %rcx
cmpl $0x300, %eax            # imm = 0x300
sete 0x28(%rbx,%rcx)
jmp 0x1c1b1
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0xb510
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, -0x2c(%rbp)
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
leaq 0x23b0b(%rip), %rax     # 0x3fdb0
movq %rax, (%rdi)
leaq 0x8(%rdi), %r12
movq %r12, %rdi
callq 0x1cef4
leaq 0x20(%r13), %rdi
movq %rbx, %rsi
callq 0x1cef4
movl %r15d, 0x38(%r13)
movl -0x2c(%rbp), %eax
movb %al, 0x3c(%r13)
cmpl $0x2, %r15d
jae 0x1c2fa
movq 0x8(%r14), %rax
subq (%r14), %rax
cmpq $0x11, %rax
jae 0x1c313
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cmpq $0x9, %rax
jae 0x1c32c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf4d9(%rip), %rdi      # 0x2b7da
leaq 0xf4f3(%rip), %rsi      # 0x2b7fb
leaq 0xf4f4(%rip), %rcx      # 0x2b803
pushq $0x3a
jmp 0x1c343
leaq 0xf550(%rip), %rdi      # 0x2b86a
leaq 0xf4da(%rip), %rsi      # 0x2b7fb
leaq 0xf4db(%rip), %rcx      # 0x2b803
pushq $0x3b
jmp 0x1c343
leaq 0xf54b(%rip), %rdi      # 0x2b87e
leaq 0xf4c1(%rip), %rsi      # 0x2b7fb
leaq 0xf4c2(%rip), %rcx      # 0x2b803
pushq $0x3c
popq %rdx
callq 0xb170
movq %rax, %rbx
movq %r12, %rdi
callq 0x1bd2e
movq %rbx, %rdi
callq 0xb4e0
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::MmcNone::cpuMemRead(unsigned short)
uint8_t MmcNone::cpuMemRead(uint16_t addr) {
  assert(addr >= mmcCpuAddrBase);
  // prg rom 1
  if ((addr >= 0x8000) and (addr < 0x8000 + 0x4000) and (progRoms.size() == 2)) {
    return *(progRoms[0] + addr - 0x8000);
  }
  // prg rom 2
  if ((addr >= 0xc000) and (progRoms.size() >= 1)) {
    if (progRoms.size() == 1) {
      return *(progRoms[0] + addr - 0xc000);
    } else {
      return *(progRoms[1] + addr - 0xc000);
    }
  }
  return 0;
}

// Assembly:
cmpw $0x5fff, %si            # imm = 0x5FFF
jbe 0x1c42d
cmpw $0xbfff, %si            # imm = 0xBFFF
jg 0x1c3fc
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
subq %rax, %rdx
movq $-0x8000, %rcx          # imm = 0x8000
cmpq $0x10, %rdx
je 0x1c420
jmp 0x1c42a
jbe 0x1c42a
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
je 0x1c42a
movq $-0xc000, %rcx          # imm = 0xFFFF4000
cmpq $0x1, %rdx
je 0x1c420
addq $0x8, %rax
movzwl %si, %edx
addq (%rax), %rdx
movb (%rcx,%rdx), %al
retq
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0xf45a(%rip), %rdi      # 0x2b892
leaq 0xf3bc(%rip), %rsi      # 0x2b7fb
leaq 0xf49e(%rip), %rcx      # 0x2b8e4
pushq $0x44
popq %rdx
callq 0xb170
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::cpuMemWrite(unsigned short, unsigned char)
void Mmc1::cpuMemWrite(uint16_t addr, uint8_t val) {
  // shift register writes
  if ((addr >= shiftWriteAddr) and (addr <= shiftWriteAddrLimit)) {
    // initialize shift register when 7th bit is set.
    if (val & (1 << 7)) {
      shiftRegister = shiftInit;
      controlReg |= 0x3 << 2;
      if (debug) {
        std::cerr << "mmc1: control reg reset: " << std::hex << (int)controlReg << std::endl;
      }
    } else {
      uint8_t oldShiftRegister = shiftRegister;
      shiftRegister >>= 1;
      shiftRegister |= (val & 0x1) << 4;
      // lowest bit is set on last write.
      if (oldShiftRegister & 0x1) {
        updateMmcRegister(addr, shiftRegister);
        shiftRegister = shiftInit;
      }
    }
  }
}

// Assembly:
testw %si, %si
js 0x1c600
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb %dl, %dl
js 0x1c637
movb 0x54(%rbx), %al
movl %eax, %ecx
shrb %cl
shlb $0x4, %dl
andb $0x10, %dl
orb %cl, %dl
movb %dl, 0x54(%rbx)
testb $0x1, %al
je 0x1c63f
movzwl %si, %esi
movzbl %dl, %edx
movq %rbx, %rdi
callq 0x1c5c6
movb $0x10, 0x54(%rbx)
jmp 0x1c63f
movb $0x10, 0x54(%rbx)
orb $0xc, 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::cpuMemRead(unsigned short)
uint8_t Mmc1::cpuMemRead(uint16_t addr) {
  assert(addr >= mmcCpuAddrBase);
  // prg rom @ 0x8000
  uint32_t prgRomMode = getPrgRomMode();
  uint8_t bank = prgBank & 0xf;
  if ((addr >= 0x8000) and (addr < 0x8000 + 0x4000)) {
    switch (prgRomMode) {
    case 0:
    case 1:
      return *(progRoms[bank & ~0x1] + addr - 0x8000);
      break;
    case 2:
      return *(progRoms[0] + addr - 0x8000);
      break;
    case 3:
      return *(progRoms[bank] + addr - 0x8000);
      break;
    default:
      assert(0);
      break;
    }
  }
  // prg rom @ 0xc000
  if (addr >= 0xc000) {
    switch (prgRomMode) {
    case 0:
    case 1:
      return *(progRoms[(bank & ~0x1) + 1] + addr - 0xc000);
      break;
    case 2:
      return *(progRoms[bank] + addr - 0xc000);
      break;
    case 3:
      return *(progRoms[progRoms.size() - 1] + addr - 0xc000);
      break;
    default:
      assert(0);
      break;
    }
  }
  return 0;
}

// Assembly:
cmpw $0x5fff, %si            # imm = 0x5FFF
jbe 0x1c6e2
movl 0x50(%rdi), %edx
shrl $0x2, %edx
andl $0x3, %edx
movzbl 0x53(%rdi), %eax
movl %eax, %ecx
andl $0xf, %ecx
cmpw $0xbfff, %si            # imm = 0xBFFF
jg 0x1c67b
cmpl $0x2, %edx
jae 0x1c690
andl $0xe, %eax
shll $0x3, %eax
addq 0x8(%rdi), %rax
jmp 0x1c696
jbe 0x1c69f
cmpb $0x2, %dl
jae 0x1c6a2
andb $0xe, %al
movzbl %al, %eax
leal 0x8(,%rax,8), %eax
jmp 0x1c6b0
jne 0x1c6b6
movq 0x8(%rdi), %rax
movq $-0x8000, %rdx          # imm = 0x8000
jmp 0x1c6d8
xorl %eax, %eax
retq
movzbl %dl, %eax
cmpl $0x2, %eax
jne 0x1c6c9
movzbl %cl, %eax
shll $0x3, %eax
addq 0x8(%rdi), %rax
jmp 0x1c6d1
shll $0x3, %ecx
addq 0x8(%rdi), %rcx
movq $-0x8000, %rdx          # imm = 0x8000
movq %rcx, %rax
jmp 0x1c6d8
movq 0x10(%rdi), %rax
addq $-0x8, %rax
movq $-0xc000, %rdx          # imm = 0xFFFF4000
movzwl %si, %ecx
addq (%rax), %rcx
movb (%rdx,%rcx), %al
retq
pushq %rbp
movq %rsp, %rbp
leaq 0xf1a5(%rip), %rdi      # 0x2b892
leaq 0xf107(%rip), %rsi      # 0x2b7fb
leaq 0xf29a(%rip), %rcx      # 0x2b995
movl $0xb1, %edx
callq 0xb170
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::vidMemWrite(unsigned short, unsigned char)
void Mmc1::vidMemWrite(uint16_t addr, uint8_t val) {
  addr = vidAddrTranslate(addr);
  bool chr8kMode = getChrRomMode() == 0;
  if ((charRoms.size() == 0) and (addr < 0x1000)) {
    if (chr8kMode) {
      videoMemory->patternTableMemory[addr] = val;
    } else {
      videoMemory->patternTableMemory[addr + ((chr0Bank & 0x1) ? 0x1000 : 0)] = val;
    }
  } else if ((charRoms.size() == 0) and (addr >= 0x1000) and (addr <= 0x1fff)) {
    if (chr8kMode) {
      videoMemory->patternTableMemory[addr] = val;
    } else {
      videoMemory->patternTableMemory[addr - 0x1000 + ((chr1Bank & 0x1) ? 0x1000 : 0)] = val;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x50(%rax)
movb 0x50(%r14), %dl
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdi
cmpq %rsi, %rdi
setne %r8b
movzwl %ax, %ecx
cmpw $0x1000, %cx            # imm = 0x1000
setae %al
orb %r8b, %al
jne 0x1c74f
movq 0x48(%r14), %rax
addq $0x8, %rax
testb $0x10, %dl
je 0x1c778
movzbl 0x51(%r14), %edx
jmp 0x1c78a
cmpq %rsi, %rdi
setne %al
movl %ecx, %esi
andl $0xf000, %esi           # imm = 0xF000
cmpw $0x1000, %si            # imm = 0x1000
setne %sil
orb %al, %sil
jne 0x1c797
movq 0x48(%r14), %rax
addq $0x8, %rax
testb $0x10, %dl
jne 0x1c77f
movl %ecx, %ecx
addq %rcx, %rax
jmp 0x1c795
addl $0xfffff000, %ecx       # imm = 0xFFFFF000
movzbl 0x52(%r14), %edx
andl $0x1, %edx
shll $0xc, %edx
orl %ecx, %edx
addq %rdx, %rax
movb %bl, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::vidMemRead(unsigned short)
uint8_t Mmc1::vidMemRead(uint16_t addr) {
  bool chr8kMode = getChrRomMode() == 0;
  if (charRoms.size() > 0) {
    // chr rom @ 0x0
    if (addr < 0x1000) {
      if (chr8kMode) {
        return *(charRoms[chr0Bank >> 1] + addr);
      } else {
        return *(charRoms[chr0Bank >> 1] + addr + ((chr0Bank & 0x1) ? 0x1000 : 0));
      }
    }
    // chr rom @ 0x1000
    if ((addr >= 0x1000) and (addr <= 0x1fff)) {
      if (chr8kMode) {
        return *(charRoms[chr0Bank >> 1] + addr);
      } else {
        return *(charRoms[chr1Bank >> 1] + addr + ((chr1Bank & 0x1) ? 0x1000 : 0) - 0x1000);
      }
    }
  } else {
    if (chr8kMode) {
      if (addr < 0x2000) {
        return videoMemory->patternTableMemory[addr];
      }
    } else {
      if (addr < 0x1000) {
        return videoMemory->patternTableMemory[addr + (chr0Bank & 0x1) ? 0x1000 : 0];
      }
      if ((addr >= 0x1000) and (addr <= 0x1fff)) {
        return videoMemory->patternTableMemory[addr - 0x1000 + (chr1Bank & 0x1) ? 0x1000 : 0];
      }
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x50(%rdi), %dl
movq 0x20(%rdi), %rcx
cmpq %rcx, 0x28(%rdi)
je 0x1c7dd
cmpw $0xfff, %si             # imm = 0xFFF
ja 0x1c7f9
movzbl 0x51(%rdi), %edi
movl %edi, %r8d
andl $-0x2, %r8d
movzwl %si, %eax
addq (%rcx,%r8,4), %rax
testb $0x10, %dl
je 0x1c875
andl $0x1, %edi
shll $0xc, %edi
addq %rdi, %rax
jmp 0x1c875
testb $0x10, %dl
jne 0x1c815
cmpw $0x1fff, %si            # imm = 0x1FFF
ja 0x1c855
movq 0x48(%rdi), %rax
movzwl %si, %ecx
addq %rcx, %rax
addq $0x8, %rax
jmp 0x1c875
cmpw $0x1fff, %si            # imm = 0x1FFF
ja 0x1c855
movzwl %si, %eax
testb $0x10, %dl
jne 0x1c859
movzbl 0x51(%rdi), %edx
andl $-0x2, %edx
addq (%rcx,%rdx,4), %rax
jmp 0x1c875
movzwl %si, %eax
cmpw $0xfff, %si             # imm = 0xFFF
ja 0x1c829
movq 0x48(%rdi), %rcx
movzbl 0x51(%rdi), %edx
jmp 0x1c83d
cmpw $0x1fff, %si            # imm = 0x1FFF
ja 0x1c855
movq 0x48(%rdi), %rcx
addl $0xfffff000, %eax       # imm = 0xFFFFF000
movzbl 0x52(%rdi), %edx
andl $0x1, %edx
xorl %esi, %esi
orl %eax, %edx
setne %sil
shll $0xc, %esi
leaq (%rcx,%rsi), %rax
addq $0x8, %rax
jmp 0x1c875
xorl %eax, %eax
jmp 0x1c877
movzbl 0x52(%rdi), %edx
movl %edx, %esi
andl $-0x2, %esi
addq (%rcx,%rsi,4), %rax
andl $0x1, %edx
shll $0xc, %edx
addq %rdx, %rax
addq $-0x1000, %rax          # imm = 0xF000
movb (%rax), %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::vidAddrTranslate(unsigned short)
uint16_t Mmc1::vidAddrTranslate(uint16_t addr) {
  uint32_t mirrorMode = getMirroringMode();
  switch (mirrorMode) {
  case 0:
    return translateSingleMirror(addr);
  case 1:
    return translateSingleMirror(addr) + nameTableSize;
  case 2:
    return translateVerticalMirror(addr);
  case 3:
    return translateHorizMirror(addr);
  default:
    assert(0);
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl 0x50(%rdi), %eax
andl $0x3, %eax
leaq 0xef14(%rip), %rcx      # 0x2b7a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %esi, %ecx
andl $0xf000, %ecx           # imm = 0xF000
movl %esi, %eax
andl $0x23ff, %eax           # imm = 0x23FF
cmpw $0x2000, %cx            # imm = 0x2000
cmovnel %esi, %eax
jmp 0x1c919
movl %esi, %ecx
andl $0xfc00, %ecx           # imm = 0xFC00
movl %esi, %edx
andl $0x27ff, %edx           # imm = 0x27FF
movl %esi, %eax
andl $0x23ff, %eax           # imm = 0x23FF
cmpw $0x2800, %cx            # imm = 0x2800
cmovnel %esi, %eax
cmpw $0x2c00, %cx            # imm = 0x2C00
jmp 0x1c8f8
movl %esi, %ecx
andl $0xfc00, %ecx           # imm = 0xFC00
movl %esi, %edx
andl $0x23ff, %edx           # imm = 0x23FF
movl %esi, %eax
andl $0x2bff, %eax           # imm = 0x2BFF
cmpw $0x2c00, %cx            # imm = 0x2C00
cmovnel %esi, %eax
cmpw $0x2400, %cx            # imm = 0x2400
cmovel %edx, %eax
jmp 0x1c919
movl %esi, %ecx
andl $0xf000, %ecx           # imm = 0xF000
movl %esi, %eax
andl $0x23ff, %eax           # imm = 0x23FF
cmpw $0x2000, %cx            # imm = 0x2000
cmovnel %esi, %eax
addl $0x400, %eax            # imm = 0x400
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::save(Rnes::MmcState&)
void Mmc1::save(MmcState &pb) {
  MmcState_Mmc1State *mmc1 = pb.mutable_mmc1();
  mmc1->set_controlreg(controlReg);
  mmc1->set_chr0bank(chr0Bank);
  mmc1->set_chr1bank(chr1Bank);
  mmc1->set_prgbank(prgBank);
  mmc1->set_shiftregister(shiftRegister);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1d028
movzbl 0x50(%rbx), %ecx
movl %ecx, 0x18(%rax)
movzbl 0x51(%rbx), %ecx
movl %ecx, 0x1c(%rax)
movzbl 0x52(%rbx), %ecx
movl %ecx, 0x20(%rax)
movzbl 0x53(%rbx), %ecx
movl %ecx, 0x24(%rax)
movzbl 0x54(%rbx), %ecx
orl $0x1f, 0x10(%rax)
movl %ecx, 0x28(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc1::restore(Rnes::MmcState&)
void Mmc1::restore(MmcState &pb) {
  const MmcState_Mmc1State &mmc1 = pb.mmc1();
  controlReg = mmc1.controlreg();
  chr0Bank = mmc1.chr0bank();
  chr1Bank = mmc1.chr1bank();
  prgBank = mmc1.prgbank();
  shiftRegister = mmc1.shiftregister();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x20(%rsi), %rax
testq %rax, %rax
jne 0x1c970
leaq 0x25098(%rip), %rax     # 0x41a08
movb 0x18(%rax), %cl
movb %cl, 0x50(%rdi)
movb 0x1c(%rax), %cl
movb %cl, 0x51(%rdi)
movb 0x20(%rax), %cl
movb %cl, 0x52(%rdi)
movb 0x24(%rax), %cl
movb %cl, 0x53(%rdi)
movb 0x28(%rax), %al
movb %al, 0x54(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc3::get1kChrBank(unsigned int)
uint8_t *Mmc3::get1kChrBank(uint32_t bank) {
  if (charRoms.size() == 0) {
    return &videoMemory->patternTableMemory[bank * 1024];
  } else {
    return charRoms[bank >> 3] + (bank & 0x7) * 1024;
  }
}

// Assembly:
movl %esi, %eax
movq 0x20(%rdi), %rcx
cmpq %rcx, 0x28(%rdi)
je 0x1cab1
pushq %rbp
movq %rsp, %rbp
movl %eax, %edx
andl $-0x8, %edx
andl $0x7, %eax
shll $0xa, %eax
addq (%rcx,%rdx), %rax
popq %rbp
retq
movq 0x48(%rdi), %rcx
shll $0xa, %eax
addq %rcx, %rax
addq $0x8, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc3::cpuMemWrite(unsigned short, unsigned char)
void Mmc3::cpuMemWrite(uint16_t addr, uint8_t val) {
  assert(addr >= mmcCpuAddrBase);

  // mmc control register writes
  if (addr >= 0x8000 and addr <= 0x9fff) {
    if (addr & 0x1) {
      updateBankRegister(val);
    } else {
      bankSelectReg = val;
    }
  } else if (addr >= 0xa000 and addr <= 0xbfff) {
    if (addr & 0x1) {
      prgRamReg = val;
    } else {
      mirrorReg = val;
    }
  } else if (addr >= 0xc000 and addr <= 0xdfff) {
    if (addr & 0x1) {
      irqCounterReg = 0;
    } else {
      irqReloadReg = val;
    }
  } else if (addr >= 0xe000 and addr <= 0xffff) {
    if (addr & 0x1) {
      irqEnabled = true;
    } else {
      irqEnabled = false;
      irqPending = false;
    }
  }
}

// Assembly:
cmpw $0x5fff, %si            # imm = 0x5FFF
jbe 0x1cb85
cmpw $0x9fff, %si            # imm = 0x9FFF
jg 0x1cb30
testb $0x1, %sil
jne 0x1cb4e
movb %dl, 0x50(%rdi)
retq
movl %esi, %eax
andl $0xe000, %eax           # imm = 0xE000
cmpw $0xc000, %ax            # imm = 0xC000
je 0x1cb5a
cmpl $0xa000, %eax           # imm = 0xA000
jne 0x1cb64
testb $0x1, %sil
jne 0x1cb77
movb %dl, 0x51(%rdi)
retq
movzbl 0x50(%rdi), %eax
andl $0x7, %eax
movb %dl, 0x53(%rdi,%rax)
retq
testb $0x1, %sil
jne 0x1cb7b
movb %dl, 0x5b(%rdi)
retq
cmpw $0xe000, %si            # imm = 0xE000
jb 0x1cb76
testb $0x1, %sil
jne 0x1cb80
andw $0x0, 0x5d(%rdi)
retq
movb %dl, 0x52(%rdi)
retq
movb $0x0, 0x5c(%rdi)
retq
movb $0x1, 0x5d(%rdi)
retq
pushq %rbp
movq %rsp, %rbp
leaq 0xed02(%rip), %rdi      # 0x2b892
leaq 0xec64(%rip), %rsi      # 0x2b7fb
leaq 0xeea5(%rip), %rcx      # 0x2ba43
movl $0x15b, %edx            # imm = 0x15B
callq 0xb170
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc3::cpuMemRead(unsigned short)
uint8_t Mmc3::cpuMemRead(uint16_t addr) {
  assert(addr >= mmcCpuAddrBase);

  // prg rom @ 0x8000
  if ((addr >= 0x8000) and (addr < 0x8000 + 0x2000)) {
    uint8_t bank;
    if (isLowerPrgRomSwappable())
      bank = bankRegister[6];
    else
      bank = get8kPrgBankCount() - 2;
    return *(get8kPrgBank(bank) + addr - 0x8000);
  }
  // prg rom @ 0xa000
  if ((addr >= 0xa000) and (addr < 0xa000 + 0x2000)) {
    uint8_t bank = bankRegister[7];
    return *(get8kPrgBank(bank) + addr - 0xa000);
  }

  // prg rom @ 0xc000
  if ((addr >= 0xc000) and (addr <= 0xdfff)) {
    uint8_t bank;
    if (isLowerPrgRomSwappable())
      bank = get8kPrgBankCount() - 2;
    else
      bank = bankRegister[6];
    return *(get8kPrgBank(bank) + addr - 0xc000);
  }
  // prg rom @ 0xe000
  if ((addr >= 0xe000) and (addr <= 0xffff)) {
    return *(get8kPrgBank(get8kPrgBankCount() - 1) + addr - 0xe000);
  }
  return 0;
}

// Assembly:
cmpw $0x5fff, %si            # imm = 0x5FFF
jbe 0x1cca2
cmpw $0x9fff, %si            # imm = 0x9FFF
jg 0x1cbc9
testb $0x40, 0x50(%rdi)
jne 0x1cc00
movb 0x59(%rdi), %al
movq 0x8(%rdi), %rcx
jmp 0x1cc10
movl %esi, %eax
andl $0xe000, %eax           # imm = 0xE000
cmpw $0xc000, %ax            # imm = 0xC000
je 0x1cc2b
cmpl $0xa000, %eax           # imm = 0xA000
jne 0x1cc43
movzbl 0x5a(%rdi), %eax
movq 0x8(%rdi), %rcx
movl %eax, %edx
andl $0x3e, %edx
andl $0x1, %eax
shll $0xd, %eax
addq (%rcx,%rdx,4), %rax
movq $-0xa000, %rcx          # imm = 0xFFFF6000
jmp 0x1cc95
movl 0x10(%rdi), %eax
movq 0x8(%rdi), %rcx
subl %ecx, %eax
shrl $0x2, %eax
andb $-0x2, %al
addb $-0x2, %al
movzbl %al, %eax
movl %eax, %edx
andl $0x3e, %edx
andl $0x1, %eax
shll $0xd, %eax
addq (%rcx,%rdx,4), %rax
movq $-0x8000, %rcx          # imm = 0x8000
jmp 0x1cc95
testb $0x40, 0x50(%rdi)
jne 0x1cc75
movl 0x10(%rdi), %eax
movq 0x8(%rdi), %rcx
subl %ecx, %eax
shrl $0x2, %eax
andb $-0x2, %al
addb $-0x2, %al
jmp 0x1cc7c
cmpw $0xe000, %si            # imm = 0xE000
jb 0x1cc9f
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
andl $-0x2, %edx
decl %edx
shrl %edx
andl $-0x61, %edx
movl $0x2000, %eax           # imm = 0x2000
addq (%rcx,%rdx,8), %rax
movq $-0xe000, %rcx          # imm = 0xFFFF2000
jmp 0x1cc95
movb 0x59(%rdi), %al
movq 0x8(%rdi), %rcx
movzbl %al, %eax
movl %eax, %edx
andl $0x3e, %edx
andl $0x1, %eax
shll $0xd, %eax
addq (%rcx,%rdx,4), %rax
movq $-0xc000, %rcx          # imm = 0xFFFF4000
movzwl %si, %edx
addq %rax, %rdx
movb (%rcx,%rdx), %al
retq
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0xebe5(%rip), %rdi      # 0x2b892
leaq 0xeb47(%rip), %rsi      # 0x2b7fb
leaq 0xedc0(%rip), %rcx      # 0x2ba7b
movl $0x17b, %edx            # imm = 0x17B
callq 0xb170
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc3::getChrPointer(unsigned short)
uint8_t *Mmc3::getChrPointer(uint16_t addr) {
  bool a12Invert = isChrA12Inverted();
  assert(addr <= 0x1fff);

  if (a12Invert) {
    addr ^= (1 << 12);
  }
  if (addr <= 0x7ff) {
    return get2kChrBank(bankRegister[0]) + addr;
  } else if (addr >= 0x800 and addr <= 0xfff) {
    return get2kChrBank(bankRegister[1]) + addr - 0x800;
  } else if (addr >= 0x1000 and addr <= 0x13ff) {
    return get1kChrBank(bankRegister[2]) + addr - 0x1000;
  } else if (addr >= 0x1400 and addr <= 0x17ff) {
    return get1kChrBank(bankRegister[3]) + addr - 0x1400;
  } else if (addr >= 0x1800 and addr <= 0x1bff) {
    return get1kChrBank(bankRegister[4]) + addr - 0x1800;
  } else if (addr >= 0x1c00 and addr <= 0x1fff) {
    return get1kChrBank(bankRegister[5]) + addr - 0x1c00;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpw $0x2000, %si            # imm = 0x2000
jae 0x1cd95
movl %esi, %ebx
xorl $0x1000, %ebx           # imm = 0x1000
cmpb $0x0, 0x50(%rdi)
cmovnsl %esi, %ebx
cmpw $0x7ff, %bx             # imm = 0x7FF
ja 0x1cd05
movzbl 0x53(%rdi), %esi
callq 0x1cf4c
movq %rax, %rcx
movzwl %bx, %eax
addq %rcx, %rax
jmp 0x1cd90
cmpw $0xfff, %bx             # imm = 0xFFF
ja 0x1cd23
movzbl 0x54(%rdi), %esi
callq 0x1cf4c
movzwl %bx, %ecx
addq %rcx, %rax
addq $-0x800, %rax           # imm = 0xF800
jmp 0x1cd90
cmpw $0x13ff, %bx            # imm = 0x13FF
ja 0x1cd41
movzbl 0x55(%rdi), %esi
callq 0x1ca90
movzwl %bx, %ecx
addq %rcx, %rax
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x1cd90
cmpw $0x17ff, %bx            # imm = 0x17FF
ja 0x1cd5f
movzbl 0x56(%rdi), %esi
callq 0x1ca90
movzwl %bx, %ecx
addq %rcx, %rax
addq $-0x1400, %rax          # imm = 0xEC00
jmp 0x1cd90
movzwl %bx, %r14d
cmpw $0x1bff, %bx            # imm = 0x1BFF
ja 0x1cd7e
movzbl 0x57(%rdi), %esi
callq 0x1ca90
addq %r14, %rax
addq $-0x1800, %rax          # imm = 0xE800
jmp 0x1cd90
movzbl 0x58(%rdi), %esi
callq 0x1ca90
addq %r14, %rax
addq $-0x1c00, %rax          # imm = 0xE400
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xed10(%rip), %rdi      # 0x2baac
leaq 0xea58(%rip), %rsi      # 0x2b7fb
leaq 0xed11(%rip), %rcx      # 0x2babb
movl $0x19e, %edx            # imm = 0x19E
callq 0xb170
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc3::notifyScanlineComplete()
void Mmc3::notifyScanlineComplete() {
  if (irqCounterReg == 0) {
    irqCounterReg = irqReloadReg;
  } else {
    irqCounterReg--;
    if (irqCounterReg == 0 and irqEnabled) {
      irqPending = true;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x5c(%rdi), %al
testb %al, %al
je 0x1ce16
decb %al
movb %al, 0x5c(%rdi)
jne 0x1ce1c
cmpb $0x1, 0x5d(%rdi)
jne 0x1ce1c
movb $0x1, 0x5e(%rdi)
jmp 0x1ce1c
movb 0x5b(%rdi), %al
movb %al, 0x5c(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/mmc.cpp
// Function: Rnes::Mmc3::save(Rnes::MmcState&)
void Mmc3::save(MmcState &pb) {
  /*
  // internal control registers
  uint8_t bankSelectReg = 1 << 6;
  uint8_t mirrorReg = 0;
  uint8_t prgRamReg = 0;
  uint8_t bankRegister[8] = {0};
  uint8_t irqReloadReg = 0;
  uint8_t irqCounterReg = 0;
  bool irqEnabled = false;
  bool irqPending = false;
  */

  MmcState_Mmc3State *mmc3 = pb.mutable_mmc3();
  mmc3->set_bankselectreg(bankSelectReg);
  mmc3->set_mirrorreg(mirrorReg);
  mmc3->set_prgramreg(prgRamReg);
  mmc3->set_bankregister(bankRegister, bankRegisterCount);
  mmc3->set_irqreloadreg(irqReloadReg);
  mmc3->set_irqcounterreg(irqCounterReg);
  mmc3->set_irqenabled(irqEnabled);
  mmc3->set_irqpending(irqPending);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1d062
movq %rax, %r14
movzbl 0x50(%rbx), %eax
movl %eax, 0x20(%r14)
movzbl 0x51(%rbx), %eax
movl %eax, 0x24(%r14)
movzbl 0x52(%rbx), %eax
orl $0xe, 0x10(%r14)
movl %eax, 0x28(%r14)
leaq 0x53(%rbx), %rsi
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x1cf5a
movzbl 0x5b(%rbx), %eax
movl %eax, 0x2c(%r14)
movzbl 0x5c(%rbx), %eax
movl %eax, 0x30(%r14)
movb 0x5d(%rbx), %al
movb %al, 0x34(%r14)
movb 0x5e(%rbx), %al
orl $0xf0, 0x10(%r14)
movb %al, 0x35(%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::MmcState_Mmc3State::set_bankregister(void const*, unsigned long)
inline void MmcState_Mmc3State::set_bankregister(const void* value,
    size_t size) {
  _has_bits_[0] |= 0x00000001u;
  bankregister_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
      reinterpret_cast<const char*>(value), size), GetArena());
  // @@protoc_insertion_point(field_set_pointer:Rnes.MmcState.Mmc3State.bankRegister)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
orb $0x1, 0x10(%rdi)
leaq 0x18(%rdi), %rbx
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq -0x30(%rbp), %rdi
callq 0x127ce
movq 0x8(%r14), %rcx
testb $0x1, %cl
jne 0x1cfb2
movq 0x2403c(%rip), %rsi     # 0x40fd0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x1d09c
leaq -0x30(%rbp), %rdi
callq 0xb9d8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x1cf8d
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xb9d8
movq %rbx, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::MmcState::_internal_mutable_mmc1()
inline ::Rnes::MmcState_Mmc1State* MmcState::_internal_mutable_mmc1() {
  _has_bits_[0] |= 0x00000002u;
  if (mmc1_ == nullptr) {
    auto* p = CreateMaybeMessage<::Rnes::MmcState_Mmc1State>(GetArena());
    mmc1_ = p;
  }
  return mmc1_;
}

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

// Assembly:
orb $0x4, 0x10(%rdi)
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x1d070
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testb $0x1, %dil
jne 0x1d093
callq 0x263e2
movq %rax, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andq $-0x2, %rdi
movq (%rdi), %rdi
jmp 0x1d083
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/memory.cpp
// Function: Rnes::CpuMemory::load(unsigned short) const
uint8_t CpuMemory::load(uint16_t addr) const {
  if (addr < cpuSramSize) {
    return cpuSram[addr];
  } else if ((addr >= prgSramBase) and (addr < prgSramBase + prgSramSize) and
             mmc->isPrgSramEnabled()) {
    return prgSram[addr - prgSramBase];
  } else {
    return mmc->cpuMemRead(addr);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
cmpw $0x7ff, %r14w           # imm = 0x7FF
ja 0x1d20a
movzwl %r14w, %eax
movb 0x8(%rbx,%rax), %al
popq %rbx
popq %r14
popq %rbp
retq
cmpw $0x6000, %r14w          # imm = 0x6000
jl 0x1d231
movq (%rbx), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
testb %al, %al
je 0x1d231
movzwl %r14w, %eax
andl $0x1fff, %eax           # imm = 0x1FFF
movb 0x808(%rbx,%rax), %al
jmp 0x1d205
movq (%rbx), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movzwl %r14w, %esi
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/memory.cpp
// Function: Rnes::CpuMemory::store(unsigned short, unsigned char)
void CpuMemory::store(uint16_t addr, uint8_t data) {
  if (addr < cpuSramSize) {
    cpuSram[addr] = data;
  } else if ((addr >= prgSramBase) and (addr < prgSramBase + prgSramSize) and
             mmc->isPrgSramWriteable()) {
    prgSram[addr - prgSramBase] = data;
  } else {
    mmc->cpuMemWrite(addr, data);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
cmpw $0x7ff, %r15w           # imm = 0x7FF
ja 0x1d274
movzwl %r15w, %eax
movb %bl, 0x8(%r14,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpw $0x6000, %r15w          # imm = 0x6000
jl 0x1d29c
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
testb %al, %al
je 0x1d29c
movzwl %r15w, %eax
andl $0x1fff, %eax           # imm = 0x1FFF
movb %bl, 0x808(%r14,%rax)
jmp 0x1d269
movq (%r14), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movzwl %r15w, %esi
movzbl %bl, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/memory.cpp
// Function: Rnes::CpuMemory::restore(Rnes::CpuMemoryState const&)
void CpuMemory::restore(const CpuMemoryState &pb) {
  const std::string &bytes = pb.cpusram();
  for (unsigned i = 0; i < bytes.size(); i++) {
    cpuSram[i] = bytes[i];
  }

  const std::string &prgBytes = pb.prgsram();
  for (unsigned i = 0; i < prgBytes.size(); i++) {
    prgSram[i] = prgBytes[i];
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x18(%rsi), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, 0x8(%rax)
jbe 0x1d314
movq (%rax), %rdx
movb (%rdx,%rcx), %dl
movb %dl, 0x8(%rdi,%rcx)
incl %ecx
jmp 0x1d2fe
movq 0x20(%rsi), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, 0x8(%rax)
jbe 0x1d333
movq (%rax), %rdx
movb (%rdx,%rcx), %dl
movb %dl, 0x808(%rdi,%rcx)
incl %ecx
jmp 0x1d31a
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/memory.cpp
// Function: Rnes::VideoMemory::load(unsigned short) const
uint8_t VideoMemory::load(uint16_t addr) const {
  if (addr >= 0x2000 and addr < 0x2000 + 0x1000) {
    addr = mmc->vidAddrTranslate(addr);
    return nameTableMemory[addr - 0x2000];
  } else if (addr >= 0x3f00 and addr <= 0x3f1f) {
    return paletteMemory[addr - 0x3f00];
  } else {
    return mmc->vidMemRead(addr);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %eax
andl $0xf000, %eax           # imm = 0xF000
cmpw $0x2000, %ax            # imm = 0x2000
jne 0x1d361
movq (%rbx), %rdi
movq (%rdi), %rax
movzwl %si, %esi
callq *0x50(%rax)
movzwl %ax, %eax
movb 0x8(%rax,%rbx), %al
jmp 0x1d37b
movl %esi, %eax
andl $0xffe0, %eax           # imm = 0xFFE0
cmpw $0x3f00, %ax            # imm = 0x3F00
jne 0x1d382
movzwl %si, %eax
andl $0x1f, %eax
movb 0x3008(%rbx,%rax), %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq (%rbx), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
movzwl %si, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/memory.cpp
// Function: Rnes::VideoMemory::store(unsigned short, unsigned char)
void VideoMemory::store(uint16_t addr, uint8_t data) {
  if (addr >= 0x2000 and addr < 0x2000 + 0x1000) {
    nameTableMemory[addr - 0x2000] = data;
  } else if (addr >= 0x3f00 and addr <= 0x3f1f) {
    paletteMemory[addr - 0x3f00] = data;
  } else {
    mmc->vidMemWrite(addr, data);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
andl $0xf000, %eax           # imm = 0xF000
cmpw $0x2000, %ax            # imm = 0x2000
jne 0x1d3b8
addl $0xffffe000, %esi       # imm = 0xFFFFE000
movb %dl, 0x2008(%rdi,%rsi)
jmp 0x1d3d2
movl %esi, %eax
andl $0xffe0, %eax           # imm = 0xFFE0
cmpw $0x3f00, %ax            # imm = 0x3F00
jne 0x1d3d4
addl $0xffffc100, %esi       # imm = 0xFFFFC100
movb %dl, 0x3008(%rdi,%rsi)
popq %rbp
retq
movq (%rdi), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
movzwl %si, %esi
movzbl %dl, %edx
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/memory.cpp
// Function: Rnes::VideoMemory::restore(Rnes::VideoMemoryState const&)
void VideoMemory::restore(const VideoMemoryState &pb) {
  {
    const std::string &bytes = pb.patterntablememory();
    for (unsigned i = 0; i < bytes.size(); i++) {
      patternTableMemory[i] = bytes[i];
    }
  }
  {
    const std::string &bytes = pb.nametablememory();
    for (unsigned i = 0; i < bytes.size(); i++) {
      nameTableMemory[i] = bytes[i];
    }
  }
  {
    const std::string &bytes = pb.palettememory();
    for (unsigned i = 0; i < bytes.size(); i++) {
      paletteMemory[i] = bytes[i];
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x18(%rsi), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, 0x8(%rax)
jbe 0x1d454
movq (%rax), %rdx
movb (%rdx,%rcx), %dl
movb %dl, 0x8(%rdi,%rcx)
incl %ecx
jmp 0x1d43e
movq 0x20(%rsi), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, 0x8(%rax)
jbe 0x1d473
movq (%rax), %rdx
movb (%rdx,%rcx), %dl
movb %dl, 0x2008(%rdi,%rcx)
incl %ecx
jmp 0x1d45a
movq 0x28(%rsi), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, 0x8(%rax)
jbe 0x1d492
movq (%rax), %rdx
movb (%rdx,%rcx), %dl
movb %dl, 0x3008(%rdi,%rcx)
incl %ecx
jmp 0x1d479
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::CpuMemoryState::set_cpusram(void const*, unsigned long)
inline void CpuMemoryState::set_cpusram(const void* value,
    size_t size) {
  _has_bits_[0] |= 0x00000001u;
  cpusram_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
      reinterpret_cast<const char*>(value), size), GetArena());
  // @@protoc_insertion_point(field_set_pointer:Rnes.CpuMemoryState.cpuSram)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
orb $0x1, 0x10(%rdi)
leaq 0x18(%rdi), %rbx
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq -0x30(%rbp), %rdi
callq 0x127ce
movq 0x8(%r14), %rcx
testb $0x1, %cl
jne 0x1d4ec
movq 0x23b02(%rip), %rsi     # 0x40fd0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x1d09c
leaq -0x30(%rbp), %rdi
callq 0xb9d8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x1d4c7
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xb9d8
movq %rbx, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::CpuMemoryState::set_prgsram(void const*, unsigned long)
inline void CpuMemoryState::set_prgsram(const void* value,
    size_t size) {
  _has_bits_[0] |= 0x00000002u;
  prgsram_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
      reinterpret_cast<const char*>(value), size), GetArena());
  // @@protoc_insertion_point(field_set_pointer:Rnes.CpuMemoryState.prgSram)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
orb $0x2, 0x10(%rdi)
leaq 0x20(%rdi), %rbx
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq -0x30(%rbp), %rdi
callq 0x127ce
movq 0x8(%r14), %rcx
testb $0x1, %cl
jne 0x1d562
movq 0x23a8c(%rip), %rsi     # 0x40fd0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x1d09c
leaq -0x30(%rbp), %rdi
callq 0xb9d8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x1d53d
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xb9d8
movq %rbx, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::VideoMemoryState::set_patterntablememory(void const*, unsigned long)
inline void VideoMemoryState::set_patterntablememory(const void* value,
    size_t size) {
  _has_bits_[0] |= 0x00000001u;
  patterntablememory_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
      reinterpret_cast<const char*>(value), size), GetArena());
  // @@protoc_insertion_point(field_set_pointer:Rnes.VideoMemoryState.patternTableMemory)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
orb $0x1, 0x10(%rdi)
leaq 0x18(%rdi), %rbx
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq -0x30(%rbp), %rdi
callq 0x127ce
movq 0x8(%r14), %rcx
testb $0x1, %cl
jne 0x1d5d8
movq 0x23a16(%rip), %rsi     # 0x40fd0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x1d09c
leaq -0x30(%rbp), %rdi
callq 0xb9d8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x1d5b3
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xb9d8
movq %rbx, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::VideoMemoryState::set_nametablememory(void const*, unsigned long)
inline void VideoMemoryState::set_nametablememory(const void* value,
    size_t size) {
  _has_bits_[0] |= 0x00000002u;
  nametablememory_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
      reinterpret_cast<const char*>(value), size), GetArena());
  // @@protoc_insertion_point(field_set_pointer:Rnes.VideoMemoryState.nameTableMemory)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
orb $0x2, 0x10(%rdi)
leaq 0x20(%rdi), %rbx
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq -0x30(%rbp), %rdi
callq 0x127ce
movq 0x8(%r14), %rcx
testb $0x1, %cl
jne 0x1d64e
movq 0x239a0(%rip), %rsi     # 0x40fd0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x1d09c
leaq -0x30(%rbp), %rdi
callq 0xb9d8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x1d629
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xb9d8
movq %rbx, %rdi
callq 0xb4e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/./bin/save.pb.h
// Function: Rnes::VideoMemoryState::set_palettememory(void const*, unsigned long)
inline void VideoMemoryState::set_palettememory(const void* value,
    size_t size) {
  _has_bits_[0] |= 0x00000004u;
  palettememory_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
      reinterpret_cast<const char*>(value), size), GetArena());
  // @@protoc_insertion_point(field_set_pointer:Rnes.VideoMemoryState.paletteMemory)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
orb $0x4, 0x10(%rdi)
leaq 0x28(%rdi), %rbx
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq -0x30(%rbp), %rdi
callq 0x127ce
movq 0x8(%r14), %rcx
testb $0x1, %cl
jne 0x1d6c4
movq 0x2392a(%rip), %rsi     # 0x40fd0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x1d09c
leaq -0x30(%rbp), %rdi
callq 0xb9d8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x1d69f
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xb9d8
movq %rbx, %rdi
callq 0xb4e0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_ApuState_save_2eproto()
static void InitDefaultsscc_info_ApuState_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_ApuState_default_instance_;
    new (ptr) ::Rnes::ApuState();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::ApuState::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xf690(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
leaq 0x241d9(%rip), %rbx     # 0x418e0
movq %rbx, %rdi
callq 0x28cb6
movq %rbx, %rdi
callq 0x28cc2
leaq 0x24122(%rip), %rax     # 0x41840
movq %rax, 0x241e3(%rip)     # 0x41908
movq %rax, 0x241e4(%rip)     # 0x41910
leaq 0x24145(%rip), %rax     # 0x41878
movq %rax, 0x241de(%rip)     # 0x41918
leaq 0x24167(%rip), %rax     # 0x418a8
movq %rax, 0x241d8(%rip)     # 0x41920
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_ControllerState_save_2eproto()
static void InitDefaultsscc_info_ControllerState_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_ControllerState_default_instance_;
    new (ptr) ::Rnes::ControllerState();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::ControllerState::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xf627(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
andq $0x0, 0x24337(%rip)     # 0x41aa8
leaq 0x24328(%rip), %rdi     # 0x41aa0
leaq 0x23091(%rip), %rax     # 0x40810
movq %rax, 0x2431a(%rip)     # 0x41aa0
xorps %xmm0, %xmm0
movups %xmm0, 0x24320(%rip)    # 0x41ab0
popq %rbp
jmp 0x28cc2
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_CpuMemoryState_save_2eproto()
static void InitDefaultsscc_info_CpuMemoryState_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_CpuMemoryState_default_instance_;
    new (ptr) ::Rnes::CpuMemoryState();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::CpuMemoryState::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xf5de(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
leaq 0x24307(%rip), %rbx     # 0x41ac0
movq %rbx, %rdi
callq 0x28cd6
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x28cc2
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_CpuState_save_2eproto()
static void InitDefaultsscc_info_CpuState_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_CpuState_default_instance_;
    new (ptr) ::Rnes::CpuState();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::CpuState::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xf5a7(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
andq $0x0, 0x2401f(%rip)     # 0x41810
leaq 0x24010(%rip), %rdi     # 0x41808
leaq 0x22881(%rip), %rax     # 0x40080
movq %rax, 0x24002(%rip)     # 0x41808
xorps %xmm0, %xmm0
movups %xmm0, 0x24008(%rip)    # 0x41818
movups %xmm0, 0x24011(%rip)    # 0x41828
andq $0x0, 0x24019(%rip)     # 0x41838
popq %rbp
jmp 0x28cc2
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_DmaState_save_2eproto()
static void InitDefaultsscc_info_DmaState_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_DmaState_default_instance_;
    new (ptr) ::Rnes::DmaState();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::DmaState::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xf551(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
andq $0x0, 0x242d9(%rip)     # 0x41b20
leaq 0x242ca(%rip), %rdi     # 0x41b18
leaq 0x231cb(%rip), %rax     # 0x40a20
movq %rax, 0x242bc(%rip)     # 0x41b18
xorps %xmm0, %xmm0
movups %xmm0, 0x242c2(%rip)    # 0x41b28
andl $0x0, 0x242cb(%rip)     # 0x41b38
popq %rbp
jmp 0x28cc2
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_MmcState_save_2eproto()
static void InitDefaultsscc_info_MmcState_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_MmcState_default_instance_;
    new (ptr) ::Rnes::MmcState();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::MmcState::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xf501(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
leaq 0x241da(%rip), %rbx     # 0x41a70
movq %rbx, %rdi
callq 0x28ce2
movq %rbx, %rdi
callq 0x28cc2
leaq 0x24143(%rip), %rax     # 0x419f0
movq %rax, 0x241d4(%rip)     # 0x41a88
leaq 0x2414d(%rip), %rax     # 0x41a08
movq %rax, 0x241ce(%rip)     # 0x41a90
leaq 0x2416f(%rip), %rax     # 0x41a38
movq %rax, 0x241c8(%rip)     # 0x41a98
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_MmcState_Mmc1State_save_2eproto()
static void InitDefaultsscc_info_MmcState_Mmc1State_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_MmcState_Mmc1State_default_instance_;
    new (ptr) ::Rnes::MmcState_Mmc1State();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::MmcState_Mmc1State::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xf49f(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
andq $0x0, 0x24117(%rip)     # 0x41a10
leaq 0x24108(%rip), %rdi     # 0x41a08
leaq 0x22cf9(%rip), %rax     # 0x40600
movq %rax, 0x240fa(%rip)     # 0x41a08
xorps %xmm0, %xmm0
movups %xmm0, 0x24100(%rip)    # 0x41a18
movups %xmm0, 0x24105(%rip)    # 0x41a24
popq %rbp
jmp 0x28cc2
// File: /workspace/github_cpp_makefile_star2_O2/mindbeast[P]rnes/bin/save.pb.cc
// Function: InitDefaultsscc_info_MmcState_Mmc3State_save_2eproto()
static void InitDefaultsscc_info_MmcState_Mmc3State_save_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::Rnes::_MmcState_Mmc3State_default_instance_;
    new (ptr) ::Rnes::MmcState_Mmc3State();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Rnes::MmcState_Mmc3State::InitAsDefaultInstance();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xf44f(%rip), %rdx      # 0x2cd81
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0xb110
leaq 0x240f0(%rip), %rbx     # 0x41a38
movq %rbx, %rdi
callq 0x28cee
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x28cc2