LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::clear_surfaces(bool)
void ppu::clear_surfaces(bool bank) {
    if(!bank)
        for(int tile = 0; tile < 256; ++tile)
            for(int palette = 0; palette < 8; ++palette)
                unget_Surface(0,tile,palette);
    else
        for(int tile = 0; tile < 256; ++tile)
            for(int palette = 0; palette < 8; ++palette)
                unget_Surface(1,tile,palette);
}

// Assembly:
subq $0x28, %rsp
movb %sil, %al
movq %rdi, 0x20(%rsp)
andb $0x1, %al
movb %al, 0x1f(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
testb $0x1, 0x1f(%rsp)
jne 0x1cbe4
movl $0x0, 0x18(%rsp)
cmpl $0x100, 0x18(%rsp)      # imm = 0x100
jge 0x1cbe2
movl $0x0, 0x14(%rsp)
cmpl $0x8, 0x14(%rsp)
jge 0x1cbd3
movq (%rsp), %rdi
movl 0x18(%rsp), %edx
movl 0x14(%rsp), %ecx
xorl %esi, %esi
callq 0x1cc40
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1cbac
jmp 0x1cbd5
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x1cb9a
jmp 0x1cc39
movl $0x0, 0x10(%rsp)
cmpl $0x100, 0x10(%rsp)      # imm = 0x100
jge 0x1cc37
movl $0x0, 0xc(%rsp)
cmpl $0x8, 0xc(%rsp)
jge 0x1cc28
movq (%rsp), %rdi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
movl $0x1, %esi
callq 0x1cc40
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1cbfe
jmp 0x1cc2a
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x1cbec
jmp 0x1cc39
addq $0x28, %rsp
retq
nop
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::unget_Surface(int, int, int)
void ppu::unget_Surface(int table, int tile, int palnum) {
    for(int hf = 0; hf < 2; ++hf) {
        for(int vf = 0; vf < 2; ++vf) {
            SDL_Surface * temp = tile_cache[table][tile][palnum][hf][vf];
            if(!temp) continue;
            SDL_FreeSurface(temp);
            tile_cache[table][tile][palnum][hf][vf] = NULL;
        }
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movl %edx, 0x28(%rsp)
movl %ecx, 0x24(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x20(%rsp)
cmpl $0x2, 0x20(%rsp)
jge 0x1cd4c
movl $0x0, 0x1c(%rsp)
cmpl $0x2, 0x1c(%rsp)
jge 0x1cd3a
movq 0x8(%rsp), %rax
addq $0x1850, %rax           # imm = 0x1850
movslq 0x2c(%rsp), %rcx
shlq $0x10, %rcx
addq %rcx, %rax
movslq 0x28(%rsp), %rcx
shlq $0x8, %rcx
addq %rcx, %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x20(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x1ccd8
jmp 0x1cd2a
movq 0x10(%rsp), %rdi
callq 0x4370
movq 0x8(%rsp), %rax
addq $0x1850, %rax           # imm = 0x1850
movslq 0x2c(%rsp), %rcx
shlq $0x10, %rcx
addq %rcx, %rax
movslq 0x28(%rsp), %rcx
shlq $0x8, %rcx
addq %rcx, %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x20(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x1c(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1cc7a
jmp 0x1cd3c
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x1cc67
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::~ppu()
ppu::~ppu() {
    //cout<<"Start ppu desctructor"<<endl;
    cout<<"Reads: "<<s.reads<<" ("<<s.twok2_reads<<" to 0x2002, "<<s.reads_during_render<<" during render) Writes: "<<s.writes<<" ("<<s.writes_during_render<<" during render) DMAs: "<<(s.dmas/256)<<endl<<"Total cycles: "<<s.cycles<<" Total frames: "<<frame<<endl;
    clear_surfaces(false);
    clear_surfaces(true);
    while(scroll_shifts.size() > 0) scroll_shifts.pop_front();
    //cout<<"End ppu destructor"<<endl<<endl;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x1a22a(%rip), %rdi     # 0x36fb0
leaq 0xf84d(%rip), %rsi      # 0x2c5da
callq 0x43c0
movq %rax, 0x88(%rsp)
jmp 0x1cd9c
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x1b8(%rax), %esi
callq 0x44c0
movq %rax, 0x78(%rsp)
jmp 0x1cdbe
movq 0x78(%rsp), %rdi
leaq 0x103fa(%rip), %rsi     # 0x2d1c4
callq 0x43c0
movq %rax, 0x70(%rsp)
jmp 0x1cdd6
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x1bc(%rax), %esi
callq 0x44c0
movq %rax, 0x68(%rsp)
jmp 0x1cdf5
movq 0x68(%rsp), %rdi
leaq 0xf7e1(%rip), %rsi      # 0x2c5e2
callq 0x43c0
movq %rax, 0x60(%rsp)
jmp 0x1ce0d
movq 0x60(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x1c0(%rax), %esi
callq 0x44c0
movq %rax, 0x58(%rsp)
jmp 0x1ce2c
movq 0x58(%rsp), %rdi
leaq 0xf7b7(%rip), %rsi      # 0x2c5ef
callq 0x43c0
movq %rax, 0x50(%rsp)
jmp 0x1ce44
movq 0x50(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x1cc(%rax), %esi
callq 0x44c0
movq %rax, 0x48(%rsp)
jmp 0x1ce63
movq 0x48(%rsp), %rdi
leaq 0x10355(%rip), %rsi     # 0x2d1c4
callq 0x43c0
movq %rax, 0x40(%rsp)
jmp 0x1ce7b
movq 0x40(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x1c4(%rax), %esi
callq 0x44c0
movq %rax, 0x38(%rsp)
jmp 0x1ce9a
movq 0x38(%rsp), %rdi
leaq 0xf762(%rip), %rsi      # 0x2c608
callq 0x43c0
movq %rax, 0x30(%rsp)
jmp 0x1ceb2
movq 0x30(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x1c8(%rax), %esi
shrl $0x8, %esi
callq 0x44c0
movq %rax, 0x28(%rsp)
jmp 0x1ced4
movq 0x28(%rsp), %rdi
movq 0x1a0b0(%rip), %rsi     # 0x36f90
callq 0x4400
movq %rax, 0x20(%rsp)
jmp 0x1ceec
movq 0x20(%rsp), %rdi
leaq 0xf727(%rip), %rsi      # 0x2c61f
callq 0x43c0
movq %rax, 0x18(%rsp)
jmp 0x1cf04
movq 0x18(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0x1d8(%rax), %rsi
callq 0x40f0
movq %rax, 0x10(%rsp)
jmp 0x1cf24
movq 0x10(%rsp), %rdi
leaq 0xf6fe(%rip), %rsi      # 0x2c62e
callq 0x43c0
movq %rax, 0x8(%rsp)
jmp 0x1cf3c
movq 0x8(%rsp), %rdi
movq 0x80(%rsp), %rax
movl 0x2185c(%rax), %esi
callq 0x4660
movq %rax, (%rsp)
jmp 0x1cf5a
movq (%rsp), %rdi
movq 0x1a02b(%rip), %rsi     # 0x36f90
callq 0x4400
jmp 0x1cf6c
movq 0x80(%rsp), %rdi
xorl %esi, %esi
callq 0x1cb70
jmp 0x1cf7d
movq 0x80(%rsp), %rdi
movl $0x1, %esi
callq 0x1cb70
jmp 0x1cf91
jmp 0x1cf93
movq 0x80(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x20110
cmpq $0x0, %rax
jbe 0x1cfc3
movq 0x80(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x20140
jmp 0x1cf93
movq 0x80(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x20100
movq 0x80(%rsp), %rdi
addq $0x8, %rdi
callq 0x25630
addq $0x98, %rsp
retq
movq %rax, %rdi
callq 0x117c0
nopl (%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::phase(unsigned int)
const ppu::ppu_phase ppu::phase(const unsigned int cycle) {
    int odd_diff = ((frame % 2 == 0)?0:1);
    ppu_phase choice = DUNNO;

    if(!control1.bits.show_bg && !control1.bits.show_sprites) choice = DISABLED; //DISABLED
    else if(cycle < (unsigned int)(VINT_LINES * CLK_PER_LINE)) choice = VINT; //VINT
    else if(cycle < (unsigned int)((VINT_LINES + PRE_RENDER_LINES) * CLK_PER_LINE - odd_diff)) choice = PRE_RENDER; //PRE_RENDER
    else if(cycle < (unsigned int)((VINT_LINES + PRE_RENDER_LINES + RENDER_LINES) * CLK_PER_LINE) - odd_diff) choice = RENDER; //RENDER
    else if(cycle < (unsigned int)((VINT_LINES + PRE_RENDER_LINES + RENDER_LINES + POST_RENDER_LINES) * CLK_PER_LINE) - odd_diff) choice = POST_RENDER; //POST_RENDER
    return choice;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x20(%rsp)
movl 0x2185c(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x20(%rsp), %rax
movl %edx, %esi
movl $0x1, %ecx
xorl %edx, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
movl %ecx, -0x10(%rsp)
movl $0x0, -0x14(%rsp)
movb 0x21854(%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1dcf6
movq -0x20(%rsp), %rax
movb 0x21854(%rax), %al
shrb $0x4, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1dcf6
movl $0x5, -0x14(%rsp)
jmp 0x1dd61
cmpl $0x1aa4, -0xc(%rsp)     # imm = 0x1AA4
jae 0x1dd0a
movl $0x1, -0x14(%rsp)
jmp 0x1dd5f
movl -0xc(%rsp), %eax
movl $0x1bf9, %ecx           # imm = 0x1BF9
subl -0x10(%rsp), %ecx
cmpl %ecx, %eax
jae 0x1dd25
movl $0x2, -0x14(%rsp)
jmp 0x1dd5d
movl -0xc(%rsp), %eax
movl $0x15ba9, %ecx          # imm = 0x15BA9
subl -0x10(%rsp), %ecx
cmpl %ecx, %eax
jae 0x1dd40
movl $0x3, -0x14(%rsp)
jmp 0x1dd5b
movl -0xc(%rsp), %eax
movl $0x15cfe, %ecx          # imm = 0x15CFE
subl -0x10(%rsp), %ecx
cmpl %ecx, %eax
jae 0x1dd59
movl $0x4, -0x14(%rsp)
jmp 0x1dd5b
jmp 0x1dd5d
jmp 0x1dd5f
jmp 0x1dd61
movl -0x14(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::overflow_cycle(unsigned int)
unsigned int ppu::overflow_cycle(unsigned int cycle) {
    if(recalc_overflow) {
        int lines[240] = {0};
        spr_overflow_cycle = 0;
        for(int sprite = 0; sprite < 64; ++sprite) { //For each sprite...
            //Increment sprite count for each line that the sprite is visible on
            for(int y = sprites[sprite].y; (y < sprites[sprite].y + 8 + (control0.big_sprites * 8)) && y < 240; ++y)
                ++lines[y];
        }
        for(int line = 0; line < 240; ++line) {
            if(lines[line] > 8) {
                spr_overflow_cycle = line * CLK_PER_LINE;
                break;
            }
        }
        //if no overflow found, set the overflow value out of range (ie no overflow occurs)
        if(spr_overflow_cycle == 0) spr_overflow_cycle = -1;
        recalc_overflow = false;
    }
    return spr_overflow_cycle;
}

// Assembly:
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rdi, 0x3f0(%rsp)
movl %esi, 0x3ec(%rsp)
movq 0x3f0(%rsp), %rax
movq %rax, 0x8(%rsp)
testb $0x1, 0x6d4(%rax)
je 0x1e3ab
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x3c0, %edx            # imm = 0x3C0
callq 0x4210
movq 0x8(%rsp), %rax
movl $0x0, 0x6cc(%rax)
movl $0x0, 0x1c(%rsp)
cmpl $0x40, 0x1c(%rsp)
jge 0x1e340
movq 0x8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl 0x208(%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, 0x18(%rsp)
movq 0x8(%rsp), %rax
movl 0x18(%rsp), %ecx
movslq 0x1c(%rsp), %rdx
movl 0x208(%rax,%rdx,4), %edx
andl $0xff, %edx
addl $0x8, %edx
movb 0x21850(%rax), %al
shrb $0x5, %al
andb $0x1, %al
movzbl %al, %eax
shll $0x3, %eax
addl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x7(%rsp)
jge 0x1e307
cmpl $0xf0, 0x18(%rsp)
setl %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x1e311
jmp 0x1e32e
movslq 0x18(%rsp), %rax
movl 0x20(%rsp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rsp,%rax,4)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x1e2bd
jmp 0x1e330
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1e298
movl $0x0, 0x14(%rsp)
cmpl $0xf0, 0x14(%rsp)
jge 0x1e382
movslq 0x14(%rsp), %rax
cmpl $0x8, 0x20(%rsp,%rax,4)
jle 0x1e373
movq 0x8(%rsp), %rax
imull $0x155, 0x14(%rsp), %ecx # imm = 0x155
movl %ecx, 0x6cc(%rax)
jmp 0x1e382
jmp 0x1e375
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1e348
movq 0x8(%rsp), %rax
cmpl $0x0, 0x6cc(%rax)
jne 0x1e39f
movq 0x8(%rsp), %rax
movl $0xffffffff, 0x6cc(%rax) # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rax
movb $0x0, 0x6d4(%rax)
movq 0x8(%rsp), %rax
movl 0x6cc(%rax), %eax
addq $0x3f8, %rsp            # imm = 0x3F8
retq
nop
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::set_scroll(int, int, int, int)
void ppu::set_scroll(int rx, int ry, int mod_col, int mod_row) {
    if(scroll_shifts.size() == 0 && rx != init_scroll_x) {
        //cout<<"First: Shifting scroll to "<<rx<<" at line "<<mod_row<<", frame "<<frame<<" (isx="<<init_scroll_x<<", size="<<scroll_shifts.size()<<")"<<endl;
        scroll_shifts.push_back(std::make_pair(rx,mod_row));
    }
    else if(scroll_shifts.size() > 0 && rx != scroll_shifts.back().first) {
        //cout<<"C1: "<<(scroll_shifts.size() == 0)<<" C2: "<<(rx!=init_scroll_x)<<endl;
        //cout<<"Second: Shifting scroll to "<<rx<<" at line "<<mod_row<<", frame "<<frame<<" (isx="<<init_scroll_x<<", size="<<scroll_shifts.size()<<")"<<endl;
        scroll_shifts.push_back(std::make_pair(rx,mod_row));
    }
    else {
        //cout<<"Filtering this scroll."<<endl;
        return;
    }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movl %ecx, 0x34(%rsp)
movl %r8d, 0x30(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x18(%rsp)
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x20110
cmpq $0x0, %rax
jne 0x1e46c
movq 0x18(%rsp), %rcx
movl 0x3c(%rsp), %eax
cmpl 0x1e8(%rcx), %eax
je 0x1e46c
movq 0x18(%rsp), %rax
addq $0x1f0, %rax            # imm = 0x1F0
movq %rax, 0x10(%rsp)
leaq 0x3c(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x201e0
movq 0x10(%rsp), %rdi
movq %rax, 0x28(%rsp)
leaq 0x28(%rsp), %rsi
callq 0x201a0
jmp 0x1e4de
movq 0x18(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x20110
cmpq $0x0, %rax
jbe 0x1e4da
movq 0x18(%rsp), %rdi
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x20210
movq %rax, %rcx
movl 0xc(%rsp), %eax
cmpl (%rcx), %eax
je 0x1e4da
movq 0x18(%rsp), %rax
addq $0x1f0, %rax            # imm = 0x1F0
movq %rax, (%rsp)
leaq 0x3c(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x201e0
movq (%rsp), %rdi
movq %rax, 0x20(%rsp)
leaq 0x20(%rsp), %rsi
callq 0x201a0
jmp 0x1e4dc
jmp 0x1e4de
jmp 0x1e4de
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::get_nt_pal(int, int, int)
int ppu::get_nt_pal(int table, int tx, int ty) {
    byte at_val;
    at_val.val = at[table][(ty/4)*8+(tx/4)];
    if(tx % 4 < 2 && ty % 4 < 2) return at_val.pairs.first;
    else if(tx % 4 < 2) return at_val.pairs.third;
    else if(ty % 4 < 2) return at_val.pairs.second;
    else return at_val.pairs.fourth;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movl %esi, -0x14(%rsp)
movl %edx, -0x18(%rsp)
movl %ecx, -0x1c(%rsp)
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movq 0x1710(%rax,%rcx,8), %rax
movq %rax, -0x28(%rsp)
movl -0x1c(%rsp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
shll $0x3, %ecx
movl -0x18(%rsp), %eax
movl $0x4, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x28(%rsp), %rax
addl %edx, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x20(%rsp)
movl -0x18(%rsp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x2, %edx
jge 0x1f909
movl -0x1c(%rsp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x2, %edx
jge 0x1f909
movb -0x20(%rsp), %al
andb $0x3, %al
movzbl %al, %eax
movl %eax, -0x4(%rsp)
jmp 0x1f95d
movl -0x18(%rsp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x2, %edx
jge 0x1f92c
movb -0x20(%rsp), %al
shrb $0x4, %al
andb $0x3, %al
movzbl %al, %eax
movl %eax, -0x4(%rsp)
jmp 0x1f95d
movl -0x1c(%rsp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x2, %edx
jge 0x1f94f
movb -0x20(%rsp), %al
shrb $0x2, %al
andb $0x3, %al
movzbl %al, %eax
movl %eax, -0x4(%rsp)
jmp 0x1f95d
movb -0x20(%rsp), %al
shrb $0x6, %al
movzbl %al, %eax
movl %eax, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::get_color(int, int, int)
int ppu::get_color(int tile, int x, int y) {
    if(y >= 8 || x >= 8 || tile >= 512) {
        cout<<"Tile: "<<tile<<" ("<<x<<", "<<y<<") doesn't exist."<<endl;
        return -1;
    }
    int address = tile * 16 + y;
    int byte1 = cart.get_cbyte(address);
    int byte2 = cart.get_cbyte(address + 8);
    return ((((byte1 & (128>>(x))) > 0)?1:0) + (((byte2 & (128>>(x))) > 0)?2:0));
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movl %edx, 0x20(%rsp)
movl %ecx, 0x1c(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x8, 0x1c(%rsp)
jge 0x1f9ab
cmpl $0x8, 0x20(%rsp)
jge 0x1f9ab
cmpl $0x200, 0x24(%rsp)      # imm = 0x200
jl 0x1fa2b
movq 0x175fe(%rip), %rdi     # 0x36fb0
leaq 0xccac(%rip), %rsi      # 0x2c665
callq 0x43c0
movq %rax, %rdi
movl 0x24(%rsp), %esi
callq 0x4660
movq %rax, %rdi
leaq 0xd7f0(%rip), %rsi      # 0x2d1c4
callq 0x43c0
movq %rax, %rdi
movl 0x20(%rsp), %esi
callq 0x4660
movq %rax, %rdi
leaq 0xd7d9(%rip), %rsi      # 0x2d1c8
callq 0x43c0
movq %rax, %rdi
movl 0x1c(%rsp), %esi
callq 0x4660
movq %rax, %rdi
leaq 0xcc62(%rip), %rsi      # 0x2c66c
callq 0x43c0
movq %rax, %rdi
movq 0x17577(%rip), %rsi     # 0x36f90
callq 0x4400
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x1faad
movq 0x8(%rsp), %rax
movl 0x24(%rsp), %ecx
shll $0x4, %ecx
addl 0x1c(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movq (%rax), %rdi
movl 0x18(%rsp), %esi
callq 0x11180
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x14(%rsp)
movq (%rax), %rdi
movl 0x18(%rsp), %esi
addl $0x8, %esi
callq 0x11180
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %edx
movl 0x20(%rsp), %ecx
movl $0x80, %eax
sarl %cl, %eax
andl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovgl %ecx, %eax
movl 0x10(%rsp), %esi
movl 0x20(%rsp), %ecx
movl $0x80, %edx
sarl %cl, %edx
movl %edx, %ecx
andl %ecx, %esi
xorl %ecx, %ecx
movl $0x2, %edx
cmpl $0x0, %esi
cmovgl %edx, %ecx
addl %ecx, %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::apply_updates_to(int)
void ppu::apply_updates_to(int curcycle) {
    //If there've been any mid-screen updates, apply them at the appropriate time (accurate to 1 vertical tile-ish
    rom::ppu_change_t changes = cart.cycle_forward(curcycle - (8 * 2* CLK_PER_LINE));
    if(changes.lo_crom == 1) clear_surfaces(false);
    if(changes.hi_crom == 1) clear_surfaces(true);
    if(changes.set_horiz == 1 || changes.set_vert == 1 || changes.set_4_scr == 1) set_mirror(cart.get_mode());
    if(changes.set_bg0 == 1) control0.bg_table = 0;
    if(changes.set_bg1 == 1) control0.bg_table = 1;
    if(changes.set_spr0 == 1) control0.sprite_table = 0;
    if(changes.set_spr1 == 1) control0.sprite_table = 1;
    int mode_count = changes.set_horiz + changes.set_vert + changes.set_4_scr;
    if(mode_count > 1) cout<<"Multiple mirroring modes set during one vertical tile of time!"<<endl; 
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq (%rax), %rdi
movl 0x1c(%rsp), %esi
subl $0x1550, %esi           # imm = 0x1550
callq 0x11280
movl %eax, 0x18(%rsp)
movw 0x18(%rsp), %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fb0a
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x1cb70
movw 0x18(%rsp), %ax
shrw %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fb2d
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x1cb70
movw 0x18(%rsp), %ax
shrw $0x2, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
je 0x1fb6c
movw 0x18(%rsp), %ax
shrw $0x3, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
je 0x1fb6c
movw 0x18(%rsp), %ax
shrw $0x4, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fb85
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x11100
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x1c910
movw 0x18(%rsp), %ax
shrw $0x5, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fbb1
movq 0x8(%rsp), %rax
movb 0x21850(%rax), %cl
andb $-0x11, %cl
orb $0x0, %cl
movb %cl, 0x21850(%rax)
movw 0x18(%rsp), %ax
shrw $0x6, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fbdd
movq 0x8(%rsp), %rax
movb 0x21850(%rax), %cl
andb $-0x11, %cl
orb $0x10, %cl
movb %cl, 0x21850(%rax)
movw 0x18(%rsp), %ax
shrw $0x7, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fc09
movq 0x8(%rsp), %rax
movb 0x21850(%rax), %cl
andb $-0x9, %cl
orb $0x0, %cl
movb %cl, 0x21850(%rax)
movw 0x18(%rsp), %ax
shrw $0x8, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x1fc35
movq 0x8(%rsp), %rax
movb 0x21850(%rax), %cl
andb $-0x9, %cl
orb $0x8, %cl
movb %cl, 0x21850(%rax)
movw 0x18(%rsp), %ax
shrw $0x2, %ax
andw $0x1, %ax
movzwl %ax, %eax
movw 0x18(%rsp), %cx
shrw $0x3, %cx
andw $0x1, %cx
movzwl %cx, %ecx
addl %ecx, %eax
movw 0x18(%rsp), %cx
shrw $0x4, %cx
andw $0x1, %cx
movzwl %cx, %ecx
addl %ecx, %eax
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
jle 0x1fc96
movq 0x17335(%rip), %rdi     # 0x36fb0
leaq 0xca38(%rip), %rsi      # 0x2c6ba
callq 0x43c0
movq %rax, %rdi
movq 0x172ff(%rip), %rsi     # 0x36f90
callq 0x4400
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::toggle_table_view()
void ppu::toggle_table_view() {
    table_view = !table_view;
    if(table_view)
        cout<<"Turn on table view"<<endl;
    else
        cout<<"Turn off table view"<<endl;
    screen.table_view(table_view);
    
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movb 0x21860(%rax), %cl
xorb $-0x1, %cl
andb $0x1, %cl
movb %cl, 0x21860(%rax)
testb $0x1, 0x21860(%rax)
je 0x1fd42
movq 0x1728b(%rip), %rdi     # 0x36fb0
leaq 0xc967(%rip), %rsi      # 0x2c693
callq 0x43c0
movq %rax, %rdi
movq 0x17255(%rip), %rsi     # 0x36f90
callq 0x4400
jmp 0x1fd64
movq 0x17267(%rip), %rdi     # 0x36fb0
leaq 0xc956(%rip), %rsi      # 0x2c6a6
callq 0x43c0
movq %rax, %rdi
movq 0x17231(%rip), %rsi     # 0x36f90
callq 0x4400
movq 0x8(%rsp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movb 0x21860(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x25fa0
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/ppu3.cpp
// Function: ppu::print_name_table()
void ppu::print_name_table() {
    bool vars[256] = {false};
    for(int big_y=0;big_y<1;++big_y) {
        for(int tile_y=0;tile_y<32;++tile_y) {
            for(int big_x=0;big_x<1;++big_x) {
                for(int tile_x=0;tile_x<32;++tile_x) {
                    printf("%02x ", name_table[tile_x+32*tile_y+1024*big_x+2048*big_y]);
                    if(tile_y < 30) {
                        vars[name_table[tile_x+32*tile_y+1024*big_x+2048*big_y]] = true;
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    printf("Contains these values: ");
    for(int i=0;i<256;++i) if(vars[i]) printf("%02x ", i);
    printf("\n");
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movq 0x120(%rsp), %rax
movq %rax, (%rsp)
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x4210
movl $0x0, 0x1c(%rsp)
cmpl $0x1, 0x1c(%rsp)
jge 0x1ff7e
movl $0x0, 0x18(%rsp)
cmpl $0x20, 0x18(%rsp)
jge 0x1ff60
movl $0x0, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
jge 0x1ff42
movl $0x0, 0x10(%rsp)
cmpl $0x20, 0x10(%rsp)
jge 0x1ff30
movq (%rsp), %rax
movl 0x10(%rsp), %ecx
movl 0x18(%rsp), %edx
shll $0x5, %edx
addl %edx, %ecx
movl 0x14(%rsp), %edx
shll $0xa, %edx
addl %edx, %ecx
movl 0x1c(%rsp), %edx
shll $0xb, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movzbl 0x6ec(%rax,%rcx), %esi
leaq 0xb5c2(%rip), %rdi      # 0x2b49f
movb $0x0, %al
callq 0x4050
cmpl $0x1e, 0x18(%rsp)
jge 0x1ff1e
movq (%rsp), %rax
movl 0x10(%rsp), %ecx
movl 0x18(%rsp), %edx
shll $0x5, %edx
addl %edx, %ecx
movl 0x14(%rsp), %edx
shll $0xa, %edx
addl %edx, %ecx
movl 0x1c(%rsp), %edx
shll $0xb, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movzbl 0x6ec(%rax,%rcx), %eax
movb $0x1, 0x20(%rsp,%rax)
jmp 0x1ff20
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x1fe9d
jmp 0x1ff32
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1fe8a
leaq 0xbbae(%rip), %rdi      # 0x2baf7
movb $0x0, %al
callq 0x4050
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x1fe77
leaq 0xbb90(%rip), %rdi      # 0x2baf7
movb $0x0, %al
callq 0x4050
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1fe64
leaq 0xc774(%rip), %rdi      # 0x2c6f9
movb $0x0, %al
callq 0x4050
movl $0x0, 0xc(%rsp)
cmpl $0x100, 0xc(%rsp)       # imm = 0x100
jge 0x1ffcb
movslq 0xc(%rsp), %rax
testb $0x1, 0x20(%rsp,%rax)
je 0x1ffbc
movl 0xc(%rsp), %esi
leaq 0xb4ea(%rip), %rdi      # 0x2b49f
movb $0x0, %al
callq 0x4050
jmp 0x1ffbe
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1ff94
leaq 0xbb25(%rip), %rdi      # 0x2baf7
movb $0x0, %al
callq 0x4050
addq $0x128, %rsp            # imm = 0x128
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: khedoros[P]khednes/util.cpp
// Function: util::toggle_log(int)
void util::toggle_log(int origin) {
    if(!init) {
        for(int i=0;i<1000;++i) active[i] = false;
        init=true;
    }
    active[origin]=!(active[origin]);
    switch(origin) {
    case 1:
        printf("1 (CPU)");
        break;
    case 2:
        printf("2 (MAIN)");
        break;
    case 3:
        printf("3 (MEM)");
        break;
    case 4:
        printf("4 (PPU)");
        break;
    case 5:
        printf("5 (ROM)");
        break;
    case 6:
        printf("6 (UTIL)");
        break;
    case 7:
        printf("7 (WAV)");
        break;
    case 8:
        printf("8 (APU)");
        break;
    }
}

// Assembly:
subq $0x68, %rsp
movl %edi, 0x64(%rsp)
testb $0x1, 0x16891(%rip)     # 0x374a0
jne 0x20c63
movl $0x0, 0x60(%rsp)
cmpl $0x3e8, 0x60(%rsp)      # imm = 0x3E8
jge 0x20c5c
movslq 0x60(%rsp), %rdx
leaq 0x50(%rsp), %rdi
leaq 0x16874(%rip), %rsi     # 0x374a8
callq 0x21f90
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x21fd0
leaq 0x50(%rsp), %rdi
callq 0x22040
movl 0x60(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x60(%rsp)
jmp 0x20c19
movb $0x1, 0x1683d(%rip)     # 0x374a0
movslq 0x64(%rsp), %rdx
leaq 0x16839(%rip), %rsi     # 0x374a8
movq %rsi, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x21f90
movq 0x10(%rsp), %rdi
callq 0x22050
movq 0x18(%rsp), %rsi
xorb $0x1, %al
movb %al, 0x23(%rsp)
movslq 0x64(%rsp), %rdx
leaq 0x30(%rsp), %rdi
callq 0x21f90
jmp 0x20ca9
movb 0x23(%rsp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq 0x30(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x21fd0
movq (%rsp), %rdi
callq 0x22040
leaq 0x40(%rsp), %rdi
callq 0x22040
movl 0x64(%rsp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
subl $0x7, %eax
ja 0x20d9a
movq 0x8(%rsp), %rax
leaq 0xba3a(%rip), %rcx      # 0x2c730
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x22040
jmp 0x20d9f
leaq 0xbe8d(%rip), %rdi      # 0x2cbb0
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe85(%rip), %rdi      # 0x2cbb8
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe7e(%rip), %rdi      # 0x2cbc1
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe76(%rip), %rdi      # 0x2cbc9
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe6e(%rip), %rdi      # 0x2cbd1
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe66(%rip), %rdi      # 0x2cbd9
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe5f(%rip), %rdi      # 0x2cbe2
movb $0x0, %al
callq 0x4050
jmp 0x20d9a
leaq 0xbe57(%rip), %rdi      # 0x2cbea
movb $0x0, %al
callq 0x4050
addq $0x68, %rsp
retq
movq 0x28(%rsp), %rdi
callq 0x4680
nopl (%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: my_callback(void*, unsigned char*, int)
void my_callback(void * ud, Uint8 * stream, int len) {
    //cout<<"Actual callback size: "<<len<<endl;
    userdata * dat = (userdata *)(ud);
    //dat->first = !(dat->first);
    //Copy the audio data
    //cout<<"Read: Index: "<<(dat->apui->buffer_read_pos)<<" Samples: "<<(len*(dat->apui->buffer_read_pos))<<" -> "<<(len*(dat->apui->buffer_read_pos+1))<<" len: "<<len<<endl;
    memcpy(stream, &dat->buffer[len*(dat->apui->buffer_read_pos)], len);
    if(dat->buffered >= len) {
        dat->buffered -= len;
        dat->apui->buffer_read_pos++;
        dat->apui->buffer_read_pos%=dat->apui->SAMPLES_PER_FRAME;
        //cout<<"Consume "<<len<<endl;
    }
    else {
        cout<<"Underbuffered by "<<len - dat->buffered<<" bytes!"<<endl;
        //memset(stream + dat->buffered, 0, len - dat->buffered);
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rsi
movslq 0x14(%rsp), %rax
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
imulq 0x10(%rcx), %rax
addq %rax, %rsi
movslq 0x14(%rsp), %rdx
callq 0x4330
movq 0x8(%rsp), %rax
movl 0x14(%rax), %eax
cmpl 0x14(%rsp), %eax
jl 0x222a2
movl 0x14(%rsp), %edx
movq 0x8(%rsp), %rax
movl 0x14(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x14(%rax)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
movq 0x10(%rax), %rax
movl $0x2df, %ecx            # imm = 0x2DF
xorl %edx, %edx
divq %rcx
movq (%rsp), %rax
movq %rdx, 0x10(%rax)
jmp 0x222e7
movq 0x14d07(%rip), %rdi     # 0x36fb0
leaq 0xabb8(%rip), %rsi      # 0x2ce68
callq 0x43c0
movq %rax, %rdi
movl 0x14(%rsp), %esi
movq 0x8(%rsp), %rax
subl 0x14(%rax), %esi
callq 0x4660
movq %rax, %rdi
leaq 0xaba7(%rip), %rsi      # 0x2ce7a
callq 0x43c0
movq %rax, %rdi
movq 0x14cae(%rip), %rsi     # 0x36f90
callq 0x4400
addq $0x28, %rsp
retq
nopl (%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::clock_quarter()
void apu::clock_quarter() {
    if(enable_linear_cntr && linear_cntr > 0) --linear_cntr;

    //Envelope decay and looping
    for(uint8_t voice = 0; voice < 4; ++voice) {
        if(voice == TRI) continue;
        if(enabled[voice] && enable_decay[voice] && length[voice] > 0) {
            if(decay_count[voice] == 0) {
                --decay_vol_lvl[voice];
                if(decay_vol_lvl[voice] > 15 && loop_decay[voice]) {
                    decay_vol_lvl[voice] = 15;
                }
                else if(decay_vol_lvl[voice] > 15) {
                    decay_vol_lvl[voice] = 0;
                    //enabled[voice] = false;
                    length[voice] = 0;
                }
                else {
                    decay_count[voice] = vol[voice];
                }
                //cout<<"Voice: "<<int(voice)<<" new vol: "<<decay_vol_lvl[voice]<<endl;
            }
            else {
                --decay_count[voice];
            }
        }
    }
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x18(%rsp)
testb $0x1, 0x11c(%rax)
je 0x2303a
movq -0x18(%rsp), %rax
cmpl $0x0, 0x118(%rax)
jbe 0x2303a
movq -0x18(%rsp), %rax
movl 0x118(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x118(%rax)
movb $0x0, -0x9(%rsp)
movzbl -0x9(%rsp), %eax
cmpl $0x4, %eax
jge 0x2319b
movzbl -0x9(%rsp), %eax
cmpl $0x2, %eax
jne 0x2305c
jmp 0x2318c
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
testb $0x1, 0xb4(%rax,%rcx)
je 0x2318a
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
testb $0x1, 0xe4(%rax,%rcx)
je 0x2318a
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
cmpl $0x0, 0x174(%rax,%rcx,4)
jle 0x2318a
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
cmpl $0x0, 0xd0(%rax,%rcx,4)
jne 0x2316d
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
movl 0xf0(%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, 0xf0(%rax,%rcx,4)
movzbl -0x9(%rsp), %ecx
cmpl $0xf, 0xf0(%rax,%rcx,4)
jbe 0x23111
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
testb $0x1, 0xe9(%rax,%rcx)
je 0x23111
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
movl $0xf, 0xf0(%rax,%rcx,4)
jmp 0x2316b
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
cmpl $0xf, 0xf0(%rax,%rcx,4)
jbe 0x2314c
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
movl $0x0, 0xf0(%rax,%rcx,4)
movzbl -0x9(%rsp), %ecx
movl $0x0, 0x174(%rax,%rcx,4)
jmp 0x23169
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
movl 0xbc(%rax,%rcx,4), %edx
movzbl -0x9(%rsp), %ecx
movl %edx, 0xd0(%rax,%rcx,4)
jmp 0x2316b
jmp 0x23188
movq -0x18(%rsp), %rax
movzbl -0x9(%rsp), %ecx
movl 0xd0(%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, 0xd0(%rax,%rcx,4)
jmp 0x2318a
jmp 0x2318c
movb -0x9(%rsp), %al
addb $0x1, %al
movb %al, -0x9(%rsp)
jmp 0x2303f
retq
nopl (%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::read_status()
int  apu::read_status() {
    status_reg a;
    a.sq1_on = (length[SQ1] > 0);
    a.sq2_on = (length[SQ2] > 0);
    a.tri_on = (length[TRI] > 0);
    a.noise_on = (length[NOISE] > 0);
    a.dmc_on = (length[DMC] > 0);
    return a.val;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
cmpl $0x0, 0x174(%rax)
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
movb %cl, %dl
movb -0xc(%rsp), %cl
andb $0x1, %dl
andb $-0x2, %cl
orb %dl, %cl
movb %cl, -0xc(%rsp)
cmpl $0x0, 0x178(%rax)
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
movb %cl, %dl
movb -0xc(%rsp), %cl
andb $0x1, %dl
shlb %dl
andb $-0x3, %cl
orb %dl, %cl
movb %cl, -0xc(%rsp)
cmpl $0x0, 0x17c(%rax)
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
movb %cl, %dl
movb -0xc(%rsp), %cl
andb $0x1, %dl
shlb $0x2, %dl
andb $-0x5, %cl
orb %dl, %cl
movb %cl, -0xc(%rsp)
cmpl $0x0, 0x180(%rax)
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
movb %cl, %dl
movb -0xc(%rsp), %cl
andb $0x1, %dl
shlb $0x3, %dl
andb $-0x9, %cl
orb %dl, %cl
movb %cl, -0xc(%rsp)
cmpl $0x0, 0x184(%rax)
setg %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movb -0xc(%rsp), %al
andb $0x1, %cl
shlb $0x4, %cl
andb $-0x11, %al
orb %cl, %al
movb %al, -0xc(%rsp)
movzbl -0xc(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::play_length(freq_len_reg)
const int apu::play_length(freq_len_reg val) {
    if(!(val.bit3 || val.bit7))
        return pal_len_table[val.mid];
    else if(!val.bit3 && val.bit7)
        return ntsc_len_table[val.mid];
    else
        return general_len_table[val.mid + val.bit7*128];
}

// Assembly:
movl %edi, -0x8(%rsp)
movw -0x8(%rsp), %ax
shrw $0xb, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x244ef
movw -0x8(%rsp), %ax
shrw $0xf, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x244ef
movw -0x8(%rsp), %ax
shrw $0xc, %ax
andw $0x7, %ax
movzwl %ax, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x2507b(%rip), %rax     # 0x49560
movzbl (%rax,%rcx), %eax
movl %eax, -0x4(%rsp)
jmp 0x2456d
movw -0x8(%rsp), %ax
shrw $0xb, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x2453a
movw -0x8(%rsp), %ax
shrw $0xf, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x2453a
movw -0x8(%rsp), %ax
shrw $0xc, %ax
andw $0x7, %ax
movzwl %ax, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25038(%rip), %rax     # 0x49568
movzbl (%rax,%rcx), %eax
movl %eax, -0x4(%rsp)
jmp 0x2456d
movw -0x8(%rsp), %ax
shrw $0xc, %ax
andw $0x7, %ax
movzwl %ax, %eax
movw -0x8(%rsp), %cx
shrw $0xf, %cx
movzwl %cx, %ecx
shll $0x7, %ecx
addl %ecx, %eax
movslq %eax, %rcx
leaq 0x2500b(%rip), %rax     # 0x49570
movzbl (%rax,%rcx), %eax
movl %eax, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::clock_duty(int)
void apu::clock_duty(int voice) {
    wavelength_count[voice] = wavelength_count_reset[voice];
    if(voice != NOISE)
        ++wave_pos[voice];
    switch(voice) {
        case SQ1:
        case SQ2:
            wave_pos[voice] %= SQ_LEN;
            break;
        case TRI:
            wave_pos[voice] %= TRI_LEN;
            break;
        case NOISE:
            if(noise_flip_flop) ++wave_pos[voice];
            noise_flip_flop = !noise_flip_flop;
            wave_pos[voice] %= NOISE_LEN[duty_cycle[voice]];
            break;
    }
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x18(%rsp)
movslq -0xc(%rsp), %rcx
movl 0x188(%rax,%rcx,4), %edx
movslq -0xc(%rsp), %rcx
movl %edx, 0x19c(%rax,%rcx,4)
cmpl $0x3, -0xc(%rsp)
je 0x245cd
movq -0x18(%rsp), %rax
movslq -0xc(%rsp), %rcx
movl 0x1b0(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x1b0(%rax,%rcx,4)
movl -0xc(%rsp), %eax
movl %eax, -0x1c(%rsp)
subl $0x2, %eax
jb 0x245f5
jmp 0x245dc
movl -0x1c(%rsp), %eax
subl $0x2, %eax
je 0x2461f
jmp 0x245e7
movl -0x1c(%rsp), %eax
subl $0x3, %eax
je 0x24646
jmp 0x246ba
movq -0x18(%rsp), %rax
movslq -0xc(%rsp), %rcx
movl 0x1b0(%rax,%rcx,4), %eax
movl $0x10, %esi
cltd
idivl %esi
movq -0x18(%rsp), %rax
movl %edx, 0x1b0(%rax,%rcx,4)
jmp 0x246ba
movq -0x18(%rsp), %rax
movslq -0xc(%rsp), %rcx
movl 0x1b0(%rax,%rcx,4), %eax
movl $0x20, %esi
cltd
idivl %esi
movq -0x18(%rsp), %rax
movl %edx, 0x1b0(%rax,%rcx,4)
jmp 0x246ba
movq -0x18(%rsp), %rax
testb $0x1, 0x1cc(%rax)
je 0x2466f
movq -0x18(%rsp), %rax
movslq -0xc(%rsp), %rcx
movl 0x1b0(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x1b0(%rax,%rcx,4)
movq -0x18(%rsp), %rax
movb 0x1cc(%rax), %cl
xorb $-0x1, %cl
andb $0x1, %cl
movb %cl, 0x1cc(%rax)
movslq -0xc(%rsp), %rcx
movl 0x104(%rax,%rcx,4), %ecx
movl %ecx, %edx
leaq 0x24f45(%rip), %rcx     # 0x495e0
movzwl (%rcx,%rdx,2), %esi
movslq -0xc(%rsp), %rcx
movl 0x1b0(%rax,%rcx,4), %eax
cltd
idivl %esi
movq -0x18(%rsp), %rax
movl %edx, 0x1b0(%rax,%rcx,4)
retq
nopl (%rax,%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::sq1_duty()
const int apu::sq1_duty() {
    int retval = 0;
    if(enable_decay[SQ1]) retval = SQ_STATES[duty_cycle[SQ1]][wave_pos[SQ1]] * decay_vol_lvl[SQ1];
    else                  retval = SQ_STATES[duty_cycle[SQ1]][wave_pos[SQ1]] * vol[SQ1];
    //cout<<"wave_pos[SQ1]: "<<wave_pos[SQ1]<<" vol: "<<retval<<endl;
    //if(retval > 15) cout<<"SQ1 decay: "<<enable_decay[SQ1]<<" vol: "<<retval<<endl;
    return retval;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x18(%rsp)
movl $0x0, -0xc(%rsp)
testb $0x1, 0xe4(%rax)
je 0x24713
movq -0x18(%rsp), %rcx
movl 0x104(%rcx), %eax
movl %eax, %edx
leaq 0x24eac(%rip), %rax     # 0x495a0
shlq $0x4, %rdx
addq %rdx, %rax
movslq 0x1b0(%rcx), %rdx
movzbl (%rax,%rdx), %eax
imull 0xf0(%rcx), %eax
movl %eax, -0xc(%rsp)
jmp 0x24744
movq -0x18(%rsp), %rcx
movl 0x104(%rcx), %eax
movl %eax, %edx
leaq 0x24e79(%rip), %rax     # 0x495a0
shlq $0x4, %rdx
addq %rdx, %rax
movslq 0x1b0(%rcx), %rdx
movzbl (%rax,%rdx), %eax
imull 0xbc(%rcx), %eax
movl %eax, -0xc(%rsp)
movl -0xc(%rsp), %eax
retq
nopl (%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::sq2_duty()
const int apu::sq2_duty() {
    int retval = 0;
    if(enable_decay[SQ2]) retval = SQ_STATES[duty_cycle[SQ2]][wave_pos[SQ2]] * decay_vol_lvl[SQ2];
    else                  retval = SQ_STATES[duty_cycle[SQ2]][wave_pos[SQ2]] * vol[SQ2];
    //cout<<"wave_pos[SQ2]: "<<wave_pos[SQ2]<<" vol: "<<retval<<endl;
    //if(retval > 15) cout<<"SQ2 decay: "<<enable_decay[SQ2]<<" vol: "<<retval<<endl;
    return retval;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x18(%rsp)
movl $0x0, -0xc(%rsp)
testb $0x1, 0xe5(%rax)
je 0x247a3
movq -0x18(%rsp), %rcx
movl 0x108(%rcx), %eax
movl %eax, %edx
leaq 0x24e1c(%rip), %rax     # 0x495a0
shlq $0x4, %rdx
addq %rdx, %rax
movslq 0x1b4(%rcx), %rdx
movzbl (%rax,%rdx), %eax
imull 0xf4(%rcx), %eax
movl %eax, -0xc(%rsp)
jmp 0x247d4
movq -0x18(%rsp), %rcx
movl 0x108(%rcx), %eax
movl %eax, %edx
leaq 0x24de9(%rip), %rax     # 0x495a0
shlq $0x4, %rdx
addq %rdx, %rax
movslq 0x1b4(%rcx), %rdx
movzbl (%rax,%rdx), %eax
imull 0xc0(%rcx), %eax
movl %eax, -0xc(%rsp)
movl -0xc(%rsp), %eax
retq
nopl (%rax)
// File: khedoros[P]khednes/apu.cpp
// Function: apu::noise_duty()
const int apu::noise_duty() {
    int retval = 0;
    if(enable_decay[NOISE]) retval = noise_states[duty_cycle[NOISE]][wave_pos[NOISE]] * decay_vol_lvl[NOISE];
    else                    retval = noise_states[duty_cycle[NOISE]][wave_pos[NOISE]] * vol[NOISE];
    //cout<<"wave_pos[NOISE]: "<<wave_pos[NOISE]<<endl;
    return ((retval*3)/4);
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x18(%rsp)
movl $0x0, -0xc(%rsp)
testb $0x1, 0xe7(%rax)
je 0x24866
movq -0x18(%rsp), %rcx
movl 0x110(%rcx), %eax
movl %eax, %edx
leaq 0x14cfc(%rip), %rax     # 0x39540
imulq $0x7fff, %rdx, %rdx     # imm = 0x7FFF
addq %rdx, %rax
movslq 0x1bc(%rcx), %rdx
movzbl (%rax,%rdx), %eax
imull 0xfc(%rcx), %eax
movl %eax, -0xc(%rsp)
jmp 0x2489a
movq -0x18(%rsp), %rcx
movl 0x110(%rcx), %eax
movl %eax, %edx
leaq 0x14cc6(%rip), %rax     # 0x39540
imulq $0x7fff, %rdx, %rdx     # imm = 0x7FFF
addq %rdx, %rax
movslq 0x1bc(%rcx), %rdx
movzbl (%rax,%rdx), %eax
imull 0xc8(%rcx), %eax
movl %eax, -0xc(%rsp)
imull $0x3, -0xc(%rsp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
retq
nopl (%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::fill(int, SDL_Surface*)
void compositor::fill(int color, SDL_Surface * buff/*=buffer*/) {
    if(!buffer) return;

    if(!buff) buff = buffer;
    SDL_Rect all;
    all.x=0; all.y=0; all.w=1024; all.h=1024;
    SDL_FillRect(buff,&all,color);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x10(%rax)
jne 0x25a45
jmp 0x25a8e
cmpq $0x0, 0x20(%rsp)
jne 0x25a5b
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x400, 0x18(%rsp)      # imm = 0x400
movl $0x400, 0x1c(%rsp)      # imm = 0x400
movq 0x20(%rsp), %rdi
movl 0x2c(%rsp), %edx
leaq 0x10(%rsp), %rsi
callq 0x4070
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::get_color(int, int)
uint32_t compositor::get_color(int x,int y) {

    int wx=320;
    int wy=240;
    if(screen) {
        SDL_GetWindowSize(screen,&wx,&wy);
    }
    //cout<<"Requested ("<<x<<", "<<y<<"), current res: ("<<cur_x_res<<", "<<cur_y_res<<")"<<" window size: ("<<wx<<", "<<wy<<")"<<endl;
    if(x>=wx||y>=wy||x<0||y<0) {
        //cout<<"Requested ("<<x<<", "<<y<<"), current res: ("<<cur_x_res<<", "<<cur_y_res<<")"<<endl;
        return 0;
    }
    else {
        //cout<<"("<<x<<", "<<y;
        x = int(float(x) * (float(cur_x_res) / float(wx)));
        y = int(float(y) * (float(cur_y_res) / float(wy)));
        //cout<<") translated to ("<<x<<", "<<y<<")"<<endl;
    }

    size_t index = 0;
    if(buffer) {
        index = (y * buffer->pitch) + x;
    }

    int color_index = 1;
    if(screen) {
        color_index =  ((uint8_t *)(buffer->pixels))[index];
    }
    //                      blue                            green                                       red
    uint32_t color = palette_table[color_index *3+2] + ((palette_table[color_index * 3 + 1])<<(8)) + ((palette_table[color_index * 3])<<(16));
    return color;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movl %edx, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
movl $0x140, 0x1c(%rsp)      # imm = 0x140
movl $0xf0, 0x18(%rsp)
cmpq $0x0, (%rax)
je 0x25ae6
movq (%rsp), %rax
movq (%rax), %rdi
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x4170
movl 0x24(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jge 0x25b08
movl 0x20(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x25b08
cmpl $0x0, 0x24(%rsp)
jl 0x25b08
cmpl $0x0, 0x20(%rsp)
jge 0x25b15
movl $0x0, 0x34(%rsp)
jmp 0x25c0d
movq (%rsp), %rax
cvtsi2ssl 0x24(%rsp), %xmm0
cvtsi2ssl 0x178(%rax), %xmm1
cvtsi2ssl 0x1c(%rsp), %xmm2
divss %xmm2, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movl %ecx, 0x24(%rsp)
cvtsi2ssl 0x20(%rsp), %xmm0
cvtsi2ssl 0x17c(%rax), %xmm1
cvtsi2ssl 0x18(%rsp), %xmm2
divss %xmm2, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, 0x20(%rsp)
movq (%rsp), %rax
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x10(%rax)
je 0x25b90
movq (%rsp), %rcx
movl 0x20(%rsp), %eax
movq 0x10(%rcx), %rcx
imull 0x18(%rcx), %eax
addl 0x24(%rsp), %eax
cltq
movq %rax, 0x10(%rsp)
movq (%rsp), %rax
movl $0x1, 0xc(%rsp)
cmpq $0x0, (%rax)
je 0x25bbb
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq 0x10(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, 0xc(%rsp)
imull $0x3, 0xc(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq 0x7603(%rip), %rax      # 0x2d1d0
movl (%rax,%rcx,4), %eax
imull $0x3, 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x75ee(%rip), %rcx      # 0x2d1d0
movl (%rcx,%rdx,4), %ecx
shll $0x8, %ecx
addl %ecx, %eax
imull $0x3, 0xc(%rsp), %ecx
movslq %ecx, %rdx
leaq 0x75d7(%rip), %rcx      # 0x2d1d0
movl (%rcx,%rdx,4), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::pset(int, int, int)
void compositor::pset(int x,int y,int color) {
    if(!overlay) return;
    //cout<<"X: "<<x<<" Y: "<<y<<" Color: "<<color<<endl;
    if(x>=overlay->w||y>=overlay->h||color>=76) {
        //cout<<"X: "<<x<<" Y: "<<y<<" Color: "<<color<<endl;
        //cout<<"cur_x_res: "<<cur_x_res<<" cur_y_res: "<<cur_y_res<<endl;
        //std::cout<<"Overlay: ("<<overlay->w<<", "<<overlay->h<<")"<<endl;
        std::cout<<"Pset: out of range ("<<x<<", "<<y<<"), "<<color<<endl;
        return;
    }
    //else cout<<"Pset: ("<<x<<", "<<y<<"), "<<color<<endl;
    //else {std::cout<<"pset ("<<x<<", "<<y<<"), "<<color<<std::endl;}
    ((uint8_t *)(overlay->pixels))[y*(overlay->pitch)+x]=color;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movl %ecx, 0x14(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x20(%rax)
jne 0x25edb
jmp 0x25f95
movq 0x8(%rsp), %rcx
movl 0x1c(%rsp), %eax
movq 0x20(%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x25f06
movq 0x8(%rsp), %rcx
movl 0x18(%rsp), %eax
movq 0x20(%rcx), %rcx
cmpl 0x14(%rcx), %eax
jge 0x25f06
cmpl $0x4c, 0x14(%rsp)
jl 0x25f6c
movq 0x110a3(%rip), %rdi     # 0x36fb0
leaq 0x729e(%rip), %rsi      # 0x2d1b2
callq 0x43c0
movq %rax, %rdi
movl 0x1c(%rsp), %esi
callq 0x4660
movq %rax, %rdi
leaq 0x7299(%rip), %rsi      # 0x2d1c8
callq 0x43c0
movq %rax, %rdi
movl 0x18(%rsp), %esi
callq 0x4660
movq %rax, %rdi
leaq 0x727d(%rip), %rsi      # 0x2d1c7
callq 0x43c0
movq %rax, %rdi
movl 0x14(%rsp), %esi
callq 0x4660
movq %rax, %rdi
movq 0x1102b(%rip), %rsi     # 0x36f90
callq 0x4400
jmp 0x25f95
movq 0x8(%rsp), %rsi
movl 0x14(%rsp), %eax
movb %al, %dl
movq 0x20(%rsi), %rax
movq 0x20(%rax), %rax
movl 0x18(%rsp), %ecx
movq 0x20(%rsi), %rsi
imull 0x18(%rsi), %ecx
addl 0x1c(%rsp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::table_view(bool)
void compositor::table_view(bool active) {
    tv=active;
    if(tv) {
        resize(1024,512,false);
        base_x_res = 1024;
        base_y_res = 512;
    }
    else {
        resize(320,240,false);
        base_x_res = 320;
        base_y_res = 240;
    }
}

// Assembly:
subq $0x18, %rsp
movb %sil, %al
movq %rdi, 0x10(%rsp)
andb $0x1, %al
movb %al, 0xf(%rsp)
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movb 0xf(%rsp), %cl
andb $0x1, %cl
movb %cl, 0x188(%rax)
testb $0x1, 0x188(%rax)
je 0x26000
movq (%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x25c40
movq (%rsp), %rax
movl $0x400, 0x180(%rax)     # imm = 0x400
movl $0x200, 0x184(%rax)     # imm = 0x200
jmp 0x2602d
movq (%rsp), %rdi
movl $0x140, %esi            # imm = 0x140
movl $0xf0, %edx
xorl %ecx, %ecx
callq 0x25c40
movq (%rsp), %rax
movl $0x140, 0x180(%rax)     # imm = 0x140
movl $0xf0, 0x184(%rax)
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::blit_hps(SDL_Surface*, int, int)
void compositor::blit_hps(SDL_Surface * s, int x, int y) {
    if(!hps) return;
    SDL_Rect pos;
    pos.x = x;
    pos.y = y;
    SDL_BlitSurface(s, NULL, hps, &pos);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movl %ecx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x38(%rax)
jne 0x26099
jmp 0x260c5
movq 0x8(%rsp), %rax
movl 0x24(%rsp), %ecx
movl %ecx, 0x10(%rsp)
movl 0x20(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movq 0x28(%rsp), %rdi
movq 0x38(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq 0x10(%rsp), %rcx
callq 0x4320
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::blit_lps(SDL_Surface*, int, int)
void compositor::blit_lps(SDL_Surface * s, int x, int y) {
    if(!lps) return;
    SDL_Rect pos;
    pos.x = x;
    pos.y = y;
    SDL_BlitSurface(s, NULL, lps, &pos);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movl %ecx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x28(%rax)
jne 0x260f9
jmp 0x26125
movq 0x8(%rsp), %rax
movl 0x24(%rsp), %ecx
movl %ecx, 0x10(%rsp)
movl 0x20(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movq 0x28(%rsp), %rdi
movq 0x28(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq 0x10(%rsp), %rcx
callq 0x4320
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: khedoros[P]khednes/compositor.cpp
// Function: compositor::blit_nt(SDL_Surface*, int, int)
void compositor::blit_nt(SDL_Surface * s, int x, int y) {
    if(!nt) return;
    SDL_Rect pos;
    pos.x = x;
    pos.y = y;
    SDL_BlitSurface(s, NULL, nt, &pos);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movl %ecx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x30(%rax)
jne 0x26159
jmp 0x26185
movq 0x8(%rsp), %rax
movl 0x24(%rsp), %ecx
movl %ecx, 0x10(%rsp)
movl 0x20(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movq 0x28(%rsp), %rdi
movq 0x30(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq 0x10(%rsp), %rcx
callq 0x4320
addq $0x38, %rsp
retq
nopw (%rax,%rax)