LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/evalp.cpp
// Function: init_evalp_bitboards()
void init_evalp_bitboards() {

    // isolated pawn masks
    for (int i=0;i<64;i++) {
        bb_isolated[i] = 0;
        file_t f = get_file((square_t)i);

        if (f > FILE_A) {
            bb_isolated[i] |= bb_files[f-1];
        }
        if (f < FILE_H) {
            bb_isolated[i] |= bb_files[f+1];
        }
    }

    // passed pawn masks
    for (int i=0;i<64;i++) {
        file_t f = get_file((square_t)i);

        bb_passed[i][WHITE] = bb_rays[i][NORTH];
        bb_passed[i][BLACK] = bb_rays[i][SOUTH];

        if (f > FILE_A) {
            bb_passed[i][WHITE] |= bb_rays[i-1][NORTH];
            bb_passed[i][BLACK] |= bb_rays[i-1][SOUTH];
        }
        if (f < FILE_H) {
            bb_passed[i][WHITE] |= bb_rays[i+1][NORTH];
            bb_passed[i][BLACK] |= bb_rays[i+1][SOUTH];
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0xc19c4(%rip), %r14     # 0xc7300
xorl %ebx, %ebx
leaq 0xf7aeb(%rip), %r15     # 0xfd430
cmpq $0x40, %rbx
je 0x597f
andq $0x0, (%r14)
movl %ebx, %edi
callq 0xbfd8
movq (%r14), %rcx
testl %eax, %eax
jle 0x596c
leal -0x1(%rax), %edx
orq (%r15,%rdx,8), %rcx
movq %rcx, (%r14)
cmpl $0x6, %eax
ja 0x5976
cltq
orq 0x8(%r15,%rax,8), %rcx
movq %rcx, (%r14)
incq %rbx
addq $0x8, %r14
jmp 0x5945
xorl %ebx, %ebx
leaq 0xf8528(%rip), %r14     # 0xfdeb0
leaq 0xc1b71(%rip), %r15     # 0xc7500
cmpq $0x40, %rbx
je 0x59f1
movl %ebx, %edi
callq 0xbfd8
movq %rbx, %rdi
shlq $0x6, %rdi
movq (%r14,%rdi), %rsi
movq 0x20(%r14,%rdi), %rcx
movq %rbx, %rdx
shlq $0x4, %rdx
addq %r15, %rdx
testl %eax, %eax
jle 0x59d0
orq -0x40(%rdi,%r14), %rsi
movq %rsi, 0x8(%rdx)
orq -0x20(%rdi,%r14), %rcx
movq %rcx, (%rdx)
cmpl $0x7, %eax
jae 0x59ec
incq %rbx
movq %rbx, %rax
shlq $0x6, %rax
orq (%r14,%rax), %rsi
movq %rsi, 0x8(%rdx)
orq 0x20(%r14,%rax), %rcx
movq %rcx, (%rdx)
jmp 0x598f
incq %rbx
jmp 0x598f
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/extend.cpp
// Function: extend(position*, unsigned long long, bool)
int32 extend(position *pos,move last_move,bool incheck) {

    assert(incheck==in_check(pos,pos->player));

    if (incheck) return 1;
    if (get_promopiece(last_move)) return 1;

    // pawn to 7th
    /*square_t to_sq = get_to_sq(last_move);
    if (pos->player==WHITE) { // black was on move
        if (pos->piece[to_sq]==-PAWN && get_rank(to_sq)==RANK_2) {
            return 1;
        }
    } else {
        if (pos->piece[to_sq]==PAWN && get_rank(to_sq)==RANK_7) {
            return 1;
        }
    }*/

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movl 0x138(%rdi), %esi
callq 0xa61f
cmpb %bpl, %al
jne 0x5a32
testb %bpl, %bpl
je 0x5a1a
pushq $0x1
popq %rax
jmp 0x5a2b
movq %rbx, %rdi
callq 0x7386
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x228d6(%rip), %rdi     # 0x2830f
leaq 0x228f2(%rip), %rsi     # 0x28332
leaq 0x228fa(%rip), %rcx     # 0x28341
pushq $0x10
popq %rdx
callq 0x20c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: build_hash_key(position*)
uint64 build_hash_key(position *pos) {
    uint64 hkey = 0;

    // fold in pieces
    for (int i=0;i<64;i++) {
        int piece = pos->piece[i];
        if (piece > NO_PIECE) {
            hkey ^= zkeys.pieces[piece][WHITE][i];
        } else if (piece < NO_PIECE) {
            hkey ^= zkeys.pieces[-piece][BLACK][i];
        }
    }

    // fold in player to move
    hkey ^= zkeys.ptm[pos->player];

    // castling rights
    assert(pos->castling_rights >= 0 && pos->castling_rights < 16);
    hkey ^= zkeys.casting_rights[pos->castling_rights];

    // ep square (including NO_SQUARE)
    assert(pos->ep_sq >= 0 && pos->ep_sq < 65);
    hkey ^= zkeys.ep[pos->ep_sq];

    return hkey;
}

// Assembly:
pushq %rax
leaq 0xf5b40(%rip), %rax     # 0xfb598
xorl %edx, %edx
movq %rax, %rsi
xorl %ecx, %ecx
cmpq $0x40, %rdx
je 0x5a9f
movslq (%rdi,%rdx,4), %r8
testq %r8, %r8
jle 0x5a85
shlq $0xa, %r8
addq %rax, %r8
leaq (%r8,%rdx,8), %r8
addq $0x200, %r8             # imm = 0x200
xorq (%r8), %rcx
jmp 0x5a8a
testl %r8d, %r8d
js 0x5a93
incq %rdx
addq $0x8, %rsi
jmp 0x5a5f
negl %r8d
shlq $0xa, %r8
addq %rsi, %r8
jmp 0x5a80
movl 0x140(%rdi), %edx
cmpq $0x10, %rdx
jae 0x5ae1
movl 0x13c(%rdi), %esi
cmpq $0x41, %rsi
jae 0x5afa
movl 0x138(%rdi), %eax
leaq 0xf5ad4(%rip), %rdi     # 0xfb598
movq 0x1c00(%rdi,%rax,8), %rax
xorq 0x1c10(%rdi,%rdx,8), %rax
xorq 0x1c90(%rdi,%rsi,8), %rax
xorq %rcx, %rax
popq %rcx
retq
leaq 0x2287e(%rip), %rdi     # 0x28366
leaq 0x228ae(%rip), %rsi     # 0x2839d
leaq 0x228b4(%rip), %rcx     # 0x283aa
pushq $0x1e
jmp 0x5b11
leaq 0x228cb(%rip), %rdi     # 0x283cc
leaq 0x22895(%rip), %rsi     # 0x2839d
leaq 0x2289b(%rip), %rcx     # 0x283aa
pushq $0x22
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: build_pawn_key(position*)
uint64 build_pawn_key(position *pos) {
    uint64 pkey = 0;

    uint64 pmap = pos->white_pawns;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        pkey ^= zkeys.pieces[PAWN][WHITE][sq];
        pmap ^= bb_squares[sq];
    }

    pmap = pos->black_pawns;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        pkey ^= zkeys.pieces[PAWN][BLACK][sq];
        pmap ^= bb_squares[sq];
    }

    return pkey;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x158(%rdi), %r15
xorl %ebx, %ebx
leaq 0xf5a65(%rip), %r12     # 0xfb598
leaq 0xf7976(%rip), %r13     # 0xfd4b0
testq %r15, %r15
je 0x5b58
movq %r15, %rdi
callq 0x3a44
movl %eax, %eax
xorq 0x600(%r12,%rax,8), %rbx
xorq (%r13,%rax,8), %r15
jmp 0x5b3a
movq 0x160(%r14), %r14
testq %r14, %r14
je 0x5b7d
movq %r14, %rdi
callq 0x397d
movl %eax, %eax
xorq 0x400(%r12,%rax,8), %rbx
xorq (%r13,%rax,8), %r14
jmp 0x5b5f
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: build_hash_val(hash_entry_t, int, int, unsigned long long)
uint64 build_hash_val(hash_entry_t entry_type,int32 depth,int32 score,move mv) {
    assert(entry_type >= LOWER_BOUND && entry_type <= EXACT_SCORE);
    assert(depth >= 0);
    assert(depth <= 0xFFFF);
    assert(abs(score) <= CHECKMATE);
    assert(abs(score) <= 0xFFFF);
    set_move_score(&mv,0);

    // convert mate scores
    if (score > CHECKMATE-500) {
        if (entry_type==UPPER_BOUND) {
            // failing low on mate.  don't allow a cutoff, just store any associated move
            entry_type = MOVE_ONLY;
        } else {
            // convert to fail high
            entry_type = LOWER_BOUND;
            score = CHECKMATE-500;
        }
    } else if (score < -(CHECKMATE-500)) {
        if (entry_type==LOWER_BOUND) {
            // failing high on -mate.
            entry_type = MOVE_ONLY;
        } else {
            // convert to fail low
            entry_type = UPPER_BOUND;
            score = -(CHECKMATE-500);
        }
    }

    uint64 val = entry_type;
    val |= ((uint64)depth) << 2;
    if (score >= 0) {
        val |= ((uint64)score) << 18;
    } else {
        val |= ((uint64)-score) << 18;
        val |= ((uint64)1) << 34;
    }
    val |= ((uint64)mv) << 35;

    return val;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %r15d
movq %rcx, 0x8(%rsp)
leal -0x1(%r15), %eax
cmpl $0x3, %eax
jae 0x5c5b
movl %esi, %r14d
testl %esi, %esi
js 0x5c74
cmpl $0x10000, %r14d         # imm = 0x10000
jae 0x5c8d
movl %edx, %ebx
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x5ca6
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x73d3
cmpl $0xfe0c, %ebx           # imm = 0xFE0C
jl 0x5bff
xorl %eax, %eax
cmpl $0x2, %r15d
setne %al
movl $0xfe0b, %ecx           # imm = 0xFE0B
cmovnel %ecx, %ebx
leal (%rax,%r14,4), %eax
jmp 0x5c2c
cmpl $0xffff01f4, %ebx       # imm = 0xFFFF01F4
jg 0x5c24
xorl %eax, %eax
cmpl $0x1, %r15d
movl $0xffff01f5, %ecx       # imm = 0xFFFF01F5
cmovel %ebx, %ecx
setne %al
shll $0x2, %r14d
leal (%r14,%rax,2), %eax
movl %ecx, %ebx
jmp 0x5c37
leal (%r15,%r14,4), %eax
testl %ebx, %ebx
js 0x5c37
movl %ebx, %ebx
shlq $0x12, %rbx
orq %rax, %rbx
jmp 0x5c45
negl %ebx
shlq $0x12, %rbx
orq %rax, %rbx
btsq $0x22, %rbx
movq 0x8(%rsp), %rax
shlq $0x23, %rax
orq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2278d(%rip), %rdi     # 0x283ef
leaq 0x22734(%rip), %rsi     # 0x2839d
leaq 0x227b6(%rip), %rcx     # 0x28426
pushq $0x3d
jmp 0x5cbd
leaq 0x227e3(%rip), %rdi     # 0x2845e
leaq 0x2271b(%rip), %rsi     # 0x2839d
leaq 0x2279d(%rip), %rcx     # 0x28426
pushq $0x3e
jmp 0x5cbd
leaq 0x227d5(%rip), %rdi     # 0x28469
leaq 0x22702(%rip), %rsi     # 0x2839d
leaq 0x22784(%rip), %rcx     # 0x28426
pushq $0x3f
jmp 0x5cbd
leaq 0x227cc(%rip), %rdi     # 0x28479
leaq 0x226e9(%rip), %rsi     # 0x2839d
leaq 0x2276b(%rip), %rcx     # 0x28426
pushq $0x40
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: build_pawn_hash_val(int)
uint64 build_pawn_hash_val(int32 score) {
    assert(abs(score) <= CHECKMATE);
    assert(abs(score) <= 0xFFFF);

    uint64 val = 1; // just so it's non-zero. this way we know there IS an entry in case
                    // the score is 0

    if (score >= 0) {
        val |= ((uint64)score) << 1;
    } else {
        val |= ((uint64)-score) << 1;
        val |= ((uint64)1) << 17;
    }

    return val;
}

// Assembly:
movl %edi, %eax
negl %eax
cmovsl %edi, %eax
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x5ceb
testl %edi, %edi
js 0x5cde
leal 0x1(,%rdi,2), %edi
jmp 0x5ce8
addl %edi, %edi
negl %edi
orl $0x20001, %edi          # imm = 0x20001
movl %edi, %eax
retq
pushq %rax
leaq 0x22786(%rip), %rdi     # 0x28479
leaq 0x226a3(%rip), %rsi     # 0x2839d
leaq 0x22790(%rip), %rcx     # 0x28491
pushq $0x67
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: init_hash_table(hash_table*, unsigned int)
void init_hash_table(hash_table *tbl,uint32 tblsize) {
    assert(tblsize > 0);

    int max_entries = tblsize / sizeof(hash_entry);
    printd("# max hash entries: %d\n",max_entries);

    // this loop will set # entries to a power of 2 > max_entries
    int actual_entries = 2;
    while (actual_entries <= max_entries) {
        actual_entries *= 2;
    }
    actual_entries /= 2;

    // set the mask and allocate memory
    tbl->tblmask = actual_entries - 1;
    printd("# effective hash entries: %d\n",actual_entries);

    tbl->tblptr = (hash_entry*)malloc(actual_entries * sizeof(hash_entry));
    printd("# effective table size: %d bytes\n\n",actual_entries * sizeof(hash_entry));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
je 0x5dba
movl %esi, %ebp
movq %rdi, %rbx
shrl $0x4, %ebp
leaq 0x2278a(%rip), %rdi     # 0x284ea
movl %ebp, %esi
xorl %eax, %eax
callq 0x60fd
pushq $0x2
popq %rax
movl %eax, %r14d
leal (%r14,%r14), %eax
cmpl %ebp, %r14d
jbe 0x5d6c
shrl %r14d
leal -0x1(%r14), %eax
cltq
movq %rax, 0x10(%rbx)
leaq 0x22776(%rip), %rdi     # 0x28502
movl %r14d, %esi
xorl %eax, %eax
callq 0x60fd
shlq $0x4, %r14
movq %r14, %rdi
callq 0x2220
movq %rax, (%rbx)
leaq 0x22774(%rip), %rdi     # 0x28520
movq %r14, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x60fd
leaq 0x226f2(%rip), %rdi     # 0x284b3
leaq 0x225d5(%rip), %rsi     # 0x2839d
leaq 0x226f0(%rip), %rcx     # 0x284bf
movl $0x99, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: clear_hash_table(hash_table*)
void clear_hash_table(hash_table *tbl) {
    assert(tbl->tblptr);
    hash_entry *he = tbl->tblptr;
    for (uint32 i=0;i<=tbl->tblmask;i++) {
        (he+i)->key = 0;
        (he+i)->val = 0;
    }
    tbl->probes = 0;
    tbl->hits = 0;
    tbl->collisions = 0;
}

// Assembly:
pushq %rax
movq (%rdi), %rax
testq %rax, %rax
je 0x5e0f
movq 0x10(%rdi), %rcx
xorl %edx, %edx
xorps %xmm0, %xmm0
movl %edx, %edx
cmpq %rdx, %rcx
jb 0x5e01
movq %rdx, %rsi
shlq $0x4, %rsi
incl %edx
movups %xmm0, (%rax,%rsi)
jmp 0x5deb
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
andq $0x0, 0x28(%rdi)
popq %rax
retq
leaq 0x2272d(%rip), %rdi     # 0x28543
leaq 0x22580(%rip), %rsi     # 0x2839d
leaq 0x2272b(%rip), %rcx     # 0x2854f
movl $0xae, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: get_hash_entry(hash_table*, unsigned long long)
uint64 get_hash_entry(hash_table *tbl,uint64 key) {
    assert(tbl->tblptr);
    tbl->probes++;
    hash_entry *he = tbl->tblptr + (key & tbl->tblmask);
    if (he->val != 0) {
        if (he->key == key) { // do full signature match
            tbl->hits++;
            return he->val;
        } else {
            tbl->collisions++;
        }
    }

    return 0;
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x5e6b
incq 0x18(%rdi)
movq 0x10(%rdi), %rax
andq %rsi, %rax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rdx
testq %rdx, %rdx
je 0x5e68
addq %rax, %rcx
xorl %eax, %eax
xorl %r8d, %r8d
cmpq %rsi, (%rcx)
cmoveq %rdx, %rax
setne %r8b
incq 0x20(%rdi,%r8,8)
retq
xorl %eax, %eax
retq
pushq %rax
leaq 0x226d0(%rip), %rdi     # 0x28543
leaq 0x22523(%rip), %rsi     # 0x2839d
leaq 0x226f2(%rip), %rcx     # 0x28573
movl $0xba, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/hash.cpp
// Function: store_hash_entry(hash_table*, unsigned long long, unsigned long long)
void store_hash_entry(hash_table *tbl,uint64 key,uint64 val) {
    assert(tbl->tblptr);
    hash_entry *he = tbl->tblptr + (key & tbl->tblmask);
    he->key = key;
    he->val = val;
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x5ea8
movq 0x10(%rdi), %rcx
andq %rsi, %rcx
shlq $0x4, %rcx
movq %rsi, (%rax,%rcx)
movq %rdx, 0x8(%rax,%rcx)
retq
pushq %rax
leaq 0x22693(%rip), %rdi     # 0x28543
leaq 0x224e6(%rip), %rsi     # 0x2839d
leaq 0x226e1(%rip), %rcx     # 0x2859f
movl $0xca, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/init.cpp
// Function: init_helper(void*)
void init_zkeys() {

    for (int i=0;i<2;i++) { // color
        for (int j=0;j<64;j++) { // squares
            for (int k=1;k<=6;k++) {
                zkeys.pieces[k][i][j] = random64();
            }
        }

        zkeys.ptm[i] = random64();
    }

    for (int i=0;i<16;i++) { // castling rights
        zkeys.casting_rights[i] = random64();
    }

    for (int i=0;i<65;i++) { // ep square
        zkeys.ep[i] = random64();
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xf56be(%rip), %rbx     # 0xfb598
xorl %r14d, %r14d
movq %rbx, %r15
cmpq $0x2, %r14
je 0x5f34
movq %r15, %r12
xorl %r13d, %r13d
cmpq $0x40, %r13
je 0x5f1b
movl $0x400, %ebp            # imm = 0x400
cmpq $0x1c00, %rbp           # imm = 0x1C00
je 0x5f12
callq 0xdcd1
movq %rax, (%r12,%rbp)
addq $0x400, %rbp            # imm = 0x400
jmp 0x5ef7
incq %r13
addq $0x8, %r12
jmp 0x5eec
callq 0xdcd1
movq %rax, 0x1c00(%rbx,%r14,8)
incq %r14
addq $0x200, %r15            # imm = 0x200
jmp 0x5ee0
xorl %r14d, %r14d
leaq 0xf565a(%rip), %rbx     # 0xfb598
cmpq $0x10, %r14
je 0x5f56
callq 0xdcd1
movq %rax, 0x1c10(%rbx,%r14,8)
incq %r14
jmp 0x5f3e
xorl %r14d, %r14d
cmpq $0x41, %r14
je 0x5f71
callq 0xdcd1
movq %rax, 0x1c90(%rbx,%r14,8)
incq %r14
jmp 0x5f59
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/init.cpp
// Function: init()
void init() {
    init_directions();
    init_zkeys();
    init_bitboards();
    init_magics();
    init_evalp_bitboards();
    reset_pos(&gpos);
    pthread_create(&think_thread,NULL,init_helper,NULL);
}

// Assembly:
pushq %rax
callq 0xc496
callq 0x5ec8
callq 0x3f54
callq 0x6e9a
callq 0x5930
leaq 0xc597f(%rip), %rdi     # 0xcb920
callq 0xa187
leaq 0xf55e3(%rip), %rdi     # 0xfb590
leaq -0xec(%rip), %rdx       # 0x5ec8
xorl %esi, %esi
xorl %ecx, %ecx
popq %rax
jmp 0x2300
nop
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/log.cpp
// Function: print(char const*, ...)
void print(const char* format, ...) {
    pthread_mutex_lock(&logfile_mutex);

    va_list stdout_args;
    va_start(stdout_args,format);
    vprintf(format,stdout_args);
    fflush(stdout);
    va_end(stdout_args);

    va_list log_args;
    va_start(log_args,format);
    fprintf(logfile,"%d ",milli_timer());
    vfprintf(logfile,format,log_args);
    fflush(logfile);
    va_end(log_args);

    pthread_mutex_unlock(&logfile_mutex);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %r14
leaq 0x40(%rsp), %r12
movq %rsi, 0x8(%r12)
movq %rdx, 0x10(%r12)
movq %rcx, 0x18(%r12)
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
testb %al, %al
je 0x6050
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
leaq 0xf8e71(%rip), %rbx     # 0xfeec8
movq %rbx, %rdi
callq 0x2290
leaq 0x20(%rsp), %rsi
movq %r12, 0x10(%rsi)
leaq 0x130(%rsp), %r13
movq %r13, 0x8(%rsi)
movabsq $0x3000000008, %rbp     # imm = 0x3000000008
movq %rbp, (%rsi)
movq %r14, %rdi
callq 0x2170
movq 0x3ef00(%rip), %rax     # 0x44f90
movq (%rax), %rdi
callq 0x21c0
movq %rsp, %r15
movq %r12, 0x10(%r15)
movq %r13, 0x8(%r15)
movq %rbp, (%r15)
movq 0xf8e13(%rip), %r12     # 0xfeec0
callq 0xd470
leaq 0x22526(%rip), %rsi     # 0x285df
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2280
movq 0xf8df4(%rip), %rdi     # 0xfeec0
movq %r14, %rsi
movq %r15, %rdx
callq 0x2230
movq 0xf8de2(%rip), %rdi     # 0xfeec0
callq 0x21c0
movq %rbx, %rdi
callq 0x20d0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/log.cpp
// Function: printd(char const*, ...)
void printd(const char* format, ...) {
    if (debug) {
        pthread_mutex_lock(&logfile_mutex);

        va_list stdout_args;
        va_start(stdout_args,format);
        vprintf(format,stdout_args);
        fflush(stdout);
        va_end(stdout_args);

        va_list log_args;
        va_start(log_args,format);
        fprintf(logfile,"%d ",milli_timer());
        vfprintf(logfile,format,log_args);
        fflush(logfile);
        va_end(log_args);

        pthread_mutex_unlock(&logfile_mutex);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
testb %al, %al
je 0x614f
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x68(%rsp)
cmpb $0x1, 0xf8d4a(%rip)     # 0xfeeb9
jne 0x6218
movq %rdi, %rbx
leaq 0xf8d49(%rip), %r14     # 0xfeec8
movq %r14, %rdi
callq 0x2290
leaq 0x40(%rsp), %r12
leaq 0x20(%rsp), %rsi
movq %r12, 0x10(%rsi)
leaq 0x130(%rsp), %r13
movq %r13, 0x8(%rsi)
movabsq $0x3000000008, %rbp     # imm = 0x3000000008
movq %rbp, (%rsi)
movq %rbx, %rdi
callq 0x2170
movq 0x3edd3(%rip), %rax     # 0x44f90
movq (%rax), %rdi
callq 0x21c0
movq %rsp, %r15
movq %r12, 0x10(%r15)
movq %r13, 0x8(%r15)
movq %rbp, (%r15)
movq 0xf8ce6(%rip), %r12     # 0xfeec0
callq 0xd470
leaq 0x223f9(%rip), %rsi     # 0x285df
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2280
movq 0xf8cc7(%rip), %rdi     # 0xfeec0
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2230
movq 0xf8cb5(%rip), %rdi     # 0xfeec0
callq 0x21c0
movq %r14, %rdi
callq 0x20d0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/log.cpp
// Function: error(char const*, ...)
void error(const char* format, ...) {
    pthread_mutex_lock(&logfile_mutex);
    va_list args;
    va_start(args,format);
    vfprintf(stderr,format,args);
    va_end(args);
    pthread_mutex_unlock(&logfile_mutex);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x628d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0xf8c34(%rip), %r14     # 0xfeec8
movq %r14, %rdi
callq 0x2290
movq %rsp, %rdx
movq %r15, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x3ed05(%rip), %rax     # 0x44fc8
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x2230
movq %r14, %rdi
callq 0x20d0
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: get_bishop_moves(position*, square_t, unsigned long long)
uint64 get_bishop_moves(position* p,square_t from,uint64 targets) {
    assert(p);
    assert(from >= A8 && from <= H1);
    assert(magic_numbers_bishops[from]);
    assert(magic_numbers_shift_bishops[from]);

    uint64 blockers = (p->black_pieces | p->white_pieces) & bb_bishop_masks[from];
    int magic_ind = (int)((blockers * magic_numbers_bishops[from]) >> magic_numbers_shift_bishops[from]);

    return bb_magic_bishop_moves[from][magic_ind] & targets;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x634e
cmpl $0x40, %esi
jae 0x6367
movl %esi, %eax
leaq 0x879308(%rip), %rcx    # 0x87f600
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x6380
leaq 0x8794f8(%rip), %rcx    # 0x87f800
movl (%rcx,%rax,4), %ecx
testq %rcx, %rcx
je 0x6399
movq 0x1a8(%rdi), %r8
orq 0x1b0(%rdi), %r8
leaq 0x6f90d7(%rip), %rdi    # 0x6ff400
andq (%rdi,%rax,8), %r8
imulq %rsi, %r8
shrq %cl, %r8
movslq %r8d, %rcx
shlq $0xd, %rax
leaq 0x6f92be(%rip), %rsi    # 0x6ff600
addq %rax, %rsi
andq (%rsi,%rcx,8), %rdx
movq %rdx, %rax
popq %rcx
retq
leaq 0x2d06a(%rip), %rdi     # 0x333bf
leaq 0x22287(%rip), %rsi     # 0x285e3
leaq 0x2228e(%rip), %rcx     # 0x285f1
pushq $0x1d
jmp 0x63b0
leaq 0x222b9(%rip), %rdi     # 0x28627
leaq 0x2226e(%rip), %rsi     # 0x285e3
leaq 0x22275(%rip), %rcx     # 0x285f1
pushq $0x1e
jmp 0x63b0
leaq 0x222b9(%rip), %rdi     # 0x28640
leaq 0x22255(%rip), %rsi     # 0x285e3
leaq 0x2225c(%rip), %rcx     # 0x285f1
pushq $0x1f
jmp 0x63b0
leaq 0x222bc(%rip), %rdi     # 0x2865c
leaq 0x2223c(%rip), %rsi     # 0x285e3
leaq 0x22243(%rip), %rcx     # 0x285f1
pushq $0x20
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: get_rook_moves(position*, square_t, unsigned long long)
uint64 get_rook_moves(position* p,square_t from,uint64 targets) {
    assert(p);
    assert(from >= A8 && from <= H1);
    assert(magic_numbers_rooks[from]);
    assert(magic_numbers_shift_rooks[from]);

    uint64 blockers = (p->black_pieces | p->white_pieces) & bb_rook_masks[from];
    int magic_ind = (int)((blockers * magic_numbers_rooks[from]) >> magic_numbers_shift_rooks[from]);

    return bb_magic_rook_moves[from][magic_ind] & targets;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x6452
cmpl $0x40, %esi
jae 0x646b
movl %esi, %eax
leaq 0x6f8d04(%rip), %rcx    # 0x6ff100
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x6484
leaq 0x6f8ef4(%rip), %rcx    # 0x6ff300
movl (%rcx,%rax,4), %ecx
testq %rcx, %rcx
je 0x649d
movq 0x1a8(%rdi), %r8
orq 0x1b0(%rdi), %r8
leaq 0xf8ad3(%rip), %rdi     # 0xfef00
andq (%rdi,%rax,8), %r8
imulq %rsi, %r8
shrq %cl, %r8
movslq %r8d, %rcx
shlq $0xf, %rax
leaq 0xf8cba(%rip), %rsi     # 0xff100
addq %rax, %rsi
andq (%rsi,%rcx,8), %rdx
movq %rdx, %rax
popq %rcx
retq
leaq 0x2cf66(%rip), %rdi     # 0x333bf
leaq 0x22183(%rip), %rsi     # 0x285e3
leaq 0x22217(%rip), %rcx     # 0x2867e
pushq $0x2d
jmp 0x64b4
leaq 0x221b5(%rip), %rdi     # 0x28627
leaq 0x2216a(%rip), %rsi     # 0x285e3
leaq 0x221fe(%rip), %rcx     # 0x2867e
pushq $0x2e
jmp 0x64b4
leaq 0x22227(%rip), %rdi     # 0x286b2
leaq 0x22151(%rip), %rsi     # 0x285e3
leaq 0x221e5(%rip), %rcx     # 0x2867e
pushq $0x2f
jmp 0x64b4
leaq 0x22228(%rip), %rdi     # 0x286cc
leaq 0x22138(%rip), %rsi     # 0x285e3
leaq 0x221cc(%rip), %rcx     # 0x2867e
pushq $0x30
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: gen_moves_mask(square_t, unsigned long long, square_t (*)(square_t))
uint64 gen_moves_mask(square_t sq,uint64 occupied,dirFuncType dirFunc) {
    uint64 mask = 0;

    square_t to = dirFunc(sq);
    while (to != NO_SQUARE) {
        mask |= bb_squares[to];
        if (bb_squares[to] & occupied) {
            break;
        }
        to = dirFunc(to);
    }

    return mask;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %eax
xorl %ebx, %ebx
leaq 0xf6fdd(%rip), %r12     # 0xfd4b0
movl %eax, %edi
callq *%r14
cmpl $0x40, %eax
je 0x64eb
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %rbx
testq %r15, %rcx
je 0x64d3
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: init_bishop_masks()
void init_bishop_masks() {
    for (int i=0;i<64;i++) {
        bb_bishop_masks[i] = 0;

        // if on the same diagonal.  "End points" can be ignored.
        for (int k=0;k<64;k++) {
            rank_t my_r = get_rank((square_t)k);
            file_t my_f = get_file((square_t)k);
            if (i != k) {
                if (is_diagonal((square_t)i,(square_t)k)
                        && my_r != RANK_1 && my_r != RANK_8
                        && my_f != FILE_A && my_f != FILE_H) {
                    bb_bishop_masks[i] |= bb_squares[k];
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
leaq 0x6f8ef2(%rip), %r12    # 0x6ff400
leaq 0xf6f9b(%rip), %r13     # 0xfd4b0
cmpq $0x40, %rbx
je 0x6578
andq $0x0, (%r12,%rbx,8)
xorl %r14d, %r14d
cmpq $0x40, %r14
je 0x6573
movl %r14d, %edi
callq 0xc001
movl %eax, %ebp
movl %r14d, %edi
callq 0xbfd8
cmpq %r14, %rbx
je 0x656e
movl %eax, %r15d
movl %ebx, %edi
movl %r14d, %esi
callq 0xc472
cmpl $0x7, %r15d
je 0x656e
testl %r15d, %r15d
je 0x656e
testl %ebp, %ebp
je 0x656e
cmpl $0x7, %ebp
je 0x656e
testb %al, %al
je 0x656e
movq (%r13,%r14,8), %rax
orq %rax, (%r12,%rbx,8)
incq %r14
jmp 0x6523
incq %rbx
jmp 0x6515
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: init_rook_masks()
void init_rook_masks() {

    for (int i=0;i<64;i++) {
        bb_rook_masks[i] = 0;

        rank_t r = get_rank((square_t)i);
        file_t f = get_file((square_t)i);

        // if on the same rank or file.  "End points" can be ignored.
        for (int k=0;k<64;k++) {
            rank_t my_r = get_rank((square_t)k);
            file_t my_f = get_file((square_t)k);
            if (i != k) {
                if ((my_r==r && my_f != FILE_A && my_f != FILE_H)
                    || (my_f==f && my_r != RANK_8 && my_r != RANK_1))
                {
                    bb_rook_masks[i] |= bb_squares[k];
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
leaq 0xf8965(%rip), %r13     # 0xfef00
cmpq $0x40, %rbx
je 0x6613
andq $0x0, (%r13,%rbx,8)
movl %ebx, %edi
callq 0xc001
movl %eax, %ebp
movl %ebx, %edi
callq 0xbfd8
movl %eax, %r14d
xorl %r15d, %r15d
cmpq $0x40, %r15
je 0x660e
movl %r15d, %edi
callq 0xc001
movl %eax, %r12d
movl %r15d, %edi
callq 0xbfd8
cmpq %r15, %rbx
je 0x6609
cmpl %ebp, %r12d
jne 0x65e9
cmpl $0x7, %eax
je 0x65e9
testl %eax, %eax
jne 0x65f9
cmpl %r14d, %eax
jne 0x6609
testl %r12d, %r12d
je 0x6609
cmpl $0x7, %r12d
je 0x6609
leaq 0xf6eb0(%rip), %rax     # 0xfd4b0
movq (%rax,%r15,8), %rax
orq %rax, (%r13,%rbx,8)
incq %r15
jmp 0x65bd
incq %rbx
jmp 0x659b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: init_bishop_magic_moves()
void init_bishop_magic_moves() {
    for (uint32 sq=0;sq<64;sq++) {
        uint64 mask = bb_bishop_masks[sq];
        uint32 num_mask_bits = get_num_bits(mask);
        uint32 num_variations = 1 << num_mask_bits;

        for (uint32 i=0;i<num_variations;i++) {
            int magic_ind = (int)((bb_bishop_occ_var[sq][i] * magic_numbers_bishops[sq]) >> magic_numbers_shift_bishops[sq]);
            bb_magic_bishop_moves[sq][magic_ind] =
                    gen_moves_mask((square_t)sq,bb_bishop_occ_var[sq][i],&northeast)
                    | gen_moves_mask((square_t)sq,bb_bishop_occ_var[sq][i],&southeast)
                    | gen_moves_mask((square_t)sq,bb_bishop_occ_var[sq][i],&southwest)
                    | gen_moves_mask((square_t)sq,bb_bishop_occ_var[sq][i],&northwest);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %r13d, %r13d
leaq 0xf68ce(%rip), %r12     # 0xfd4b0
cmpq $0x40, %r13
je 0x6d23
leaq 0x6f880d(%rip), %rax    # 0x6ff400
movq (%rax,%r13,8), %rdi
callq 0x3928
movl %eax, 0x10(%rsp)
xorl %edx, %edx
movq %r13, %rcx
shlq $0xd, %rcx
leaq 0x7789f0(%rip), %rax    # 0x77f600
movq %rcx, 0x20(%rsp)
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq %r13, 0x8(%rsp)
movl %edx, %eax
movl 0x10(%rsp), %ecx
shrl %cl, %eax
testl %eax, %eax
jne 0x6d1b
movl %edx, 0x14(%rsp)
movl %edx, %eax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,8), %rbx
movq (%rbx), %rbp
leaq 0x8789b5(%rip), %rax    # 0x87f600
movq (%rax,%r13,8), %r15
imulq %rbp, %r15
leaq 0x878ba6(%rip), %rax    # 0x87f800
movb (%rax,%r13,4), %cl
shrq %cl, %r15
movl %r13d, %eax
xorl %r13d, %r13d
movl %eax, %edi
callq 0xc2a9
cmpl $0x40, %eax
je 0x6c81
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %r13
testq %rbp, %rcx
je 0x6c67
movq (%rbx), %r14
movq 0x8(%rsp), %rax
xorl %ebp, %ebp
movl %eax, %edi
callq 0xc2ff
cmpl $0x40, %eax
je 0x6ca5
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %rbp
testq %r14, %rcx
je 0x6c8b
orq %r13, %rbp
movq (%rbx), %r14
movq 0x8(%rsp), %rax
xorl %r13d, %r13d
movl %eax, %edi
callq 0xc356
cmpl $0x40, %eax
je 0x6ccd
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %r13
testq %r14, %rcx
je 0x6cb3
orq %r13, %rbp
movq (%rbx), %r14
movq 0x8(%rsp), %r13
movl %r13d, %eax
xorl %ebx, %ebx
movl %eax, %edi
callq 0xc3ac
cmpl $0x40, %eax
je 0x6cf7
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %rbx
testq %r14, %rcx
je 0x6cdd
orq %rbx, %rbp
movslq %r15d, %rax
leaq 0x6f88fc(%rip), %rcx    # 0x6ff600
movq 0x20(%rsp), %rdx
addq %rdx, %rcx
movq %rbp, (%rcx,%rax,8)
movl 0x14(%rsp), %edx
incl %edx
jmp 0x6c22
incq %r13
jmp 0x6be2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: init_rook_magic_moves()
void init_rook_magic_moves() {
    for (uint32 sq=0;sq<64;sq++) {
        uint64 mask = bb_rook_masks[sq];
        uint32 num_mask_bits = get_num_bits(mask);
        uint32 num_variations = 1 << num_mask_bits;

        for (uint32 i=0;i<num_variations;i++) {
            int magic_ind = (int)((bb_rook_occ_var[sq][i] * magic_numbers_rooks[sq]) >> magic_numbers_shift_rooks[sq]);
            bb_magic_rook_moves[sq][magic_ind] =
                    gen_moves_mask((square_t)sq,bb_rook_occ_var[sq][i],&north)
                    | gen_moves_mask((square_t)sq,bb_rook_occ_var[sq][i],&south)
                    | gen_moves_mask((square_t)sq,bb_rook_occ_var[sq][i],&east)
                    | gen_moves_mask((square_t)sq,bb_rook_occ_var[sq][i],&west);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %r13d, %r13d
leaq 0xf6766(%rip), %r12     # 0xfd4b0
cmpq $0x40, %r13
je 0x6e8b
leaq 0xf81a5(%rip), %rax     # 0xfef00
movq (%rax,%r13,8), %rdi
callq 0x3928
movl %eax, 0x10(%rsp)
xorl %edx, %edx
movq %r13, %rcx
shlq $0xf, %rcx
leaq 0x2f8388(%rip), %rax    # 0x2ff100
movq %rcx, 0x20(%rsp)
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq %r13, 0x8(%rsp)
movl %edx, %eax
movl 0x10(%rsp), %ecx
shrl %cl, %eax
testl %eax, %eax
jne 0x6e83
movl %edx, 0x14(%rsp)
movl %edx, %eax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,8), %rbx
movq (%rbx), %rbp
leaq 0x6f834d(%rip), %rax    # 0x6ff100
movq (%rax,%r13,8), %r15
imulq %rbp, %r15
leaq 0x6f853e(%rip), %rax    # 0x6ff300
movb (%rax,%r13,4), %cl
shrq %cl, %r15
movl %r13d, %eax
xorl %r13d, %r13d
movl %eax, %edi
callq 0xc19d
cmpl $0x40, %eax
je 0x6de9
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %r13
testq %rbp, %rcx
je 0x6dcf
movq (%rbx), %r14
movq 0x8(%rsp), %rax
xorl %ebp, %ebp
movl %eax, %edi
callq 0xc1e0
cmpl $0x40, %eax
je 0x6e0d
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %rbp
testq %r14, %rcx
je 0x6df3
orq %r13, %rbp
movq (%rbx), %r14
movq 0x8(%rsp), %rax
xorl %r13d, %r13d
movl %eax, %edi
callq 0xc224
cmpl $0x40, %eax
je 0x6e35
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %r13
testq %r14, %rcx
je 0x6e1b
orq %r13, %rbp
movq (%rbx), %r14
movq 0x8(%rsp), %r13
movl %r13d, %eax
xorl %ebx, %ebx
movl %eax, %edi
callq 0xc267
cmpl $0x40, %eax
je 0x6e5f
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %rbx
testq %r14, %rcx
je 0x6e45
orq %rbx, %rbp
movslq %r15d, %rax
leaq 0xf8294(%rip), %rcx     # 0xff100
movq 0x20(%rsp), %rdx
addq %rdx, %rcx
movq %rbp, (%rcx,%rax,8)
movl 0x14(%rsp), %edx
incl %edx
jmp 0x6d8a
incq %r13
jmp 0x6d4a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/magic.cpp
// Function: init_magics()
void init_magics() {
    // make sure bitboards are already initialized
    assert(bb_squares[D4]);

    init_rook_masks();
    init_bishop_masks();
    init_rook_occupancy_variations();
    init_bishop_occupancy_variations();
    init_magic_numbers(true); // rooks
    init_magic_numbers(false); // bishops
    init_rook_magic_moves();
    init_bishop_magic_moves();
}

// Assembly:
pushq %rax
leaq 0xf660e(%rip), %rax     # 0xfd4b0
cmpq $0x0, 0x118(%rax)
je 0x6eda
callq 0x6587
callq 0x64fa
callq 0x67ff
callq 0x6622
pushq $0x1
popq %rdi
callq 0x69de
xorl %edi, %edi
callq 0x69de
callq 0x6d32
popq %rax
jmp 0x6bca
leaq 0x25671(%rip), %rdi     # 0x2c552
leaq 0x216fb(%rip), %rsi     # 0x285e3
leaq 0x2193c(%rip), %rcx     # 0x2882b
movl $0x13d, %edx            # imm = 0x13D
callq 0x20c0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/main.cpp
// Function: run_tests()
bool run_tests() {
    print("THIS IS A DEBUG BUILD.... running tests...\n");
    test_defs();
    test_bitboards();
    test_magic();
    test_draw();
    test_init();
    test_utils();
    test_square();
    test_pos();
    test_attack();
    test_move();
    test_movegen();
    test_next();
    test_apply();
    test_eval();
    test_evalp();
    test_search();
    test_time();
    test_hash();
    test_mvvlva();
    test_extend();
    test_prune();
    test_see();
    print("testing complete.\n");
    reset_pos(&gpos);
    clear_hash_table(&htbl);
    clear_hash_table(&phtbl);

    return true;
}

// Assembly:
pushq %rax
leaq 0x2196f(%rip), %rdi     # 0x28892
xorl %eax, %eax
callq 0x5fdd
callq 0x1088b
callq 0x106e5
callq 0x17603
callq 0x110eb
callq 0x174eb
callq 0x2641f
callq 0x24eaf
callq 0x223d2
callq 0xfbbc
callq 0x18552
callq 0x1c33c
callq 0x1f5b2
callq 0xf180
callq 0x1257e
callq 0x13491
callq 0x2344c
callq 0x25003
callq 0x16cc8
callq 0x1cf52
callq 0x14197
callq 0x2241c
callq 0x23d75
leaq 0x2191f(%rip), %rdi     # 0x288be
xorl %eax, %eax
callq 0x5fdd
leaq 0xc4973(%rip), %rdi     # 0xcb920
callq 0xa187
leaq 0xf3f37(%rip), %rdi     # 0xfaef0
callq 0x5dd9
leaq 0xf3f5b(%rip), %rdi     # 0xfaf20
callq 0x5dd9
movb $0x1, %al
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/main.cpp
// Function: process_args(int, char**)
void process_args(int argc,char *argv[]) {

    for (int i=1;i<argc;i++) {
        char *p = strchr(argv[i],'=');
        if (p) {
            if (!strncmp(argv[i],"-book",5)) {
                book_path = strdup(p+1);
            } else if (!strncmp(argv[i],"-hash",5)) {
                hash_size = atoi(p+1) *1024*1024; // MB
            } else if (!strncmp(argv[i],"-phash",6)) {
                pawn_hash_size = atoi(p+1) *1024*1024; // MB
            } else if (!strncmp(argv[i],"-suite",6)) {
                tsfile = strdup(p+1);
            } else if (!strncmp(argv[i],"-time",5)) {
                tstime = atoi(p+1);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movslq %edi, %rbx
pushq $0x1
popq %rbp
movq %rbx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
cmpq %rbx, %rbp
jge 0x7110
movq (%r14,%rbp,8), %r13
movq %r13, %rdi
pushq $0x3d
popq %rsi
callq 0x2070
testq %rax, %rax
je 0x7108
movq %rax, %r12
movq %r14, %r15
movq %r13, %rdi
leaq 0x218b1(%rip), %rsi     # 0x288d1
pushq $0x5
popq %r14
movq %r14, %rdx
callq 0x2090
testl %eax, %eax
je 0x70a9
movq %r13, %rdi
leaq 0x2189d(%rip), %rsi     # 0x288d7
movq %r14, %rdx
callq 0x2090
testl %eax, %eax
je 0x70bd
movq %r13, %rdi
leaq 0x2188d(%rip), %rsi     # 0x288dd
pushq $0x6
popq %r14
movq %r14, %rdx
callq 0x2090
testl %eax, %eax
je 0x70d6
movq %r13, %rdi
leaq 0x2187a(%rip), %rsi     # 0x288e4
movq %r14, %rdx
callq 0x2090
testl %eax, %eax
je 0x70ec
movq %r13, %rdi
leaq 0x2186b(%rip), %rsi     # 0x288eb
pushq $0x5
popq %rdx
callq 0x2090
testl %eax, %eax
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %rbx
jne 0x7108
incq %r12
movq %r12, %rdi
callq 0x22b0
movl %eax, 0x3e0f9(%rip)     # 0x451a0
jmp 0x7108
incq %r12
movq %r12, %rdi
callq 0x2310
movq %rax, 0x87884d(%rip)    # 0x87f908
jmp 0x70d1
incq %r12
movq %r12, %rdi
callq 0x22b0
shll $0x14, %eax
movl %eax, 0x878847(%rip)    # 0x87f918
movq %r15, %r14
jmp 0x7108
incq %r12
movq %r12, %rdi
callq 0x22b0
shll $0x14, %eax
movl %eax, 0x878832(%rip)    # 0x87f91c
jmp 0x70fe
incq %r12
movq %r12, %rdi
callq 0x2310
movq %rax, 0x878812(%rip)    # 0x87f910
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %rbx
incq %rbp
jmp 0x6fef
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/main.cpp
// Function: main
int main(int argc,char *argv[]) {
    setbuf(stdin, NULL);
    setbuf(stdout, NULL);
    init_logfile();

    char input[255];
    print_greeting();
    assert_assumptions();
    init();

    process_args(argc,argv);

    if (hash_size==0) hash_size = default_hash_size;
    print("initializing hash table with %d bytes\n",hash_size);
    init_hash_table(&htbl,hash_size);

    if (pawn_hash_size==0) pawn_hash_size = default_hash_size;
    print("initializing pawn hash table with %d bytes\n",pawn_hash_size);
    init_hash_table(&phtbl,pawn_hash_size);

    assert(run_tests());

    if (tsfile != 0) {
        test_suite(tsfile,tstime);
        exit(0);
    }

    if (book_path != 0) {
        int32 num_moves = open_book_db(book_path);
        print("opened book %s with %d moves.\n",book_path,num_moves);
        assert(test_book());
    }

    while (1) {
        int result=scanf("%s",input);
        if (result==EOF) {
            error("EOF\n");
            exit(1);
        }
        parse_command(input);
    }

}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %rbx
movl %edi, %ebp
movq 0x3de8c(%rip), %rax     # 0x44fc0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2270
movq 0x3de4b(%rip), %rax     # 0x44f90
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2270
callq 0x5fc0
callq 0x6efc
callq 0x5f80
movl %ebp, %edi
movq %rbx, %rsi
callq 0x6fce
movl 0x8787aa(%rip), %esi    # 0x87f918
testl %esi, %esi
jne 0x7181
movl $0x10000000, 0x87879c(%rip) # imm = 0x10000000
movl $0x10000000, %esi       # imm = 0x10000000
leaq 0x21769(%rip), %rdi     # 0x288f1
xorl %eax, %eax
callq 0x5fdd
movl 0x878783(%rip), %esi    # 0x87f918
leaq 0xf3d54(%rip), %rdi     # 0xfaef0
callq 0x5d49
movl 0x878775(%rip), %esi    # 0x87f91c
testl %esi, %esi
jne 0x71ba
movl $0x10000000, 0x878767(%rip) # imm = 0x10000000
movl $0x10000000, %esi       # imm = 0x10000000
leaq 0x21757(%rip), %rdi     # 0x28918
xorl %eax, %eax
callq 0x5fdd
movl 0x87874e(%rip), %esi    # 0x87f91c
leaq 0xf3d4b(%rip), %rdi     # 0xfaf20
callq 0x5d49
callq 0x6f1b
movq 0x87872a(%rip), %rdi    # 0x87f910
testq %rdi, %rdi
jne 0x7271
movq 0x878712(%rip), %rdi    # 0x87f908
testq %rdi, %rdi
je 0x7245
callq 0x42ae
movq 0x878701(%rip), %rsi    # 0x87f908
leaq 0x2175a(%rip), %rdi     # 0x28968
movl %eax, %edx
xorl %eax, %eax
callq 0x5fdd
callq 0x1087e
testb %al, %al
jne 0x7245
leaq 0x21760(%rip), %rdi     # 0x28987
leaq 0x21716(%rip), %rsi     # 0x28944
leaq 0x2171c(%rip), %rcx     # 0x28951
pushq $0x7d
popq %rdx
callq 0x20c0
movq %rsp, %rdi
callq 0xe6a4
leaq 0x23438(%rip), %rdi     # 0x2a684
movq %rsp, %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
jne 0x723d
leaq 0x21731(%rip), %rdi     # 0x28993
xorl %eax, %eax
callq 0x622a
pushq $0x1
popq %rdi
callq 0x21f0
movl 0x3df29(%rip), %esi     # 0x451a0
callq 0xc4d8
xorl %edi, %edi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/move.cpp
// Function: set_capture(unsigned long long*, piece_t)
void set_capture(move *mv,piece_t captured_piece) {
    assert(captured_piece != NO_PIECE);
    int32 cp = captured_piece < NO_PIECE ? -captured_piece : captured_piece;
    assert(cp > 0 && cp < 8);
    *mv &= ~(7 << 18);
    *mv |= cp << 18;
}

// Assembly:
pushq %rax
testl %esi, %esi
je 0x7305
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
cmpl $0x8, %eax
jae 0x731e
movq $-0x1c0001, %rcx        # imm = 0xFFE3FFFF
andq (%rdi), %rcx
shll $0x12, %eax
orq %rcx, %rax
movq %rax, (%rdi)
popq %rax
retq
leaq 0x2168c(%rip), %rdi     # 0x28998
leaq 0x216a0(%rip), %rsi     # 0x289b3
leaq 0x216a6(%rip), %rcx     # 0x289c0
pushq $0x26
jmp 0x7335
leaq 0x216bd(%rip), %rdi     # 0x289e2
leaq 0x21687(%rip), %rsi     # 0x289b3
leaq 0x2168d(%rip), %rcx     # 0x289c0
pushq $0x28
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/move.cpp
// Function: set_move_score(unsigned long long*, int)
void set_move_score(move *m,int32 score) {
    // clear high order bits
    *m &= 0xFFFFFFFF;

    // now set score
    if (score >= 0) {
        *m |= ((uint64)score)<<32;
    } else {
        *m |= ((uint64)-score)<<32;
        *m |= ((uint64)1)<<63;
    }
}

// Assembly:
movl (%rdi), %eax
testl %esi, %esi
js 0x73e2
shlq $0x20, %rsi
orq %rsi, %rax
jmp 0x73f0
negl %esi
shlq $0x20, %rsi
orq %rsi, %rax
btsq $0x3f, %rax
movq %rax, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_legal_moves(unsigned long long*, position*, bool, bool)
move* gen_legal_moves(move *m,position *p,bool caps,bool noncaps) {
    move* endp = gen_moves(m,p,caps,noncaps);

    undo undos[p->move_counter + (endp-m)];
    for (move* mp=m;mp<endp;mp++) {
        apply_move(p,*mp,undos);
        if (in_check(p,opposite_player(p->player))) {
            // mark as 'invalid'
            *mp = 0;
        }
        undo_last_move(p,undos);
    }

    return endp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x7482
movq %rax, %r15
movl 0x144(%rbx), %eax
movq %r15, %rcx
subq %r14, %rcx
shrq $0x3, %rcx
addq %rax, %rcx
shlq $0x5, %rcx
movq %rsp, %r12
subq %rcx, %r12
movq %r12, %rsp
cmpq %r15, %r14
jae 0x7472
movq (%r14), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x2fa5
movl 0x138(%rbx), %edi
callq 0xd4d8
movq %rbx, %rdi
movl %eax, %esi
callq 0xa61f
testb %al, %al
je 0x7461
andq $0x0, (%r14)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x31f8
addq $0x8, %r14
jmp 0x7431
movq %r15, %rax
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_moves(unsigned long long*, position*, bool, bool)
move* gen_moves(move *m,position *p,bool caps,bool noncaps) {

    m = gen_pawn_moves(m,p,caps,noncaps);
    m = gen_knight_moves(m,p,caps,noncaps);
    m = gen_bishop_moves(m,p,caps,noncaps);
    m = gen_rook_moves(m,p,caps,noncaps);
    m = gen_queen_moves(m,p,caps,noncaps);
    m = gen_king_moves(m,p,caps,noncaps);

    return m;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r14
callq 0x74e1
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x794c
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x79e2
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7a55
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7ac8
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x7b3b
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_knight_moves(unsigned long long*, position*, bool, bool)
move* gen_knight_moves(move* m,position* p,bool caps,bool noncaps) {
    assert(caps || noncaps);
    uint64 pmap = p->player==WHITE ? p->white_knights : p->black_knights;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        m = gen_knight_moves(m,p,sq,caps,noncaps);
        pmap ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %eax
orb %cl, %al
je 0x79c5
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
setne %al
movq 0x168(%rsi,%rax,8), %r15
movzbl %dl, %ebp
movzbl %cl, %r12d
testq %r15, %r15
je 0x79b3
movq %r15, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x7f93
movq %rax, %r14
movl %r13d, %eax
leaq 0xf5b03(%rip), %rcx     # 0xfd4b0
xorq (%rcx,%rax,8), %r15
jmp 0x797e
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x210ec(%rip), %rdi     # 0x28ab8
leaq 0x21095(%rip), %rsi     # 0x28a68
leaq 0x210ee(%rip), %rcx     # 0x28ac8
pushq $0x6e
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_bishop_moves(unsigned long long*, position*, bool, bool)
move* gen_bishop_moves(move* m,position* p,bool caps,bool noncaps) {

    uint64 pmap = p->player==WHITE ? p->white_bishops : p->black_bishops;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        m = gen_bishop_moves(m,p,sq,caps,noncaps);
        pmap ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
setne %al
movq 0x178(%rsi,%rax,8), %r15
movzbl %dl, %ebp
movzbl %cl, %r12d
testq %r15, %r15
je 0x7a43
movq %r15, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x80ac
movq %rax, %r14
movl %r13d, %eax
leaq 0xf5a73(%rip), %rcx     # 0xfd4b0
xorq (%rcx,%rax,8), %r15
jmp 0x7a0e
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq