LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/main.cpp
// Function: main_redirect_stdout(char const*)
void main_redirect_stdout(const char *f)
{
    static FILE *fd = 0, *stdout_back = 0;
    static streambuf *rdbuf_back = 0;
    static ofstream filestr;
    if (0 == stdout_back) {
        stdout_back = stdout;
        rdbuf_back = cout.rdbuf();
    }
    if (0 != fd && stdout != fd) {
        fclose(fd);
        filestr.close();
    }
    if (0 == f) {
        stdout = stdout_back;
        cout.rdbuf(rdbuf_back);
    } else {
        fd = stdout = fopen(f, "w");
        filestr.open(f);
        cout.rdbuf(filestr.rdbuf());
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x17c7e(%rip), %al      # 0x38710
testb %al, %al
je 0x20b6c
cmpq $0x0, 0x17a5e(%rip)     # 0x38500
movq 0x174e7(%rip), %r14     # 0x37f90
movq (%r14), %rax
jne 0x20ad2
movq %rax, 0x17a4b(%rip)     # 0x38500
movq 0x17504(%rip), %rcx     # 0x37fc0
movq (%rcx), %rdx
movq -0x18(%rdx), %rdx
movq 0xe8(%rcx,%rdx), %rcx
movq %rcx, 0x17a36(%rip)     # 0x38508
movq 0x17a1f(%rip), %rdi     # 0x384f8
testq %rdi, %rdi
sete %cl
cmpq %rdi, %rax
sete %al
orb %cl, %al
jne 0x20afa
callq 0x62c0
leaq 0x17a1b(%rip), %rdi     # 0x38510
callq 0x6400
testq %rbx, %rbx
je 0x20b41
leaq 0x81b0(%rip), %rsi      # 0x28cb6
movq %rbx, %rdi
callq 0x6360
movq %rax, (%r14)
movq %rax, 0x179e0(%rip)     # 0x384f8
leaq 0x179f1(%rip), %rdi     # 0x38510
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x6060
movq 0x1748f(%rip), %rdi     # 0x37fc0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
leaq 0x179d9(%rip), %rsi     # 0x38518
jmp 0x20b60
movq 0x179b8(%rip), %rax     # 0x38500
movq %rax, (%r14)
movq 0x1746e(%rip), %rdi     # 0x37fc0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movq 0x179a8(%rip), %rsi     # 0x38508
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6570
leaq 0x17b9d(%rip), %rdi     # 0x38710
callq 0x6550
testl %eax, %eax
je 0x20a9a
leaq 0x17989(%rip), %rdi     # 0x38510
callq 0x64f0
movq 0x1743d(%rip), %rdi     # 0x37fd0
leaq 0x17976(%rip), %rsi     # 0x38510
leaq 0x17747(%rip), %rdx     # 0x382e8
callq 0x6290
leaq 0x17b63(%rip), %rdi     # 0x38710
callq 0x61b0
jmp 0x20a9a
movq %rax, %rbx
leaq 0x17b4f(%rip), %rdi     # 0x38710
callq 0x61a0
movq %rbx, %rdi
callq 0x6530
// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/main.cpp
// Function: main_tac_create(main_args, AST*)
Tac* main_tac_create(main_args args, AST *ast){

    Tac* tac = ast->to_tac();
    if (args.to_separate_archives) {
        main_redirect_stdout("bla.tac");
    }
    tac->dump(cout, args.tac_with_comments);

    if (!args.to_separate_archives) {
        cout << "-------------------------------------------------------" << endl << endl;
    }

    return tac;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movq (%rdx), %rax
movq %rdx, %rdi
callq *0x10(%rax)
movq %rax, %rbx
btl $0x8, %r14d
jb 0x20c27
shrl $0x18, %r14d
andl $0x1, %r14d
movq 0x173c8(%rip), %r15     # 0x37fc0
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x21416
leaq 0x7ecc(%rip), %rsi      # 0x28ad9
movq %r15, %rdi
callq 0x62b0
movq %rax, %rdi
callq 0x6130
movq %rax, %rdi
callq 0x6130
jmp 0x20c4d
leaq 0x7fd5(%rip), %rdi      # 0x28c03
callq 0x20a85
shrl $0x18, %r14d
andl $0x1, %r14d
movq 0x1737e(%rip), %rsi     # 0x37fc0
movq %rbx, %rdi
movl %r14d, %edx
callq 0x21416
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/main.cpp
// Function: main_tac_dump(main_args, Tac*)
void main_tac_dump(main_args args, Tac* tac)
{
    main_redirect_stdout();
    cout << "Escribiendo bloques básico en bla.blocks"
         << " y grafo de flujo en bla.png\n\n";
    dump_in_file("bla");

    if (!args.to_separate_archives && !args.to_single_archive) {
        cout << "-------------------------------------------------------" << endl << endl;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %edi, %edi
callq 0x20a85
movq 0x17340(%rip), %rdi     # 0x37fc0
leaq 0x7f84(%rip), %rsi      # 0x28c0b
callq 0x62b0
leaq 0x7fa2(%rip), %rsi      # 0x28c35
movq %rax, %rdi
callq 0x62b0
leaq 0x46d1(%rip), %rsi      # 0x25373
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x6d6c
movq %r14, %rdi
callq 0x17489
leaq 0x8(%rsp), %rdi
callq 0x65c8
btl $0x8, %ebx
jb 0x20cf4
testb $0x1, %bl
jne 0x20cf4
movq 0x172e8(%rip), %rdi     # 0x37fc0
leaq 0x7dfa(%rip), %rsi      # 0x28ad9
callq 0x62b0
movq %rax, %rdi
callq 0x6130
movq %rax, %rdi
callq 0x6130
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x65c8
movq %rbx, %rdi
callq 0x6530
// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/Tac.cpp
// Function: Tac::backpatch(std::__cxx11::list<int, std::allocator<int>>&, int)
void Tac::backpatch(list<int>& l, int instr){
    list<int>::iterator it;
    for (it = l.begin(); it != l.end(); ++it){
        quad* in = (quad*)(*(block->instructions.vinst))[*it];
        in->arg2 = new opd(instr, O_LABEL);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r15
movq %rsi, %r14
movq (%r14), %r14
cmpq %r12, %r14
je 0x213e2
movq (%r15), %rax
movq 0x8(%rax), %rax
movslq 0x10(%r14), %rcx
movq (%rax), %rax
movq (%rax,%rcx,8), %rbp
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r13
movq %rax, %rdi
movl %ebx, %esi
pushq $0x6
popq %rdx
callq 0x1815e
movq %r13, 0x20(%rbp)
jmp 0x213aa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r13, %rdi
callq 0x62e0
movq %rbx, %rdi
callq 0x6530
nop
// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/Tac.cpp
// Function: Tac::to_spim()
Spim* Tac::to_spim()
{
    Spim* spim = new Spim(this);
    
    vector<Block*>::iterator itb = list_of_blocks.begin();
    bool in = false, out = false;
    for( ; itb != list_of_blocks.end(); ++itb){
        list<inst*>::iterator iti = (*itb)->instructions.linst->begin();
        for( ; iti != (*itb)->instructions.linst->end(); ++iti){
            const inst i = **iti;
            in = !out && (in || (i.op == inst::PROLOGUE && !i.arg2->data.sym->getName().compare("main")));
            if (in) {
                switch (i.op) {
                case inst::WRITE:
                    //spim->append_inst(Spim_Inst::LI);
                    //spim->append_inst(Spim_Inst::LI);
                default:
                    break;
                }
                //spim->append_inst(*iti);
            }
            out = out || (i.op == inst::EPILOGUE && !i.arg2->data.sym->getName().compare("main"));
            if (out && in) {
                // ep�logo main
                //spim->append_inst(Spim_Inst::LI, new opd(10));
                //spim->append_inst(Spim_Inst::LI);
            }
        }
    }
    return spim;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
pushq $0x28
popq %rdi
callq 0x62d0
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x215a4
leaq 0x16f62(%rip), %rax     # 0x383b0
movq (%rax), %rbp
xorl %ebx, %ebx
leaq 0x10(%rsp), %r14
leaq 0x58(%rsp), %r15
xorl %r12d, %r12d
leaq 0x16f49(%rip), %rax     # 0x383b0
cmpq 0x8(%rax), %rbp
je 0x21538
movq (%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, %r13
movq (%r13), %r13
cmpq %rax, %r13
je 0x2152f
movq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0x21576
testb $0x1, %r12b
je 0x214a2
movb $0x1, %r12b
xorl %ebx, %ebx
jmp 0x2151a
movl 0x1c(%rsp), %eax
cmpl $0xe, %eax
setne %cl
orb %bl, %cl
testb $0x1, %cl
jne 0x214e3
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x13efa
movq %r15, %rdi
leaq 0x26ac(%rip), %rsi      # 0x23b79
callq 0x60d0
testl %eax, %eax
sete %bl
movq %r15, %rdi
callq 0x65c8
movl 0x1c(%rsp), %eax
cmpl $0xf, %eax
jne 0x21517
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x13efa
movq %r15, %rdi
leaq 0x2677(%rip), %rsi      # 0x23b79
callq 0x60d0
testl %eax, %eax
sete %r12b
movq %r15, %rdi
callq 0x65c8
jmp 0x2151a
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x1a20c
movq (%rbp), %rax
movq 0x8(%rax), %rax
jmp 0x2147c
addq $0x8, %rbp
jmp 0x21460
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
pushq $0x28
popq %rsi
movq 0x8(%rsp), %rdi
callq 0x62e0
jmp 0x2156d
jmp 0x21560
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x1a20c
movq %r14, %rdi
callq 0x6530
nop
// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/codegen.cpp
// Function: register_descriptor::release_cost()
int register_descriptor::release_cost(){
    
    int cost = 0;
    set<symbol*>::iterator it = variables_available.begin();
    
    for ( ; it != variables_available.end(); ++it){
        symbol* s = *it;
        if ( s->availability.size() == 1 )
            cost++;
    }
    
    return cost;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40(%rdi), %rax
addq $0x30, %rbx
xorl %ebp, %ebp
cmpq %rbx, %rax
je 0x21819
movq 0x20(%rax), %rcx
xorl %edx, %edx
cmpq $0x1, 0x70(%rcx)
sete %dl
addl %edx, %ebp
movq %rax, %rdi
callq 0x6330
jmp 0x217fa
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/uri.c
// Function: uri_parts
void
uri_parts(char const *request, URIREF *uri)
{
    char const  *ap, *cp = find(request, 1);   // brk ":/?#\0"
    memset(uri, 0, sizeof(URIREF));

    if (cp > request && cp[0] == ':' && cp[1] == '/' && cp[2] == '/') {
        uri->scheme = (MEMREF){request, cp - request};
        cp += 3;
    } else {
        cp = request;
    }

    if (cp[0] == '/' && cp[1] == '/') {
        // Do not use find(): auth may contain ':'
        // and password may contain anything except '@'
        //  and query or fragment may contain "@"??
        if ((ap = strchr(cp += 2, '@'))) { // BasicAuth
            uri->auth = (MEMREF){cp, ap - cp};
            cp = ap + 1;
        }
    }

    uri->host.ptr = cp;
    cp = find(cp, 1);   // brk ":/?#\0"
    if (!(uri->host.len = cp - uri->host.ptr))
        uri->host.ptr = NULL;

    if (*cp == ':') {
        uri->port.ptr = ++cp;
        cp = find(cp, 2);    // brk "/?#\0"
        uri->port.len = cp - uri->port.ptr;
    }

    if (*cp == '/') {
        uri->path.ptr = ++cp;
        cp = find(cp, 3);    // brk "#?\0"
        uri->path.len = cp - uri->path.ptr;
    }

    if (*cp == '?') {
        uri->query.ptr = ++cp;
        cp = find(cp, 4);    // brk "#\0"
        uri->query.len = cp - uri->query.ptr;
    }

    if (*cp == '#') {
        uri->fragment.len = strlen(uri->fragment.ptr = cp + 1);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rsi
callq 0x4ce4
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x60(%rbx)
movq %rax, %rcx
subq %r14, %rcx
jbe 0x4bfc
cmpb $0x3a, (%rax)
jne 0x4bfc
cmpb $0x2f, 0x1(%rax)
jne 0x4bfc
cmpb $0x2f, 0x2(%rax)
jne 0x4bfc
movq %r14, (%rbx)
movq %rcx, 0x8(%rbx)
addq $0x3, %rax
movq %rax, %r14
cmpb $0x2f, (%r14)
jne 0x4c31
cmpb $0x2f, 0x1(%r14)
jne 0x4c31
addq $0x2, %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x3090
testq %rax, %rax
je 0x4c31
movq %rax, %rcx
subq %r14, %rcx
movq %r14, 0x10(%rbx)
movq %rcx, 0x18(%rbx)
incq %rax
movq %rax, %r14
movq %r14, 0x20(%rbx)
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x4ce4
movq %rax, %r15
subq %r14, %rax
movq %rax, 0x28(%rbx)
jne 0x4c51
andq $0x0, 0x20(%rbx)
movb (%r15), %cl
cmpb $0x3a, %cl
jne 0x4c7a
incq %r15
movq %r15, 0x30(%rbx)
pushq $0x2
popq %rsi
movq %r15, %rdi
callq 0x4ce4
movq %rax, %rcx
subq %r15, %rcx
movq %rcx, 0x38(%rbx)
movb (%rax), %cl
movq %rax, %r15
cmpb $0x2f, %cl
jne 0x4ca0
incq %r15
movq %r15, 0x40(%rbx)
pushq $0x3
popq %rsi
movq %r15, %rdi
callq 0x4ce4
movq %rax, %rcx
subq %r15, %rcx
movq %rcx, 0x48(%rbx)
movb (%rax), %cl
movq %rax, %r15
cmpb $0x3f, %cl
jne 0x4cc6
incq %r15
movq %r15, 0x50(%rbx)
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x4ce4
movq %rax, %rcx
subq %r15, %rcx
movq %rcx, 0x58(%rbx)
movb (%rax), %cl
movq %rax, %r15
cmpb $0x23, %cl
jne 0x4cde
incq %r15
movq %r15, 0x60(%rbx)
movq %r15, %rdi
callq 0x30a0
movq %rax, 0x68(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/main.cpp
// Function: main
int main(int argc, char* argv[])
{
    mg_init();
    Zobrist::init();
    bb_init();
    uci();
    return 0;
}

// Assembly:
pushq %rax
callq 0xd1d0
callq 0x159ac
callq 0xafd0
callq 0x15201
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/MagicMoves.cpp
// Function: initmagicmoves_occ(int const*, int, unsigned long long)
U64 initmagicmoves_occ(const int* squares, const int numSquares, const U64 linocc)
{
	int i;
	U64 ret=0;
	for(i=0;i<numSquares;i++)
		if(linocc&(((U64)(1))<<i)) ret|=(((U64)(1))<<squares[i]);
	return ret;
}

// Assembly:
xorl %ecx, %ecx
testl %esi, %esi
cmovlel %ecx, %esi
xorl %eax, %eax
cmpq %rcx, %rsi
je 0xad3d
btq %rcx, %rdx
jae 0xad38
movb (%rdi,%rcx,4), %r8b
btsq %r8, %rax
incq %rcx
jmp 0xad25
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/MagicMoves.cpp
// Function: initmagicmoves_Rmoves(int, unsigned long long)
U64 initmagicmoves_Rmoves(const int square, const U64 occ)
{
	U64 ret=0;
	U64 bit;
	U64 rowbits=(((U64)0xFF)<<(8*(square/8)));
	
	bit=(((U64)(1))<<square);
	do
	{
		bit<<=8;
		ret|=bit;
	}while(bit && !(bit&occ));
	bit=(((U64)(1))<<square);
	do
	{
		bit>>=8;
		ret|=bit;
	}while(bit && !(bit&occ));
	bit=(((U64)(1))<<square);
	do
	{
		bit<<=1;
		if(bit&rowbits) ret|=bit;
		else break;
	}while(!(bit&occ));
	bit=(((U64)(1))<<square);
	do
	{
		bit>>=1;
		if(bit&rowbits) ret|=bit;
		else break;
	}while(!(bit&occ));
	return ret;
}

// Assembly:
movl %edi, %ecx
pushq $0x8
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
movl %eax, %edx
pushq $0x1
popq %rdi
shlq %cl, %rdi
shll $0x3, %edx
xorl %eax, %eax
movq %rdi, %rcx
shlq $0x8, %rcx
orq %rcx, %rax
testq %rcx, %rcx
je 0xad6c
movq %rcx, %r8
andq %rsi, %r8
je 0xad58
movq %rdi, %rcx
movq %rcx, %r8
shrq $0x8, %rcx
orq %rcx, %rax
cmpq $0x100, %r8             # imm = 0x100
jb 0xad8a
movq %rcx, %r8
andq %rsi, %r8
je 0xad6f
movl $0xff, %r8d
movl %edx, %ecx
shlq %cl, %r8
movq %rdi, %rcx
addq %rcx, %rcx
testq %r8, %rcx
je 0xadb2
orq %rcx, %rax
testq %rsi, %rcx
je 0xad98
jmp 0xadb2
orq %rdi, %rax
testq %rsi, %rdi
jne 0xadba
shrq %rdi
testq %r8, %rdi
jne 0xadaa
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/MagicMoves.cpp
// Function: initmagicmoves_Bmoves(int, unsigned long long)
U64 initmagicmoves_Bmoves(const int square, const U64 occ)
{
	U64 ret=0;
	U64 bit;
	U64 bit2;
	U64 rowbits=(((U64)0xFF)<<(8*(square/8)));
	
	bit=(((U64)(1))<<square);
	bit2=bit;
	do
	{
		bit<<=8-1;
		bit2>>=1;
		if(bit2&rowbits) ret|=bit;
		else break;
	}while(bit && !(bit&occ));
	bit=(((U64)(1))<<square);
	bit2=bit;
	do
	{
		bit<<=8+1;
		bit2<<=1;
		if(bit2&rowbits) ret|=bit;
		else break;
	}while(bit && !(bit&occ));
	bit=(((U64)(1))<<square);
	bit2=bit;
	do
	{
		bit>>=8-1;
		bit2<<=1;
		if(bit2&rowbits) ret|=bit;
		else break;
	}while(bit && !(bit&occ));
	bit=(((U64)(1))<<square);
	bit2=bit;
	do
	{
		bit>>=8+1;
		bit2>>=1;
		if(bit2&rowbits) ret|=bit;
		else break;
	}while(bit && !(bit&occ));
	return ret;
}

// Assembly:
pushq $0x8
popq %rcx
movl %edi, %eax
cltd
idivl %ecx
leal (,%rax,8), %ecx
movl $0xff, %edx
shlq %cl, %rdx
pushq $0x1
popq %r8
movl %edi, %ecx
shlq %cl, %r8
xorl %eax, %eax
movq %r8, %rcx
movq %r8, %rdi
shrq %rdi
testq %rdx, %rdi
je 0xadff
shlq $0x7, %rcx
orq %rcx, %rax
testq %rcx, %rcx
je 0xadff
movq %rcx, %r9
andq %rsi, %r9
je 0xade3
movq %r8, %rcx
movq %r8, %rdi
addq %rdi, %rdi
testq %rdx, %rdi
je 0xae21
shlq $0x9, %rcx
orq %rcx, %rax
testq %rcx, %rcx
je 0xae21
movq %rcx, %r9
andq %rsi, %r9
je 0xae05
movq %r8, %rdi
movq %r8, %rcx
addq %rcx, %rcx
testq %rdx, %rcx
je 0xae4d
movq %rdi, %r9
shrq $0x7, %r9
orq %r9, %rax
cmpq $0x80, %rdi
jb 0xae4d
movq %r9, %r10
movq %r9, %rdi
andq %rsi, %r10
je 0xae27
movq %r8, %rcx
shrq %rcx
testq %rdx, %rcx
je 0xae76
movq %r8, %rdi
shrq $0x9, %rdi
orq %rdi, %rax
cmpq $0x200, %r8             # imm = 0x200
jb 0xae76
movq %rdi, %r9
movq %rdi, %r8
andq %rsi, %r9
je 0xae50
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.cpp
// Function: print_bb(unsigned long long)
void print_bb(U64 bb)
{
    const U64 MSB = 0x8000000000000000ULL;
    std::string ret;
    for (int i = 0; i < 64; ++i)
    {
        if (i % 8 == 0)
        {
            if (i != 0)
            {
                ret.append("\n");
            }
            for (int j = 0; j < 8; ++j)
            {
                ret.append("+-");
            }
            ret.append("+\n|");
        }
        U64 bit = pow(2, i);
        if (bb << i & MSB)
        {
            ret.append("1|");
        }
        else
        {
            ret.append("0|");
        }
    }
    ret.append("\n");
    for (int j = 0; j < 8; ++j)
    {
        ret.append("+-");
    }
    ret.append("+\n");
    std::cout << ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r14d, %r14d
leaq 0x8(%rsp), %r12
leaq 0xb55f(%rip), %r13      # 0x16ad0
leaq 0xb55f(%rip), %r15      # 0x16ad7
cmpq $0x40, %r14
je 0xb5ed
testb $0x7, %r14b
jne 0xb5bc
testq %r14, %r14
je 0xb598
movq %r12, %rdi
leaq 0xb54b(%rip), %rsi      # 0x16ade
callq 0x43e0
pushq $0x8
popq %rbp
subl $0x1, %ebp
jb 0xb5ad
movq %r12, %rdi
movq %r13, %rsi
callq 0x43e0
jmp 0xb59b
movq %r12, %rdi
leaq 0xb51c(%rip), %rsi      # 0x16ad3
callq 0x43e0
cvtsi2sd %r14d, %xmm0
callq 0x41f0
movq %rbx, %rax
movl %r14d, %ecx
shlq %cl, %rax
testq %rax, %rax
movq %r15, %rsi
leaq 0xb4fe(%rip), %rax      # 0x16ada
cmovnsq %rax, %rsi
movq %r12, %rdi
callq 0x43e0
incq %r14
jmp 0xb578
leaq 0xb4ea(%rip), %rsi      # 0x16ade
leaq 0x8(%rsp), %rdi
callq 0x43e0
pushq $0x8
popq %rbp
leaq 0xb4c8(%rip), %rbx      # 0x16ad0
leaq 0x8(%rsp), %r14
subl $0x1, %ebp
jb 0xb61f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x43e0
jmp 0xb60d
leaq 0xb4b7(%rip), %rsi      # 0x16add
leaq 0x8(%rsp), %rdi
callq 0x43e0
movq 0x17961(%rip), %rdi     # 0x22f98
leaq 0x8(%rsp), %rsi
callq 0x41e0
leaq 0x8(%rsp), %rdi
callq 0x4418
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb662
jmp 0xb662
jmp 0xb662
jmp 0xb662
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4418
movq %rbx, %rdi
callq 0x43d0
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.h
// Function: east_fill(unsigned long long)
inline
U64 east_fill(U64 gen) 
{
   const U64 pr0 = Not_h_file;
   const U64 pr1 = pr0 & (pr0 << 1);
   const U64 pr2 = pr1 & (pr1 << 2);
   gen |= pr0 & (gen  << 1);
   gen |= pr1 & (gen  << 2);
   gen |= pr2 & (gen  << 4);
   return gen;
}

// Assembly:
leaq (%rdi,%rdi), %rax
movabsq $-0x101010101010102, %rcx # imm = 0xFEFEFEFEFEFEFEFE
andq %rax, %rcx
orq %rdi, %rcx
leaq (,%rcx,4), %rax
movabsq $-0x303030303030304, %rdx # imm = 0xFCFCFCFCFCFCFCFC
andq %rax, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shlq $0x4, %rcx
movabsq $-0xf0f0f0f0f0f0f10, %rax # imm = 0xF0F0F0F0F0F0F0F0
andq %rcx, %rax
orq %rdx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.h
// Function: west_fill(unsigned long long)
inline
U64 west_fill(U64 gen) 
{
   const U64 pr0 = Not_a_file;
   const U64 pr1 = pr0 & (pr0 >> 1);
   const U64 pr2 = pr1 & (pr1 >> 2);
   gen |= pr0 & (gen >> 1);
   gen |= pr1 & (gen >> 2);
   gen |= pr2 & (gen >> 4);
   return gen;
}

// Assembly:
movq %rdi, %rax
shrq %rax
movabsq $0x7f7f7f7f7f7f7f7f, %rcx # imm = 0x7F7F7F7F7F7F7F7F
andq %rax, %rcx
orq %rdi, %rcx
movq %rcx, %rax
shrq $0x2, %rax
movabsq $0x3f3f3f3f3f3f3f3f, %rdx # imm = 0x3F3F3F3F3F3F3F3F
andq %rax, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x4, %rcx
movabsq $0xf0f0f0f0f0f0f0f, %rax # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
orq %rdx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.h
// Function: north_east_fill(unsigned long long)
inline
U64 north_east_fill(U64 gen) 
{
   const U64 pr0 = Not_h_file;
   const U64 pr1 = pr0 & (pr0 <<  9);
   const U64 pr2 = pr1 & (pr1 << 18);
   gen |= pr0 & (gen <<  9);
   gen |= pr1 & (gen << 18);
   gen |= pr2 & (gen << 36);
   return gen;
}

// Assembly:
movq %rdi, %rax
shlq $0x9, %rax
movabsq $-0x101010101010200, %rcx # imm = 0xFEFEFEFEFEFEFE00
andq %rax, %rcx
orq %rdi, %rcx
movq %rcx, %rax
shlq $0x12, %rax
movabsq $-0x303030303040000, %rdx # imm = 0xFCFCFCFCFCFC0000
andq %rax, %rdx
orq %rcx, %rdx
movl %edx, %eax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
shlq $0x24, %rax
orq %rdx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.h
// Function: north_west_fill(unsigned long long)
inline
U64 north_west_fill(U64 gen) 
{
   const U64 pr0 = Not_a_file;
   const U64 pr1 = pr0 & (pr0 <<  7);
   const U64 pr2 = pr1 & (pr1 << 14);
   gen |= pr0 & (gen <<  7);
   gen |= pr1 & (gen << 14);
   gen |= pr2 & (gen << 28);
   return gen;
}

// Assembly:
movq %rdi, %rax
shlq $0x7, %rax
movabsq $0x7f7f7f7f7f7f7f00, %rcx # imm = 0x7F7F7F7F7F7F7F00
andq %rax, %rcx
orq %rdi, %rcx
movq %rcx, %rax
shlq $0xe, %rax
movabsq $0x3f3f3f3f3f3f0000, %rdx # imm = 0x3F3F3F3F3F3F0000
andq %rax, %rdx
orq %rcx, %rdx
movl %edx, %eax
andl $0xf0f0f0f0, %eax       # imm = 0xF0F0F0F0
shlq $0x1c, %rax
orq %rdx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.h
// Function: south_east_fill(unsigned long long)
inline
U64 south_east_fill(U64 gen) 
{
   const U64 pr0 = Not_h_file;
   const U64 pr1 = pr0 & (pr0 >>  7);
   const U64 pr2 = pr1 & (pr1 >> 14);
   gen |= pr0 & (gen >>  7);
   gen |= pr1 & (gen >> 14);
   gen |= pr2 & (gen >> 28);
   return gen;
}

// Assembly:
movq %rdi, %rax
shrq $0x7, %rax
movabsq $0xfefefefefefefe, %rcx # imm = 0xFEFEFEFEFEFEFE
andq %rax, %rcx
orq %rdi, %rcx
movq %rcx, %rax
shrq $0xe, %rax
movabsq $0xfcfcfcfcfcfc, %rdx   # imm = 0xFCFCFCFCFCFC
andq %rax, %rdx
orq %rcx, %rdx
movq %rdx, %rax
shrq $0x1c, %rax
andl $0xf0f0f0f0, %eax       # imm = 0xF0F0F0F0
orq %rdx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/bitboard.h
// Function: south_west_fill(unsigned long long)
inline
U64 south_west_fill(U64 gen) 
{
   const U64 pr0 = Not_a_file;
   const U64 pr1 = pr0 & (pr0 >>  9);
   const U64 pr2 = pr1 & (pr1 >> 18);
   gen |= pr0 & (gen >>  9);
   gen |= pr1 & (gen >> 18);
   gen |= pr2 & (gen >> 36);
   return gen;
}

// Assembly:
movq %rdi, %rax
shrq $0x9, %rax
movabsq $0x7f7f7f7f7f7f7f, %rcx # imm = 0x7F7F7F7F7F7F7F
andq %rax, %rcx
orq %rdi, %rcx
movq %rcx, %rax
shrq $0x12, %rax
movabsq $0x3f3f3f3f3f3f, %rdx   # imm = 0x3F3F3F3F3F3F
andq %rax, %rdx
orq %rcx, %rdx
movq %rdx, %rax
shrq $0x24, %rax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
orq %rdx, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/evaluation.cpp
// Function: int Evaluate::outpost<(PieceType)1>(Square, Color)
int Evaluate::outpost(Square p, Color c)
{
    int score;
    // To be an outpost, the piece must be supported by a friendly pawn
    // and unable to be attacked by an opponents pawn.
    if (   !(p & outpost_area[c])
        || !(pawn_attacks[!c][p] & mState.getPieceBB<pawn>(c))
        || in_front[c][p] & adj_files[p] & mState.getPieceBB<pawn>(!c))
        return 0;

    score = PieceSquareTable::outpost[PT == bishop][c][p];

    // Extra bonus if the outpost cannot be captured by a minor piece.
    if (   !mState.getPieceBB<knight>(!c)
        && !(mState.getPieceBB<bishop>(!c) & squares_of_color(p)))
        score *= 2;

    return score;
}

// Assembly:
movl %edx, %ecx
leaq 0x13baef(%rip), %r9     # 0x148680
movl %esi, %r8d
leaq 0x119ee5(%rip), %rax    # 0x126a80
movq (%rax,%r8,8), %rsi
xorl %eax, %eax
testq %rsi, (%r9,%rcx,8)
je 0xcc02
xorl %r9d, %r9d
testl %edx, %edx
sete %r9b
movl %r9d, %r10d
shll $0x9, %r10d
addq 0x163ea(%rip), %r10     # 0x22fa8
movq 0x8(%rdi), %rdx
imulq $0x30, %rcx, %rdi
movq 0x288(%rdx,%rdi), %rdi
testq %rdi, (%r10,%r8,8)
je 0xcc02
movq %rcx, %rdi
shlq $0x9, %rdi
addq 0x163be(%rip), %rdi     # 0x22fa0
leaq 0x13b097(%rip), %r10    # 0x147c80
movq (%r10,%r8,8), %r10
andq (%rdi,%r8,8), %r10
addq $0x288, %rdx            # imm = 0x288
imulq $0x30, %r9, %rdi
testq %r10, (%rdx,%rdi)
je 0xcc03
retq
shlq $0x8, %rcx
leaq 0xa6c2(%rip), %rax      # 0x172d0
addq %rcx, %rax
movl (%rax,%r8,4), %eax
cmpq $0x0, 0x8(%rdx,%rdi)
jne 0xcc02
movabsq $0x55aa55aa55aa55aa, %rcx # imm = 0x55AA55AA55AA55AA
testq %rcx, %rsi
movabsq $-0x55aa55aa55aa55ab, %rsi # imm = 0xAA55AA55AA55AA55
cmovneq %rcx, %rsi
testq %rsi, 0x10(%rdx,%rdi)
sete %cl
shll %cl, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/line_manager.cpp
// Function: LineManager::pushToPv(unsigned short, unsigned long long, int, int)
void LineManager::pushToPv(Move pMove, U64 pKey, int pPly, int pScore)
{
    // Check if this is a mating line.
    mMatingLine = std::abs(pScore) + Max_ply >= Checkmate ? true : false;

    // Find the indicies using the triangular forumla.
    int copyTo = triangularIndex(pPly);
    int copyFromStart = triangularIndex(pPly + 1);
    int copyFromEnd = copyFromStart + Max_ply - pPly - 1;

    // Store the current move.
    mPv[copyTo++] = std::make_pair(pMove, pKey);

    // Copy from the previous iteration.
    std::copy(std::make_move_iterator(mPv.begin() + copyFromStart), 
              std::make_move_iterator(mPv.begin() + copyFromEnd), 
              mPv.begin() + copyTo);
}

// Assembly:
movq %rdx, %r9
movl %r8d, %eax
negl %eax
cmovsl %r8d, %eax
cmpl $0x7fcd, %eax           # imm = 0x7FCD
setae 0x4fb0(%rdi)
pushq $0x65
popq %rax
subl %ecx, %eax
imull %ecx, %eax
pushq $0x2
popq %r10
cltd
idivl %r10d
movl %eax, %r8d
leal 0x1(%rcx), %edx
pushq $0x64
popq %rax
subl %ecx, %eax
imull %edx, %eax
cltd
idivl %r10d
movslq %eax, %r10
subl %ecx, %eax
addl $0x31, %eax
movslq %r8d, %rcx
shlq $0x4, %rcx
leaq (%rdi,%rcx), %rdx
addq $0x10, %rdx
movw %si, -0x10(%rdx)
movq %r9, -0x8(%rdx)
shlq $0x4, %r10
addq %rdi, %r10
movslq %eax, %rsi
shlq $0x4, %rsi
addq %rdi, %rsi
movq %r10, %rdi
jmp 0xd1a4
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/line_manager.cpp
// Function: LineManager::checkPv(State&)
void LineManager::checkPv(State& pState)
{
    State c;
    Move nextMove;
    std::memmove(&c, &pState, sizeof(pState));
    for (int i = 0; i < Max_ply; ++i)
    {
        nextMove = mPv[i].first;
        if (nextMove == nullMove)
        {
            mSize = i;
            break;
        }
        // Push moves to the move list.
        MoveList moveList(c);

        // If the next pv move is in the move list, make the move.
        if (moveList.contains(nextMove))
            c.make_t(nextMove);
        // If the next pv move is not found, break the loop.
        else
        {
            mSize = i;
            break;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd68, %rsp            # imm = 0xD68
movq %rdi, %rbx
leaq 0x860(%rsp), %r14
movl $0x508, %edx            # imm = 0x508
movq %r14, %rdi
callq 0x41c0
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq %rbx, (%rsp)
cmpq $0x32, %r15
je 0xcfad
movzwl (%rbx), %ebp
testw %bp, %bp
je 0xcfa2
movq %r12, %rdi
movq %r14, %rsi
callq 0xdbd4
movzwl %bp, %r13d
movq %r12, %rdi
movl %r13d, %esi
callq 0xd298
movl %eax, %ebp
testb %al, %al
je 0xcf7c
movq %r14, %rdi
movl %r13d, %esi
callq 0x13694
jmp 0xcf87
movq (%rsp), %rax
movq %r15, 0x4fb8(%rax)
leaq 0x838(%rsp), %rdi
callq 0xd138
incq %r15
addq $0x10, %rbx
testb %bpl, %bpl
jne 0xcf41
jmp 0xcfad
movq (%rsp), %rax
movq %r15, 0x4fb8(%rax)
addq $0xd68, %rsp            # imm = 0xD68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x838(%rsp), %rdi
callq 0xd138
movq %rbx, %rdi
callq 0x43d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move.h
// Function: toString[abi:cxx11](unsigned short)
inline std::string toString(Move m)
{
	std::string ret;
	Square src, dst;

	src = getSrc(m);
	dst = getDst(m);

	ret = SQ[src] + SQ[dst];

	switch (getPiecePromo(m))
	{
		case knight:
			ret += "n";
			break;
		case bishop:
			ret += "b";
			break;
		case rook:
			ret += "r";
			break;
		case queen:
			ret += "q";
			break;
		default:
			break;
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movl %esi, %ebp
movb $0x0, 0x10(%rdi)
movl %esi, %edx
shrl $0x6, %edx
andl $0x3f, %edx
andl $0x3f, %esi
shll $0x5, %esi
leaq 0x16c1f3(%rip), %rax    # 0x1792b0
addq %rax, %rsi
shll $0x5, %edx
addq %rax, %rdx
movq %rsp, %rdi
callq 0xd16b
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42a0
movq %r14, %rdi
callq 0x4418
shrl $0xc, %ebp
andl $0x7, %ebp
decl %ebp
cmpw $0x4, %bp
jae 0xd10b
movzwl %bp, %eax
leaq 0xa604(%rip), %rcx      # 0x17700
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq %rbx, %rdi
callq 0x43e0
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xd119
movq %rax, %r14
movq %rbx, %rdi
callq 0x4418
movq %r14, %rdi
callq 0x43d0
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: MoveList::MoveList(State const&, unsigned short, History*, int, bool)
MoveList::MoveList(const State& pState, Move pBest, History* pHistory, int pPly, bool pQSearch)
: mState(pState), mValid(Full), mBest(pBest), mQSearch(pQSearch), mKiller1(nullMove), mKiller2(nullMove)
, mSize(0), mHistory(pHistory), mPly(pPly)
{
    if (pHistory)
    {
        mKiller1 = mHistory->getKiller(pPly).first;
        mKiller2 = mHistory->getKiller(pPly).second;
    }

    if (mState.inCheck())
    {
        Square k = mState.getKingSquare(mState.getOurColor());
        Square c = get_lsb(mState.getCheckersBB());
        mValid = between[k][c] | mState.getCheckersBB();
        mStage = nEvadeBestMove;
    }
    else
        mStage = mQSearch ? qBestMove : nBestMove;
}

// Assembly:
movb %r9b, (%rdi)
orq $-0x1, 0x8(%rdi)
movq %rsi, 0x18(%rdi)
movq %rcx, 0x20(%rdi)
movl %r8d, 0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x830(%rdi)
movups %xmm0, 0x840(%rdi)
movw %dx, 0x850(%rdi)
andl $0x0, 0x852(%rdi)
testq %rcx, %rcx
je 0xd21b
movslq %r8d, %rax
movl 0x18(%rcx,%rax,4), %eax
movl %eax, 0x852(%rdi)
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0xd250
movl (%rsi), %ecx
imulq $0xf0, %rcx, %rcx
movl 0x3f0(%rsi,%rcx), %ecx
bsfq %rax, %rdx
shlq $0x9, %rcx
addq 0x15d85(%rip), %rcx     # 0x22fc8
orq (%rcx,%rdx,8), %rax
movq %rax, 0x8(%rdi)
pushq $0xc
popq %rax
jmp 0xd25b
xorl %ecx, %ecx
testb %r9b, %r9b
pushq $0x7
popq %rax
cmovel %ecx, %eax
movl %eax, 0x2c(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: void MoveList::generateMoves<(MoveType)2>()
void MoveList::generateMoves<MoveType::Evasions>()
{
    assert(mState.inCheck());

    Square k, c;

    mValid = mState.getOccupancyBB(mState.getTheirColor()) | mState.getEmptyBB();
    pushMoves<MoveType::Evasions, king>();

    if (mState.inDoubleCheck())
        return;

    k = mState.getKingSquare(mState.getOurColor());
    c = get_lsb(mState.getCheckersBB());
    mValid = between[k][c] | mState.getCheckersBB();

    mState.getOurColor() == white ? pushPawnMoves<MoveType::Evasions, white>() 
                                  : pushPawnMoves<MoveType::Evasions, black>();
    pushMoves<MoveType::Evasions, knight>();
    pushMoves<MoveType::Evasions, bishop>();
    pushMoves<MoveType::Evasions, rook>();
    pushMoves<MoveType::Evasions, queen>();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movl 0x4(%rax), %ecx
movq 0x80(%rax), %rdx
orq 0x78(%rax), %rdx
notq %rdx
orq 0x78(%rax,%rcx,8), %rdx
movq %rdx, 0x8(%rdi)
callq 0xdc40
movq 0x18(%rbx), %rcx
movq 0x28(%rcx), %rax
movq %rax, %rdx
shrq %rdx
movabsq $0x5555555555555555, %rsi # imm = 0x5555555555555555
andq %rdx, %rsi
movq %rax, %rdx
subq %rsi, %rdx
movabsq $0x3333333333333333, %rsi # imm = 0x3333333333333333
movq %rdx, %rdi
andq %rsi, %rdi
shrq $0x2, %rdx
andq %rsi, %rdx
addq %rdi, %rdx
movq %rdx, %rsi
shrq $0x4, %rsi
addq %rdx, %rsi
movabsq $0xf0f0f0f0f0f0f0f, %rdx # imm = 0xF0F0F0F0F0F0F0F
andq %rsi, %rdx
movabsq $0x101010101010101, %rsi # imm = 0x101010101010101
imulq %rdx, %rsi
shrq $0x38, %rsi
cmpl $0x2, %esi
jne 0xd3c0
popq %rbx
retq
movl (%rcx), %edx
imulq $0xf0, %rdx, %rsi
movl 0x3f0(%rcx,%rsi), %ecx
bsfq %rax, %rsi
shlq $0x9, %rcx
addq 0x15be9(%rip), %rcx     # 0x22fc8
orq (%rcx,%rsi,8), %rax
movq %rax, 0x8(%rbx)
movq %rbx, %rdi
testq %rdx, %rdx
je 0xd3f6
callq 0xde52
jmp 0xd3fb
callq 0xdcbc
movq %rbx, %rdi
callq 0xdfe4
movq %rbx, %rdi
callq 0xe060
movq %rbx, %rdi
callq 0xe0ea
movq %rbx, %rdi
popq %rbx
jmp 0xe174
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: void MoveList::generateMoves<(MoveType)4>()
void MoveList::generateMoves<MoveType::All>()
{
    if (mState.inCheck())
    {
        generateMoves<MoveType::Evasions>();
        return;
    }

    mValid = mState.getOccupancyBB(mState.getTheirColor()) | mState.getEmptyBB();

    mState.getOurColor() == white ? pushPawnMoves<MoveType::All, white>() 
                                  : pushPawnMoves<MoveType::All, black>();
    pushMoves<MoveType::All, knight>();
    pushMoves<MoveType::All, bishop>();
    pushMoves<MoveType::All, rook>();
    pushMoves<MoveType::All, queen>();
    pushMoves<MoveType::All, king>();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpq $0x0, 0x28(%rax)
je 0xd434
movq %rbx, %rdi
popq %rbx
jmp 0xd32e
movq 0x80(%rax), %rcx
orq 0x78(%rax), %rcx
movl 0x4(%rax), %edx
notq %rcx
orq 0x78(%rax,%rdx,8), %rcx
movq %rcx, 0x8(%rbx)
cmpl $0x0, (%rax)
je 0xd45d
movq %rbx, %rdi
callq 0xe38a
jmp 0xd465
movq %rbx, %rdi
callq 0xe1fe
movq %rbx, %rdi
callq 0xe50e
movq %rbx, %rdi
callq 0xe58a
movq %rbx, %rdi
callq 0xe614
movq %rbx, %rdi
callq 0xe69e
movq %rbx, %rdi
popq %rbx
jmp 0xe728
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: void MoveList::pushMoves<(MoveType)4, (PieceType)5>()
void MoveList::pushMoves()
{
    U64 m;
    Square dst;
    Color c = mState.getOurColor();

    for (Square src : mState.getPieceList<P>(c))
    {
        if (src == no_sq)
            break;

        m = mState.getAttackBB<P>(src) & mValid;

        if (T == MoveType::QuietChecks)
        {
            if (square_bb[src] & mDiscover)
            {
                if (P == king)
                    m &= ~coplanar[src][mState.getKingSquare(!c)];
            }
            else
                m &= mState.getCheckSquaresBB(P);
        }

        while (m)
            push(makeMove(src, pop_lsb(m)));

        if (P == king && T != MoveType::Attacks && T != MoveType::Evasions)
            pushCastle<T>();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movl (%rax), %ecx
imulq $0xf0, %rcx, %rcx
leaq (%rax,%rcx), %r14
addq $0x3f0, %r14            # imm = 0x3F0
xorl %r15d, %r15d
leaq 0x858b(%rip), %r12      # 0x16ce0
cmpq $0x28, %r15
je 0xe7b2
movl (%r14,%r15), %eax
cmpq $0x40, %rax
je 0xe7b2
movq 0x8(%rbx), %rdx
andq (%r12,%rax,8), %rdx
movq 0x848(%rbx), %rcx
addq $0x6, %rcx
testq %rdx, %rdx
je 0xe7a4
leaq -0x1(%rdx), %rsi
andq %rdx, %rsi
bsfq %rdx, %rdx
shll $0x6, %edx
orl %eax, %edx
leaq -0x5(%rcx), %rdi
movq %rdi, 0x848(%rbx)
movw %dx, (%rbx,%rcx,8)
incq %rcx
movq %rsi, %rdx
jmp 0xe778
movq %rbx, %rdi
callq 0xecc4
addq $0x4, %r15
jmp 0xe755
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: void MoveList::generateMoves<(MoveType)0>()
void MoveList::generateMoves()
{
    assert(!mState.inCheck());

    if (T == MoveType::QuietChecks)
        mDiscover = mState.getDiscoveredChecks(mState.getOurColor());

    mValid = T == MoveType::Attacks 
                ? mState.getOccupancyBB(mState.getTheirColor())
                : mState.getEmptyBB();

    mState.getOurColor() == white ? pushPawnMoves<T, white>() 
                                  : pushPawnMoves<T, black>();
    pushMoves<T, knight>();
    pushMoves<T, bishop>();
    pushMoves<T, rook>();
    pushMoves<T, queen>();
    pushMoves<T, king>();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movl 0x4(%rax), %ecx
movq 0x78(%rax,%rcx,8), %rcx
movq %rcx, 0x8(%rdi)
cmpl $0x0, (%rax)
je 0xe7e1
movq %rbx, %rdi
callq 0xef6a
jmp 0xe7e9
movq %rbx, %rdi
callq 0xee7a
movq %rbx, %rdi
callq 0xf04c
movq %rbx, %rdi
callq 0xf0c8
movq %rbx, %rdi
callq 0xf152
movq %rbx, %rdi
callq 0xf1dc
movq %rbx, %rdi
popq %rbx
jmp 0xf266
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/move_generator.cpp
// Function: void MoveList::pushCastle<(MoveType)4>()
void MoveList::pushCastle()
{
    Square k = mState.getKingSquare(mState.getOurColor());

    if (mState.canCastleKingside() &&
        !(between_hor[k][k-3] & mState.getOccupancyBB()) &&
        !mState.attacked(k-1) && 
        !mState.attacked(k-2)) 
    {
        if (T == MoveType::QuietChecks)
        {
            if (square_bb[k-1] & mState.getCheckSquaresBB(rook))
                push(makeCastle(k, k-2));
        }
        else
            push(makeCastle(k, k-2));
    }

    if (mState.canCastleQueenside() && 
        !(between_hor[k][k+4] & mState.getOccupancyBB()) && 
        !mState.attacked(k+1) && 
        !mState.attacked(k+2))
    {
        if (T == MoveType::QuietChecks)
        {
            if (square_bb[k+1] & mState.getCheckSquaresBB(rook))
                push(makeCastle(k, k+2));
        }
        else
            push(makeCastle(k, k+2));
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movl (%rdi), %eax
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
imulq $0xf0, %rax, %rax
movl 0x3f0(%rdi,%rax), %r14d
leal (%rcx,%rcx,2), %eax
incl %eax
testl %eax, 0xc(%rdi)
je 0xed58
leal -0x3(%r14), %eax
movq %r14, %rcx
shlq $0x9, %rcx
addq 0x142bc(%rip), %rcx     # 0x22fc0
movq 0x80(%rdi), %rdx
orq 0x78(%rdi), %rdx
testq %rdx, (%rcx,%rax,8)
jne 0xed58
leal -0x1(%r14), %esi
callq 0xedda
testb %al, %al
jne 0xed58
movq 0x18(%rbx), %rdi
leal -0x2(%r14), %ebp
movl %ebp, %esi
callq 0xedda
testb %al, %al
jne 0xed58
shll $0x6, %ebp
orl %r14d, %ebp
orl $0x8000, %ebp           # imm = 0x8000
movq 0x848(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x848(%rbx)
movw %bp, 0x30(%rbx,%rax,8)
movq 0x18(%rbx), %rdi
cmpl $0x0, (%rdi)
pushq $0x2
popq %rax
pushq $0x8
popq %rcx
cmovel %eax, %ecx
testl %ecx, 0xc(%rdi)
je 0xedd5
leal 0x4(%r14), %eax
movq %r14, %rcx
shlq $0x9, %rcx
addq 0x14241(%rip), %rcx     # 0x22fc0
movq 0x80(%rdi), %rdx
orq 0x78(%rdi), %rdx
testq %rdx, (%rcx,%rax,8)
jne 0xedd5
leal 0x1(%r14), %esi
callq 0xedda
testb %al, %al
jne 0xedd5
movq 0x18(%rbx), %rdi
movl %r14d, %ebp
addl $0x2, %ebp
movl %ebp, %esi
callq 0xedda
testb %al, %al
jne 0xedd5
shll $0x6, %ebp
orl %r14d, %ebp
orl $0x8000, %ebp           # imm = 0x8000
movq 0x848(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x848(%rbx)
movw %bp, 0x30(%rbx,%rax,8)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/state.h
// Function: State::attacked(Square) const
inline
bool State::attacked(Square s) const
{
    return getAttackBB< pawn >(s, mUs) &  getPieceBB< pawn >(mThem)
        || getAttackBB<knight>(s) &  getPieceBB<knight>(mThem)
        || getAttackBB<bishop>(s) & (getPieceBB<bishop>(mThem) | getPieceBB<queen>(mThem))
        || getAttackBB< rook >(s) & (getPieceBB< rook >(mThem) | getPieceBB<queen>(mThem));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movl (%rdi), %edx
movl 0x4(%rdi), %ecx
movl %esi, %eax
shlq $0x9, %rdx
addq 0x141b3(%rip), %rdx     # 0x22fa8
imulq $0x30, %rcx, %rcx
movq 0x288(%rdi,%rcx), %rsi
movb $0x1, %r14b
testq %rsi, (%rdx,%rax,8)
jne 0xee6c
movq %rdi, %rbx
leaq 0x288(%rdi), %r15
leaq 0x7cc5(%rip), %rdx      # 0x16ae0
movq 0x8(%r15,%rcx), %rcx
testq %rcx, (%rdx,%rax,8)
jne 0xee6c
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcd04
movl 0x4(%rbx), %ecx
imulq $0x30, %rcx, %rcx
movq 0x20(%r15,%rcx), %rdx
orq 0x10(%r15,%rcx), %rdx
testq %rax, %rdx
jne 0xee6c
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcd46
movl 0x4(%rbx), %ecx
imulq $0x30, %rcx, %rcx
movq 0x20(%r15,%rcx), %rdx
orq 0x18(%r15,%rcx), %rdx
testq %rax, %rdx
setne %r14b
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/perft.cpp
// Function: perft(State&, int)
int perft(State & s, int depth)
{
	int nodes = 0;

	if (s.getFiftyMoveRule() > 99)
		return nodes;

	MoveList mlist(s);

	if (depth == 1)
		return mlist.size();

	Move m;

	while (m = mlist.getBestMove())
	{
		State c(s);
		c.make_t(m);
		nodes += perft(c, depth-1);
	}

	return nodes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd68, %rsp            # imm = 0xD68
xorl %ebx, %ebx
cmpl $0x63, 0x8(%rdi)
jg 0x10776
movl %esi, %ebp
movq %rdi, %r14
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xdbd4
cmpl $0x1, %ebp
jne 0x1078a
leaq 0x8(%rsp), %rdi
callq 0xd260
movq %rax, %rbx
leaq 0x838(%rsp), %rdi
callq 0xd138
movl %ebx, %eax
addq $0xd68, %rsp            # imm = 0xD68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl %ebp
xorl %ebx, %ebx
leaq 0x8(%rsp), %r15
leaq 0x860(%rsp), %r12
movq %r15, %rdi
callq 0xd48e
movl %eax, %r13d
testw %ax, %ax
je 0x10769
movq %r12, %rdi
movq %r14, %rsi
callq 0x12874
movzwl %r13w, %esi
movq %r12, %rdi
callq 0x13694
movq %r12, %rdi
movl %ebp, %esi
callq 0x1072c
addl %eax, %ebx
jmp 0x1079b
jmp 0x107d4
jmp 0x107d4
movq %rax, %rbx
leaq 0x838(%rsp), %rdi
callq 0xd138
movq %rbx, %rdi
callq 0x43d0
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/perft.cpp
// Function: test(State, MoveList*, int, int)
void test(State s, MoveList* mList, int depth, int id)
{
	{
		std::unique_lock<std::mutex> lk(qMutex);
		cv.wait(lk, [] { return ready; });
	}

	Move m;

	{
		std::lock_guard<std::mutex> lk(qMutex);
		m = mList->getBestMove();
	}

	while (m != nullMove)
	{
		State c(s);
		c.make_t(m);
		int nodes = perft(c, depth - 1);
		
		{
			std::lock_guard<std::mutex> lk(qMutex);
			nodeCount.push_back(nodes);
			m = mList->getBestMove();
		} 
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1a263c(%rip), %rsi    # 0x1b2e48
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x10f06
leaq 0x1a25f8(%rip), %r13    # 0x1b2e18
cmpb $0x0, 0x1a25e9(%rip)    # 0x1b2e10
jne 0x10836
movq %r13, %rdi
movq %r12, %rsi
callq 0x40b0
jmp 0x10820
leaq 0x10(%rsp), %rdi
callq 0x10f1c
leaq 0x1a2601(%rip), %rdi    # 0x1b2e48
callq 0x11344
movq %r14, %rdi
callq 0xd48e
movl %eax, %ebp
leaq 0x1a25eb(%rip), %r12    # 0x1b2e48
movq %r12, %rdi
callq 0x41a0
decl %ebx
leaq 0x10(%rsp), %r13
testw %bp, %bp
je 0x108c2
movq %r13, %rdi
movq %r15, %rsi
callq 0x12874
movzwl %bp, %esi
movq %r13, %rdi
callq 0x13694
movq %r13, %rdi
movl %ebx, %esi
callq 0x1072c
movl %eax, 0xc(%rsp)
movq %r12, %rdi
callq 0x11344
leaq 0x1a261c(%rip), %rdi    # 0x1b2ec0
leaq 0xc(%rsp), %rsi
callq 0x10f32
movq %r14, %rdi
callq 0xd48e
movl %eax, %ebp
movq %r12, %rdi
callq 0x41a0
jmp 0x1086c
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x108d6
movq %rax, %rbx
leaq 0x1a2568(%rip), %rdi    # 0x1b2e48
callq 0x41a0
movq %rbx, %rdi
callq 0x43d0
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/perft.cpp
// Function: MTperft(State&, int)
int MTperft(State& s, int depth)
{
	unsigned int nThreads = std::thread::hardware_concurrency();
	std::vector<std::thread> threads;
	nodeCount.clear();
	MoveList mlist(s);

	for (unsigned int i = 0; i < nThreads; ++i)
		threads.push_back(std::thread(test, s, &mlist, depth, i));

	{
		std::lock_guard<std::mutex> lk(qMutex);
		ready = true;
		cv.notify_all();
	}

	for (std::thread& thread : threads)
		thread.join();

	return std::accumulate(nodeCount.begin(), nodeCount.end(), 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x898, %rsp            # imm = 0x898
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
callq 0x42c0
movl %eax, %ebp
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq 0x1a259f(%rip), %rax    # 0x1b2ec0
cmpq %rax, 0x1a25a0(%rip)    # 0x1b2ec8
je 0x10931
movq %rax, 0x1a2597(%rip)    # 0x1b2ec8
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0xdbd4
xorl %eax, %eax
leaq 0x38(%rsp), %r12
leaq 0xc(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x10(%rsp), %r13
movl %eax, 0x8(%rsp)
cmpl %ebp, %eax
jae 0x1099e
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r12, %rdi
leaq -0x184(%rip), %rsi      # 0x107ec
movq %rbx, %rdx
leaq 0x30(%rsp), %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x10f50
movq %r13, %rdi
movq %r12, %rsi
callq 0x11664
movq %r12, %rdi
callq 0x10ffa
movl 0x8(%rsp), %eax
incl %eax
jmp 0x10954
leaq 0x1a24a3(%rip), %rdi    # 0x1b2e48
callq 0x11344
movb $0x1, 0x1a245f(%rip)    # 0x1b2e10
leaq 0x1a2460(%rip), %rdi    # 0x1b2e18
callq 0x43a0
leaq 0x1a2484(%rip), %rdi    # 0x1b2e48
callq 0x41a0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r14
cmpq %r14, %rbx
je 0x109e6
movq %rbx, %rdi
callq 0x43b0
addq $0x8, %rbx
jmp 0x109d3
movq 0x1a24d3(%rip), %rax    # 0x1b2ec0
xorl %ebx, %ebx
movq 0x1a24d2(%rip), %rcx    # 0x1b2ec8
cmpq %rcx, %rax
je 0x10a03
addl (%rax), %ebx
addq $0x4, %rax
jmp 0x109f6
leaq 0x870(%rsp), %rdi
callq 0xd138
leaq 0x10(%rsp), %rdi
callq 0x11008
movl %ebx, %eax
addq $0x898, %rsp            # imm = 0x898
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10a46
movq %rax, %rbx
jmp 0x10a56
jmp 0x10a46
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x10ffa
jmp 0x10a49
movq %rax, %rbx
leaq 0x870(%rsp), %rdi
callq 0xd138
leaq 0x10(%rsp), %rdi
callq 0x11008
movq %rbx, %rdi
callq 0x43d0
// File: /workspace/github_cpp_makefile_star2_O2/SethKasmann[P]clever-girl/src/perft.cpp
// Function: perftTestDebug()
void perftTestDebug()
{
	int nodes;
	for (int i = 0; i < totalTests; ++i)
	{
		history.clear();
		State s(perftFen[i]);
		history.push(std::make_pair(nullMove, s.getKey()));
		nodes = MTperft(s, perftDepth[i]);
		//std::cout << perftFen[i] << std::endl;
		std::cout << (nodes == perftResults[i] ? "Success " : "Fail ")
		          << nodes << " == " << perftResults[i] << std::endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
leaq 0x199d3b(%rip), %rbx    # 0x1aaad0
xorl %ebp, %ebp
leaq 0x199f92(%rip), %r14    # 0x1aad30
leaq 0x10(%rsp), %r15
cmpq $0x4c, %rbp
je 0x10e57
movq %r14, %rdi
callq 0x11042
movq %r15, %rdi
movq %rbx, %rsi
callq 0x12a50
movq 0x28(%rsp), %rax
andw $0x0, (%rsp)
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %rsp, %rsi
callq 0x1121a
leaq 0x839f(%rip), %rax      # 0x19180
movl (%rbp,%rax), %esi
movq %r15, %rdi
callq 0x108ed
movl %eax, %r12d
leaq 0x83d9(%rip), %rax      # 0x191d0
movl (%rbp,%rax), %r13d
cmpl %r13d, %r12d
leaq 0x8351(%rip), %rsi      # 0x19157
leaq 0x8341(%rip), %rax      # 0x1914e
cmoveq %rax, %rsi
movq 0x12180(%rip), %rdi     # 0x22f98
callq 0x4240
movq %rax, %rdi
movl %r12d, %esi
callq 0x43c0
movq %rax, %rdi
leaq 0x832b(%rip), %rsi      # 0x1915d
callq 0x4240
movq %rax, %rdi
movl %r13d, %esi
callq 0x43c0
movq %rax, %rdi
callq 0x4120
addq $0x4, %rbp
addq $0x20, %rbx
jmp 0x10da3
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop