LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/OHeapReadPathEviction.cpp
// Function: OHeapReadPathEviction::extractMin()
Block OHeapReadPathEviction::extractMin() {
  Block min_block = this->onlyFindMin();
  Block ret = this->onlyDeleteBlock(min_block.leaf_id, min_block.t);

  if (this->type_hiding_security) {
    this->insertDummyBlock();
  }

  this->t++;
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3f68
movl (%r15), %edx
movq 0x8(%r15), %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4056
cmpb $0x1, 0x28(%rbx)
jne 0x4364
movq %rbx, %rdi
callq 0x4472
incq 0x20(%rbx)
movq %r14, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/OHeapReadPathEviction.cpp
// Function: OHeapReadPathEviction::decreaseKey(int, long)
std::pair<int, int> OHeapReadPathEviction::decreaseKey(int leaf, long t) {
  if (this->type_hiding_security) {
    this->onlyFindMin();
  }

  Block old_block = this->onlyDeleteBlock(leaf, t);
  auto ret = this->onlyInsertBlock(old_block.k - 1, old_block.v);

  this->t++;
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x1, 0x28(%rdi)
jne 0x439b
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x3f68
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x4056
movl 0x10(%r15), %esi
decl %esi
movups 0x14(%r15), %xmm0
movaps %xmm0, 0x20(%rsp)
movups 0x24(%r15), %xmm0
movaps %xmm0, 0x30(%rsp)
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x4282
incq 0x20(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/OHeapReadPathEviction.cpp
// Function: OHeapReadPathEviction::increaseKey(int, long)
std::pair<int, int> OHeapReadPathEviction::increaseKey(int leaf, long t) {
  if (this->type_hiding_security) {
    this->onlyFindMin();
  }

  Block old_block = this->onlyDeleteBlock(leaf, t);
  auto ret = this->onlyInsertBlock(old_block.k + 1, old_block.v);

  this->t++;
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x1, 0x28(%rdi)
jne 0x4419
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x3f68
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x4056
movl 0x10(%r15), %esi
incl %esi
movups 0x14(%r15), %xmm0
movaps %xmm0, 0x20(%rsp)
movups 0x24(%r15), %xmm0
movaps %xmm0, 0x30(%rsp)
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x4282
incq 0x20(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/OHeapReadPathEviction.cpp
// Function: OHeapReadPathEviction::readAndRemove(int, long)
Block OHeapReadPathEviction::readAndRemove(int leaf, long t) {
  if (leaf != -1 && t != -1) {
    Block ret;    
    for (int l = 0; l < this->num_levels; l++) {
      int p = this->P(leaf, l);
      Bucket bucket_on_path = this->storage->readBucket(p);
      std::optional<Block> possible_ret = bucket_on_path.removeBlock(t);
      if (possible_ret.has_value()) {
        ret = possible_ret.value();
        bucket_on_path.addBlock(Block());  // for obliviousness
      }
      this->storage->writeBucket(p, bucket_on_path);
    }
    return ret;
  } else {
    // dummy ops
    leaf = this->rand_gen->getRandomLeaf();
    for (int l = 0; l < num_levels; l++) {
      int p = this->P(leaf, l);
      Bucket b = this->storage->readBucket(p);
      this->storage->writeBucket(p, b);
    }
    return Block();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r14
cmpl $-0x1, %edx
sete %al
movq %rcx, 0x8(%rsp)
cmpq $-0x1, %rcx
sete %cl
orb %al, %cl
movq %rdi, (%rsp)
jne 0x4a9f
movl %edx, %ebx
callq 0x25e8
cmpl $0x0, 0xc(%r14)
jle 0x4b13
xorl %r12d, %r12d
leaq 0x10(%rsp), %r13
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
movl %r12d, %edx
callq *0x30(%rax)
movl %eax, %r15d
movq 0x30(%r14), %rsi
movq (%rsi), %rax
movq %r13, %rdi
movl %r15d, %edx
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x2842
cmpb $0x1, 0x98(%rsp)
jne 0x4a69
movl 0x90(%rsp), %eax
movq (%rsp), %rcx
movl %eax, 0x30(%rcx)
movups 0x60(%rsp), %xmm0
movups 0x70(%rsp), %xmm1
movups 0x80(%rsp), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
callq 0x25e8
movq %r13, %rdi
movq %rbp, %rsi
callq 0x27e2
movq 0x30(%r14), %rdi
movq (%rdi), %rax
movl %r15d, %esi
movq %r13, %rdx
callq *0x10(%rax)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x4a90
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
incl %r12d
cmpl 0xc(%r14), %r12d
jl 0x49e6
jmp 0x4b13
movq 0x38(%r14), %rdi
movq (%rdi), %rax
callq *(%rax)
cmpl $0x0, 0xc(%r14)
jle 0x4b0a
movl %eax, %ebp
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
movq (%r14), %rax
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq *0x30(%rax)
movl %eax, %r13d
movq 0x30(%r14), %rsi
movq (%rsi), %rax
movq %r12, %rdi
movl %r13d, %edx
callq *0x8(%rax)
movq 0x30(%r14), %rdi
movq (%rdi), %rax
movl %r13d, %esi
movq %r12, %rdx
callq *0x10(%rax)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x4b01
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
incl %r15d
cmpl 0xc(%r14), %r15d
jl 0x4ab9
movq (%rsp), %rdi
callq 0x25e8
movq (%rsp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4b2d
jmp 0x4b2d
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x4b47
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2250
nop
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/RandomForOHeap.cpp
// Function: RandomForOHeap::RandomForOHeap()
RandomForOHeap::RandomForOHeap() {
  if (RandomForOHeap::is_initialized) {
    throw std::runtime_error("Only one random instance can be used at a time!");
  }

  this->bound = -1;
  rnd_generator.seed(0L);
  this->seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1);
  RandomForOHeap::is_initialized  = true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4e99(%rip), %rax      # 0xad20
movq %rax, (%rdi)
movq $0x1, 0x10(%rdi)
movq $0x0, 0x18(%rdi)
cmpb $0x1, 0x52c8(%rip)      # 0xb169
je 0x5ecf
movl $0xffffffff, 0x8(%rdi)  # imm = 0xFFFFFFFF
movq $0x0, 0x10(%rdi)
movabsq $0x5deece66d, %rax      # imm = 0x5DEECE66D
movq %rax, 0x18(%rdi)
movb $0x1, 0x52a2(%rip)      # 0xb169
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %rbx
leaq 0x13ee(%rip), %rsi      # 0x72d1
movq %rax, %rdi
callq 0x2090
movq 0x50fe(%rip), %rsi      # 0xaff0
movq 0x50cf(%rip), %rdx      # 0xafc8
movq %rbx, %rdi
callq 0x2230
movq %rax, %r14
movq %rbx, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/RandomForOHeap.cpp
// Function: RandomForOHeap::getRandomLeaf()
int RandomForOHeap::getRandomLeaf() {
  if (this->bound == -1) {
    throw std::runtime_error("Bound is not set.");
  }

  long next = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
  this->seed = next;
  int bits = next >> (48 - 31);
  if ((this->bound & -this->bound) == this->bound) {  // if bound is a power of 2
    return (int)((this->bound * (long)bits) >> 31);
  }
  int val = bits % this->bound;
  while (bits - val + (this->bound-1) < 0) {
    next = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
    this->seed = next;
    bits = next >> (48 - 31);
    val = bits % this->bound;
  }
  return val;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movslq 0x8(%rdi), %rsi
cmpq $-0x1, %rsi
je 0x5fa9
movabsq $0xffffffffffff, %r9    # imm = 0xFFFFFFFFFFFF
movabsq $0x5deece66d, %r10      # imm = 0x5DEECE66D
movq 0x18(%rdi), %r8
imulq %r10, %r8
addq $0xb, %r8
andq %r9, %r8
movq %r8, 0x18(%rdi)
movq %r8, %rcx
shrq $0x11, %rcx
leal -0x1(%rsi), %eax
testl %eax, %esi
jne 0x5f67
imulq %rsi, %rcx
shrq $0x1f, %rcx
movl %ecx, %edx
jmp 0x5f9f
leal -0x1(%rsi), %r11d
movl %ecx, %eax
xorl %edx, %edx
idivl %esi
movl %r11d, %eax
subl %edx, %eax
addl %ecx, %eax
jns 0x5f9f
imulq %r10, %r8
addq $0xb, %r8
andq %r9, %r8
movq %r8, %rcx
shrq $0x11, %rcx
movl %ecx, %eax
xorl %edx, %edx
idivl %esi
movl %r11d, %eax
subl %edx, %eax
addl %ecx, %eax
js 0x5f7a
movq %r8, 0x18(%rdi)
movl %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %rbx
leaq 0x1344(%rip), %rsi      # 0x7301
movq %rax, %rdi
callq 0x2090
movq 0x5024(%rip), %rsi      # 0xaff0
movq 0x4ff5(%rip), %rdx      # 0xafc8
movq %rbx, %rdi
callq 0x2230
movq %rax, %r14
movq %rbx, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/ServerStorage.cpp
// Function: ServerStorage::setCapacity(int)
void ServerStorage::setCapacity(int total_num_of_buckets) {
  if (this->is_capacity_set) {
    throw std::runtime_error("Capacity of ServerStorage cannot be changed");
  }
  this->is_capacity_set = true;
  this->capacity = total_num_of_buckets;
  this->buckets.assign(total_num_of_buckets, Bucket());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
cmpb $0x1, 0x50da(%rip)      # 0xb16c
je 0x60e2
movq %rdi, %rbx
movb $0x1, 0x50ce(%rip)      # 0xb16c
movl %esi, 0x8(%rdi)
addq $0x10, %rbx
movslq %esi, %r14
movq %rsp, %r15
movq %r15, %rdi
callq 0x2754
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x687a
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x60d8
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %r14
leaq 0x128b(%rip), %rsi      # 0x7381
movq %rax, %rdi
callq 0x2090
movq 0x4eeb(%rip), %rsi      # 0xaff0
movq 0x4ebc(%rip), %rdx      # 0xafc8
movq %r14, %rdi
callq 0x2230
movq %rax, %rbx
movq %r14, %rdi
callq 0x2110
jmp 0x613b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x613b
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2250
nop
// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/main.cpp
// Function: main
int main() {
  //Job::run();
  //Job2::run();
  //JobForStatisticalSimulation::run();
  PlainHeapComparisonTest().run();
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x59e8
movq %rbx, %rdi
callq 0x5a88
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6ba2
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6bc3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::Cpu()
Cpu::Cpu() {
    regX = regY = regA = 0x00;
    regPC = mem.read_word(0xFFFC);
    regSP = 0x01ff;
    regP.C = regP.Z = regP.I = regP.D = regP.B = regP.V = regP.N = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x41d8
movw $0x0, 0x10020(%rbx)
movb $0x0, 0x10022(%rbx)
movq %r14, %rdi
movl $0xfffc, %esi           # imm = 0xFFFC
callq 0x4358
movw %ax, 0x10024(%rbx)
movw $0x1ff, 0x10026(%rbx)   # imm = 0x1FF
xorl %eax, %eax
movl %eax, 0x10028(%rbx)
movl %eax, 0x1002b(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::ASL_mem_execute(unsigned short, unsigned char)
void Cpu::ASL_mem_execute(uint16_t address, uint8_t operand) {
    // Arithmetic shift left (Memory content)
    // M,Z,C,N = M*2

    uint8_t result = operand << 1;

    mem.write_byte(address, result);

    regP.Z = result == 0;
    regP.C = (operand >> 7) & 1;
    regP.N = (result >> 7) & 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
leal (%rbx,%rbx), %eax
addq $0x8, %rdi
movzbl %al, %ebp
movl %ebp, %edx
callq 0x43b4
testb %bpl, %bpl
sete 0x10029(%r14)
shrb $0x7, %bl
movb %bl, 0x10028(%r14)
shrb $0x7, %bpl
movb %bpl, 0x1002e(%r14)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::INC_execute(unsigned short, unsigned char)
void Cpu::INC_execute(uint16_t address, uint8_t operand) {
    //Increment memory
    //M,Z,N = M+1

    uint8_t result = operand + 1;
    mem.write_byte(address, result);

    regP.Z = result == 0;
    regP.N = result >> 7;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
leal 0x1(%rbx), %eax
addq $0x8, %rdi
movzbl %al, %edx
callq 0x43b4
incb %bl
sete 0x10029(%r14)
shrb $0x7, %bl
movb %bl, 0x1002e(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::LSR_mem_execute(unsigned short, unsigned char)
void Cpu::LSR_mem_execute(uint16_t address, uint8_t operand) {
    // Logical shift right (Memory content)
    // M,Z,C,N = M/2

    uint8_t result = (operand >> 1) & 0x7f;

    mem.write_byte(address, result);

    regP.Z = result == 0;
    regP.C = operand & 1;
    regP.N = (result >> 7) & 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movl %ebx, %eax
shrb %al
addq $0x8, %rdi
movzbl %al, %edx
callq 0x43b4
cmpb $0x2, %bl
setb 0x10029(%r14)
andb $0x1, %bl
movb %bl, 0x10028(%r14)
movb $0x0, 0x1002e(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::PHP_execute()
void Cpu::PHP_execute() {
    // Push processor status
    
    uint8_t procStat;
    procStat =  (regP.N) << 6 |
		(regP.V) << 5 |
		(regP.B) << 4 |
		(regP.D) << 3 |
		(regP.I) << 2 |
		(regP.Z) << 1 |
		(regP.C);
    pushStack(procStat);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb 0x1002e(%rdi), %al
shlb $0x6, %al
movb 0x1002d(%rdi), %cl
shlb $0x5, %cl
orb %al, %cl
movb 0x1002c(%rdi), %al
shlb $0x4, %al
orb %cl, %al
movb 0x1002b(%rdi), %cl
shlb $0x3, %cl
orb %al, %cl
movb 0x10029(%rdi), %al
movb 0x1002a(%rdi), %dl
shlb $0x2, %dl
orb %cl, %dl
addb %al, %al
orb %dl, %al
orb 0x10028(%rdi), %al
addq $0x8, %rdi
movzwl 0x10026(%rbx), %esi
movzbl %al, %edx
callq 0x43b4
decw 0x10026(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::PLA_execute()
void Cpu::PLA_execute() {
    // Pull accumulator

    regA = pullStack();

    regP.Z = regA == 0;
    regP.N = regA >> 7;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movzwl 0x10026(%rdi), %eax
incl %eax
movw %ax, 0x10026(%rdi)
addq $0x8, %rdi
movzwl %ax, %esi
callq 0x4292
movb %al, 0x10020(%rbx)
testb %al, %al
sete 0x10029(%rbx)
shrb $0x7, %al
movb %al, 0x1002e(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::RTI_execute()
void Cpu::RTI_execute() {
    // Return from interrupt

    uint8_t procStat = pullStack();
    regP.N = (procStat >> 6) & 1;
    regP.V = (procStat >> 5) & 1;
    regP.B = (procStat >> 4) & 1;
    regP.D = (procStat >> 3) & 1;
    regP.I = (procStat >> 2) & 1;
    regP.Z = (procStat >> 1) & 1;
    regP.C = procStat & 1;

    uint8_t PC_low = pullStack();
    uint8_t PC_high = pullStack();
    regPC = (PC_high << 8) | PC_low;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzwl 0x10026(%rdi), %esi
incl %esi
movw %si, 0x10026(%rdi)
leaq 0x8(%rdi), %r14
movl $0xffff, %r15d          # imm = 0xFFFF
andl %r15d, %esi
movq %r14, %rdi
callq 0x4292
movl %eax, %ecx
shrb $0x6, %cl
andb $0x1, %cl
movb %cl, 0x1002e(%rbx)
movl %eax, %ecx
shrb $0x5, %cl
andb $0x1, %cl
movb %cl, 0x1002d(%rbx)
movl %eax, %ecx
shrb $0x4, %cl
andb $0x1, %cl
movb %cl, 0x1002c(%rbx)
movl %eax, %ecx
shrb $0x3, %cl
andb $0x1, %cl
movb %cl, 0x1002b(%rbx)
movl %eax, %ecx
shrb $0x2, %cl
andb $0x1, %cl
movb %cl, 0x1002a(%rbx)
movl %eax, %ecx
shrb %cl
andb $0x1, %cl
movb %cl, 0x10029(%rbx)
andb $0x1, %al
movb %al, 0x10028(%rbx)
movzwl 0x10026(%rbx), %esi
incl %esi
movw %si, 0x10026(%rbx)
andl %r15d, %esi
movq %r14, %rdi
callq 0x4292
movl %eax, %ebp
movzwl 0x10026(%rbx), %esi
incl %esi
movw %si, 0x10026(%rbx)
andl %r15d, %esi
movq %r14, %rdi
callq 0x4292
movzbl %al, %eax
shll $0x8, %eax
movzbl %bpl, %ecx
orl %eax, %ecx
movw %cx, 0x10024(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::RTS_execute()
void Cpu::RTS_execute() {
    // Return from subroutine

    uint8_t PC_low = pullStack();
    uint8_t PC_high = pullStack();
    uint16_t PC = (PC_high << 8) | PC_low;
    regPC = PC + 1; //It had the last byte of the last instr
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzwl 0x10026(%rdi), %esi
incl %esi
movw %si, 0x10026(%rdi)
leaq 0x8(%rdi), %r14
movl $0xffff, %r15d          # imm = 0xFFFF
andl %r15d, %esi
movq %r14, %rdi
callq 0x4292
movl %eax, %ebp
movzwl 0x10026(%rbx), %esi
incl %esi
movw %si, 0x10026(%rbx)
andl %r15d, %esi
movq %r14, %rdi
callq 0x4292
movzbl %al, %eax
shll $0x8, %eax
movzbl %bpl, %ecx
addl %ecx, %eax
incl %eax
movw %ax, 0x10024(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_absolute(addr_mode_t*, unsigned char)
uint32_t Cpu::read_operand_absolute(addr_mode_t *addr_mode, uint8_t opcode) {
    uint8_t operand;
    uint8_t high, low;
    low = mem.read_byte(regPC + 0x0001);
    high = mem.read_byte(regPC + 0x0002);
    uint16_t address = (high << 8) | low;
    regPC += 0x03;
    *addr_mode = ABSOLUTE;
    //These opcodes don't need an operand
    //We avoid lateral effects on ppu regs reads
    if (!(opcode == 0x20 || opcode == 0x8c || opcode == 0x4c || opcode == 0x0c || opcode ==
	0x8d || opcode == 0x8e))
	operand = mem.read_byte(address);
    else
	operand = 0;
    return (address << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leaq 0x8(%rdi), %rbx
movl 0x10024(%rdi), %esi
incl %esi
movl $0xffff, %r13d          # imm = 0xFFFF
andl %r13d, %esi
movq %rbx, %rdi
callq 0x4292
movl %eax, %ebp
movl 0x10024(%r12), %esi
addl $0x2, %esi
andl %r13d, %esi
movq %rbx, %rdi
callq 0x4292
movzbl %al, %eax
shll $0x8, %eax
movzbl %bpl, %ebp
addw $0x3, 0x10024(%r12)
orl %eax, %ebp
movl $0x3, (%r15)
xorl %eax, %eax
cmpl $0x8b, %r14d
jg 0x38f7
cmpl $0xc, %r14d
je 0x3904
cmpl $0x20, %r14d
je 0x3904
cmpl $0x4c, %r14d
je 0x3904
movzwl %bp, %esi
movq %rbx, %rdi
callq 0x4292
movzbl %al, %eax
jmp 0x3904
addl $0xffffff74, %r14d      # imm = 0xFFFFFF74
cmpl $0x3, %r14d
jae 0x38e7
shll $0x10, %ebp
orl %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_imm(addr_mode_t*)
uint32_t Cpu::read_operand_imm(addr_mode_t *addr_mode) {
    uint8_t operand;
    operand = mem.read_byte(regPC + 0x0001);
    regPC += 0x02;
    *addr_mode = IMMEDIATE;
    return operand;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x8, %rdi
movl 0x10024(%r14), %eax
incl %eax
movzwl %ax, %esi
callq 0x4292
addw $0x2, 0x10024(%r14)
movl $0x0, (%rbx)
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_indexed_indirect(addr_mode_t*)
uint32_t Cpu::read_operand_indexed_indirect(addr_mode_t *addr_mode) {
    uint8_t operand;
    uint16_t address;
    uint8_t d = mem.read_byte(regPC + 0x0001);
    address = mem.read_word(uint16_t (0x00FF & (d+regX)));
    operand = mem.read_byte(address);
    regPC += 0x02;
    *addr_mode = INDIRECT_X;
    return (d << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %r15
movl 0x10024(%rdi), %eax
incl %eax
movzwl %ax, %esi
movq %r15, %rdi
callq 0x4292
movzbl %al, %ebp
movb 0x10021(%r14), %al
addb %bpl, %al
movzbl %al, %esi
movq %r15, %rdi
callq 0x4358
movzwl %ax, %esi
movq %r15, %rdi
callq 0x4292
addw $0x2, 0x10024(%r14)
movl $0x6, (%rbx)
shll $0x10, %ebp
movzbl %al, %eax
orl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_zero_page(addr_mode_t*)
uint32_t Cpu::read_operand_zero_page(addr_mode_t *addr_mode) {
    uint8_t operand;
    uint16_t address = 0;
    uint8_t d = mem.read_byte(regPC + 0x0001);
    address = address | (0x00ff & d);
    operand = mem.read_byte(address);
    regPC += 0x02;
    *addr_mode = ZERO_PAGE;
    return (address << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %r15
movl 0x10024(%rdi), %eax
incl %eax
movzwl %ax, %esi
movq %r15, %rdi
callq 0x4292
movzbl %al, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x4292
addw $0x2, 0x10024(%r14)
movl $0x1, (%rbx)
shll $0x10, %ebp
movzbl %al, %eax
orl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_indirect(addr_mode_t*)
uint32_t Cpu::read_operand_indirect(addr_mode_t *addr_mode) {
    uint16_t pointer;
    uint16_t address;
    uint8_t high, low, operand;
    operand = 0;
    low = mem.read_byte(regPC + 0x0001);
    high = mem.read_byte(regPC + 0x0002);
    pointer = (high << 8) | low;
    address = mem.read_word(pointer);
    regPC += 0x03;
    *addr_mode = INDIRECT;
    return (address << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %r15
movl 0x10024(%rdi), %esi
incl %esi
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %esi
movq %r15, %rdi
callq 0x4292
movl %eax, %ebp
movl 0x10024(%r14), %esi
addl $0x2, %esi
andl %r12d, %esi
movq %r15, %rdi
callq 0x4292
movzbl %al, %eax
shll $0x8, %eax
movzbl %bpl, %esi
orl %eax, %esi
andl %r12d, %esi
movq %r15, %rdi
callq 0x4358
addw $0x3, 0x10024(%r14)
movl $0x9, (%rbx)
shll $0x10, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_indirect_indexed(addr_mode_t*)
uint32_t Cpu::read_operand_indirect_indexed(addr_mode_t *addr_mode) {
    uint16_t address;
    uint8_t operand;
    uint8_t high, low;
    low = mem.read_byte(regPC + 0x0001);
    high = 0x00;
    address = mem.read_word((high << 8) | low);
    address += (uint16_t) regY;
    operand = mem.read_byte(address);
    regPC += 0x02;
    *addr_mode = INDIRECT_Y;
    return (address << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %r15
movl 0x10024(%rdi), %esi
incl %esi
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %esi
movq %r15, %rdi
callq 0x4292
movzbl %al, %esi
movq %r15, %rdi
callq 0x4358
movl %eax, %r12d
movzbl 0x10022(%r14), %eax
addl %eax, %r12d
andl %r12d, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x4292
addw $0x2, 0x10024(%r14)
movl $0x7, (%rbx)
shll $0x10, %r12d
movzbl %al, %eax
orl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_zero_page_indexed_x(addr_mode_t*)
uint32_t Cpu::read_operand_zero_page_indexed_x(addr_mode_t *addr_mode) {
    uint8_t operand;
    uint16_t address;
    uint8_t d = mem.read_byte(regPC + 0x0001);
    address = (0x0FF & (d+regX));
    operand = mem.read_byte(address);
    regPC += 0x02;
    *addr_mode = ZERO_PAGE_X;
    return (address << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %r15
movl 0x10024(%rdi), %eax
incl %eax
movzwl %ax, %esi
movq %r15, %rdi
callq 0x4292
addb 0x10021(%r14), %al
movzbl %al, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x4292
addw $0x2, 0x10024(%r14)
movl $0x2, (%rbx)
shll $0x10, %ebp
movzbl %al, %eax
orl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::read_operand_absolute_indexed_y(addr_mode_t*)
uint32_t Cpu::read_operand_absolute_indexed_y(addr_mode_t *addr_mode) {
    uint16_t address;
    uint8_t operand;
    uint8_t high, low;
    low = mem.read_byte(regPC + 0x0001);
    high = mem.read_byte(regPC + 0x0002);
    address = (high << 8) | low;
    address += regY;
    operand = mem.read_byte(address);
    regPC += 0x03;
    *addr_mode = ABSOLUTE_Y;
    return (address << 16) | operand;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %r15
movl 0x10024(%rdi), %esi
incl %esi
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %esi
movq %r15, %rdi
callq 0x4292
movl %eax, %r12d
movl 0x10024(%r14), %esi
addl $0x2, %esi
andl %ebp, %esi
movq %r15, %rdi
callq 0x4292
movzbl %al, %eax
shll $0x8, %eax
movzbl %r12b, %ecx
orl %eax, %ecx
movzbl 0x10022(%r14), %r12d
addl %ecx, %r12d
andl %r12d, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x4292
addw $0x3, 0x10024(%r14)
movl $0x5, (%rbx)
shll $0x10, %r12d
movzbl %al, %eax
orl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::NMI_execute()
void Cpu::NMI_execute() {
    // Non-Maskable interrupt

    uint8_t lowPC, highPC;
    lowPC = regPC;
    highPC = (regPC >> 8);
    
    uint8_t procStat;
    procStat =  (regP.N) << 6 |
		(regP.V) << 5 |
		(regP.B) << 4 |
		(regP.D) << 3 |
		(regP.I) << 2 |
		(regP.Z) << 1 |
		(regP.C);
    
    //We push the PC and Processor Status into the stack
    pushStack(highPC);
    pushStack(lowPC);
    pushStack(procStat);

    //We set the PC to the interrupt vector
    regPC = mem.read_word(NMI_INT_VECTOR_ADDR);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movzwl 0x10024(%rdi), %ebp
movl %ebp, %edx
shrl $0x8, %edx
movb 0x1002e(%rdi), %al
shlb $0x6, %al
movb 0x1002d(%rdi), %cl
shlb $0x5, %cl
orb %al, %cl
movb 0x1002c(%rdi), %al
shlb $0x4, %al
orb %cl, %al
movb 0x1002b(%rdi), %cl
shlb $0x3, %cl
orb %al, %cl
movb 0x10029(%rdi), %r15b
movb 0x1002a(%rdi), %al
shlb $0x2, %al
orb %cl, %al
addb %r15b, %r15b
orb %al, %r15b
orb 0x10028(%rdi), %r15b
leaq 0x8(%rdi), %r14
movzwl 0x10026(%rdi), %esi
movq %r14, %rdi
callq 0x43b4
movzwl 0x10026(%rbx), %esi
decl %esi
movw %si, 0x10026(%rbx)
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %esi
movzbl %bpl, %edx
movq %r14, %rdi
callq 0x43b4
movzwl 0x10026(%rbx), %esi
decl %esi
movw %si, 0x10026(%rbx)
andl %r12d, %esi
movzbl %r15b, %edx
movq %r14, %rdi
callq 0x43b4
decw 0x10026(%rbx)
movq %r14, %rdi
movl $0xfffa, %esi           # imm = 0xFFFA
callq 0x4358
movw %ax, 0x10024(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem.cpp
// Function: Mem::read_byte(unsigned short)
uint8_t Mem::read_byte(uint16_t addr) {
    //Mirroring
    if (addr > 0x07FF) {
	if (addr < 0x1000)
	    addr -= 0x0800;
	else if (addr < 0x1800)
	    addr -= 0x1000;
	else if (addr < 0x2000)
	    addr -= 0x1800;
    }
    //PPU regs mirroring
    if (addr > 0x2007 && addr < 0x4000) {
	addr = (addr & 7) + 0x2000;
    }

    if (addr == 0x2000)
	return mem_ppu->read_PPUCTRL();
    else if (addr == 0x2001)
	return mem_ppu->read_PPUMASK();
    else if (addr == 0x2002)
	return mem_ppu->read_PPUSTATUS();
    else if (addr == 0x2007)
        return mem_ppu->read_PPUDATA();
    else if (addr == 0x4016) {
	uint8_t result = controller_latch & 1;
	controller_latch = controller_latch >> 1;
	controller_latch |= 0x80;
	return result;
    }
    else
        return ram[addr];
}

// Assembly:
cmpl $0x800, %esi            # imm = 0x800
jb 0x42c9
movzwl %si, %eax
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x42ac
addl $0xfffff800, %esi       # imm = 0xFFFFF800
jmp 0x42c9
cmpl $0x17ff, %eax           # imm = 0x17FF
ja 0x42bb
addl $0xfffff000, %esi       # imm = 0xFFFFF000
jmp 0x42c9
leal -0x1800(%rax), %esi
cmpl $0x2000, %eax           # imm = 0x2000
cmovael %eax, %esi
leal -0x2008(%rsi), %edx
movl $0xffff, %ecx           # imm = 0xFFFF
andl %ecx, %edx
movl %esi, %eax
andl $0x2007, %eax           # imm = 0x2007
cmpl $0x1ff8, %edx           # imm = 0x1FF8
cmovael %esi, %eax
andl %eax, %ecx
leal -0x2000(%rcx), %edx
cmpl $0x7, %edx
ja 0x430f
leaq 0x224e(%rip), %rcx      # 0x6548
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq 0x10000(%rdi), %rdi
jmp 0x4948
cmpl $0x4016, %ecx           # imm = 0x4016
jne 0x432d
movb 0x10008(%rdi), %cl
movl %ecx, %eax
andb $0x1, %al
shrb %cl
orb $-0x80, %cl
movb %cl, 0x10008(%rdi)
retq
movzwl %ax, %eax
movb (%rdi,%rax), %al
retq
movq 0x10000(%rdi), %rdi
jmp 0x49b6
movq 0x10000(%rdi), %rdi
jmp 0x49e8
movq 0x10000(%rdi), %rdi
jmp 0x4b7c
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem.cpp
// Function: Mem::read_word(unsigned short)
uint16_t Mem::read_word(uint16_t addr) {
    //Mirroring
    if (addr > 0x07FF) {
	if (addr < 0x1000)
	    addr -= 0x0800;
	else if (addr < 0x1800)
	    addr -= 0x1000;
	else if (addr < 0x2000)
	    addr -= 0x1800;
    }
    //PPU regs mirroring
    if (addr > 0x2007 && addr < 0x4000) {
	addr = (addr & 7) + 0x2000;
    }
    uint16_t result;
    uint8_t lower, upper;
    lower = ram[addr];
    upper = ram[addr+1];
    result = ((uint16_t) upper << 8) | (uint16_t) lower; //$HHLL
    return result;
}

// Assembly:
cmpl $0x800, %esi            # imm = 0x800
jb 0x438f
movzwl %si, %eax
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x4372
addl $0xfffff800, %esi       # imm = 0xFFFFF800
jmp 0x438f
cmpl $0x17ff, %eax           # imm = 0x17FF
ja 0x4381
addl $0xfffff000, %esi       # imm = 0xFFFFF000
jmp 0x438f
leal -0x1800(%rax), %esi
cmpl $0x2000, %eax           # imm = 0x2000
cmovael %eax, %esi
leal -0x2008(%rsi), %eax
movl $0xffff, %ecx           # imm = 0xFFFF
andl %ecx, %eax
movl %esi, %edx
andl $0x2007, %edx           # imm = 0x2007
cmpl $0x1ff8, %eax           # imm = 0x1FF8
cmovael %esi, %edx
andl %ecx, %edx
movzwl (%rdi,%rdx), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::read_byte(unsigned short)
uint8_t Mem_ppu::read_byte(uint16_t addr) {
    //Mirroring
    if (addr > 0x2fff && addr < 0x3f00)
	addr = addr - 0x1000;
    else if (addr > 0x3f1f && addr < 0x4000)
	addr = addr - 0x0020;
    //Pallette mirroring
    if (addr == 0x3f10)
	addr = 0x3f00;
    else if (addr == 0x3f14)
	addr = 0x3f04;
    else if (addr == 0x3f18)
	addr = 0x3f08;
    else if (addr == 0x3f1c)
	addr = 0x3f1c;

    return ram[addr];
}

// Assembly:
movl %esi, %eax
addl $0xffffd000, %eax       # imm = 0xFFFFD000
movzwl %ax, %eax
cmpl $0xeff, %eax            # imm = 0xEFF
ja 0x4761
leal -0x1000(%rsi), %eax
jmp 0x4776
leal -0x3f20(%rsi), %eax
movzwl %ax, %ecx
leal -0x20(%rsi), %eax
cmpl $0xe0, %ecx
cmovael %esi, %eax
movzwl %ax, %eax
cmpl $0x3f10, %eax           # imm = 0x3F10
je 0x479c
cmpl $0x3f18, %eax           # imm = 0x3F18
je 0x4795
cmpl $0x3f14, %eax           # imm = 0x3F14
jne 0x47a1
movl $0x3f04, %eax           # imm = 0x3F04
jmp 0x47a1
movl $0x3f08, %eax           # imm = 0x3F08
jmp 0x47a1
movl $0x3f00, %eax           # imm = 0x3F00
movq (%rdi), %rcx
movb (%rcx,%rax), %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::read_word(unsigned short)
uint16_t Mem_ppu::read_word(uint16_t addr) {
    //Mirroring
    if (addr > 0x2fff && addr < 0x3f00)
	addr = addr - 0x1000;
    else if (addr > 0x3f1f && addr < 0x4000)
	addr = addr - 0x0020;
    //Pallette mirroring
    if (addr == 0x3f10)
	addr = 0x3f00;
    else if (addr == 0x3f14)
	addr = 0x3f04;
    else if (addr == 0x3f18)
	addr = 0x3f08;
    else if (addr == 0x3f1c)
	addr = 0x3f1c;
    uint16_t result;
    uint8_t lower, upper;
    lower = ram[addr&0xFFFE];
    upper = ram[addr|0x0001];
    result = ((uint16_t) upper << 8) | (uint16_t) lower; //$HHLL
    return result;
}

// Assembly:
movl %esi, %eax
addl $0xffffd000, %eax       # imm = 0xFFFFD000
movzwl %ax, %eax
cmpl $0xeff, %eax            # imm = 0xEFF
ja 0x47c1
leal -0x1000(%rsi), %eax
jmp 0x47d6
leal -0x3f20(%rsi), %eax
movzwl %ax, %ecx
leal -0x20(%rsi), %eax
cmpl $0xe0, %ecx
cmovael %esi, %eax
movzwl %ax, %eax
cmpl $0x3f10, %eax           # imm = 0x3F10
je 0x47fc
cmpl $0x3f18, %eax           # imm = 0x3F18
je 0x47f5
cmpl $0x3f14, %eax           # imm = 0x3F14
jne 0x4801
movl $0x3f04, %eax           # imm = 0x3F04
jmp 0x4801
movl $0x3f08, %eax           # imm = 0x3F08
jmp 0x4801
movl $0x3f00, %eax           # imm = 0x3F00
movq (%rdi), %rcx
movl %eax, %eax
movl %eax, %edx
andl $-0x2, %edx
movzbl (%rcx,%rdx), %edx
orq $0x1, %rax
movzbl (%rcx,%rax), %eax
shll $0x8, %eax
orl %edx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::write_byte(unsigned short, unsigned char)
void Mem_ppu::write_byte(uint16_t addr, uint8_t data) {
    //Mirroring
    if (addr > 0x2fff && addr < 0x3f00)
	addr = addr - 0x1000;
    else if (addr > 0x3f1f && addr < 0x4000)
	addr = addr - 0x0020;
    //Pallette mirroring
    if (addr == 0x3f10)
	addr = 0x3f00;
    else if (addr == 0x3f14)
	addr = 0x3f04;
    else if (addr == 0x3f18)
	addr = 0x3f08;
    else if (addr == 0x3f1c)
	addr = 0x3f1c;
    ram[addr] = data;
}

// Assembly:
movl %esi, %eax
addl $0xffffd000, %eax       # imm = 0xFFFFD000
movzwl %ax, %eax
cmpl $0xeff, %eax            # imm = 0xEFF
ja 0x4837
leal -0x1000(%rsi), %eax
jmp 0x484c
leal -0x3f20(%rsi), %eax
movzwl %ax, %ecx
leal -0x20(%rsi), %eax
cmpl $0xe0, %ecx
cmovael %esi, %eax
movzwl %ax, %eax
cmpl $0x3f10, %eax           # imm = 0x3F10
je 0x4872
cmpl $0x3f18, %eax           # imm = 0x3F18
je 0x486b
cmpl $0x3f14, %eax           # imm = 0x3F14
jne 0x4877
movl $0x3f04, %eax           # imm = 0x3F04
jmp 0x4877
movl $0x3f08, %eax           # imm = 0x3F08
jmp 0x4877
movl $0x3f00, %eax           # imm = 0x3F00
movq (%rdi), %rcx
movb %dl, (%rcx,%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::write_PPUADDR(unsigned char)
void Mem_ppu::write_PPUADDR(uint8_t addr) {
    if (ppuaddr_ptr_hl == 0) {
	//Writing high byte
	PPUADDR = (addr << 8);
	PPUADDR &= 0x3FFF; //Upper adddresses are mirrored
	ppuaddr_ptr_hl = 1;
    }
    else {
	//Writing low byte
	PPUADDR |= (addr & 0x00FF);
	ppuaddr_ptr_hl = 0;
    }
    //Lower bits of ppustatus are the last written bits
    PPUSTATUS = (PPUSTATUS & 0xe0) | (addr & 0x1f);
}

// Assembly:
cmpb $0x0, 0x3c01c(%rdi)
je 0x4986
movzbl %sil, %eax
orw %ax, 0x3c012(%rdi)
xorl %eax, %eax
jmp 0x4999
movzbl %sil, %eax
andl $0x3f, %eax
shll $0x8, %eax
movw %ax, 0x3c012(%rdi)
movb $0x1, %al
movb %al, 0x3c01c(%rdi)
movb 0x3c015(%rdi), %al
andb $-0x20, %al
andb $0x1f, %sil
orb %al, %sil
movb %sil, 0x3c015(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::read_PPUSTATUS()
uint8_t Mem_ppu::read_PPUSTATUS() {
    uint8_t result = PPUSTATUS;
    //Clear the vblank status bit if we are not in vblank
    if (!in_vblank)
	PPUSTATUS = PPUSTATUS & 0x7f;
    //Clear the address latch
    PPUADDR = 0;
    ppuaddr_ptr_hl = 0;
    ppuscroll_ptr_hl = 0;
    oamaddr_ptr_hl = 0;
    return result;
}

// Assembly:
movb 0x3c015(%rdi), %al
cmpb $0x0, 0x3c01f(%rdi)
jne 0x49d0
movl %eax, %ecx
andb $0x7f, %cl
movb %cl, 0x3c015(%rdi)
xorl %ecx, %ecx
movw %cx, 0x3c012(%rdi)
movw %cx, 0x3c01c(%rdi)
movb $0x0, 0x3c01e(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::read_PPUDATA()
uint8_t Mem_ppu::read_PPUDATA() {
    uint8_t result;
    if (PPUADDR > 0x3eff) {
	//When ppuaddr is at the pallettes, read normally
	result = read_byte(PPUADDR);
	PPUDATA = result;
    }
    else {
	//If not, then read the internal buffer
	result = PPUDATA;
	PPUDATA = read_byte(PPUADDR);
    }
    //The internal buffer updates anyways

    if (((PPUCTRL >> 2) & 1) == 0) {
	    PPUADDR += 1;
    }
    else {
	    PPUADDR += 32;
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzwl 0x3c012(%rdi), %r14d
cmpl $0x3f00, %r14d          # imm = 0x3F00
jb 0x4a10
movzwl %r14w, %esi
movq %rbx, %rdi
callq 0x4748
movl %eax, %ebp
jmp 0x4a23
movb 0x3c014(%rbx), %bpl
movzwl %r14w, %esi
movq %rbx, %rdi
callq 0x4748
movb %al, 0x3c014(%rbx)
leal 0x20(%r14), %eax
leal 0x1(%r14), %ecx
testb $0x4, 0x3c010(%rbx)
cmovnel %eax, %ecx
movw %cx, 0x3c012(%rbx)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::write_PPUDATA(unsigned char)
void Mem_ppu::write_PPUDATA(uint8_t data) {
    write_byte(PPUADDR, data);
    if (((PPUCTRL >> 2) & 1) == 0) {
	    PPUADDR += 1;
    }
    else {
	    PPUADDR += 32;
    }
    //Lower bits of ppustatus are the last written bits
    PPUSTATUS = (PPUSTATUS & 0xe0) | (data & 0x1f);
}

// Assembly:
movzwl 0x3c012(%rdi), %eax
movl %eax, %ecx
addl $0xffffd000, %ecx       # imm = 0xFFFFD000
movzwl %cx, %ecx
cmpl $0xeff, %ecx            # imm = 0xEFF
ja 0x4a6c
leal -0x1000(%rax), %ecx
jmp 0x4a81
leal -0x3f20(%rax), %ecx
movzwl %cx, %edx
leal -0x20(%rax), %ecx
cmpl $0xe0, %edx
cmovael %eax, %ecx
movzwl %cx, %eax
cmpl $0x3f10, %eax           # imm = 0x3F10
je 0x4aa7
cmpl $0x3f18, %eax           # imm = 0x3F18
je 0x4aa0
cmpl $0x3f14, %eax           # imm = 0x3F14
jne 0x4aac
movl $0x3f04, %eax           # imm = 0x3F04
jmp 0x4aac
movl $0x3f08, %eax           # imm = 0x3F08
jmp 0x4aac
movl $0x3f00, %eax           # imm = 0x3F00
movq (%rdi), %rcx
movb %sil, (%rcx,%rax)
testb $0x4, 0x3c010(%rdi)
movl $0x1, %eax
movl $0x20, %ecx
cmovel %eax, %ecx
addw %cx, 0x3c012(%rdi)
movb 0x3c015(%rdi), %al
andb $-0x20, %al
andb $0x1f, %sil
orb %al, %sil
movb %sil, 0x3c015(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::write_OAMADDR(unsigned char)
void Mem_ppu::write_OAMADDR(uint8_t addr) {
    if (oamaddr_ptr_hl == 0) {
	//Writing high byte
	OAMADDR = (addr << 8);
	OAMADDR &= 0x3FFF; //Upper adddresses are mirrored
	oamaddr_ptr_hl = 1;
    }
    else {
	//Writing low byte
	OAMADDR |= (addr & 0x00FF);
	oamaddr_ptr_hl = 0;
    }
    //Lower bits of ppustatus are the last written bits
    PPUSTATUS = (PPUSTATUS & 0xe0) | (addr & 0x1f);
}

// Assembly:
cmpb $0x0, 0x3c01d(%rdi)
je 0x4afe
movzbl %sil, %eax
orw %ax, 0x3c016(%rdi)
xorl %eax, %eax
jmp 0x4b11
movzbl %sil, %eax
andl $0x3f, %eax
shll $0x8, %eax
movw %ax, 0x3c016(%rdi)
movb $0x1, %al
movb %al, 0x3c01d(%rdi)
movb 0x3c015(%rdi), %al
andb $-0x20, %al
andb $0x1f, %sil
orb %al, %sil
movb %sil, 0x3c015(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::read_OAMDATA()
uint8_t Mem_ppu::read_OAMDATA() {
    uint8_t result = ram[OAMADDR];
    if (!in_vblank)
	OAMADDR = OAMADDR+1;
    return result;
}

// Assembly:
movq (%rdi), %rax
movzwl 0x3c016(%rdi), %ecx
movb (%rax,%rcx), %al
cmpb $0x0, 0x3c01f(%rdi)
jne 0x4b4d
incl %ecx
movw %cx, 0x3c016(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/mem_ppu.cpp
// Function: Mem_ppu::write_PPUSCROLL(unsigned char)
void Mem_ppu::write_PPUSCROLL(uint8_t data) {
    if (ppuscroll_ptr_hl == 0) {
	//Writing high byte
	PPUSCROLL = (data << 8);
	ppuscroll_ptr_hl = 1;
    }
    else {
	//Writing low byte
	PPUSCROLL |= (data & 0x00FF);
	ppuscroll_ptr_hl = 0;
    }
    //Lower bits of ppustatus are the last written bits
    PPUSTATUS = (PPUSTATUS & 0xe0) | (data & 0x1f);
}

// Assembly:
cmpb $0x0, 0x3c01e(%rdi)
je 0x4ba4
movzbl %sil, %eax
orw %ax, 0x3c01a(%rdi)
xorl %eax, %eax
jmp 0x4bb4
movzbl %sil, %eax
shll $0x8, %eax
movw %ax, 0x3c01a(%rdi)
movb $0x1, %al
movb %al, 0x3c01e(%rdi)
movb 0x3c015(%rdi), %al
andb $-0x20, %al
andb $0x1f, %sil
orb %al, %sil
movb %sil, 0x3c015(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/src/ppu.cpp
// Function: Ppu::vblank()
void Ppu::vblank() {
    //Set the vblank bit
    mem_ppu->PPUSTATUS = mem_ppu->PPUSTATUS | 0x80;
    mem_ppu->in_vblank = true;
    if ((mem_ppu->PPUCTRL >> 7) & 1)
	cpu->NMI_execute();
}

// Assembly:
movq 0x8(%rdi), %rax
orb $-0x80, 0x3c015(%rax)
movb $0x1, 0x3c01f(%rax)
cmpb $0x0, 0x3c010(%rax)
js 0x5306
retq
movq (%rdi), %rdi
jmp 0x3ce4
nop
// File: /workspace/github_cpp_makefile_star2_O3/NGageMegaman[P]NEScutre/main.cpp
// Function: main
int main() {
    int count = 0, n_scanline;
    unsigned int next_vblank = 89342;
    unsigned int next_vblank_end = 89342 + 7746;
    unsigned int next_sprite = 89342 + 7746 + 340;
    Clock nes_clock;
    Mem_ppu nes_mem_ppu;
    nes_mem_ppu.load_rom("smb.nes");
    Cpu nes_cpu;
    nes_cpu.clock = &nes_clock;
    nes_cpu.mem.mem_ppu = &nes_mem_ppu;
    Ppu nes_ppu;
    nes_ppu.cpu = &nes_cpu;
    nes_ppu.mem_ppu = &nes_mem_ppu;
    nes_cpu.mem.di = nes_ppu.di;
    while(1) {
	    nes_cpu.execute();
	    if (nes_clock.cycles >= next_vblank) {
		//usleep(400000);
		for (int i = 0; i<240; ++i)
		    nes_ppu.drawSprites(i);
		nes_ppu.drawScreen();
		count++;
		n_scanline = 0;
	        next_vblank += 89342;
		next_sprite = next_vblank_end + 340;
	        nes_ppu.vblank();
	    }
	    if (nes_clock.cycles >= next_vblank_end) {
		next_vblank_end = next_vblank + 7746;
		nes_mem_ppu.vblank_end();
		nes_mem_ppu.PPUSTATUS = nes_mem_ppu.PPUSTATUS & 0xbf;
	    }
	    //Draw for each scanline
	    //We assume the first sprite always does s0h
	    if (n_scanline != 0xee && nes_clock.cycles >= next_sprite) {
		nes_ppu.draw(n_scanline);
		nes_ppu.checkSprite0Hit(n_scanline);
		next_sprite = next_sprite + 340;
		n_scanline++;
	    }
	   
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4c198, %rsp          # imm = 0x4C198
leaq 0xc(%rsp), %r15
movq %r15, %rdi
callq 0x23dc
leaq 0x10178(%rsp), %rbx
movq %rbx, %rdi
callq 0x4704
leaq 0x1273(%rip), %rsi      # 0x65b8
movq %rbx, %rdi
callq 0x487e
leaq 0x148(%rsp), %r14
movq %r14, %rdi
callq 0x23e4
movq %r15, (%r14)
movq %rbx, 0x10008(%r14)
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x4be4
movq %r14, (%r15)
movq %rbx, 0x8(%r15)
movq 0x10(%r15), %rax
movq %rax, 0x10018(%r14)
movl $0x17c94, %ebx          # imm = 0x17C94
movl $0x17b40, %r13d         # imm = 0x17B40
movl $0x15cfe, %r12d         # imm = 0x15CFE
leaq 0x148(%rsp), %rdi
callq 0x243a
movl 0xc(%rsp), %eax
cmpl %r12d, %eax
jae 0x53b2
movl %r14d, %ebp
jmp 0x53ec
xorl %ebp, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x4d96
incl %ebp
cmpl $0xf0, %ebp
jne 0x53b4
movq %r15, %rdi
callq 0x529a
addl $0x15cfe, %r12d         # imm = 0x15CFE
leal 0x154(%r13), %ebx
movq %r15, %rdi
callq 0x52ea
xorl %ebp, %ebp
movl 0xc(%rsp), %eax
cmpl %r13d, %eax
jb 0x540e
leal 0x1e42(%r12), %r13d
leaq 0x10178(%rsp), %rdi
callq 0x4bd2
andb $-0x41, 0x4c18d(%rsp)
movl $0xee, %r14d
cmpl $0xee, %ebp
je 0x5397
movl %ebp, %r14d
cmpl %ebx, 0xc(%rsp)
jb 0x5397
movq %r15, %rdi
movl %ebp, %esi
callq 0x50b4
movq %r15, %rdi
movl %ebp, %esi
callq 0x4d7e
addl $0x154, %ebx            # imm = 0x154
incl %ebp
movl %ebp, %r14d
jmp 0x5397
// File: /workspace/github_cpp_makefile_star2_O3/araujoigor[P]ipp-compiler/./src/include/IMath.hpp
// Function: IMath::isNumber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
static bool isNumber(std::string numberStr){
		try{
			std::string::size_type sz;
			std::stof(numberStr, &sz);
			return true;
		}catch(std::invalid_argument& e){
			return false;
		}catch(std::out_of_range& ex){
			std::cout << "Erro ao avaliar string " << numberStr << std::endl;
			return false;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r15
callq 0x7060
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq -0x30(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x7590
cmpq %r15, (%r12)
je 0xa1fa
movl (%r14), %eax
testl %eax, %eax
je 0xa1e6
cmpl $0x22, %eax
jne 0xa1e9
leaq 0x20e5a(%rip), %rdi     # 0x2b03b
callq 0x75f0
movl %r13d, (%r14)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20e3a(%rip), %rdi     # 0x2b03b
callq 0x7260
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0xa212
movl %r13d, (%r14)
cmpl $0x2, %edx
jne 0xa221
movq %r15, %rdi
callq 0x7190
jmp 0xa261
cmpl $0x1, %edx
jne 0xa272
movq %r15, %rdi
callq 0x7190
movq 0x31d93(%rip), %rdi     # 0x3bfc8
leaq 0x20de7(%rip), %rsi     # 0x2b023
movl $0x17, %edx
callq 0x7460
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x31d74(%rip), %rdi     # 0x3bfc8
callq 0x7460
movq %rax, %rdi
callq 0x71e0
callq 0x7700
xorl %eax, %eax
jmp 0xa1eb
movq %rax, %r15
callq 0x7700
movq %r15, %rdi
callq 0x77b0
movq %rax, %rdi
callq 0xb2be
// File: /workspace/github_cpp_makefile_star2_O3/araujoigor[P]ipp-compiler/./src/include/IDefinition.hpp
// Function: IDefinition::addVar(IData*)
void addVar(IData *var){
		vars.push_back(var);

		if(ownerBlock == NULL)
			scheduledVariableRegister = true;
		else
			ownerBlock->registerLocalVariable(var, myLine);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
movq %rsi, -0x10(%rbp)
movq 0x40(%rdi), %rsi
cmpq 0x48(%rdi), %rsi
je 0xa5ea
movq %rax, (%rsi)
addq $0x8, 0x40(%rbx)
jmp 0xa5f7
leaq 0x38(%rbx), %rdi
leaq -0x10(%rbp), %rdx
callq 0xdd88
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0xa60e
movq -0x10(%rbp), %rsi
movl 0x8(%rbx), %edx
callq 0xdc30
jmp 0xa615
movb $0x1, 0xb0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/araujoigor[P]ipp-compiler/./src/include/IDefinition.hpp
// Function: IDefinition::addVar(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
void addVar(std::string *leftVar, std::string *rightVar){
		varEqualsVarMapping[*leftVar] = *rightVar;

		if(ownerBlock == NULL)
			scheduledVariableRegister = true;
		else
			ownerBlock->registerLocalVariable(generateVariable(&type, leftVar), myLine);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
addq $0x50, %rdi
callq 0xdec2
movq %rax, %rdi
movq %r15, %rsi
callq 0x7230
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0xa670
leaq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x803e
movl 0x8(%rbx), %edx
movq %r15, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xdc30
movb $0x1, 0xb0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/araujoigor[P]ipp-compiler/./src/include/IMath.hpp
// Function: IMath::IMath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
IMath(std::string *newExpression){
		expression.clear();
		expression.push_back('(');
		expression.append(*newExpression);
		expression.push_back(')');
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
leaq 0x20(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x2c(%rdi)
movl $0x1, 0x3c(%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movl $0x28, %esi
callq 0x7310
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x7120
movq %rbx, %rdi
movl $0x29, %esi
callq 0x7310
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %r14, %rdi
callq 0xe272
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0xa703
callq 0x7350
movq %r15, %rdi
callq 0x77b0
nop