// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
movq %rdi, %rbx
movq %rsi, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq $0x0, 0x18(%rdi)
leaq 0x18(%rsi), %rax
movq %rax, 0x28(%rdi)
leaq 0x19(%rsi), %rax
movq %rax, 0x30(%rdi)
leaq 0x1a(%rsi), %rax
movq %rax, 0x38(%rdi)
leaq 0x1b(%rsi), %rax
movq %rax, 0x40(%rdi)
leaq 0x1c(%rsi), %rax
movq %rax, 0x48(%rdi)
leaq 0x1d(%rsi), %rax
movq %rax, 0x50(%rdi)
leaq 0x1e(%rsi), %rax
movq %rax, 0x58(%rdi)
leaq 0x1f(%rsi), %rax
movq %rax, 0x60(%rdi)
leaq 0x20(%rsi), %rax
movq %rax, 0x68(%rdi)
leaq 0x21(%rsi), %rax
movq %rax, 0x70(%rdi)
addq $0x22, %rsi
movq %rsi, 0x78(%rdi)
movups %xmm0, 0x88(%rdi)
movups %xmm0, 0x98(%rdi)
movups %xmm0, 0xa8(%rdi)
movl $0x16800, %edi          # imm = 0x16800
callq 0x21b0
movq %rax, %r14
movq %rax, %r15
addq $0x16800, %r15          # imm = 0x16800
movl $0x16800, %edx          # imm = 0x16800
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movq 0x8(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq %r14, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movq %r15, 0x18(%rbx)
testq %rdi, %rdi
je 0x7a01
subq %rdi, %rsi
callq 0x21c0
movl $0x16800, %edi          # imm = 0x16800
callq 0x21b0
movq %rax, %r14
movq %rax, %r15
addq $0x16800, %r15          # imm = 0x16800
movl $0x16800, %edx          # imm = 0x16800
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movq 0x88(%rbx), %rdi
movq 0x98(%rbx), %rsi
movq %r14, 0x88(%rbx)
movq %r15, 0x90(%rbx)
movq %r15, 0x98(%rbx)
testq %rdi, %rdi
je 0x7a57
subq %rdi, %rsi
callq 0x21c0
movl $0xa0, %edi
callq 0x21b0
movq %rax, %r14
movq %rax, %r15
addq $0xa0, %r15
xorl %ebp, %ebp
movl $0xa0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movq 0xa0(%rbx), %rdi
movq 0xb0(%rbx), %rsi
movq %r14, 0xa0(%rbx)
movq %r15, 0xa8(%rbx)
movq %r15, 0xb0(%rbx)
testq %rdi, %rdi
je 0x7ab6
subq %rdi, %rsi
callq 0x21c0
movq 0xa0(%rbx), %r14
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
movl $0xa0, %edx
movq %r14, %rdi
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)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7b10
jmp 0x7b10
movq %rax, %r14
leaq 0x88(%rbx), %r15
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x7b35
movq 0xb0(%rbx), %rsi
subq %rdi, %rsi
callq 0x21c0
leaq 0x8(%rbx), %r12
movq (%r15), %rdi
testq %rdi, %rdi
je 0x7b50
movq 0x98(%rbx), %rsi
subq %rdi, %rsi
callq 0x21c0
movq (%r12), %rdi
testq %rdi, %rdi
je 0x7b65
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x2270
nop