LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpb $0x1, 0x11c(%rdi)
jne 0x10f05
movl 0x118(%rdi), %eax
testl %eax, %eax
je 0x10f05
decl %eax
movl %eax, 0x118(%rdi)
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x2, %rcx
je 0x10f76
cmpb $0x1, 0xb4(%rdi,%rcx)
jne 0x10f76
cmpb $0x1, 0xe4(%rdi,%rcx)
jne 0x10f76
cmpl $0x0, 0x174(%rdi,%rcx,4)
jle 0x10f76
movl 0xd0(%rdi,%rcx,4), %edx
testl %edx, %edx
je 0x10f3c
decl %edx
jmp 0x10f6f
movl 0xf0(%rdi,%rcx,4), %edx
decl %edx
movl %edx, 0xf0(%rdi,%rcx,4)
cmpl $0x10, %edx
jb 0x10f68
cmpb $0x1, 0xe9(%rdi,%rcx)
jne 0x10f81
movl $0xf, 0xf0(%rdi,%rcx,4)
jmp 0x10f76
movl 0xbc(%rdi,%rcx,4), %edx
movl %edx, 0xd0(%rdi,%rcx,4)
incq %rcx
cmpq $0x4, %rcx
jne 0x10f09
jmp 0x10f91
movl %eax, 0xf0(%rdi,%rcx,4)
movl %eax, 0x174(%rdi,%rcx,4)
jmp 0x10f76
retq
// File: /workspace/github_cpp_makefile_star2_O3/khedoros[P]khednes/apu.cpp
// Function: apu::clock_half()
void apu::clock_half() {
    for(uint8_t voice = 0; voice < 4; ++voice) {
        //clock length counter
        if(enabled[voice] && length[voice] > 0 && !loop_decay[voice] && (voice != TRI || !enable_linear_cntr)) length[voice]--;

        //Wavelength sweep
        if(voice < 2 && enabled[voice] && length[voice] > 0 && sweep_enable[voice]) {
            --sweep_count[voice];
            if(sweep_count[voice] == 0) {
                int sweep_amount = wavelength_count_reset[voice];
                sweep_amount>>=(sweep_shift[voice]);
                if(sweep_dir[voice] == 1) //decrease wavelength
                    sweep_amount *= -1;
                if(wavelength_count_reset[voice] + sweep_amount < 0x7ff && wavelength_count_reset[voice] + sweep_amount > 0x08) {
                    wavelength_count_reset[voice] += sweep_amount;
                    if(sweep_count[voice] == 0) sweep_count[voice] = sweep_rate[voice] + 1;
                }
                else {
                    length[voice] = 0;
                    //enabled[voice] = 0;
                }
            }
        }   
    }

}

// Assembly:
movb 0x11c(%rdi), %al
xorl %edx, %edx
cmpb $0x1, 0xb4(%rdi,%rdx)
jne 0x1105c
movl 0x174(%rdi,%rdx,4), %ecx
testl %ecx, %ecx
jle 0x1105c
cmpb $0x0, 0xe9(%rdi,%rdx)
je 0x10fc5
xorl %ecx, %ecx
jmp 0x10fe3
cmpq $0x2, %rdx
jne 0x10fd3
testb $0x1, %al
jne 0x1105c
leal -0x1(%rcx), %esi
movl %esi, 0x174(%rdi,%rdx,4)
cmpl $0x1, %ecx
sete %cl
cmpq $0x1, %rdx
ja 0x1105c
testb %cl, %cl
jne 0x1105c
cmpb $0x1, 0x11d(%rdi,%rdx)
jne 0x1105c
decl 0x160(%rdi,%rdx,4)
jne 0x1105c
movl 0x188(%rdi,%rdx,4), %esi
movb 0x124(%rdi,%rdx,4), %cl
movl %esi, %r8d
sarl %cl, %r8d
movl %r8d, %ecx
negl %ecx
cmpl $0x1, 0x138(%rdi,%rdx,4)
cmovnel %r8d, %ecx
leal (%rcx,%rsi), %r8d
addl $-0x9, %r8d
cmpl $0x7f5, %r8d            # imm = 0x7F5
ja 0x11051
addl %esi, %ecx
movl %ecx, 0x188(%rdi,%rdx,4)
movl 0x14c(%rdi,%rdx,4), %ecx
incl %ecx
movl %ecx, 0x160(%rdi,%rdx,4)
jmp 0x1105c
movl $0x0, 0x174(%rdi,%rdx,4)
incq %rdx
cmpq $0x4, %rdx
jne 0x10f9a
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4345(%rip), %xmm0     # 0x15e00
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_O3/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, %eax
shrl $0xc, %eax
andl $0x7, %eax
movl %edi, %ecx
andl $0x8800, %ecx           # imm = 0x8800
movl %ecx, %edx
negw %dx
jo 0x11b0e
testl %ecx, %ecx
jne 0x11b19
movl %eax, %eax
leaq 0x1ca14(%rip), %rcx     # 0x2e520
jmp 0x11b2b
movl %eax, %eax
leaq 0x1ca11(%rip), %rcx     # 0x2e528
jmp 0x11b2b
shrl $0x8, %edi
andl $0x80, %edi
orl %edi, %eax
leaq 0x1ca05(%rip), %rcx     # 0x2e530
addq %rax, %rcx
movzbl (%rcx), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x11b7e
movzbl 0x1cc(%rdi), %edx
movl %edx, %eax
addl 0x1b0(%rdi,%rcx,4), %eax
xorb $0x1, %dl
movb %dl, 0x1cc(%rdi)
movl 0x104(%rdi,%rcx,4), %edx
leaq 0x1ca31(%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 0x11ba0
leal 0xf(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %edx
andl $-0x10, %edx
jmp 0x11bad
jne 0x11b7d
leal 0x1f(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %edx
andl $-0x20, %edx
subl %edx, %eax
movl %eax, 0x1b0(%rdi,%rcx,4)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1203a
movq (%rdi), %r14
callq 0x4380
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x1202a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x12334
subq $0x18, %rsp
movl %esi, %eax
testq %rdx, %rdx
cmovneq %rdx, %rdi
movaps 0x3dbd(%rip), %xmm0     # 0x160e0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movl %eax, %edx
callq 0x4070
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl $0x140, 0x4(%rsp)       # imm = 0x140
movl $0xf0, (%rsp)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x12371
leaq 0x4(%rsp), %r15
movq %rsp, %rdx
movq %r15, %rsi
callq 0x4160
movl (%r15), %ecx
jmp 0x12376
movl $0x140, %ecx            # imm = 0x140
xorl %eax, %eax
cmpl %ebp, %ecx
jle 0x12428
movl (%rsp), %edx
cmpl %r14d, %edx
setle %sil
movl %r14d, %edi
orl %ebp, %edi
sets %dil
orb %sil, %dil
jne 0x12428
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x123f2
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 0x123f4
xorl %ecx, %ecx
cmpq $0x0, (%rbx)
je 0x12407
movq 0x20(%rax), %rax
movzbl (%rax,%rcx), %eax
leal (%rax,%rax,2), %eax
jmp 0x1240c
movl $0x3, %eax
leaq 0x3dbd(%rip), %rcx      # 0x161d0
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 $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x12627
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
cmpl %esi, 0x10(%rax)
jle 0x12632
cmpl $0x4b, %ebx
jg 0x12632
cmpl %ebp, 0x14(%rax)
jle 0x12632
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 0x9977(%rip), %r15      # 0x1bfb0
leaq 0x3b6a(%rip), %rsi      # 0x161aa
movl $0x14, %edx
movq %r15, %rdi
callq 0x4410
movq %r15, %rdi
movl %r14d, %esi
callq 0x45e0
movq %rax, %r14
leaq 0x3b5e(%rip), %rsi      # 0x161c0
movl $0x2, %edx
movq %rax, %rdi
callq 0x4410
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movq %rax, %r14
leaq 0x3b3c(%rip), %rsi      # 0x161bf
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_O3/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 0x126f8
movl $0x400, %esi            # imm = 0x400
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x1243c
movsd 0x3a0a(%rip), %xmm0     # 0x16100
jmp 0x12711
movl $0x140, %esi            # imm = 0x140
movl $0xf0, %edx
xorl %ecx, %ecx
callq 0x1243c
movsd 0x39df(%rip), %xmm0     # 0x160f0
movlps %xmm0, 0x180(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1274e
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_O3/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 0x1277c
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_O3/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 0x127aa
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_O3/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 0x12896
addl $0xffff8000, %esi       # imm = 0xFFFF8000
addq 0x28(%rax), %rsi
jmp 0x128b3
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x128aa
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x128b0
addl $0xffff4000, %esi       # imm = 0xFFFF4000
addq %rax, %rsi
movzbl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x128d2
addl $0xffff8000, %esi       # imm = 0xFFFF8000
shlq $0x2, %rsi
addq 0x40(%rax), %rsi
jmp 0x128f0
movq 0x40(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x128e6
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x128ec
addl $0xffff4000, %esi       # imm = 0xFFFF4000
leaq (%rax,%rsi,4), %rsi
movl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x12955
movq 0x96a7(%rip), %r14      # 0x1bfb0
leaq 0x3c50(%rip), %rsi      # 0x16560
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 0x12963
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_O3/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 0x12870
leaq 0x916c(%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 0x12a13
orb $0xf, %al
testb $0x8, %dl
movzbl %cl, %ecx
movzbl %al, %eax
cmovnel %ecx, %eax
jmp 0x12a15
orb $0xe, %al
movb %al, 0x28(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x12a37
movl 0x44(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x12a42
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_O3/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 0x12a67
movl 0x44(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x12a72
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_O3/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 0x12ad9
movq 0x9523(%rip), %r14      # 0x1bfb0
leaq 0x3acc(%rip), %rsi      # 0x16560
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 0x12b03
movq 0x8(%rdi), %rax
cmpl $0xfff, %ebx            # imm = 0xFFF
ja 0x12af1
addl 0x4c(%rdi), %ebx
movq 0x58(%rax), %rax
movb (%rax,%rbx), %al
jmp 0x12b03
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_O3/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 0x12e13
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x12e37
movl %edx, %edx
movq 0x58(%rcx), %rcx
movb %sil, (%rcx,%rdx)
testl %eax, %eax
sete %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x12f09
movl 0x10(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x12f14
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_O3/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 0x12f39
movl 0x10(%rdi), %ecx
addl %esi, %ecx
addl $0xffff8000, %ecx       # imm = 0xFFFF8000
jmp 0x12f44
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_O3/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 0x12f8f
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_O3/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 0x1300e
addl $0xffff8000, %esi       # imm = 0xFFFF8000
addq 0x28(%rax), %rsi
jmp 0x1302b
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x13022
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x13028
addl $0xffff4000, %esi       # imm = 0xFFFF4000
addq %rax, %rsi
movzbl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1304a
addl $0xffff8000, %esi       # imm = 0xFFFF8000
shlq $0x2, %rsi
addq 0x40(%rax), %rsi
jmp 0x13068
movq 0x40(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x1305e
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x13064
addl $0xffff4000, %esi       # imm = 0xFFFF4000
leaq (%rax,%rsi,4), %rsi
movl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x130cd
movq 0x8f2f(%rip), %r14      # 0x1bfb0
leaq 0x34d8(%rip), %rsi      # 0x16560
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 0x130db
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_O3/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 0x1337e
addl $0xffff8000, %esi       # imm = 0xFFFF8000
addq 0x28(%rax), %rsi
jmp 0x1339b
movq 0x28(%rax), %rax
cmpl $0xbfff, %esi           # imm = 0xBFFF
ja 0x13392
addl $0xffff8000, %esi       # imm = 0xFFFF8000
jmp 0x13398
addl $0xffff4000, %esi       # imm = 0xFFFF4000
addq %rax, %rsi
movzbl (%rsi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1343d
movq 0x8bbf(%rip), %r14      # 0x1bfb0
leaq 0x3168(%rip), %rsi      # 0x16560
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 0x1344b
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_O3/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 $0x1, 0xcf(%rax)
jne 0x13768
xorl %r14d, %r14d
movq 0x10(%rbx), %rdi
movl %r14d, %esi
orl $0x70, %esi
callq 0x9fac
movl %eax, 0x18(%rbx,%r14,4)
incq %r14
cmpq $0x8, %r14
jne 0x13749
jmp 0x1377e
movaps 0x2ef1(%rip), %xmm0     # 0x16660
movups %xmm0, 0x18(%rbx)
movaps 0x2ef6(%rip), %xmm0     # 0x16670
movups %xmm0, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
testl %esi, %esi
je 0x14c0
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
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 0x14aa
addl %ebx, %eax
movl $0x3, %edx
subl %eax, %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x1454
movl %ebx, (%r12,%r13,4)
movq %r14, %rdi
callq 0x13ce
incq %r15
addl $-0x1, %ebp
jb 0x1472
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movl (%rsi), %eax
xorl %r15d, %r15d
testl %eax, %eax
jle 0x2550
movq %rsi, %r14
callq 0x2050
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x4, %ecx
subl %ecx, %eax
cltq
movq 0x6c03(%rip), %rcx      # 0x9138
movsbl (%rcx,%rax), %esi
movq %rbx, %rdi
callq 0x2110
incl %r15d
movl (%r14), %eax
cmpl %eax, %r15d
jl 0x251a
movq 0x8(%rbx), %r15
cltq
cmpq %rax, %r15
jne 0x2566
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x3ac3(%rip), %rdi      # 0x6030
leaq 0x3ace(%rip), %rsi      # 0x6042
leaq 0x3ada(%rip), %rcx      # 0x6055
movl $0x27, %edx
callq 0x20b0
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x2595
callq 0x2130
movq %r14, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/fpavetic[P]lcskpp/test_lcskpp.cpp
// Function: test_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 test_lcskpp(const string& a, const string& b, const int K) {
  int lcskpp_length = 0;
  lcskpp_slow(a, b, K, &lcskpp_length);

  int lcskpp_sparse_slow_len = 0;
  vector<pair<int, int> > lcskpp_sparse_slow_recon;
  lcskpp_sparse_slow(a, b, K, &lcskpp_sparse_slow_len,
                     &lcskpp_sparse_slow_recon);

  int lcskpp_sparse_fast_len = 0;
  vector<pair<int, int> > lcskpp_sparse_fast_recon;
  lcskpp_sparse_fast(a, b, K, &lcskpp_sparse_fast_len,
                     &lcskpp_sparse_fast_recon);
  
  // printf("%d %d %d\n", 
  //        lcskpp_length, 
  //        lcskpp_sparse_slow_len,
  //        lcskpp_sparse_fast_len);
  // printf("%s\n%s\n", a.c_str(), b.c_str());
  assert(lcskpp_length == lcskpp_sparse_slow_len);
  assert(lcskpp_length == lcskpp_sparse_fast_len);
  assert(valid_lcskpp(a, b, K, lcskpp_sparse_slow_len, 
		      lcskpp_sparse_slow_recon));
  assert(valid_lcskpp(a, b, K, lcskpp_sparse_fast_len,
    		      lcskpp_sparse_fast_recon));
  
  return lcskpp_length;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %rcx
movl %ebp, (%rcx)
callq 0x3b86
leaq 0xc(%rsp), %rcx
movl %ebp, (%rcx)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r8
movaps %xmm0, (%r8)
movq $0x0, 0x10(%r8)
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x2e48
leaq 0x4(%rsp), %rcx
movl $0x0, (%rcx)
leaq 0x10(%rsp), %r8
xorps %xmm0, %xmm0
movaps %xmm0, (%r8)
movq $0x0, 0x10(%r8)
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x34c0
movl 0x8(%rsp), %ecx
cmpl 0xc(%rsp), %ecx
jne 0x268c
cmpl 0x4(%rsp), %ecx
jne 0x26ab
leaq 0x30(%rsp), %r8
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x3a64
testb %al, %al
je 0x26ca
movl 0x4(%rsp), %ecx
leaq 0x10(%rsp), %r8
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x3a64
testb %al, %al
je 0x26e9
movl 0x8(%rsp), %ebx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2670
callq 0x2130
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x267f
callq 0x2130
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x39eb(%rip), %rdi      # 0x607e
leaq 0x3a0c(%rip), %rsi      # 0x60a6
leaq 0x3a15(%rip), %rcx      # 0x60b6
movl $0x39, %edx
callq 0x20b0
leaq 0x3a3f(%rip), %rdi      # 0x60f1
leaq 0x39ed(%rip), %rsi      # 0x60a6
leaq 0x39f6(%rip), %rcx      # 0x60b6
movl $0x3a, %edx
callq 0x20b0
leaq 0x3a48(%rip), %rdi      # 0x6119
leaq 0x39ce(%rip), %rsi      # 0x60a6
leaq 0x39d7(%rip), %rcx      # 0x60b6
movl $0x3c, %edx
callq 0x20b0
leaq 0x3a71(%rip), %rdi      # 0x6161
leaq 0x39af(%rip), %rsi      # 0x60a6
leaq 0x39b8(%rip), %rcx      # 0x60b6
movl $0x3e, %edx
callq 0x20b0
movq %rax, %rbx
jmp 0x271f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x271f
callq 0x2130
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x272e
callq 0x2130
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3928(%rip), %rdi      # 0x61a9
xorl %ebx, %ebx
movl $0x3e8, %esi            # imm = 0x3E8
xorl %eax, %eax
callq 0x2030
leaq 0x39a2(%rip), %rdi      # 0x6238
callq 0x21c0
leaq 0x3929(%rip), %rdi      # 0x61cb
movl $0x64, %esi
xorl %eax, %eax
callq 0x2030
leaq 0x392a(%rip), %rdi      # 0x61df
movl $0xa, %esi
xorl %eax, %eax
callq 0x2030
leaq 0x391f(%rip), %rdi      # 0x61e7
movsd 0x3748(%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 0x2828
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 0x2a32
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 0x2920
leaq 0x3899(%rip), %rdi      # 0x61f6
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x2030
leaq 0x38e6(%rip), %rdi      # 0x6257
callq 0x21c0
leaq 0x18(%rsp), %rdi
callq 0x2aa2
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
jmp 0x298c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2aa2
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2eae
movq %rsp, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3228
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2e8c
callq 0x2130
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2ea6
callq 0x2130
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2eae
movq %rsp, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3526
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x3504
callq 0x2130
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x351e
callq 0x2130
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/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, %r9
movq (%r8), %r10
movq 0x8(%r8), %r8
movq %r8, %rax
subq %r10, %rax
sarq $0x3, %rax
cmpq %r9, %rax
jne 0x3b78
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpq %r8, %r10
je 0x3ae3
movq (%rdi), %r11
movq 0x8(%rdi), %rdi
movq (%rsi), %rbx
movq 0x8(%rsi), %rsi
movq %r10, %r14
movslq (%r14), %r15
testq %r15, %r15
js 0x3b7b
xorl %eax, %eax
cmpq %r15, %rdi
jbe 0x3b7d
movl 0x4(%r14), %r12d
testl %r12d, %r12d
js 0x3b7d
cmpq %r12, %rsi
jbe 0x3b7b
movb (%r11,%r15), %al
cmpb (%rbx,%r12), %al
jne 0x3b7b
addq $0x8, %r14
cmpq %r8, %r14
jne 0x3a9f
movb $0x1, %al
cmpl $0x2, %ecx
jb 0x3b7d
leaq -0x1(%r9), %rcx
addq $-0x2, %r9
movl $0x1, %edi
xorl %esi, %esi
movl $0x1, %r11d
movl (%r10,%rsi,8), %r15d
movl 0x8(%r10,%rsi,8), %r12d
cmpl %r12d, %r15d
jge 0x3b7b
movl 0x4(%r10,%rsi,8), %ebp
movl 0xc(%r10,%rsi,8), %r14d
cmpl %r14d, %ebp
jge 0x3b7b
incl %r15d
leal 0x1(%r11), %r8d
incl %ebp
leal 0x1(%rdi), %ebx
cmpl %r14d, %ebp
cmovel %ebx, %edi
cmpq %rsi, %r9
jne 0x3b4b
cmpl %r12d, %r15d
cmovel %r8d, %r11d
movl $0x1, %r8d
cmpl %edx, %r11d
jge 0x3b60
jmp 0x3b7b
cmpl %r12d, %r15d
je 0x3b5b
movl $0x1, %r8d
cmpl %edx, %r11d
jl 0x3b7b
cmpl %r14d, %ebp
je 0x3b69
movl $0x1, %ebx
cmpl %edx, %edi
jl 0x3b7b
incq %rsi
movl %ebx, %edi
movl %r8d, %r11d
cmpq %rsi, %rcx
jne 0x3b03
jmp 0x3b7d
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/fpavetic[P]lcskpp/./fenwick.h
// Function: FenwickMax<std::pair<int, int>>::get(unsigned long)
T get(size_t pos) {
    ++pos;
    T ret = T();
    for ( ; pos > 0; pos -= lobit(pos)) {
      ret = std::max(ret, elements_[pos]);
    }
    return ret;
  }

// Assembly:
xorl %eax, %eax
incq %rsi
je 0x4ea6
movq (%rdi), %rcx
xorl %edx, %edx
movl (%rcx,%rsi,8), %edi
cmpl %edi, %edx
jge 0x4e83
movl 0x4(%rcx,%rsi,8), %eax
movl %edi, %edx
jmp 0x4e94
jg 0x4e94
movl 0x4(%rcx,%rsi,8), %r8d
cmpl %r8d, %eax
cmovll %r8d, %eax
cmovll %edi, %edx
leaq -0x1(%rsi), %rdi
andq %rdi, %rsi
jne 0x4e74
shlq $0x20, %rax
movl %edx, %ecx
orq %rcx, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xba4b(%rip), %rbx      # 0xe248
movq %rbx, %rdi
callq 0x2360
movq 0xb7ec(%rip), %rdi      # 0xdff8
leaq 0xba15(%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 0xb91a(%rip), %rdi      # 0xe250
leaq 0x8(%rsp), %rsi
leaq 0x7(%rsp), %rcx
movl $0x8, %edx
callq 0x3544
movq $-0x100, %r14
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x2965
movq (%rbx), %rsi
incq %rsi
callq 0x2230
addq $-0x20, %rbx
addq $0x20, %r14
jne 0x2951
leaq 0xc16(%rip), %rdi       # 0x358c
leaq 0xb8d3(%rip), %rsi      # 0xe250
leaq 0xb8a4(%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 0x29b1
movq %rbx, %rdi
callq 0x23c0