// File: RegulusImpact[P]sadboy/src/MMU.cpp
// Function: MMU::CheckMemory()
void MMU::CheckMemory() {
    if (Read(0xFF05) != 0x00) { std::cout << "failed on FF0F" << std::endl; exit(1); } // TIMA
    if (Read(0xFF06) != 0x00) { std::cout << "failed on FF0F" << std::endl; exit(1); } // TMA
    if (Read(0xFF07) != 0x00) { std::cout << "failed on FF07" << std::endl; exit(1); } // TAC
    // if (Read(0xFF10) != 0x80) { std::cout << "failed on FF10" << std::endl; exit(1); } // NR10
    // if (Read(0xFF11) != 0xBF) { std::cout << "failed on FF11" << std::endl; exit(1); } // NR11
    // if (Read(0xFF12) != 0xF3) { std::cout << "failed on FF12" << std::endl; exit(1); } // NR12
    // if (Read(0xFF14) != 0xBF) { std::cout << "failed on FF14" << std::endl; exit(1); } // NR14
    // if (Read(0xFF16) != 0x3F) { std::cout << "failed on FF16" << std::endl; exit(1); } // NR21
    // if (Read(0xFF17) != 0x00) { std::cout << "failed on FF17" << std::endl; exit(1); } // NR22
    // if (Read(0xFF19) != 0xBF) { std::cout << "failed on FF19" << std::endl; exit(1); } // NR24
    // if (Read(0xFF1A) != 0x7F) { std::cout << "failed on FF1A" << std::endl; exit(1); } // NR30
    // if (Read(0xFF1B) != 0xFF) { std::cout << "failed on FF1B" << std::endl; exit(1); } // NR31
    // if (Read(0xFF1C) != 0x9F) { std::cout << "failed on FF1C" << std::endl; exit(1); } // NR32
    // if (Read(0xFF1E) != 0xBF) { std::cout << "failed on FF1E" << std::endl; exit(1); } // NR33
    // if (Read(0xFF20) != 0xFF) { std::cout << "failed on FF20" << std::endl; exit(1); } // NR41
    // if (Read(0xFF21) != 0x00) { std::cout << "failed on FF21" << std::endl; exit(1); } // NR42
    // if (Read(0xFF22) != 0x00) { std::cout << "failed on FF22" << std::endl; exit(1); } // NR43
    // if (Read(0xFF23) != 0xBF) { std::cout << "failed on FF23" << std::endl; exit(1); } // NR30
    // if (Read(0xFF24) != 0x77) { std::cout << "failed on FF24" << std::endl; exit(1); } // NR50
    // if (Read(0xFF25) != 0xF3) { std::cout << "failed on FF25" << std::endl; exit(1); } // NR51
    // if (Read(0xFF26) != 0xF1) { std::cout << "failed on FF26" << std::endl; exit(1); } // NR52
    if (Read(0xFF40) != 0x91) { std::cout << "failed on FF40" << std::endl; exit(1); } // LCDC
    if (Read(0xFF42) != 0x00) { std::cout << "failed on FF42" << std::endl; exit(1); } // SCY
    if (Read(0xFF43) != 0x00) { std::cout << "failed on FF43" << std::endl; exit(1); } // SCX
    if (Read(0xFF45) != 0x00) { std::cout << "failed on FF45" << std::endl; exit(1); } // LYC
    if (Read(0xFF47) != 0xFC) { std::cout << "failed on FF47" << std::endl; exit(1); } // BGP
    if (Read(0xFF4A) != 0x00) { std::cout << "failed on FF4A" << std::endl; printf("%.2X", Read(0xFF4A)); exit(1); } // WY
    if (Read(0xFF4B) != 0x00) { std::cout << "failed on FF4B" << std::endl; printf("%.2X", Read(0xFF4B)); exit(1); } // WX
    // if (Read(0xFFFF) != 0x00) { std::cout << "failed on FFFF" << std::endl; printf("%.2X", Read(0xFFFF)); exit(1); } // IE
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movl $0xff05, %esi           # imm = 0xFF05
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x339e2
movq 0x18603(%rip), %rdi     # 0x4bfc0
leaq 0x60fb(%rip), %rsi      # 0x39abf
callq 0x5460
movq %rax, %rdi
movq 0x185d5(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff06, %esi           # imm = 0xFF06
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33a24
movq 0x185c1(%rip), %rdi     # 0x4bfc0
leaq 0x60b9(%rip), %rsi      # 0x39abf
callq 0x5460
movq %rax, %rdi
movq 0x18593(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff07, %esi           # imm = 0xFF07
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33a66
movq 0x1857f(%rip), %rdi     # 0x4bfc0
leaq 0x6086(%rip), %rsi      # 0x39ace
callq 0x5460
movq %rax, %rdi
movq 0x18551(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff40, %esi           # imm = 0xFF40
callq 0x334c0
movzbl %al, %eax
cmpl $0x91, %eax
je 0x33aaa
movq 0x1853b(%rip), %rdi     # 0x4bfc0
leaq 0x6051(%rip), %rsi      # 0x39add
callq 0x5460
movq %rax, %rdi
movq 0x1850d(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff42, %esi           # imm = 0xFF42
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33aec
movq 0x184f9(%rip), %rdi     # 0x4bfc0
leaq 0x601e(%rip), %rsi      # 0x39aec
callq 0x5460
movq %rax, %rdi
movq 0x184cb(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff43, %esi           # imm = 0xFF43
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33b2e
movq 0x184b7(%rip), %rdi     # 0x4bfc0
leaq 0x5feb(%rip), %rsi      # 0x39afb
callq 0x5460
movq %rax, %rdi
movq 0x18489(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff45, %esi           # imm = 0xFF45
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33b70
movq 0x18475(%rip), %rdi     # 0x4bfc0
leaq 0x5fb8(%rip), %rsi      # 0x39b0a
callq 0x5460
movq %rax, %rdi
movq 0x18447(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff47, %esi           # imm = 0xFF47
callq 0x334c0
movzbl %al, %eax
cmpl $0xfc, %eax
je 0x33bb4
movq 0x18431(%rip), %rdi     # 0x4bfc0
leaq 0x5f83(%rip), %rsi      # 0x39b19
callq 0x5460
movq %rax, %rdi
movq 0x18403(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff4a, %esi           # imm = 0xFF4A
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33c15
movq 0x183ef(%rip), %rdi     # 0x4bfc0
leaq 0x5f50(%rip), %rsi      # 0x39b28
callq 0x5460
movq %rax, %rdi
movq 0x183c1(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movq -0x10(%rbp), %rdi
movl $0xff4a, %esi           # imm = 0xFF4A
callq 0x334c0
movzbl %al, %esi
leaq 0x5f33(%rip), %rdi      # 0x39b37
movb $0x0, %al
callq 0x5070
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0xff4b, %esi           # imm = 0xFF4B
callq 0x334c0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x33c76
movq 0x1838e(%rip), %rdi     # 0x4bfc0
leaq 0x5f03(%rip), %rsi      # 0x39b3c
callq 0x5460
movq %rax, %rdi
movq 0x18360(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movq -0x10(%rbp), %rdi
movl $0xff4b, %esi           # imm = 0xFF4B
callq 0x334c0
movzbl %al, %esi
leaq 0x5ed2(%rip), %rdi      # 0x39b37
movb $0x0, %al
callq 0x5070
movl $0x1, %edi
callq 0x5590
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)