// File: /workspace/github_cpp_makefile_star2_O1/nicoeps[P]NicoGB/src/ppu.cpp
// Function: PPU::PPU(Memory&)
PPU::PPU(Memory& memory) :
    memory(memory),
    lcdc(memory.lcd.lcdc),
    stat(memory.lcd.stat),
    scy(memory.lcd.scy),
    scx(memory.lcd.scx),
    ly(memory.lcd.ly),
    lyc(memory.lcd.lyc),
    bgp(memory.lcd.bgp),
    obp0(memory.lcd.obp0),
    obp1(memory.lcd.obp1),
    wy(memory.lcd.wy),
    wx(memory.lcd.wx) {
    framebuffer = std::vector<uint32_t>(160*144);
    writebuffer = std::vector<uint32_t>(160*144);
    line = std::vector<uint8_t>(160);
    init();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsi, (%rdi)
leaq 0x8(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
xorl %eax, %eax
movq %rax, 0x18(%rdi)
leaq 0x18(%rsi), %rcx
movq %rcx, 0x28(%rdi)
leaq 0x19(%rsi), %rcx
movq %rcx, 0x30(%rdi)
leaq 0x1a(%rsi), %rcx
movq %rcx, 0x38(%rdi)
leaq 0x1b(%rsi), %rcx
movq %rcx, 0x40(%rdi)
leaq 0x1c(%rsi), %rcx
movq %rcx, 0x48(%rdi)
leaq 0x1d(%rsi), %rcx
movq %rcx, 0x50(%rdi)
leaq 0x1e(%rsi), %rcx
movq %rcx, 0x58(%rdi)
leaq 0x1f(%rsi), %rcx
movq %rcx, 0x60(%rdi)
leaq 0x20(%rsi), %rcx
movq %rcx, 0x68(%rdi)
leaq 0x21(%rsi), %rcx
movq %rcx, 0x70(%rdi)
addq $0x22, %rsi
movq %rsi, 0x78(%rdi)
leaq 0x88(%rdi), %r12
leaq 0xa0(%rdi), %r15
movups %xmm0, 0x88(%rdi)
movups %xmm0, 0x98(%rdi)
movups %xmm0, 0xa8(%rdi)
movq %rax, 0x10(%rsp)
movaps %xmm0, (%rsp)
movl $0x16800, %edi          # imm = 0x16800
callq 0x21b0
movq %rsp, %r13
movq %rax, (%r13)
movq %rax, 0x8(%r13)
movq %rax, %rbp
addq $0x16800, %rbp          # imm = 0x16800
movq %rbp, 0x10(%r13)
movl $0x16800, %edx          # imm = 0x16800
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movq %rbp, 0x8(%r13)
movq %r14, %rdi
movq %r13, %rsi
callq 0x8da6
movq (%r13), %rdi
testq %rdi, %rdi
je 0x7a74
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movl $0x16800, %edi          # imm = 0x16800
callq 0x21b0
movq %rsp, %r13
movq %rax, (%r13)
movq %rax, 0x8(%r13)
movq %rax, %rbp
addq $0x16800, %rbp          # imm = 0x16800
movq %rbp, 0x10(%r13)
movl $0x16800, %edx          # imm = 0x16800
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movq %rbp, 0x8(%r13)
movq %r12, %rdi
movq %r13, %rsi
callq 0x8da6
movq (%r13), %rdi
testq %rdi, %rdi
je 0x7adb
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movl $0xa0, %edi
callq 0x21b0
movq %rsp, %r14
movq %rax, (%r14)
movq %rax, 0x8(%r14)
movq %rax, %r12
addq $0xa0, %r12
movq %r12, 0x10(%r14)
xorl %ebp, %ebp
movl $0xa0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movq %r12, 0x8(%r14)
movq %r15, %rdi
movq %r14, %rsi
callq 0x285c
movq (%r14), %rdi
testq %rdi, %rdi
je 0x7b42
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq 0x8(%rbx), %rdi
movl $0x16800, %edx          # imm = 0x16800
xorl %esi, %esi
callq 0x2120
movq 0x88(%rbx), %rdi
movl $0x16800, %edx          # imm = 0x16800
xorl %esi, %esi
callq 0x2120
movq 0xa0(%rbx), %rdi
movl $0xa0, %edx
xorl %esi, %esi
callq 0x2120
movb $0x4, 0x80(%rbx)
movl %ebp, 0x20(%rbx)
movb $0x0, 0x24(%rbx)
movl %ebp, 0x84(%rbx)
movb $0x1, 0xb8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7ba6
jmp 0x7ba6
movq %rax, %r13
movq (%r15), %rdi
testq %rdi, %rdi
je 0x7bc0
movq 0xb0(%rbx), %rsi
subq %rdi, %rsi
callq 0x21c0
movq (%r12), %rdi
testq %rdi, %rdi
je 0x7bd8
movq 0x98(%rbx), %rsi
subq %rdi, %rsi
callq 0x21c0
movq (%r14), %rdi
testq %rdi, %rdi
je 0x7bec
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
callq 0x21c0
movq %r13, %rdi
callq 0x2270