LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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:
xorl %ecx, %ecx
cmpl $0x0, 0x174(%rdi)
movdqu 0x178(%rdi), %xmm0
pxor %xmm1, %xmm1
pcmpgtd %xmm1, %xmm0
pand 0x4247(%rip), %xmm0     # 0x15e10
setg %cl
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
por %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
por %xmm1, %xmm0
movd %xmm0, %eax
orl %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl $0x8800, %edi           # imm = 0x8800
je 0x11c21
movl %edi, %ecx
andl $0x8800, %ecx           # imm = 0x8800
movl %edi, %eax
shrl $0xc, %eax
andl $0x7, %eax
cmpl $0x8000, %ecx           # imm = 0x8000
jne 0x11c33
movl %eax, %eax
leaq 0x1c909(%rip), %rcx     # 0x2e528
jmp 0x11c45
shrl $0xc, %edi
andl $0x7, %edi
leaq 0x1c8f2(%rip), %rcx     # 0x2e520
addq %rdi, %rcx
jmp 0x11c48
shrl $0x8, %edi
andl $0x80, %edi
orl %edi, %eax
leaq 0x1c8eb(%rip), %rcx     # 0x2e530
addq %rax, %rcx
movzbl (%rcx), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movslq %esi, %rcx
movl 0x188(%rdi,%rcx,4), %eax
movl %eax, 0x19c(%rdi,%rcx,4)
cmpl $0x3, %ecx
jne 0x11c9f
movb 0x1cc(%rdi), %al
cmpb $0x1, %al
jne 0x11c73
incl 0x1b0(%rdi,%rcx,4)
xorb $0x1, %al
movb %al, 0x1cc(%rdi)
movl 0x104(%rdi,%rcx,4), %edx
movl 0x1b0(%rdi,%rcx,4), %eax
leaq 0x1c910(%rip), %rsi     # 0x2e5a0
movzwl (%rsi,%rdx,2), %esi
cltd
idivl %esi
movl %edx, 0x1b0(%rdi,%rcx,4)
retq
movl 0x1b0(%rdi,%rcx,4), %eax
incl %eax
movl %eax, 0x1b0(%rdi,%rcx,4)
cmpl $0x2, %ecx
jae 0x11cc1
leal 0xf(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %edx
andl $-0x10, %edx
jmp 0x11cce
jne 0x11c9e
leal 0x1f(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %edx
andl $-0x20, %edx
subl %edx, %eax
movl %eax, 0x1b0(%rdi,%rcx,4)
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/compositor.cpp
// Function: compositor::~compositor()
compositor::~compositor() {
    //SDL_DestroyRenderer(render);
    //SDL_DestroyTexture(texture);
    //SDL_DestroyWindow(screen);
    //SDL_FreePalette(palstruct);
    //SDL_FreeSurface(buffer);
    //SDL_FreeSurface(overlay);
    //SDL_FreeSurface(lps);
    //SDL_FreeSurface(hps);
    //SDL_FreeSurface(nt);
    //SDL_FreeSurface(buffer);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x190(%rdi), %rdi
addq $0x190, %rbx            # imm = 0x190
cmpq %rbx, %rdi
je 0x12156
movq (%rdi), %r14
callq 0x4380
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x12146
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x12456
subq $0x18, %rsp
movl %esi, %eax
testq %rdx, %rdx
cmovneq %rdx, %rdi
movaps 0x3cab(%rip), %xmm0     # 0x160f0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movl %eax, %edx
callq 0x4070
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl $0x140, 0xc(%rsp)       # imm = 0x140
movl $0xf0, 0x8(%rsp)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x1248f
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x4160
movl 0xc(%rsp), %ecx
xorl %eax, %eax
cmpl %ebp, %ecx
jle 0x12546
movl 0x8(%rsp), %edx
cmpl %r14d, %edx
setle %sil
movl %r14d, %edi
orl %ebp, %edi
sets %dil
orb %sil, %dil
jne 0x12546
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x12510
cvtsi2ssl 0x17c(%rbx), %xmm0
cvtsi2ss %edx, %xmm1
cvtsi2ss %r14d, %xmm2
divss %xmm1, %xmm0
mulss %xmm0, %xmm2
cvttss2si %xmm2, %edx
xorps %xmm0, %xmm0
cvtsi2ssl 0x178(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
xorps %xmm2, %xmm2
cvtsi2ss %ebp, %xmm2
divss %xmm1, %xmm0
mulss %xmm0, %xmm2
cvttss2si %xmm2, %ecx
imull 0x18(%rax), %edx
addl %ecx, %edx
movslq %edx, %rcx
jmp 0x12512
xorl %ecx, %ecx
cmpq $0x0, (%rbx)
je 0x12525
movq 0x20(%rax), %rax
movzbl (%rax,%rcx), %eax
leal (%rax,%rax,2), %eax
jmp 0x1252a
movl $0x3, %eax
leaq 0x3caf(%rip), %rcx      # 0x161e0
movl %eax, %edx
movl (%rcx,%rdx,4), %eax
movl 0x4(%rcx,%rdx,4), %esi
shll $0x8, %esi
addl 0x8(%rcx,%rdx,4), %esi
shll $0x10, %eax
addl %esi, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x12743
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
cmpl %esi, 0x10(%rax)
jle 0x1274e
cmpl $0x4b, %ebx
jg 0x1274e
cmpl %ebp, 0x14(%rax)
jle 0x1274e
imull 0x18(%rax), %ebp
movq 0x20(%rax), %rax
addl %r14d, %ebp
movslq %ebp, %rcx
movb %bl, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x985b(%rip), %r15      # 0x1bfb0
leaq 0x3a5e(%rip), %rsi      # 0x161ba
movl $0x14, %edx
movq %r15, %rdi
callq 0x4410
movq %r15, %rdi
movl %r14d, %esi
callq 0x45e0
movq %rax, %r14
leaq 0x3a52(%rip), %rsi      # 0x161d0
movl $0x2, %edx
movq %rax, %rdi
callq 0x4410
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movq %rax, %r14
leaq 0x3a30(%rip), %rsi      # 0x161cf
movl $0x3, %edx
movq %rax, %rdi
callq 0x4410
movq %r14, %rdi
movl %ebx, %esi
callq 0x45e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbx
movq %rdi, %rbx
movb %sil, 0x188(%rdi)
testl %esi, %esi
je 0x12814
movl $0x400, %esi            # imm = 0x400
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x12558
movsd 0x38fe(%rip), %xmm0     # 0x16110
jmp 0x1282d
movl $0x140, %esi            # imm = 0x140
movl $0xf0, %edx
xorl %ecx, %ecx
callq 0x12558
movsd 0x38d3(%rip), %xmm0     # 0x16100
movlps %xmm0, 0x180(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl %edx, %eax
movq 0x38(%rdi), %rdx
testq %rdx, %rdx
je 0x1286a
subq $0x18, %rsp
leaq 0x8(%rsp), %r8
movl %eax, (%r8)
movl %ecx, 0x4(%r8)
movq %rsi, %rdi
xorl %esi, %esi
movq %r8, %rcx
callq 0x4320
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl %edx, %eax
movq 0x28(%rdi), %rdx
testq %rdx, %rdx
je 0x12898
subq $0x18, %rsp
leaq 0x8(%rsp), %r8
movl %eax, (%r8)
movl %ecx, 0x4(%r8)
movq %rsi, %rdi
xorl %esi, %esi
movq %r8, %rcx
callq 0x4320
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl %edx, %eax
movq 0x30(%rdi), %rdx
testq %rdx, %rdx
je 0x128c6
subq $0x18, %rsp
leaq 0x8(%rsp), %r8
movl %eax, (%r8)
movl %ecx, 0x4(%r8)
movq %rsi, %rdi
xorl %esi, %esi
movq %r8, %rcx
callq 0x4320
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/compositor.cpp
// Function: compositor::add_nt_area(int, int, int, int)
void compositor::add_nt_area(int sx, int sy, int ex, int ey) {
    if(nt_regions.size() > 1000) return;
    SDL_Rect * temp = new SDL_Rect;
    temp->x = sx;
    temp->y = sy;
    temp->w = ex - sx;
    temp->h = ey - sy;
    nt_regions.push_back(temp);
}

// Assembly:
cmpq $0x3e8, 0x1a0(%rdi) # imm = 0x3E8
ja 0x1298a
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r15d
movl %edx, %r14d
movl %esi, %r12d
movq %rdi, %rbx
leaq 0x190(%rdi), %rax
movq %rax, (%rsp)
movl $0x10, %edi
callq 0x43b0
movq %rax, %r13
movl %r12d, (%rax)
movl %r14d, 0x4(%rax)
subl %r12d, %r15d
movl %r15d, 0x8(%rax)
subl %r14d, %ebp
movl %ebp, 0xc(%rax)
movl $0x18, %edi
callq 0x43b0
movq %r13, 0x10(%rax)
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x4080
incq 0x1a0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper.cpp
// Function: mapper::get_pbyte(unsigned int)
const unsigned int mapper::get_pbyte(const unsigned int addr) {
    if(cart->prom_pages > 1) return cart->prom[addr-0x8000];
    else if(addr < 0xC000)
        return cart->prom[addr-0x8000];
    else
        return cart->prom[addr-0xC000];
}

// Assembly:
movq 0x8(%rdi), %rax
cmpl $0x2, 0x78(%rax)
jl 0x129b2
addl $0xffff8000, %esi       # imm = 0xFFFF8000
addq 0x28(%rax), %rsi
jmp 0x129cf
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x129c6
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x129cc
addl $0xffff4000, %esi       # imm = 0xFFFF4000
addq %rax, %rsi
movzbl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper.cpp
// Function: mapper::get_pword(unsigned int)
const unsigned int mapper::get_pword(const unsigned int addr) {
    if(cart->prom_pages > 1) return cart->prom_w[addr-0x8000];
    else if(addr < 0xC000) {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0x8000+prg_lo_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0x8000];
    }
    else {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0xc000+prg_hi_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0xC000];
    }
}

// Assembly:
movq 0x8(%rdi), %rax
cmpl $0x2, 0x78(%rax)
jl 0x129ee
addl $0xffff8000, %esi       # imm = 0xFFFF8000
shlq $0x2, %rsi
addq 0x40(%rax), %rsi
jmp 0x12a0c
movq 0x40(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x12a02
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x12a08
addl $0xffff4000, %esi       # imm = 0xFFFF4000
leaq (%rax,%rsi,4), %rsi
movl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper.cpp
// Function: mapper::get_cbyte(unsigned int)
const unsigned int mapper::get_cbyte(const unsigned int addr) {
    if(addr>=8192) {
        std::cout<<"Trying to get CHR byte at address: "<<addr<<std::endl;
        return 0;
    }
    return cart->crom[addr];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $0x2000, %esi           # imm = 0x2000
jb 0x12a71
movq 0x958b(%rip), %r14      # 0x1bfb0
leaq 0x3b44(%rip), %rsi      # 0x16570
movl $0x23, %edx
movq %r14, %rdi
callq 0x4410
movl %ebx, %esi
movq %r14, %rdi
callq 0x4280
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4290
xorl %eax, %eax
jmp 0x12a7f
movq 0x8(%rdi), %rax
movl %ebx, %ecx
movq 0x58(%rax), %rax
movzbl (%rax,%rcx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_001_mmc1.cpp
// Function: mapper_001::mapper_001(rom*)
mapper_001::mapper_001(rom * r): mapper(r) {
    prg_lo_offset=0;
    prg_hi_offset=(cart->prom_pages - 1) * PRG_PAGE_SIZE;
    chr_lo_offset = 0;
    chr_hi_offset = 0x1000;

    mmc1_reg.reg0.val = 0x0c;
    mmc1_reg.reg1.val = 0;
    mmc1_reg.reg2.val = 0;
    mmc1_reg.reg3.val = 0;
    mmc1_reg.counter = 0;
    for(int i=0;i<5;++i) {
        mmc1_reg.temp[i]=false;
    }

    if(0x01 & (cart->header[6])) {
        mmc1_reg.reg0.mirror=false;
        mmc1_reg.reg0.obey_mirror=true;
    }
    else if(0x08 & (cart->header[6])) {
        mmc1_reg.reg0.mirror=false;
        mmc1_reg.reg0.obey_mirror=false;
    }
    else {
        mmc1_reg.reg0.mirror=true;
        mmc1_reg.reg0.obey_mirror=true;
    }
    mmc1_reg.reg0.high_low = true;
    mmc1_reg.reg0.large_small_prg = true;
    mmc1_reg.reg0.large_small_chr = false;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x1298c
leaq 0x9050(%rip), %rax      # 0x1bb08
movq %rax, (%rbx)
leaq 0x10(%rbx), %rax
movq %rax, 0x18(%rbx)
movq %rax, 0x10(%rbx)
xorl %edx, %edx
movq %rdx, 0x20(%rbx)
movl $0x0, 0x44(%rbx)
movq 0x8(%rbx), %rsi
movl 0x78(%rsi), %eax
shll $0xe, %eax
addl $0xffffc000, %eax       # imm = 0xFFFFC000
movl %eax, 0x48(%rbx)
movabsq $0x100000000000, %rax   # imm = 0x100000000000
movq %rax, 0x4c(%rbx)
movb 0x28(%rbx), %al
andb $-0x20, %al
leal 0xc(%rax), %ecx
movb %cl, 0x28(%rbx)
andb $-0x20, 0x2c(%rbx)
andb $-0x20, 0x30(%rbx)
andb $-0x10, 0x34(%rbx)
movq %rdx, 0x38(%rbx)
movb $0x0, 0x40(%rbx)
movq 0x10(%rsi), %rdx
movb 0x6(%rdx), %dl
testb $0x1, %dl
jne 0x12b2f
orb $0xf, %al
testb $0x8, %dl
movzbl %cl, %ecx
movzbl %al, %eax
cmovnel %ecx, %eax
jmp 0x12b31
orb $0xe, %al
andb $-0x1d, %al
orb $0xc, %al
movb %al, 0x28(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_001_mmc1.cpp
// Function: mapper_001::get_pbyte(unsigned int)
const unsigned int mapper_001::get_pbyte(const unsigned int addr) {
    if(addr < 0xC000) {
        //std::cout<<std::hex<<"Addr: "<<addr<<"("<<addr-0x8000+prg_lo_offset<<")"<<std::endl;
        return cart->prom[addr-0x8000 + prg_lo_offset];
    }
    else {
        //std::cout<<std::hex<<"Addr: "<<addr<<"("<<addr-0xc000+prg_hi_offset<<")"<<std::endl;
        //std::cout<<"Cart: "<<cart<<std::endl;
        return cart->prom[addr-0xC000 + prg_hi_offset];
    }
}

// Assembly:
movq 0x8(%rdi), %rax
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x12b57
movl 0x44(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x12b62
movl 0x48(%rdi), %ecx
addl %esi, %ecx
addl $0xffff4000, %ecx       # imm = 0xFFFF4000
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_001_mmc1.cpp
// Function: mapper_001::get_pword(unsigned int)
const unsigned int mapper_001::get_pword(const unsigned int addr) {
    if(addr < 0xC000) {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0x8000+prg_lo_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0x8000 + prg_lo_offset];
    }
    else {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0xc000+prg_hi_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0xC000 + prg_hi_offset];
    }
}

// Assembly:
movq 0x8(%rdi), %rax
movq 0x40(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x12b87
movl 0x44(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x12b92
movl 0x48(%rdi), %ecx
addl %esi, %ecx
addl $0xffff4000, %ecx       # imm = 0xFFFF4000
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_001_mmc1.cpp
// Function: mapper_001::get_cbyte(unsigned int)
const unsigned int mapper_001::get_cbyte(const unsigned int addr) {
    if(addr>=8192) {
        std::cout<<"Trying to get CHR byte at address: "<<addr<<std::endl;
        return 0;
    }
    if(addr < 0x1000) return cart->crom[addr+chr_lo_offset];
    else return cart->crom[addr-0x1000+chr_hi_offset];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $0x2000, %esi           # imm = 0x2000
jb 0x12bf9
movq 0x9403(%rip), %r14      # 0x1bfb0
leaq 0x39bc(%rip), %rsi      # 0x16570
movl $0x23, %edx
movq %r14, %rdi
callq 0x4410
movl %ebx, %esi
movq %r14, %rdi
callq 0x4280
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4290
xorl %eax, %eax
jmp 0x12c23
movq 0x8(%rdi), %rax
cmpl $0xfff, %ebx            # imm = 0xFFF
ja 0x12c11
addl 0x4c(%rdi), %ebx
movq 0x58(%rax), %rax
movb (%rax,%rbx), %al
jmp 0x12c23
movl 0x50(%rdi), %ecx
addl %ebx, %ecx
addl $0xfffff000, %ecx       # imm = 0xFFFFF000
movq 0x58(%rax), %rax
movb (%rax,%rcx), %al
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_001_mmc1.cpp
// Function: mapper_001::tempval(bool*)
int mapper_001::tempval(bool * val) {
    int retval = 0;
    for(int i = 4; i >= 0; --i) {
        retval<<=(1);
        retval |= int(val[i]);
    }
    return retval;
}

// Assembly:
xorl %eax, %eax
movl $0x5, %ecx
movzbl -0x1(%rsi,%rcx), %edx
leal (%rdx,%rax,2), %eax
decq %rcx
jne 0x12f39
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_001_mmc1.cpp
// Function: mapper_001::put_cbyte(unsigned int, unsigned int)
bool mapper_001::put_cbyte(const unsigned int val,const unsigned int addr) {
    if(cart->crom_pages == 0) {
        cart->crom[addr]=val;
        return true;
    }
    else return false;
}

// Assembly:
movq 0x8(%rdi), %rcx
movl 0x7c(%rcx), %eax
testl %eax, %eax
jne 0x12f5d
movl %edx, %edx
movq 0x58(%rcx), %rcx
movb %sil, (%rcx,%rdx)
testl %eax, %eax
sete %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_002_unrom.cpp
// Function: mapper_002::get_pbyte(unsigned int)
const unsigned int mapper_002::get_pbyte(const unsigned int addr) {
    if(addr < 0xC000)
        return cart->prom[addr-0x8000+prg_lo_offset];
    else
        return cart->prom[addr-0xC000+prg_hi_offset];
}

// Assembly:
movq 0x8(%rdi), %rax
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x1302d
movl 0x10(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x13038
movl 0x14(%rdi), %ecx
addl %esi, %ecx
addl $0xffff4000, %ecx       # imm = 0xFFFF4000
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_002_unrom.cpp
// Function: mapper_002::get_pword(unsigned int)
const unsigned int mapper_002::get_pword(const unsigned int addr) {
    if(addr < 0xC000) {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0x8000+prg_lo_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0x8000+prg_lo_offset];
    }
    else {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0xc000+prg_hi_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0xC000+prg_hi_offset];
    }
}

// Assembly:
movq 0x8(%rdi), %rax
movq 0x40(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x1305d
movl 0x10(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x13068
movl 0x14(%rdi), %ecx
addl %esi, %ecx
addl $0xffff4000, %ecx       # imm = 0xFFFF4000
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_002_unrom.cpp
// Function: mapper_002::put_cbyte(unsigned int, unsigned int)
bool mapper_002::put_cbyte(const unsigned int val,const unsigned int addr) {
    if(cart->crom_pages == 0) {
        cart->crom[addr]=val;
        cart->updated_crom = 3;
        return true;
    }
    else return false;
}

// Assembly:
movq 0x8(%rdi), %rcx
movl 0x7c(%rcx), %eax
testl %eax, %eax
jne 0x130b3
movl %edx, %edx
movq 0x58(%rcx), %rcx
movb %sil, (%rcx,%rdx)
movq 0x8(%rdi), %rcx
movl $0x3, 0xa4(%rcx)
testl %eax, %eax
sete %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_003_cnrom.cpp
// Function: mapper_003::get_pbyte(unsigned int)
const unsigned int mapper_003::get_pbyte(const unsigned int addr) {
    if(cart->prom_pages > 1) return cart->prom[addr-0x8000];
    else if(addr < 0xC000)
        return cart->prom[addr-0x8000];
    else
        return cart->prom[addr-0xC000];
}

// Assembly:
movq 0x8(%rdi), %rax
cmpl $0x2, 0x78(%rax)
jl 0x13132
addl $0xffff8000, %esi       # imm = 0xFFFF8000
addq 0x28(%rax), %rsi
jmp 0x1314f
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x13146
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x1314c
addl $0xffff4000, %esi       # imm = 0xFFFF4000
addq %rax, %rsi
movzbl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_003_cnrom.cpp
// Function: mapper_003::get_pword(unsigned int)
const unsigned int mapper_003::get_pword(const unsigned int addr) {
    if(cart->prom_pages > 1) return cart->prom_w[addr-0x8000];
    else if(addr < 0xC000) {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0x8000+prg_lo_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0x8000];
    }
    else {
        //std::cout<<"Reading: 0x"<<std::hex<<addr<<" (0x"<<(addr-0xc000+prg_hi_offset)<<")"<<std::endl;
        return cart->prom_w[addr-0xC000];
    }
}

// Assembly:
movq 0x8(%rdi), %rax
cmpl $0x2, 0x78(%rax)
jl 0x1316e
addl $0xffff8000, %esi       # imm = 0xFFFF8000
shlq $0x2, %rsi
addq 0x40(%rax), %rsi
jmp 0x1318c
movq 0x40(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x13182
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x13188
addl $0xffff4000, %esi       # imm = 0xFFFF4000
leaq (%rax,%rsi,4), %rsi
movl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_003_cnrom.cpp
// Function: mapper_003::get_cbyte(unsigned int)
const unsigned int mapper_003::get_cbyte(const unsigned int addr) {
    if(addr>=8192) {
        std::cout<<"Trying to get CHR byte at address: "<<addr<<std::endl;
        return 0;
    }
    return cart->crom[addr];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $0x2000, %esi           # imm = 0x2000
jb 0x131f1
movq 0x8e0b(%rip), %r14      # 0x1bfb0
leaq 0x33c4(%rip), %rsi      # 0x16570
movl $0x23, %edx
movq %r14, %rdi
callq 0x4410
movl %ebx, %esi
movq %r14, %rdi
callq 0x4280
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4290
xorl %eax, %eax
jmp 0x131ff
movq 0x8(%rdi), %rax
movl %ebx, %ecx
movq 0x58(%rax), %rax
movzbl (%rax,%rcx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_003_cnrom.cpp
// Function: mapper_003::put_pbyte(unsigned int, unsigned int, unsigned int)
void mapper_003::put_pbyte(const unsigned int cycle, const unsigned int val,const unsigned int addr) {
        cart->updated_crom = 3;
        int real_val = ((val & get_pbyte(addr))&0x3);
        int new_chr_lo_offset = CHR_PAGE_SIZE * real_val;
        int new_chr_hi_offset = new_chr_lo_offset + 0x1000;
        ppu_change(cycle, lo_crom, new_chr_lo_offset);
        ppu_change(cycle, hi_crom, new_chr_hi_offset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rdi), %rax
movl $0x3, 0xa4(%rax)
movq (%rdi), %rax
movl %ecx, %esi
callq *(%rax)
andl %eax, %ebx
andl $0x3, %ebx
shll $0xd, %ebx
leal 0x1000(%rbx), %r15d
movq (%r14), %rax
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
movl %ebx, %ecx
callq *0x50(%rax)
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r14, %rdi
movl %ebp, %esi
movl $0x1, %edx
movl %r15d, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_011_color_dreams.cpp
// Function: mapper_011::mapper_011(rom*)
mapper_011::mapper_011(rom* r) : mapper(r) {
    prg_hi_offset = (r->prom_pages - 1) * PRG_PAGE_SIZE;
    prg_lo_offset = (r->prom_pages - 2) * PRG_PAGE_SIZE;
    chr_lo_offset = 0;
    chr_hi_offset = 0x1000;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1298c
leaq 0x8826(%rip), %rax      # 0x1bc80
movq %rax, (%r14)
leaq 0x10(%r14), %rax
movq %rax, 0x18(%r14)
movq %rax, 0x10(%r14)
movq $0x0, 0x20(%r14)
movl 0x78(%rbx), %eax
shll $0xe, %eax
leal -0x4000(%rax), %ecx
movl %ecx, 0x28(%r14)
addl $0xffff8000, %eax       # imm = 0xFFFF8000
movl %eax, 0x2c(%r14)
movabsq $0x100000000000, %rax   # imm = 0x100000000000
movq %rax, 0x30(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_011_color_dreams.cpp
// Function: mapper_011::get_pbyte(unsigned int)
const unsigned int mapper_011::get_pbyte(const unsigned int addr) {
    if(cart->prom_pages > 1) return cart->prom[addr-0x8000];
    else if(addr < 0xC000)
        return cart->prom[addr-0x8000];
    else
        return cart->prom[addr-0xC000];
}

// Assembly:
movq 0x8(%rdi), %rax
cmpl $0x2, 0x78(%rax)
jl 0x134b6
addl $0xffff8000, %esi       # imm = 0xFFFF8000
addq 0x28(%rax), %rsi
jmp 0x134d3
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x134ca
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x134d0
addl $0xffff4000, %esi       # imm = 0xFFFF4000
addq %rax, %rsi
movzbl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_011_color_dreams.cpp
// Function: mapper_011::get_cbyte(unsigned int)
const unsigned int mapper_011::get_cbyte(const unsigned int addr) {
    if(addr>=8192) {
        std::cout<<"Trying to get CHR byte at address: "<<addr<<std::endl;
        return 0;
    }
    return cart->crom[addr];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $0x2000, %esi           # imm = 0x2000
jb 0x13575
movq 0x8a87(%rip), %r14      # 0x1bfb0
leaq 0x3040(%rip), %rsi      # 0x16570
movl $0x23, %edx
movq %r14, %rdi
callq 0x4410
movl %ebx, %esi
movq %r14, %rdi
callq 0x4280
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4290
xorl %eax, %eax
jmp 0x13583
movq 0x8(%rdi), %rax
movl %ebx, %ecx
movq 0x58(%rax), %rax
movzbl (%rax,%rcx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_011_color_dreams.cpp
// Function: mapper_011::put_pbyte(unsigned int, unsigned int, unsigned int)
void mapper_011::put_pbyte(const unsigned int cycle, const unsigned int val,const unsigned int addr) {
    int real_val = val & get_pbyte(addr);
    int prg_page = (real_val & 3);
    int chr_page = real_val / 16;
    //std::cout<<"Switch to PRG page "<<prg_page<<", CHR page "<<chr_page<<std::endl;
    prg_lo_offset = 2 * prg_page * PRG_PAGE_SIZE;
    prg_hi_offset = ((2 * prg_page) + 1) * PRG_PAGE_SIZE;
    int new_chr_lo_offset = chr_page * CHR_PAGE_SIZE;
    int new_chr_hi_offset = new_chr_lo_offset + 0x1000;
    ppu_change(cycle, lo_crom, new_chr_lo_offset);
    ppu_change(cycle, hi_crom, new_chr_hi_offset);
    cart->updated_crom = 3;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
movl %ecx, %esi
callq *(%rax)
andl %r14d, %eax
leal 0xf(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $0x3, %eax
shll $0xf, %eax
movl %eax, 0x2c(%rbx)
orl $0x4000, %eax           # imm = 0x4000
movl %eax, 0x28(%rbx)
andl $-0x10, %ecx
shll $0x9, %ecx
leal 0x1000(%rcx), %r14d
movq (%rbx), %rax
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq *0x50(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1, %edx
movl %r14d, %ecx
callq *0x50(%rax)
movq 0x8(%rbx), %rax
movl $0x3, 0xa4(%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mapper_nsf.cpp
// Function: mapper_nsf::reset_map()
void mapper_nsf::reset_map() {
    if(cart->uses_banks) {
        for(int i=0;i<8;++i)
            bank[i] = cart->get_header(0x70+i);
    }
    else {
        for(int i=0;i<8;++i)
            bank[i] = i;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rax
cmpb $0x0, 0xcf(%rax)
je 0x138b4
xorl %r14d, %r14d
movq 0x10(%rbx), %rdi
movl %r14d, %esi
orl $0x70, %esi
callq 0xa0be
movl %eax, 0x18(%rbx,%r14,4)
incq %r14
cmpq $0x8, %r14
jne 0x13895
jmp 0x138da
movdqa 0x2db4(%rip), %xmm0     # 0x16670
xorl %eax, %eax
movdqa 0x2dba(%rip), %xmm1     # 0x16680
movdqu %xmm0, 0x18(%rbx,%rax,4)
addq $0x4, %rax
paddd %xmm1, %xmm0
cmpq $0x8, %rax
jne 0x138c6
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rom1v[P]metahanoi/hanoi.cpp
// Function: Hanoi::solveRec(unsigned int, unsigned int)
void solveRec(size disks, tower target) {
        if (disks == 0) {
            return;
        }
        // the tower of the largest disk at this depth of recursion
        tower &largest = state[state.size() - disks];
        if (largest == target) {
            // the largest disk is already on the target tower
            solveRec(disks - 1, target);
        } else {
            // move disks above the largest to the intermediate tower
            solveRec(disks - 1, other(largest, target));
            // move the largest disk to the target
            largest = target;
            printState();
            // move back the disks on the largest
            solveRec(disks - 1, target);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl %esi, %r15d
decl %ebp
negq %r15
cmpl $-0x1, %ebp
je 0x14be
movq (%r14), %r12
movq 0x8(%r14), %r13
subq %r12, %r13
sarq $0x2, %r13
addq %r15, %r13
movl (%r12,%r13,4), %eax
cmpl %ebx, %eax
je 0x14b7
addl %ebx, %eax
movl $0x3, %edx
subl %eax, %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x1460
movl %ebx, (%r12,%r13,4)
movq %r14, %rdi
callq 0x13da
decl %ebp
incq %r15
jmp 0x147a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/fpavetic[P]lcskpp/./random_strings.h
// Function: generate_similar(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, double const&)
std::string generate_similar(const std::string& a, 
                             const double& p_err) {
  std::string b = a;
  for (int i = 0; i < b.size(); ++i) {
    if (1.0*rand()/RAND_MAX <= p_err) {
      b[i] = get_random_base();
    }
  }
  return b;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
movq %rax, %rsi
callq 0x2ae4
cmpq $0x0, 0x8(%r14)
je 0x24e7
xorl %r15d, %r15d
callq 0x2050
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x3b59(%rip), %xmm0     # 0x6008
movsd (%rbx), %xmm1
ucomisd %xmm0, %xmm1
jb 0x24de
callq 0x2050
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x4, %ecx
subl %ecx, %eax
cltq
movq 0x6c64(%rip), %rcx      # 0x9138
movb (%rcx,%rax), %al
movq (%r14), %rcx
movb %al, (%rcx,%r15)
incq %r15
cmpq %r15, 0x8(%r14)
ja 0x249b
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/fpavetic[P]lcskpp/./random_strings.h
// Function: generate_string[abi:cxx11](int const&)
std::string generate_string(const int& len) {
  std::string ret;
  for (int i = 0; i < len; ++i) {
    ret += get_random_base();
  }
  assert(ret.size() == len);
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movl (%rsi), %eax
testl %eax, %eax
jle 0x2548
movq %rsi, %r14
xorl %ebp, %ebp
callq 0x2050
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x4, %ecx
subl %ecx, %eax
cltq
movq 0x6c05(%rip), %rcx      # 0x9138
movsbl (%rcx,%rax), %esi
movq %rbx, %rdi
callq 0x2110
incl %ebp
movl (%r14), %eax
cmpl %eax, %ebp
jl 0x2518
cltq
cmpq %rax, 0x8(%rbx)
jne 0x255e
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3acb(%rip), %rdi      # 0x6030
leaq 0x3ad6(%rip), %rsi      # 0x6042
leaq 0x3ae2(%rip), %rcx      # 0x6055
movl $0x27, %edx
callq 0x20b0
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x258d
callq 0x2130
movq %r14, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O1/fpavetic[P]lcskpp/test_lcskpp.cpp
// Function: main
int main(int argc, char* argv[]) {
  printf("Running tests on %d random pairs ", kSimulationRuns);
  printf("with the following parameters:\n");
  printf("  string length=%d\n", kStringLen);
  printf("  k=%d\n", kK);
  printf("  pErr=%0.2lf\n", kPerr);

  srand(1603);

  map<int, double> distr;
  calculate_distribution(distr);

  double sum_prob = 0;
  double e_lcs = 0;

  for (int i = 0; i <= kStringLen; ++i) {
    double p = distr[i];
    sum_prob += p;
    e_lcs += p*i;
  }

  assert(0.99999 <= sum_prob <= 1.00001);
  printf("Expected LCSk++=%0.3lf\n", e_lcs);
  printf("Test PASSED!\n");
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq 0x392e(%rip), %rdi      # 0x61a9
xorl %ebx, %ebx
movl $0x3e8, %esi            # imm = 0x3E8
xorl %eax, %eax
callq 0x2030
leaq 0x39a8(%rip), %rdi      # 0x6238
callq 0x21c0
leaq 0x392f(%rip), %rdi      # 0x61cb
movl $0x64, %esi
xorl %eax, %eax
callq 0x2030
leaq 0x3930(%rip), %rdi      # 0x61df
movl $0xa, %esi
xorl %eax, %eax
callq 0x2030
leaq 0x3925(%rip), %rdi      # 0x61e7
movsd 0x374e(%rip), %xmm0     # 0x6018
movb $0x1, %al
callq 0x2030
movl $0x643, %edi            # imm = 0x643
callq 0x2140
leaq 0x20(%rsp), %rax
movl $0x0, (%rax)
movq %rbx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rbx, 0x20(%rax)
leaq 0x18(%rsp), %rdi
callq 0x2822
leaq 0xc(%rsp), %rbx
movl $0x0, (%rbx)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a2a
movl 0xc(%rsp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd (%rax), %xmm0
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
leal 0x1(%rcx), %eax
movl %eax, 0xc(%rsp)
cmpl $0x64, %ecx
jl 0x291a
leaq 0x389f(%rip), %rdi      # 0x61f6
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x2030
leaq 0x38ec(%rip), %rdi      # 0x6257
callq 0x21c0
leaq 0x18(%rsp), %rdi
callq 0x2a9a
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
jmp 0x2986
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2a9a
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/fpavetic[P]lcskpp/lcskpp.cpp
// Function: lcskpp_sparse_slow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int*, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>*)
void lcskpp_sparse_slow(
    const string& a, const string& b,
    const int k, int* lcskpp_length,
    vector<pair<int, int> >* lcskpp_reconstruction) {
  vector<pair<int, int> > matches;
  get_matches(a, b, k, &matches);
  lcskpp_sparse_slow(matches, k, lcskpp_length, 
                     lcskpp_reconstruction);  
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
callq 0x2ea2
movq %rsp, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3239
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2e80
callq 0x2130
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2e9a
callq 0x2130
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O1/fpavetic[P]lcskpp/lcskpp.cpp
// Function: lcskpp_sparse_fast(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int*, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>*)
void lcskpp_sparse_fast(
    const string& a, const string& b,
    const int k, int* lcskpp_length,
    vector<pair<int, int> >* lcskpp_reconstruction) {
  vector<pair<int, int> > matches;
  get_matches(a, b, k, &matches);
  lcskpp_sparse_fast(matches, k, lcskpp_length, 
                     lcskpp_reconstruction);  
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
callq 0x2ea2
movq %rsp, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3522
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x3500
callq 0x2130
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x351a
callq 0x2130
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O1/fpavetic[P]lcskpp/lcskpp.cpp
// Function: valid_lcskpp(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> const&)
bool valid_lcskpp(const string& a, const string& b,
                  const int k, const int lcskpp_len,
                  const vector<pair<int, int> >& lcskpp_recon) {
  // 1) Ensure correct length.
  if (lcskpp_len != lcskpp_recon.size()) {
    return false;
  }

  // 2) Ensure chars corresponding to the indices match.
  for (auto match: lcskpp_recon) {
    int i = match.first;
    int j = match.second;
    
    if (i < 0 || i >= a.size()) { return false; }
    if (j < 0 || j >= b.size()) { return false; }
    if (a[i] != b[j]) { return false; }
  }

  // 3) Ensure runs of indices have at least length of k.
  int run_a = 1;
  int run_b = 1;
  for (size_t i = 1; i < lcskpp_recon.size(); ++i) {
    if (lcskpp_recon[i-1].first >= lcskpp_recon[i].first) { return false; }
    if (lcskpp_recon[i-1].second >= lcskpp_recon[i].second) { return false; }

    if (lcskpp_recon[i-1].first+1 == lcskpp_recon[i].first) { ++run_a; }
    if (lcskpp_recon[i-1].second+1 == lcskpp_recon[i].second) { ++run_b; }

    if (i+1 == lcskpp_recon.size() || 
        lcskpp_recon[i-1].first+1 != lcskpp_recon[i].first) {
      if (run_a < k) { return false; }
      run_a = 1;
    }

    if (i+1 == lcskpp_recon.size() ||
        lcskpp_recon[i-1].second+1 != lcskpp_recon[i].second) {
      if (run_b < k) { return false; }
      run_b = 1;
    }
  }

  return true;
}

// Assembly:
movslq %ecx, %rax
movq (%r8), %rcx
movq 0x8(%r8), %r9
movq %r9, %r8
subq %rcx, %r8
sarq $0x3, %r8
cmpq %rax, %r8
jne 0x3b82
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
cmpq %r9, %rcx
sete %al
je 0x3af2
movl (%rcx), %ebp
testl %ebp, %ebp
js 0x3aea
movq (%rdi), %r10
movq 0x8(%rdi), %rdi
movq (%rsi), %r11
movq 0x8(%rsi), %rsi
leaq 0x8(%rcx), %rbx
movl %ebp, %r14d
cmpq %r14, %rdi
jbe 0x3aea
movl -0x4(%rbx), %r15d
testl %r15d, %r15d
js 0x3aea
cmpq %r15, %rsi
jbe 0x3aea
movb (%r10,%r14), %bpl
cmpb (%r11,%r15), %bpl
jne 0x3aea
cmpq %r9, %rbx
sete %al
je 0x3af2
movl (%rbx), %ebp
addq $0x8, %rbx
testl %ebp, %ebp
jns 0x3ab8
testb $0x1, %al
je 0x3b85
cmpq $0x2, %r8
setb %al
jb 0x3b87
leaq -0x1(%r8), %rax
addq $-0x2, %r8
movl $0x1, %edi
xorl %esi, %esi
movl $0x1, %r9d
movl (%rcx,%rsi,8), %ebx
movl 0x8(%rcx,%rsi,8), %ebp
cmpl %ebp, %ebx
jge 0x3b85
movl 0x4(%rcx,%rsi,8), %r10d
movl 0xc(%rcx,%rsi,8), %r11d
cmpl %r11d, %r10d
jge 0x3b85
incl %ebx
xorl %r14d, %r14d
cmpl %ebp, %ebx
sete %r14b
addl %r14d, %r9d
incl %r10d
xorl %r14d, %r14d
cmpl %r11d, %r10d
sete %r15b
cmpq %rsi, %r8
je 0x3b52
cmpl %ebp, %ebx
je 0x3b5d
cmpl %edx, %r9d
movl $0x1, %r9d
jl 0x3b85
movb %r15b, %r14b
addl %r14d, %edi
cmpq %rsi, %r8
je 0x3b6d
cmpl %r11d, %r10d
je 0x3b76
cmpl %edx, %edi
movl $0x1, %edi
jl 0x3b85
incq %rsi
cmpq %rsi, %rax
jne 0x3b14
movb $0x1, %al
jmp 0x3b87
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Thomas1995[P]Rentz/src/./server.h
// Function: Server::acceptConnection()
int acceptConnection() {
    sockaddr_storage addr;
    socklen_t addrlen = sizeof(addr);
    int client = accept(fd, (sockaddr *)&addr, &addrlen);

    char buff[INET6_ADDRSTRLEN];

    if(addr.ss_family == AF_INET) {
      //the client is using IPv4
      sockaddr_in *sin = (sockaddr_in *)&addr;
      inet_ntop(sin->sin_family, (void *)&sin->sin_addr, buff, sizeof(buff));

      debug("Accepted connection from %s: %d\n", buff, sin->sin_port);
    } else {
      //the client is using IPv6
      sockaddr_in6 *sin = (sockaddr_in6 *)&addr;
      inet_ntop(sin->sin6_family, (void *)&sin->sin6_addr, buff, sizeof(buff));
      debug("Accepted connection from %s: %d\n", buff, sin->sin6_port);
    }

    if(client == -1) {
      perror("Accept() failed: ");
      exit(1);
    }
    return client;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc8, %rsp
leaq 0xc(%rsp), %rdx
movl $0x80, (%rdx)
movl (%rdi), %edi
leaq 0x48(%rsp), %r14
movq %r14, %rsi
callq 0x20c0
movl %eax, %ebx
movzwl (%r14), %edi
xorl %eax, %eax
cmpl $0x2, %edi
setne %al
leaq (%rsp,%rax,4), %rsi
addq $0x4c, %rsi
leaq 0x10(%rsp), %r15
pushq $0x2e
popq %rcx
movq %r15, %rdx
callq 0x2250
movq 0xbb19(%rip), %r12      # 0xdfd0
movq (%r12), %rdi
movzwl 0x2(%r14), %ecx
leaq 0x6c9e(%rip), %rsi      # 0x9165
movq %r15, %rdx
xorl %eax, %eax
callq 0x2330
movq (%r12), %rdi
callq 0x22b0
cmpl $-0x1, %ebx
je 0x24f0
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6c8f(%rip), %rdi      # 0x9186
callq 0x21c0
pushq $0x1
popq %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O1/Thomas1995[P]Rentz/src/score.cpp
// Function: GLOBAL__sub_I_score.cpp
void Table::ChangeScore() {

    int crtConnection = firstPlayer - players.begin();

    int scoreToAdd = 0;

    if(gameType == KingOfHearts)
        ScoreKingOfHearts(scoreToAdd);

    if(gameType == Queens)
        ScoreQueens(scoreToAdd);

    if(gameType == Diamonds)
        ScoreDiamonds(scoreToAdd);

    if(gameType == Acool)
        ScoreAcool(scoreToAdd);

    if(gameType == Whist)
        ScoreWhist(scoreToAdd);

    if(gameType == TenClub)
        ScoreTenClub(scoreToAdd);

    if(gameType == Totals)
        ScoreTotals(scoreToAdd);

    score[crtConnection] += scoreToAdd * (1 + modeNV);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0xba35(%rip), %rbx      # 0xe248
movq %rbx, %rdi
callq 0x2360
movq 0xb7d6(%rip), %rdi      # 0xdff8
leaq 0xb9ff(%rip), %rdx      # 0xe228
movq %rbx, %rsi
callq 0x21e0
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movl $0x6c6c756e, (%rcx)     # imm = 0x6C6C756E
movq $0x4, -0x8(%rcx)
xorl %eax, %eax
movb %al, 0x4(%rcx)
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movabsq $0x20666f20676e694b, %rdx # imm = 0x20666F20676E694B
movq %rdx, (%rcx)
movabsq $0x7374726165482066, %rdx # imm = 0x7374726165482066
movq %rdx, 0x6(%rcx)
movq $0xe, -0x8(%rcx)
movb %al, 0xe(%rcx)
leaq 0x58(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movl $0x65657551, (%rdx)     # imm = 0x65657551
movw $0x736e, 0x4(%rdx)      # imm = 0x736E
movl $0x6, %ecx
movq %rcx, -0x8(%rdx)
movb %al, 0x6(%rdx)
leaq 0x78(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movabsq $0x73646e6f6d616944, %rsi # imm = 0x73646E6F6D616944
movq %rsi, (%rdx)
movq $0x8, -0x8(%rdx)
movb %al, 0x8(%rdx)
leaq 0x98(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movw $0x6c, 0x4(%rdx)
movl $0x6f6f6341, (%rdx)     # imm = 0x6F6F6341
movl $0x5, %esi
movq %rsi, -0x8(%rdx)
leaq 0xb8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movl $0x73696857, (%rdx)     # imm = 0x73696857
movw $0x74, 0x4(%rdx)
movq %rsi, -0x8(%rdx)
leaq 0xd8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movabsq $0x6320666f206e6554, %rsi # imm = 0x6320666F206E6554
movq %rsi, (%rdx)
movl $0x7362756c, 0x8(%rdx)  # imm = 0x7362756C
movq $0xc, -0x8(%rdx)
movb %al, 0xc(%rdx)
leaq 0xf8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movw $0x736c, 0x4(%rbx)      # imm = 0x736C
movl $0x61746f54, (%rbx)     # imm = 0x61746F54
movq %rcx, -0x8(%rbx)
movb %al, 0x6(%rbx)
leaq 0xb904(%rip), %rdi      # 0xe250
leaq 0x8(%rsp), %rsi
leaq 0x7(%rsp), %rcx
movl $0x8, %edx
callq 0x355c
movq $-0x100, %r14
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x297b
movq (%rbx), %rsi
incq %rsi
callq 0x2230
addq $-0x20, %rbx
addq $0x20, %r14
jne 0x2967
leaq 0xc18(%rip), %rdi       # 0x35a4
leaq 0xb8bd(%rip), %rsi      # 0xe250
leaq 0xb88e(%rip), %rdx      # 0xe228
callq 0x21e0
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
leaq 0x108(%rsp), %rdi
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
callq 0x29c7
movq %rbx, %rdi
callq 0x23c0
// File: /workspace/github_cpp_makefile_star2_O1/Thomas1995[P]Rentz/src/score.cpp
// Function: Table::ScoreTotals(int&)
void Table::ScoreTotals(int& scoreToAdd) {
    ScoreKingOfHearts(scoreToAdd);
    ScoreQueens(scoreToAdd);
    ScoreDiamonds(scoreToAdd);
    ScoreAcool(scoreToAdd);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x33de
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3436
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3482
addl $-0xa, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq