LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apu.cpp
// Function: Rnes::Apu::restore(Rnes::ApuState const&)
void Apu::restore(const ApuState &pb) {
  // Restore sub-units.
  pulseA->restore(pb.pulsea());
  pulseB->restore(pb.pulseb());
  triangle->restore(pb.triangle());
  noise->restore(pb.noise());

  /*
  // Apu register file.
  repeated uint32 reg = 1;
  optional uint32 sampleRate = 2;
  optional uint32 fourFrameCount = 3;
  optional uint32 fiveFrameCount = 4;
  optional uint32 frameDivider = 5;
  optional uint32 step = 6;
  optional uint32 halfTimerDivider = 7;
  optional uint32 samplerDivider = 8;
  optional float clksPerSample = 9;
  optional float currentSampleClk = 10;
  optional uint32 nextSampleCountdown = 11;
  */

  for (int i = 0; i < pb.reg_size(); i++) {
    regs[i] = pb.reg(i);
  }

  sampleRate = pb.samplerate();
  fourFrameCount = pb.fourframecount();
  fiveFrameCount = pb.fiveframecount();
  frameDivider = pb.framedivider();
  step = pb.step();
  halfTimerDivider = pb.halftimerdivider();
  samplerDivider = pb.samplerdivider();
  clksPerSample = pb.clkspersample();
  currentSampleClk = pb.currentsampleclk();
  nextSampleCountdown = pb.nextsamplecountdown();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0xe8(%rdi), %rdi
movq 0x28(%rsi), %rsi
testq %rsi, %rsi
leaq 0x2e1e0(%rip), %r15     # 0x47840
cmoveq %r15, %rsi
callq 0x1a428
movq 0xf0(%rbx), %rdi
movq 0x30(%r14), %rsi
testq %rsi, %rsi
cmoveq %r15, %rsi
callq 0x1a428
movq 0xf8(%rbx), %rdi
movq 0x38(%r14), %rsi
testq %rsi, %rsi
jne 0x19697
leaq 0x2e1e1(%rip), %rsi     # 0x47878
callq 0x1a644
movq 0x100(%rbx), %rdi
movq 0x40(%r14), %rsi
testq %rsi, %rsi
jne 0x196b3
leaq 0x2e1f5(%rip), %rsi     # 0x478a8
callq 0x1a7e6
cmpl $0x0, 0x18(%r14)
jle 0x196e6
leaq 0x18(%r14), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0xa720
movb (%rax), %al
movb %al, 0xb8(%rbx,%r12)
incq %r12
movslq (%r15), %rax
cmpq %rax, %r12
jl 0x196c6
movl 0x48(%r14), %eax
movl %eax, 0xd0(%rbx)
movl 0x4c(%r14), %eax
movq %rax, 0xd8(%rbx)
movl 0x50(%r14), %eax
movq %rax, 0xe0(%rbx)
movl 0x54(%r14), %eax
movl %eax, 0x10(%rbx)
movl 0x58(%r14), %eax
movl %eax, 0x14(%rbx)
movl 0x5c(%r14), %eax
movl %eax, 0x18(%rbx)
movl 0x60(%r14), %eax
movl %eax, 0x1c(%rbx)
movss 0x64(%r14), %xmm0
movss %xmm0, 0x20(%rbx)
movss 0x68(%r14), %xmm0
movss %xmm0, 0x24(%rbx)
movl 0x6c(%r14), %eax
movl %eax, 0x28(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/./ringbuffer.h
// Function: Rnes::RingBuffer<short>::getData(short*, unsigned int)
void getData(T *out, uint32_t count) {
    {
      std::unique_lock<std::mutex> lock(mutex);
      if (!hasData(count)) {
        consumeCv.wait(lock, [&] { return this->hasData(count); });
      }
      for (uint32_t i = 0; i < count; i++) {
        out[i] = buffer[get & (size - 1)];
        get += 1;
      }
    }
    produceCv.notify_one();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x30(%rdi), %rax
leaq -0x40(%rbp), %r12
movq %rax, (%r12)
movb $0x0, 0x8(%r12)
movq %r12, %rdi
callq 0x19e46
movb $0x1, 0x8(%r12)
movl %r15d, -0x2c(%rbp)
movl %r15d, %r15d
movq 0x20(%rbx), %rax
addq %r15, %rax
cmpq 0x28(%rbx), %rax
jbe 0x19be1
movq 0x20(%rbx), %rax
addq %r15, %rax
cmpq 0x28(%rbx), %rax
jbe 0x19be1
leaq 0x58(%rbx), %r12
leaq -0x40(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xa4c0
movq 0x20(%rbx), %rax
addq %r15, %rax
cmpq 0x28(%rbx), %rax
ja 0x19bc9
cmpl $0x0, -0x2c(%rbp)
je 0x19c0c
movl 0x18(%rbx), %eax
decl %eax
movq (%rbx), %rcx
xorl %edx, %edx
movq 0x20(%rbx), %rsi
andl %eax, %esi
movzwl (%rcx,%rsi,2), %esi
movw %si, (%r14,%rdx,2)
incq 0x20(%rbx)
incq %rdx
cmpq %rdx, %r15
jne 0x19bf1
leaq -0x40(%rbp), %rdi
callq 0x19e2c
addq $0x88, %rbx
movq %rbx, %rdi
callq 0xa460
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/./ringbuffer.h
// Function: Rnes::RingBuffer<unsigned short>::putData(unsigned short const*, unsigned int)
void putData(const T *in, uint32_t count) {
    {
      std::unique_lock<std::mutex> lock(mutex);
      if (!hasEmptySpace(count)) {
        produceCv.wait(lock, [&] { return this->hasEmptySpace(count); });
      }
      for (uint32_t i = 0; i < count; i++) {
        buffer[put & (size - 1)] = in[i];
        put += 1;
      }
    }
    consumeCv.notify_one();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, -0x24(%rbp)
leaq 0x30(%rdi), %rax
leaq -0x38(%rbp), %r12
movq %rax, (%r12)
movb $0x0, 0x8(%r12)
movq %r12, %rdi
callq 0x19e46
movb $0x1, 0x8(%r12)
movl %r15d, %eax
addq 0x28(%rbx), %rax
subq 0x20(%rbx), %rax
movl 0x18(%rbx), %ecx
cmpq %rcx, %rax
jbe 0x19c9d
leaq 0x88(%rbx), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x24(%rbp), %rcx
movq %rbx, %rdx
callq 0x19ffe
movl -0x24(%rbp), %r15d
testl %r15d, %r15d
je 0x19ccc
movl 0x18(%rbx), %eax
decl %eax
movq (%rbx), %rcx
movl %r15d, %edx
xorl %esi, %esi
movzwl (%r14,%rsi,2), %edi
movq 0x28(%rbx), %r8
andl %eax, %r8d
movw %di, (%rcx,%r8,2)
incq 0x28(%rbx)
incq %rsi
cmpq %rsi, %rdx
jne 0x19caf
leaq -0x38(%rbp), %rdi
callq 0x19e2c
addq $0x58, %rbx
movq %rbx, %rdi
callq 0xa460
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x19e2c
movq %rbx, %rdi
callq 0xa4d0
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Pulse::envelopeDividerClock()
void Pulse::envelopeDividerClock() {
  if (envelope) {
    envelope--;
  } else if (isEnvelopeLoopSet()) {
    envelope = 15;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x12(%rdi), %al
testb %al, %al
je 0x1a3b3
decb %al
jmp 0x1a3be
movq 0x8(%rdi), %rcx
movb $0xf, %al
testb $0x20, (%rcx)
je 0x1a3c1
movb %al, 0x12(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Pulse::getCurrentSample() const
uint8_t Pulse::getCurrentSample() const {
  // channel is silenced when period is < 8
  const uint16_t timerPeriod = getTimerPeriod();
  if (timerPeriod < 8) {
    return 0;
  }
  // channel silenced when target is above 0x7ff
  const uint16_t targetPeriod = computeSweepTarget();
  if (targetPeriod > 0x7ff) {
    return 0;
  }
  if (!isNonZeroLength()) {
    return 0;
  }
  if (!currentSample) {
    return 0;
  }
  return getVolume();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rdx
movzbl 0x2(%rdx), %eax
movzbl 0x3(%rdx), %ecx
andl $0x7, %ecx
shll $0x8, %ecx
addl %ecx, %eax
incl %eax
cmpw $0x8, %ax
jb 0x1a4b4
movb 0x1(%rdx), %sil
movzwl %ax, %eax
movl %esi, %ecx
andb $0x7, %cl
movl %eax, %r8d
shrl %cl, %r8d
movzbl 0x10(%rdi), %ecx
xorl $0x1, %ecx
subl %r8d, %ecx
testb $0x8, %sil
cmovel %r8d, %ecx
addl %eax, %ecx
movzwl %cx, %eax
cmpl $0x7ff, %eax            # imm = 0x7FF
jbe 0x1a4b8
xorl %eax, %eax
popq %rbp
retq
xorl %eax, %eax
cmpb $0x0, 0x11(%rdi)
je 0x1a4b6
cmpb $0x0, 0x17(%rdi)
je 0x1a4b6
movb (%rdx), %al
movl %eax, %ecx
andb $0xf, %cl
testb $0x10, %al
movzbl 0x12(%rdi), %edx
movzbl %cl, %eax
cmovel %edx, %eax
jmp 0x1a4b6
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Pulse::clockEnvelope()
void Pulse::clockEnvelope() {
  if (resetEnvelopeAndDivider) {
    envelope = 15;
    envelopeDivider = getEnvelopeN() + 1;
    resetEnvelopeAndDivider = false;
  } else {
    if (envelopeDivider) {
      envelopeDivider--;
    } else {
      envelopeDividerClock();
      envelopeDivider = getEnvelopeN() + 1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x1, 0x14(%rdi)
jne 0x1a4fd
movb $0xf, 0x12(%rdi)
movq 0x8(%rdi), %rax
movb (%rax), %al
andb $0xf, %al
incb %al
movb %al, 0x13(%rdi)
movb $0x0, 0x14(%rdi)
jmp 0x1a534
movb 0x13(%rdi), %al
testb %al, %al
je 0x1a50b
decb %al
movb %al, 0x13(%rdi)
jmp 0x1a534
movb 0x12(%rdi), %al
testb %al, %al
je 0x1a51a
decb %al
movq 0x8(%rdi), %rcx
jmp 0x1a527
movq 0x8(%rdi), %rcx
movb (%rcx), %dl
movb $0xf, %al
testb $0x20, %dl
je 0x1a52c
movb %al, 0x12(%rdi)
movb (%rcx), %dl
andb $0xf, %dl
incb %dl
movb %dl, 0x13(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Pulse::clockLengthAndSweep()
void Pulse::clockLengthAndSweep() {
  // Length
  if (!isHalted() and lengthCounter) {
    lengthCounter--;
  }
  // Sweep
  if (resetSweepDivider) {
    sweepDivider = getSweepP() + 1;
    resetSweepDivider = false;
  } else {
    if (sweepDivider) {
      sweepDivider--;
    } else {
      if (isSweepEnabled()) {
        sweepDivider = getSweepP() + 1;
        sweepPeriod();
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
testb $0x20, (%rax)
jne 0x1a54f
movb 0x11(%rdi), %cl
testb %cl, %cl
je 0x1a54f
decb %cl
movb %cl, 0x11(%rdi)
cmpb $0x1, 0x15(%rdi)
jne 0x1a568
movb 0x1(%rax), %al
shrb $0x4, %al
andb $0x7, %al
incb %al
movb %al, 0x16(%rdi)
movb $0x0, 0x15(%rdi)
jmp 0x1a57d
movb 0x16(%rdi), %cl
testb %cl, %cl
je 0x1a576
decb %cl
movb %cl, 0x16(%rdi)
jmp 0x1a57d
movb 0x1(%rax), %al
testb %al, %al
js 0x1a57f
popq %rbp
retq
shrb $0x4, %al
andb $0x7, %al
incb %al
movb %al, 0x16(%rdi)
popq %rbp
jmp 0x1a318
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Triangle::clockLinearCounter()
void Triangle::clockLinearCounter() {
  if (linearCounterHalt) {
    linearCounter = getLinearCounterReload();
  } else if (linearCounter) {
    linearCounter--;
  }
  if (!getControlFlag()) {
    linearCounterHalt = false;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x1, 0x29(%rdi)
jne 0x1a69e
movq 0x20(%rdi), %rax
movb (%rax), %al
andb $0x7f, %al
jmp 0x1a6a7
movb 0x2a(%rdi), %al
testb %al, %al
je 0x1a6aa
decb %al
movb %al, 0x2a(%rdi)
movq 0x20(%rdi), %rax
cmpb $0x0, (%rax)
js 0x1a6b7
movb $0x0, 0x29(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Noise::getVolume() const
uint8_t Noise::getVolume() const {
  if (isDisabled()) {
    return getEnvelopeN();
  } else {
    return envelope;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movb (%rax), %al
testb $0x10, %al
jne 0x1a752
movl 0xc(%rdi), %eax
jmp 0x1a757
andb $0xf, %al
movzbl %al, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Noise::envelopeDividerClock()
void Noise::envelopeDividerClock() {
  if (envelope) {
    envelope--;
  } else if (isEnvelopeLoopSet()) {
    envelope = 15;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0xc(%rdi), %al
testb %al, %al
je 0x1a769
decb %al
jmp 0x1a773
movq (%rdi), %rcx
movb $0xf, %al
testb $0x20, (%rcx)
je 0x1a776
movb %al, 0xc(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/apuunit.cpp
// Function: Rnes::Noise::getCurrentSample() const
uint8_t Noise::getCurrentSample() const {
  if (!currentSample) {
    return 0;
  }
  if (!isNonZeroLength()) {
    return 0;
  }
  return getVolume();
}

// Assembly:
xorl %eax, %eax
cmpb $0x0, 0xf(%rdi)
je 0x1a79e
cmpb $0x0, 0x8(%rdi)
je 0x1a79e
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movb (%rax), %al
testb $0x10, %al
jne 0x1a798
movl 0xc(%rdi), %eax
jmp 0x1a79d
andb $0xf, %al
movzbl %al, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::setZeroAndNeg(unsigned char)
void Cpu::setZeroAndNeg(uint8_t val) {
  if (val == 0) {
    setFlag(ZERO);
  } else {
    clearFlag(ZERO);
  }
  if (val & (1 << 7)) {
    setFlag(NEGATIVE);
  } else {
    clearFlag(NEGATIVE);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x18(%rdi), %al
testl %esi, %esi
je 0x1a9b0
andb $-0x3, %al
testb %sil, %sil
jns 0x1a9b2
orb $-0x80, %al
jmp 0x1a9b4
orb $0x2, %al
andb $0x7f, %al
movb %al, 0x18(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::doInt()
uint32_t Cpu::doInt() {
  pushStack((uint8_t)(pc >> 8));
  pushStack((uint8_t)pc);
  pushStack(status);
  setFlag(INT_DISABLE);
  pc = load(irqBaseAddr) | ((uint16_t)load(irqBaseAddr + 1) << 8);
  cycle += 7;
  return 7;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzbl 0xd(%rdi), %edx
movzbl 0xe(%rdi), %esi
movl $0x100, %r14d           # imm = 0x100
orl %r14d, %esi
movq (%rdi), %rdi
callq 0x20656
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0xc(%rbx), %edx
movzbl %al, %esi
orl %r14d, %esi
movq (%rbx), %rdi
callq 0x20656
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0x18(%rbx), %edx
movzbl %al, %esi
orl %r14d, %esi
movq (%rbx), %rdi
callq 0x20656
decb 0xe(%rbx)
orb $0x4, 0x18(%rbx)
movq (%rbx), %rdi
movl $0xfffe, %esi           # imm = 0xFFFE
callq 0x2072e
movzbl %al, %r14d
movq (%rbx), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x2072e
movzbl %al, %eax
shll $0x8, %eax
orl %r14d, %eax
movw %ax, 0xc(%rbx)
addq $0x7, 0x10(%rbx)
movl $0x7, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::doNmi()
uint32_t Cpu::doNmi() {
  pushStack((uint8_t)(pc >> 8));
  pushStack((uint8_t)pc);
  pushStack(status);
  setFlag(INT_DISABLE);
  pc = load(nmiBaseAddr) | ((uint16_t)load(nmiBaseAddr + 1) << 8);
  cycle += 7;
  return 7;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzbl 0xd(%rdi), %edx
movzbl 0xe(%rdi), %esi
movl $0x100, %r14d           # imm = 0x100
orl %r14d, %esi
movq (%rdi), %rdi
callq 0x20656
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0xc(%rbx), %edx
movzbl %al, %esi
orl %r14d, %esi
movq (%rbx), %rdi
callq 0x20656
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0x18(%rbx), %edx
movzbl %al, %esi
orl %r14d, %esi
movq (%rbx), %rdi
callq 0x20656
decb 0xe(%rbx)
orb $0x4, 0x18(%rbx)
movq (%rbx), %rdi
movl $0xfffa, %esi           # imm = 0xFFFA
callq 0x2072e
movzbl %al, %r14d
movq (%rbx), %rdi
movl $0xfffb, %esi           # imm = 0xFFFB
callq 0x2072e
movzbl %al, %eax
shll $0x8, %eax
orl %r14d, %eax
movw %ax, 0xc(%rbx)
addq $0x7, 0x10(%rbx)
movl $0x7, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::adcInst(unsigned short)
void Cpu::adcInst(uint16_t addr) {
  uint8_t v = load(addr);
  uint16_t result = a + v + (getFlag(CARRY) ? 1 : 0);
  if (result & (1u << 8)) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  if (isNeg((uint8_t)result) && isPos(a) && isPos(v)) {
    setFlag(OVERFL);
  } else if (isPos((uint8_t)result) && isNeg((a) && isNeg(v))) {
    setFlag(OVERFL);
  } else {
    clearFlag(OVERFL);
  }
  a = (uint8_t)result;
  setZeroAndNeg(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2072e
movzbl 0x8(%rbx), %edx
movzbl %al, %esi
movzbl 0x18(%rbx), %edi
movl %edi, %ecx
andl $0x1, %ecx
addl %edx, %ecx
addl %esi, %ecx
andb $-0x2, %dil
movl %ecx, %esi
shrl $0x8, %esi
orb %dil, %sil
testb %cl, %cl
js 0x1abb8
movl %esi, %eax
orb $0x2, %al
andb $0x3d, %sil
testb %cl, %cl
movzbl %al, %eax
movzbl %sil, %edx
cmovel %eax, %edx
andb $0x3f, %dl
jmp 0x1abcb
orb %al, %dl
andb $0x3d, %sil
notb %dl
shrb %dl
andb $0x40, %dl
orb %sil, %dl
orb $-0x80, %dl
movb %cl, 0x8(%rbx)
movb %dl, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::aslInstMem(unsigned short)
void Cpu::aslInstMem(uint16_t addr) {
  uint8_t src = load(addr);
  uint8_t result = src << 1;
  store(addr, result);
  setZeroAndNeg(result);
  if (src & (1 << 7)) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2072e
movl %eax, %r14d
leal (%r14,%r14), %r13d
movq (%rbx), %rdi
movzbl %r13b, %r12d
movl %r15d, %esi
movl %r12d, %edx
callq 0x20656
movb 0x18(%rbx), %al
testb %r12b, %r12b
je 0x1ac20
andb $-0x3, %al
testb %r13b, %r13b
jns 0x1ac22
orb $-0x80, %al
jmp 0x1ac24
orb $0x2, %al
andb $0x7f, %al
andb $-0x2, %al
shrb $0x7, %r14b
orb %al, %r14b
movb %r14b, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::aslInstReg(unsigned short)
void Cpu::aslInstReg(uint16_t addr) {
  if (a & (1 << 7)) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }

  a <<= 1;
  setZeroAndNeg(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x8(%rdi), %cl
movb 0x18(%rdi), %dl
andb $-0x2, %dl
movl %ecx, %eax
shrb $0x7, %al
orb %dl, %al
addb %cl, %cl
movb %cl, 0x8(%rdi)
je 0x1ac65
andb $-0x3, %al
testb %cl, %cl
jns 0x1ac67
orb $-0x80, %al
jmp 0x1ac69
orb $0x2, %al
andb $0x7f, %al
movb %al, 0x18(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::bitInst(unsigned short)
void Cpu::bitInst(uint16_t addr) {
  uint8_t v = load(addr);
  bool zero = (a & v) == 0;
  if (zero) {
    setFlag(ZERO);
  } else {
    clearFlag(ZERO);
  }
  if (v & (1 << 7)) {
    setFlag(NEGATIVE);
  } else {
    clearFlag(NEGATIVE);
  }
  if (v & (1 << 6)) {
    setFlag(OVERFL);
  } else {
    clearFlag(OVERFL);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2072e
testb %al, 0x8(%rbx)
sete %cl
movb 0x18(%rbx), %dl
andb $0x3d, %dl
addb %cl, %cl
orb %dl, %cl
andb $-0x40, %al
orb %cl, %al
movb %al, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::brkInst(unsigned short)
void Cpu::brkInst(uint16_t) {
  pc++;
  pushStack((uint8_t)(pc >> 8));
  pushStack((uint8_t)pc);
  pushStack(status | BREAK);

  pc = load(irqBaseAddr) | ((uint16_t)load(irqBaseAddr + 1) << 8);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %eax
incl %eax
movw %ax, 0xc(%rdi)
movzbl %ah, %edx
movzbl 0xe(%rdi), %esi
movl $0x100, %r14d           # imm = 0x100
orl %r14d, %esi
movq (%rdi), %rdi
callq 0x20656
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0xc(%rbx), %edx
movzbl %al, %esi
orl %r14d, %esi
movq (%rbx), %rdi
callq 0x20656
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0x18(%rbx), %edx
movzbl %al, %esi
orl %r14d, %esi
movq (%rbx), %rdi
orl $0x10, %edx
callq 0x20656
decb 0xe(%rbx)
movq (%rbx), %rdi
movl $0xfffe, %esi           # imm = 0xFFFE
callq 0x2072e
movzbl %al, %r14d
movq (%rbx), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x2072e
movzbl %al, %eax
shll $0x8, %eax
orl %r14d, %eax
movw %ax, 0xc(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::cmp(unsigned short, unsigned char)
void Cpu::cmp(uint16_t addr, uint8_t val) {
  uint8_t v = load(addr);
  uint8_t result;
  result = val - v;
  setZeroAndNeg(result);
  if (val >= v) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edx, %r14d
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2072e
movb 0x18(%rbx), %cl
cmpb %al, %r14b
jne 0x1af0e
orb $0x2, %cl
jmp 0x1af16
andb $-0x3, %cl
cmpb %al, %r14b
js 0x1af2c
andb $0x7f, %cl
cmpb %al, %r14b
setae %al
andb $-0x2, %cl
orb %al, %cl
movb %cl, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
orb $-0x80, %cl
jmp 0x1af19
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::jsrInst(unsigned short)
void Cpu::jsrInst(uint16_t addr) {
  uint16_t pcm = pc - 1;
  pushStack((uint8_t)(pcm >> 8));
  pushStack((uint8_t)pcm);
  pc = addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r15d
movq %rdi, %r14
movl 0xc(%rdi), %ebx
decl %ebx
movzbl %bh, %edx
movzbl 0xe(%rdi), %esi
movl $0x100, %r12d           # imm = 0x100
orl %r12d, %esi
movq (%rdi), %rdi
callq 0x20656
movb 0xe(%r14), %al
decb %al
movb %al, 0xe(%r14)
movzbl %al, %esi
orl %r12d, %esi
movq (%r14), %rdi
movzbl %bl, %edx
callq 0x20656
decb 0xe(%r14)
movw %r15w, 0xc(%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::lsrInstMem(unsigned short)
void Cpu::lsrInstMem(uint16_t addr) {
  uint8_t t = load(addr);
  uint8_t result = t >> 1;
  setZeroAndNeg(result);
  if (t & 1) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  store(addr, result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x2072e
cmpb $0x2, %al
setb %cl
movb 0x18(%r14), %dl
andb $0x7d, %dl
addb %cl, %cl
orb %dl, %cl
movl %ecx, %edx
orb $0x1, %dl
andb $0x7e, %cl
testb $0x1, %al
movzbl %cl, %ecx
movzbl %dl, %edx
cmovel %ecx, %edx
movb %dl, 0x18(%r14)
shrb %al
movq (%r14), %rdi
movzbl %al, %edx
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x20656
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::lsrInstReg(unsigned short)
void Cpu::lsrInstReg(uint16_t) {
  uint8_t result = a >> 1;
  setZeroAndNeg(result);
  if (a & 1) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  a = result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x8(%rdi), %al
movb 0x18(%rdi), %cl
cmpb $0x2, %al
setb %dl
andb $0x7d, %cl
addb %dl, %dl
orb %cl, %dl
movl %edx, %ecx
orb $0x1, %cl
andb $0x7e, %dl
testb $0x1, %al
movzbl %dl, %edx
movzbl %cl, %ecx
cmovel %edx, %ecx
movb %cl, 0x18(%rdi)
shrb %al
movb %al, 0x8(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::rolInstReg(unsigned short)
void Cpu::rolInstReg(uint16_t) {
  uint8_t result = a << 1 | (getFlag(CARRY) ? 1 : 0);
  if (a & (1 << 7)) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  a = result;
  setZeroAndNeg(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x8(%rdi), %cl
movb 0x18(%rdi), %dl
movl %edx, %esi
andb $0x1, %sil
andb $-0x2, %dl
movl %ecx, %eax
shrb $0x7, %al
orb %dl, %al
addb %cl, %cl
orb %cl, %sil
movb %sil, 0x8(%rdi)
je 0x1b781
andb $-0x3, %al
testb %cl, %cl
jns 0x1b783
orb $-0x80, %al
jmp 0x1b785
orb $0x2, %al
andb $0x7f, %al
movb %al, 0x18(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::rolInstMem(unsigned short)
void Cpu::rolInstMem(uint16_t addr) {
  uint8_t t = load(addr);
  uint8_t result = (t << 1) | (getFlag(CARRY) ? 1 : 0);
  if (t & (1 << 7)) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  store(addr, result);
  setZeroAndNeg(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r15d
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2072e
movl %eax, %r14d
movb 0x18(%rbx), %al
movl %eax, %ecx
andb $0x1, %cl
andb $-0x2, %al
movl %r14d, %edx
shrb $0x7, %dl
orb %al, %dl
movb %dl, 0x18(%rbx)
addb %r14b, %r14b
orb %r14b, %cl
movq (%rbx), %rdi
movzbl %cl, %r12d
movl %r15d, %esi
movl %r12d, %edx
callq 0x20656
movb 0x18(%rbx), %al
testb %r12b, %r12b
je 0x1b7e6
andb $-0x3, %al
testb %r14b, %r14b
jns 0x1b7e8
orb $-0x80, %al
jmp 0x1b7ea
orb $0x2, %al
andb $0x7f, %al
movb %al, 0x18(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::rorInstReg(unsigned short)
void Cpu::rorInstReg(uint16_t) {
  uint8_t result = (a >> 1) | (getFlag(CARRY) ? 1u << 7 : 0);
  if (a & 1) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  a = result;
  setZeroAndNeg(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x8(%rdi), %dl
movb 0x18(%rdi), %cl
movl %edx, %esi
andb $0x1, %sil
movl %ecx, %eax
andb $-0x2, %al
orb %sil, %al
shrb %dl
shlb $0x7, %cl
orb %dl, %cl
movb %cl, 0x8(%rdi)
testb %cl, %cl
je 0x1b825
andb $-0x3, %al
testb %cl, %cl
jns 0x1b827
orb $-0x80, %al
jmp 0x1b829
orb $0x2, %al
andb $0x7f, %al
movb %al, 0x18(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::rorInstMem(unsigned short)
void Cpu::rorInstMem(uint16_t addr) {
  uint8_t t = load(addr);
  uint8_t result = (t >> 1) | (getFlag(CARRY) ? 1u << 7 : 0);
  if (t & 1) {
    setFlag(CARRY);
  } else {
    clearFlag(CARRY);
  }
  store(addr, result);
  setZeroAndNeg(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2072e
movb 0x18(%rbx), %r12b
movl %eax, %ecx
andb $0x1, %cl
movl %r12d, %edx
andb $-0x2, %dl
orb %cl, %dl
movb %dl, 0x18(%rbx)
shrb %al
shlb $0x7, %r12b
orb %al, %r12b
movq (%rbx), %rdi
movzbl %r12b, %r15d
movl %r14d, %esi
movl %r15d, %edx
callq 0x20656
movb 0x18(%rbx), %al
testb %r15b, %r15b
je 0x1b889
andb $-0x3, %al
testb %r12b, %r12b
jns 0x1b88b
orb $-0x80, %al
jmp 0x1b88d
orb $0x2, %al
andb $0x7f, %al
movb %al, 0x18(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::sbcInst(unsigned short)
void Cpu::sbcInst(uint16_t addr) {
  uint8_t v = load(addr);
  int16_t sresult = (int16_t)(int8_t)a - (int16_t)(int8_t)v - (getFlag(CARRY) ? 0 : 1);
  int16_t uresult = (int16_t)a - (int16_t)v - (getFlag(CARRY) ? 0 : 1);

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

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

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

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

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

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

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x208e4
testb %al, %al
je 0x1bb0e
movq %rbx, %rdi
callq 0x1aad2
movl $0x7, %eax
jmp 0x1bb94
movq (%rbx), %rdi
callq 0x208f2
testb %al, %al
je 0x1bb2a
testb $0x4, 0x18(%rbx)
jne 0x1bb2a
movq %rbx, %rdi
callq 0x1aa3a
jmp 0x1bb04
movzwl 0xc(%rbx), %esi
movq (%rbx), %rdi
callq 0x2072e
leaq -0x11(%rbp), %rcx
movb %al, (%rcx)
movzbl %al, %r8d
leaq 0x2bc79(%rip), %rdi     # 0x477c0
movq %r8, %rax
xorl %edx, %edx
divq 0x2bc75(%rip)           # 0x477c8
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x20254
testq %rax, %rax
je 0x1bb9d
movq (%rax), %r14
testq %r14, %r14
je 0x1bb9d
leaq 0x10(%r14), %rsi
movq 0x38(%r14), %rax
movq 0x40(%r14), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x1bb89
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
movzwl 0x30(%r14), %eax
addq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x17900(%rip), %rdi     # 0x334a4
leaq 0x187a7(%rip), %rsi     # 0x34352
leaq 0x187a8(%rip), %rcx     # 0x3435a
movl $0x3c7, %edx            # imm = 0x3C7
callq 0xa160
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::reset()
void Cpu::reset() {
  setFlag(INT_DISABLE);
  setFlag(ONE);
  pc = load16(resetBaseAddr);
  sp = stackPointerStart;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
orb $0x24, 0x18(%rdi)
movq (%rdi), %rdi
movl $0xfffc, %esi           # imm = 0xFFFC
callq 0x2072e
movl %eax, %r14d
movq (%rbx), %rdi
movl $0xfffd, %esi           # imm = 0xFFFD
callq 0x2072e
movzbl %al, %eax
shll $0x8, %eax
movzbl %r14b, %ecx
orl %eax, %ecx
movw %cx, 0xc(%rbx)
movb $-0x3, 0xe(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dumpRegs()
void Cpu::dumpRegs() {
  using namespace std;
  cerr << setfill('0') << right;
  cerr << "A:" << setw(2) << (int)a << " ";
  cerr << "X:" << setw(2) << (int)x << " ";
  cerr << "Y:" << setw(2) << (int)y << " ";
  cerr << "P:" << setw(2) << (int)status << " ";
  cerr << "SP:" << setw(2) << (int)sp << " ";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x2b3db(%rip), %rbx     # 0x46ff0
movq (%rbx), %rax
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r15
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x1bc42
movq %r15, %rdi
movl $0x20, %esi
callq 0xa850
movb $0x1, 0xe1(%r15)
movq (%rbx), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ecx       # imm = 0xFFFFFF4F
andl 0x18(%rbx,%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x18710(%rip), %rsi     # 0x34378
movl $0x2, %r12d
movl $0x2, %edx
movq %rbx, %rdi
callq 0xa7a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %r12, 0x10(%rbx,%rax)
movzbl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0xa290
leaq 0x186ec(%rip), %r15     # 0x34387
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xa7a0
leaq 0x186c9(%rip), %rsi     # 0x3437b
movl $0x2, %edx
movq %rbx, %rdi
callq 0xa7a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %r12, 0x10(%rbx,%rax)
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0xa290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xa7a0
leaq 0x1868f(%rip), %rsi     # 0x3437e
movl $0x2, %edx
movq %rbx, %rdi
callq 0xa7a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %r12, 0x10(%rbx,%rax)
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
callq 0xa290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xa7a0
leaq 0x18656(%rip), %rsi     # 0x34382
movl $0x2, %edx
movq %rbx, %rdi
callq 0xa7a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %r12, 0x10(%rbx,%rax)
movzbl 0x18(%r14), %esi
movq %rbx, %rdi
callq 0xa290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xa7a0
leaq 0x18618(%rip), %rsi     # 0x34381
movl $0x3, %edx
movq %rbx, %rdi
callq 0xa7a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %r12, 0x10(%rbx,%rax)
movzbl 0xe(%r14), %esi
movq %rbx, %rdi
callq 0xa290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa7a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dumpInstructionBytes(int)
void Cpu::dumpInstructionBytes(int bytes) {
  using namespace std;
  cerr << setfill('0') << right;
  for (int i = 0; i < bytes; i++) {
    cerr << setw(2) << uppercase << (int)load(pc + i) << " ";
  }
  for (int i = 0; i < maxInstLength - bytes; i++) {
    cerr << "   ";
  }
  cerr << " ";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x2b178(%rip), %r15     # 0x46ff0
movq (%r15), %rax
movq -0x18(%rax), %rcx
leaq (%r15,%rcx), %r12
cmpb $0x0, 0xe1(%r15,%rcx)
jne 0x1bea7
movq %r12, %rdi
movl $0x20, %esi
callq 0xa850
movb $0x1, 0xe1(%r12)
movq (%r15), %rax
movb $0x30, 0xe0(%r12)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ecx       # imm = 0xFFFFFF4F
andl 0x18(%r15,%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%r15,%rax)
testl %ebx, %ebx
jle 0x1bf2e
xorl %r13d, %r13d
leaq 0x184b0(%rip), %r12     # 0x34387
movq (%r15), %rax
movq -0x18(%rax), %rcx
movq $0x2, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
orl $0x4000, 0x18(%r15,%rax) # imm = 0x4000
movl 0xc(%r14), %eax
addl %r13d, %eax
movq (%r14), %rdi
movzwl %ax, %esi
callq 0x2072e
movzbl %al, %esi
movq %r15, %rdi
callq 0xa290
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0xa7a0
incl %r13d
cmpl %r13d, %ebx
jne 0x1bed7
cmpl $0x2, %ebx
jg 0x1bf65
movl $0x3, %eax
subl %ebx, %eax
cmpl $0x2, %eax
movl $0x1, %r15d
cmovgel %eax, %r15d
movq 0x2b0a7(%rip), %rbx     # 0x46ff0
leaq 0x18435(%rip), %r14     # 0x34385
movl $0x3, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa7a0
decl %r15d
jne 0x1bf50
movq 0x2b084(%rip), %rdi     # 0x46ff0
leaq 0x18414(%rip), %rsi     # 0x34387
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa7a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: Rnes::Cpu::dumpPPUTiming()
void Cpu::dumpPPUTiming() {
  using namespace std;
  // const int initScanLine = 0;
  cerr << setfill(' ') << right;
  cerr << "CYC:" << dec << setw(3) << (3 * cycle) % 341;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x2b050(%rip), %rbx     # 0x46ff0
movq (%rbx), %rax
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r15
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x1bfcd
movq %r15, %rdi
movl $0x20, %esi
callq 0xa850
movb $0x1, 0xe1(%r15)
movq (%rbx), %rax
movb $0x20, 0xe0(%r15)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ecx       # imm = 0xFFFFFF4F
andl 0x18(%rbx,%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x18396(%rip), %rsi     # 0x34389
movl $0x4, %edx
movq %rbx, %rdi
callq 0xa7a0
movq (%rbx), %rax
movq -0x18(%rax), %rcx
movl 0x18(%rbx,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rbx,%rcx)
movq -0x18(%rax), %rax
movq $0x3, 0x10(%rbx,%rax)
movq 0x10(%r14), %rax
leaq (%rax,%rax,2), %rsi
movabsq $-0x7f9fe7f9fe7f9fe7, %rcx # imm = 0x8060180601806019
movq %rsi, %rax
mulq %rcx
movq %rsi, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x8, %rax
imulq $0x155, %rax, %rax      # imm = 0x155
subq %rax, %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa3e0
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::indexedIndirectFormat<&Rnes::Cpu::staInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::indexedIndirectFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1;
  uint8_t immed = load(immediateAddr);
  uint8_t tableAddr = immed + x;
  uint16_t finalAddr = load(tableAddr);
  finalAddr |= (uint16_t)load((tableAddr + 1) & 0xff) << 8;

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

  instTrace(str.str(), 2);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %r13
movq %rdi, %rbx
movl 0xc(%rdi), %eax
incl %eax
movq (%rdi), %rdi
movzwl %ax, %esi
callq 0x2072e
movl %eax, %r12d
movb 0x9(%rbx), %al
addb %r12b, %al
movq (%rbx), %rdi
movzbl %al, %r14d
movl %r14d, %esi
callq 0x2072e
movb %al, -0x29(%rbp)
incb %r14b
movq (%rbx), %rdi
movzbl %r14b, %esi
callq 0x2072e
movl %eax, %r15d
leaq -0x1d8(%rbp), %r14
movq %r14, %rdi
callq 0xa260
movq 0x10(%r14), %rax
movq -0x18(%rax), %rcx
leaq (%rcx,%rbp), %r14
addq $-0x1c8, %r14           # imm = 0xFE38
cmpb $0x0, 0xe1(%r14)
jne 0x1e1f7
movq %r14, %rdi
movl $0x20, %esi
callq 0xa850
movb $0x1, 0xe1(%r14)
movq -0x1c8(%rbp), %rax
leaq -0x1c8(%rbp), %rdi
movb $0x30, 0xe0(%r14)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ecx       # imm = 0xFFFFFF4F
andl -0x1b0(%rbp,%rax), %ecx
orl $0x80, %ecx
movl %ecx, -0x1b0(%rbp,%rax)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
callq 0xa7a0
movq %rax, %r13
leaq 0x16154(%rip), %rsi     # 0x3438e
movl $0x3, %edx
movq %rax, %rdi
callq 0xa7a0
movq (%r13), %rax
movq -0x18(%rax), %rcx
movl 0x18(%r13,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%r13,%rcx)
movq -0x18(%rax), %rcx
orl $0x4000, 0x18(%r13,%rcx) # imm = 0x4000
movzbl %r12b, %esi
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r13,%rax)
movq %r13, %rdi
callq 0xa290
leaq 0x16106(%rip), %rsi     # 0x34392
movl $0x3, %edx
movq %rax, %rdi
callq 0xa7a0
leaq -0x1c0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0xa310
movzbl %r15b, %eax
shll $0x8, %eax
movzbl -0x29(%rbp), %r14d
orl %eax, %r14d
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e2d1
movq -0x40(%rbp), %rsi
incq %rsi
callq 0xa0e0
addw $0x2, 0xc(%rbx)
movzbl 0x8(%rbx), %edx
movq (%rbx), %rdi
movzwl %r14w, %esi
callq 0x20656
movq 0x28ceb(%rip), %rsi     # 0x46fd8
leaq -0x1d8(%rbp), %rdi
callq 0xa5c0
leaq -0x158(%rbp), %rdi
callq 0xa560
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e319
movq %rax, %rbx
movq 0x28cb5(%rip), %rsi     # 0x46fd8
leaq -0x1d8(%rbp), %rdi
callq 0xa5c0
leaq -0x158(%rbp), %rdi
callq 0xa560
movq %rbx, %rdi
callq 0xa4d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::zeroPageFormat<&Rnes::Cpu::bitInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::zeroPageFormat(const Instruction &ins) {
  uint16_t zeroPageAddr = pc + 1;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %eax
leal 0x1(%rax), %ecx
addl $0x2, %eax
movw %ax, 0xc(%rdi)
movq (%rdi), %rdi
movzwl %cx, %esi
callq 0x2072e
movq (%rbx), %rdi
movzbl %al, %esi
callq 0x2072e
testb %al, 0x8(%rbx)
sete %cl
movb 0x18(%rbx), %dl
andb $0x3d, %dl
addb %cl, %cl
andb $-0x40, %al
orb %dl, %al
orb %cl, %al
movb %al, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::absoluteFormat<&Rnes::Cpu::bitInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::absoluteFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1;
  uint16_t absAddr = load(immediateAddr);
  absAddr |= ((uint16_t)load(immediateAddr + 1)) << 8;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %r14d
leal 0x1(%r14), %esi
movq (%rdi), %rdi
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %esi
callq 0x2072e
movl %eax, %r15d
addl $0x2, %r14d
movq (%rbx), %rdi
andl %r12d, %r14d
movl %r14d, %esi
callq 0x2072e
movzbl %al, %eax
shll $0x8, %eax
addw $0x3, 0xc(%rbx)
movzbl %r15b, %esi
orl %eax, %esi
movq (%rbx), %rdi
andl %r12d, %esi
callq 0x2072e
testb %al, 0x8(%rbx)
sete %cl
movb 0x18(%rbx), %dl
andb $0x3d, %dl
addb %cl, %cl
andb $-0x40, %al
orb %dl, %al
orb %cl, %al
movb %al, 0x18(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/cpu.cpp
// Function: void Rnes::Cpu::indirectIndexedFormat<&Rnes::Cpu::staInst(unsigned short)>(Rnes::Cpu::Instruction const&)
void Cpu::indirectIndexedFormat(const Instruction &ins) {
  uint16_t immediateAddr = pc + 1;
  uint8_t immed = load(immediateAddr);

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

  uint16_t finalAddr = tableAddr + y;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %r14d
leal 0x1(%r14), %esi
movq (%rdi), %rdi
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %esi
callq 0x2072e
movl %eax, %r15d
addl $0x2, %r14d
movq (%rbx), %rdi
andl %r12d, %r14d
movl %r14d, %esi
callq 0x2072e
movzbl %al, %r13d
shll $0x8, %r13d
movzbl %r15b, %r15d
leal (%r15,%r13), %esi
movq (%rbx), %rdi
andl %r12d, %esi
callq 0x2072e
movl %eax, %r14d
cmpb $-0x1, %r15b
leal 0x1(%r13,%r15), %esi
cmovel %r13d, %esi
movq (%rbx), %rdi
andl %r12d, %esi
callq 0x2072e
movzbl %al, %eax
shll $0x8, %eax
movzbl %r14b, %ecx
orl %eax, %ecx
movw %cx, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq