LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/bitboards.cpp
// Function: init_pawn_attacks()
void init_pawn_attacks() {
    for (int i=0;i<64;i++) {
        square_t sq = (square_t)i;
        file_t file_i = get_file(sq);
        rank_t rank_i = get_rank(sq);

        bb_pawn_attacks[i][BLACK] = bb_pawn_attacks[i][WHITE] = 0;
        if (rank_i != RANK_1 && rank_i != RANK_8) {
            if (file_i > FILE_A) {
                bb_pawn_attacks[i][WHITE] |= bb_squares[northwest(sq)];
                bb_pawn_attacks[i][BLACK] |= bb_squares[southwest(sq)];
            }
            if (file_i < FILE_H) {
                bb_pawn_attacks[i][WHITE] |= bb_squares[northeast(sq)];
                bb_pawn_attacks[i][BLACK] |= bb_squares[southeast(sq)];
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0xf6a36(%rip), %r14     # 0xfaab0
xorl %ebx, %ebx
leaq 0xf642d(%rip), %r15     # 0xfa4b0
movl %ebx, %edi
callq 0xca4a
movl %eax, %ebp
movl %ebx, %edi
callq 0xca75
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
testl %eax, %eax
je 0x40ee
cmpl $0x7, %eax
je 0x40ee
testl %ebp, %ebp
jle 0x40c8
movl %ebx, %edi
callq 0xcdc7
movl %eax, %eax
movq (%r15,%rax,8), %rax
orq %rax, 0x8(%r14)
movl %ebx, %edi
callq 0xcd87
movl %eax, %eax
movq (%r15,%rax,8), %rax
orq %rax, (%r14)
cmpl $0x6, %ebp
jg 0x40ee
movl %ebx, %edi
callq 0xccfc
movl %eax, %eax
movq (%r15,%rax,8), %rax
orq %rax, 0x8(%r14)
movl %ebx, %edi
callq 0xcd3f
movl %eax, %eax
movq (%r15,%rax,8), %rax
orq %rax, (%r14)
incq %rbx
addq $0x10, %r14
cmpq $0x40, %rbx
jne 0x4083
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/bitboards.cpp
// Function: init_bitboards()
void init_bitboards() {

    for (int i=0;i<64;i++) {
        bb_squares[i] = ((uint64)1) << i;
    }

    for (int i=0;i<8;i++) {
        bb_ranks[i] = 0;
        bb_files[i] = 0;
    }

    for (int i=0;i<64;i++) {
        bb_ranks[get_rank((square_t)i)] |= bb_squares[i];
        bb_files[get_file((square_t)i)] |= bb_squares[i];
    }

    lsb[0] = 0; msb[0] = 0;
    for (uint32 i=1;i<65536;i++) {
        lsb[i] = get_lsb_slow(i);
        msb[i] = get_msb_slow(i);
    }

    init_knight_moves();
    init_king_moves();
    init_pawn_attacks();
    init_rays();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ecx, %ecx
leaq 0xf6398(%rip), %r14     # 0xfa4b0
movl $0x1, %eax
shlq %cl, %rax
movq %rax, (%r14,%rcx,8)
incq %rcx
cmpq $0x40, %rcx
jne 0x4118
xorps %xmm0, %xmm0
leaq 0xf6339(%rip), %r15     # 0xfa470
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0xf62df(%rip), %r12     # 0xfa430
movaps %xmm0, (%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x30(%r12)
xorl %ebx, %ebx
movq (%r14,%rbx,8), %r13
movl %ebx, %edi
callq 0xca75
movl %eax, %eax
orq %r13, (%r15,%rax,8)
movq (%r14,%rbx,8), %r13
movl %ebx, %edi
callq 0xca4a
movl %eax, %eax
orq %r13, (%r12,%rax,8)
incq %rbx
cmpq $0x40, %rbx
jne 0x416a
xorl %eax, %eax
movl %eax, 0x3e303(%rip)     # 0x424a0
movl %eax, 0x7e2fd(%rip)     # 0x824a0
movl $0x1, %ebx
leaq 0x3e2f1(%rip), %r14     # 0x424a0
leaq 0x7e2ea(%rip), %r15     # 0x824a0
movq %rbx, %rdi
callq 0x3b1b
movl %eax, (%r14,%rbx,4)
movq %rbx, %rdi
callq 0x3bda
movl %eax, (%r15,%rbx,4)
incq %rbx
cmpq $0x10000, %rbx          # imm = 0x10000
jne 0x41b6
callq 0x3cc7
callq 0x3e0c
callq 0x406c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3f03
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: load_zkeys()
void load_zkeys() {
    printd("loading zkeys from book...\n");

    char* sql = "select key from zobrist_keys order by id";
    char *err_msg = 0;
    int num_keys = 0;

    int rc = sqlite3_exec(book_db,sql,load_zkeys_callback,(void*)&num_keys,&err_msg);
    if( rc != SQLITE_OK ){
        error("SQL error: %s\n",err_msg);
        sqlite3_free(err_msg);
    }
    printd("loaded %d keys\n",num_keys);
}

// Assembly:
subq $0x18, %rsp
leaq 0x2515d(%rip), %rdi     # 0x29360
xorl %eax, %eax
callq 0x652d
leaq 0x10(%rsp), %r8
movq $0x0, (%r8)
leaq 0xc(%rsp), %rcx
movl $0x0, (%rcx)
leaq 0xc06f0(%rip), %rax     # 0xc4918
movq (%rax), %rdi
leaq 0x2514a(%rip), %rsi     # 0x2937c
leaq 0x3d(%rip), %rdx        # 0x4276
callq 0x2250
testl %eax, %eax
je 0x425f
movq 0x10(%rsp), %rsi
leaq 0x25157(%rip), %rdi     # 0x293a5
xorl %eax, %eax
callq 0x2330
movq 0x10(%rsp), %rdi
callq 0x2200
movl 0xc(%rsp), %esi
leaq 0x2514a(%rip), %rdi     # 0x293b4
xorl %eax, %eax
callq 0x652d
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: open_book_db(char*)
int32 open_book_db(char *path) {

    int rc = sqlite3_open(path, &book_db);
    if (rc){
        error("Can't open database: %s\n", sqlite3_errmsg(book_db));
        sqlite3_close(book_db);
        book_db = 0;
        return 0;
    }

    char* sql = "select count(*) from book_moves";
    char *err_msg = 0;
    int num_moves = 0;

    rc = sqlite3_exec(book_db,sql,num_moves_callback,(void*)&num_moves,&err_msg);
    if( rc != SQLITE_OK ){
        error("SQL error: %s\n",err_msg);
        sqlite3_free(err_msg);
    }

    load_zkeys();

    return num_moves;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
leaq 0xc0499(%rip), %rbx     # 0xc4918
movq %rbx, %rsi
callq 0x22e0
testl %eax, %eax
je 0x44b7
movq (%rbx), %rdi
callq 0x2160
leaq 0x24f2a(%rip), %rdi     # 0x293c4
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0x2330
movq (%rbx), %rdi
callq 0x20a0
movq $0x0, (%rbx)
jmp 0x450e
leaq 0x10(%rsp), %r8
movq $0x0, (%r8)
leaq 0xc(%rsp), %rcx
movl $0x0, (%rcx)
movq (%rbx), %rdi
leaq 0x24f05(%rip), %rsi     # 0x293dd
leaq 0x38(%rip), %rdx        # 0x4517
callq 0x2250
testl %eax, %eax
je 0x4505
movq 0x10(%rsp), %rsi
leaq 0x24eb1(%rip), %rdi     # 0x293a5
xorl %eax, %eax
callq 0x2330
movq 0x10(%rsp), %rdi
callq 0x2200
callq 0x41f8
movl 0xc(%rsp), %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: num_moves_callback(void*, int, char**, char**)
static int num_moves_callback(void *data, int argc, char **argv, char **azColName){

    int* num_moves = (int*)data;

    if (argc==1 && argv[0]) {
        *num_moves = atoi(argv[0]);
    }

    printd("num moves: %d\n",*num_moves);

    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x1, %esi
jne 0x452f
movq (%rdx), %rdi
testq %rdi, %rdi
je 0x452f
callq 0x22b0
movl %eax, (%rbx)
movl (%rbx), %esi
leaq 0x24ffa(%rip), %rdi     # 0x29532
xorl %eax, %eax
callq 0x652d
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: build_book_key(position*)
int64 build_book_key(position *p) {
    int64 key = 0;

    for (int32 sq=0;sq<64;sq++) {
        if (p->piece[sq] != NO_PIECE) {
            int32 pc = p->piece[sq];
            int32 ptm = WHITE;
            if (pc < 0) {
                pc = -pc;
                ptm = BLACK;
            }
            key ^= bk_pieces[pc][ptm][sq];
        }
    }

    if (p->castling_rights & 1) {
        key ^= bk_castling_rights[bk_cr_wk];
    }
    if (p->castling_rights & 2) {
        key ^= bk_castling_rights[bk_cr_wq];
    }
    if (p->castling_rights & 4) {
        key ^= bk_castling_rights[bk_cr_bk];
    }
    if (p->castling_rights & 8) {
        key ^= bk_castling_rights[bk_cr_bq];
    }

    if (p->ep_sq != NO_SQUARE) {
        key ^= bk_ep[p->ep_sq];
    }

    key ^= bk_ptm[p->player];

    return key;
}

// Assembly:
xorl %eax, %eax
leaq 0xbdf64(%rip), %rdx     # 0xc24b0
movq %rdi, %rsi
xorl %ecx, %ecx
movl (%rsi), %r8d
testl %r8d, %r8d
je 0x457f
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
shlq $0xa, %r9
notl %r8d
shrl $0x16, %r8d
andl $0x200, %r8d            # imm = 0x200
orq %r9, %r8
addq %rax, %r8
xorq (%rdx,%r8), %rcx
addq $0x4, %rsi
addq $0x8, %rax
cmpq $0x200, %rax            # imm = 0x200
jne 0x4551
movl 0x140(%rdi), %r8d
xorl %edx, %edx
movl $0x0, %esi
testb $0x1, %r8b
je 0x45aa
movq 0xbfb2e(%rip), %rsi     # 0xc40d8
movl $0x0, %eax
testb $0x2, %r8b
je 0x45bc
movq 0xbfb14(%rip), %rax     # 0xc40d0
movl $0x0, %r10d
testb $0x4, %r8b
je 0x45cf
movq 0xbfaf9(%rip), %r10     # 0xc40c8
movl 0x13c(%rdi), %r9d
testb $0x8, %r8b
je 0x45e3
movq 0xbfadd(%rip), %rdx     # 0xc40c0
xorq %rdx, %r10
xorq %rsi, %rax
xorq %r10, %rax
xorq %rcx, %rax
cmpq $0x40, %r9
je 0x4600
leaq 0xbfae4(%rip), %rcx     # 0xc40e0
xorq (%rcx,%r9,8), %rax
movl 0x138(%rdi), %ecx
leaq 0xbfaa3(%rip), %rdx     # 0xc40b0
xorq (%rdx,%rcx,8), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: probe_book(position*)
move probe_book(position *p) {
    move_freq_pair mfp[300];
    int32 num_book_moves = get_book_moves(mfp,p);

    // get the total frequency of all book moves
    int32 total_freq=0;
    char move_buffer[8];
    for (int i=0;i<num_book_moves;i++) {
        if (mfp[i].freq > 0) {
            move_to_str(mfp[i].mv,move_buffer);
            printd("# book move: %s, freq: %d\n",move_buffer,mfp[i].freq);
            total_freq += mfp[i].freq;
        }
    }
    printd("# total freq: %d\n",total_freq);
    if (total_freq==0) {
        return 0;
    }

    // do a weighted random selection
    srand(time(NULL));
    double g = rand() / ((double) RAND_MAX); // [0-1]
    double random_weight = g * total_freq;
    printd("# random weight: %f\n",random_weight);

    int sum_freq = 0;
    move selected_mv = 0;
    for (int i=0;i<num_book_moves;i++) {
        if (mfp[i].freq > 0) {
            sum_freq += mfp[i].freq;
            if (sum_freq >= random_weight) {
                selected_mv = mfp[i].mv;
                move_to_str(selected_mv,move_buffer);
                printd("# selected move %s with sum_freq=%d\n",move_buffer,sum_freq);
                break;
            }
        }
    }

    return selected_mv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x12e8, %rsp           # imm = 0x12E8
movq %rdi, %rsi
leaq 0x20(%rsp), %rdi
callq 0x4759
movl %eax, %r12d
movl %eax, 0xc(%rsp)
testl %eax, %eax
jle 0x4688
movq %r12, %r13
shlq $0x4, %r13
leaq 0x18(%rsp), %rbx
leaq 0x24daf(%rip), %r15     # 0x293fd
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl $0x0, 0x28(%rsp,%rbp)
jle 0x467d
movq 0x20(%rsp,%rbp), %rdi
movq %rbx, %rsi
callq 0xe0f5
movl 0x28(%rsp,%rbp), %edx
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x652d
addl 0x28(%rsp,%rbp), %r14d
addq $0x10, %rbp
cmpq %rbp, %r13
jne 0x4653
jmp 0x468b
xorl %r14d, %r14d
leaq 0x24d86(%rip), %rdi     # 0x29418
xorl %ebx, %ebx
movl %r14d, %esi
xorl %eax, %eax
callq 0x652d
testl %r14d, %r14d
je 0x4744
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x2140
movl %eax, %edi
callq 0x2150
callq 0x2060
cvtsi2sd %eax, %xmm1
divsd 0x24c90(%rip), %xmm1    # 0x29358
cvtsi2sd %r14d, %xmm0
mulsd %xmm1, %xmm0
leaq 0x24d52(%rip), %rdi     # 0x2942a
movsd %xmm0, 0x10(%rsp)
movb $0x1, %al
callq 0x652d
cmpl $0x0, 0xc(%rsp)
jle 0x4744
shlq $0x4, %r12
xorl %eax, %eax
xorl %ebp, %ebp
movsd 0x10(%rsp), %xmm1
movl 0x28(%rsp,%rax), %ecx
testl %ecx, %ecx
jle 0x4711
addl %ecx, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
ucomisd %xmm1, %xmm0
jae 0x471c
addq $0x10, %rax
cmpq %rax, %r12
jne 0x46fa
jmp 0x4744
movq 0x20(%rsp,%rax), %rbx
leaq 0x18(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe0f5
leaq 0x24d07(%rip), %rdi     # 0x2943f
movq %r14, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x652d
movq %rbx, %rax
addq $0x12e8, %rsp           # imm = 0x12E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: get_book_moves(move_freq_pair*, position*)
int32 get_book_moves(move_freq_pair *mfp,position *p) {
    if (book_db==0) {
        printd("# can't probe - no book database\n");
        return 0;
    }

    printd("# probing book...\n");

    long long key = build_book_key(p);

    char sql[128];
    sprintf(sql,"select fromsq,tosq,frequency,wins,losses,draws from book_moves where key=%lld",key);

    char *err_msg = 0;

    move moves[300],*endp;
    endp = gen_legal_moves(moves,p,true,true);

    int mv_ind=0;
    for (move *mp=moves;mp<endp;mp++) {
        if (*mp) {
            mfp[mv_ind].mv=*mp;
            mfp[mv_ind].freq=0;
            mv_ind++;
        }
    }
    assert(mv_ind<300);

    mfpn_type mfpn;
    mfpn.mfp = &mfp[0];
    mfpn.n = mv_ind;
    int rc = sqlite3_exec(book_db,sql,get_moves_callback,(void*)&mfpn,&err_msg);
    if( rc != SQLITE_OK ){
        error("SQL error: %s\n",err_msg);
        sqlite3_free(err_msg);
    }

    return mv_ind;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa00, %rsp            # imm = 0xA00
leaq 0xc01a8(%rip), %r13     # 0xc4918
cmpq $0x0, (%r13)
je 0x4856
movq %rsi, %r12
movq %rdi, %r14
leaq 0x24cfe(%rip), %rdi     # 0x29486
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x652d
movq %r12, %rdi
callq 0x4543
leaq 0x24cf9(%rip), %rsi     # 0x29499
leaq 0x20(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2040
movq $0x0, 0x8(%rsp)
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7840
cmpq %rax, %r15
jae 0x4806
xorl %ebx, %ebx
movq (%r15), %rcx
testq %rcx, %rcx
je 0x47fd
movslq %ebx, %rbx
movq %rbx, %rdx
shlq $0x4, %rdx
movq %rcx, (%r14,%rdx)
movl $0x0, 0x8(%r14,%rdx)
incl %ebx
addq $0x8, %r15
cmpq %rax, %r15
jb 0x47dc
cmpl $0x12c, %ebx            # imm = 0x12C
jge 0x4879
leaq 0x10(%rsp), %rcx
movq %r14, (%rcx)
movl %ebx, 0x8(%rcx)
movq (%r13), %rdi
leaq 0x74(%rip), %rdx        # 0x4898
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %r8
callq 0x2250
testl %eax, %eax
je 0x4866
movq 0x8(%rsp), %rsi
leaq 0x24b62(%rip), %rdi     # 0x293a5
xorl %eax, %eax
callq 0x2330
movq 0x8(%rsp), %rdi
callq 0x2200
jmp 0x4866
leaq 0x24c07(%rip), %rdi     # 0x29464
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x652d
movl %ebx, %eax
addq $0xa00, %rsp            # imm = 0xA00
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x24c67(%rip), %rdi     # 0x294e7
leaq 0x24c6b(%rip), %rsi     # 0x294f2
leaq 0x24c71(%rip), %rcx     # 0x294ff
movl $0x104, %edx            # imm = 0x104
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/book.cpp
// Function: get_moves_callback(void*, int, char**, char**)
static int get_moves_callback(void *data,int argc,char **argv,char **azColName) {

    mfpn_type* mfpn = (mfpn_type*)data;

    int fromsq = atoi(argv[0]);
    int tosq = atoi(argv[1]);
    int freq = atoi(argv[2]);

    for (int i=0;i<mfpn->n;i++) {
        if (get_from_sq(mfpn->mfp[i].mv)==fromsq && get_to_sq(mfpn->mfp[i].mv)==tosq) {
            mfpn->mfp[i].freq += freq;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
movq (%rdx), %rdi
callq 0x22b0
movl %eax, %ebp
movq 0x8(%r15), %rdi
callq 0x22b0
movl %eax, %r14d
movq 0x10(%r15), %rdi
callq 0x22b0
cmpl $0x0, 0x8(%rbx)
jle 0x4910
movl %eax, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%rbx), %rax
movq (%rax,%r12), %rdi
callq 0x77b0
cmpl %ebp, %eax
jne 0x4900
movq (%rbx), %rax
movq (%rax,%r12), %rdi
callq 0x77b7
cmpl %r14d, %eax
jne 0x4900
movq (%rbx), %rax
addl %r15d, 0x8(%rax,%r12)
incq %r13
movslq 0x8(%rbx), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x48d7
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/draw.cpp
// Function: is_lack_of_mating_material(position*)
bool is_lack_of_mating_material(position *pos) {
    assert(pos);

    int num_knights=0,num_white_sq_bishops=0,num_black_sq_bishops=0;

    for (int sq=0;sq<64;sq++) {
        switch(pos->piece[sq]) {
            // any position with a pawn, rook, or queen is not drawn by lack of mating material
            case PAWN:
            case -PAWN:
            case ROOK:
            case -ROOK:
            case QUEEN:
            case -QUEEN:
                return false;

            // a position with more than one knight is not drawn by lack of mating material
            case KNIGHT:
            case -KNIGHT:
                num_knights++;
                if (num_knights>1) return false;
                if (num_white_sq_bishops>0 || num_black_sq_bishops>0) return false;
                break;

            // a position with bishops on opposite colors is not drawn
            case BISHOP:
            case -BISHOP:
                if (is_light_sq((square_t)sq)) {
                    num_white_sq_bishops++;
                } else {
                    num_black_sq_bishops++;
                }
                if (num_white_sq_bishops>0 && num_black_sq_bishops>0) return false;
                if (num_knights>0) return false;
                break;
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x49f2
movq %rdi, %rbx
xorl %r14d, %r14d
movl $0x88, %ecx
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ebp, %ebp
movl (%rbx,%r14,4), %eax
addl $0x5, %eax
cmpl $0xa, %eax
ja 0x49c3
btl %eax, %ecx
jb 0x49a4
movl $0x104, %edx            # imm = 0x104
btl %eax, %edx
jae 0x49b9
movl %r14d, %edi
callq 0xce02
movzbl %al, %eax
movl %eax, %ecx
andl $0x1, %ecx
notb %al
movzbl %al, %eax
andl $0x1, %eax
addl %eax, %r13d
addl %ecx, %r12d
setg %al
testl %r13d, %r13d
setg %cl
testb %cl, %al
jne 0x49dc
testl %ebp, %ebp
movl $0x0, %ebp
movl $0x88, %ecx
jle 0x49c3
jmp 0x49dc
testl %ebp, %ebp
jg 0x49dc
testl %r12d, %r12d
jg 0x49dc
movl $0x1, %ebp
testl %r13d, %r13d
jle 0x49c3
jmp 0x49dc
movl $0x653, %edx            # imm = 0x653
btl %eax, %edx
jb 0x49dc
cmpq $0x3f, %r14
leaq 0x1(%r14), %rax
setae %r15b
movq %rax, %r14
cmpq $0x40, %rax
jne 0x494e
andb $0x1, %r15b
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24b48(%rip), %rdi     # 0x29541
leaq 0x24b45(%rip), %rsi     # 0x29545
leaq 0x24b4b(%rip), %rcx     # 0x29552
movl $0x18, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/draw.cpp
// Function: is_draw_by_rep(position*, undo*)
bool is_draw_by_rep(position *pos,undo *undo_stack) {
    assert(pos);
    assert(pos->move_counter >= 0 && pos->move_counter < MAX_MOVES_PER_GAME);
    assert(pos->fifty_counter >= 0 && pos->fifty_counter <= pos->move_counter);
    assert(pos->hash_key==build_hash_key(pos));
    assert(undo_stack);

    uint32 reps = 0;
    for (uint32 i=(pos->move_counter-pos->fifty_counter);i<pos->move_counter;i++) {
        if ((undo_stack+i)->hash_key==pos->hash_key) {
            reps++;
        }
    }

    return reps >= 2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x4ab1
movq %rdi, %r14
movl 0x144(%rdi), %eax
cmpl $0x173c, %eax           # imm = 0x173C
jae 0x4ad0
cmpl %eax, 0x148(%r14)
ja 0x4aef
movq %rsi, %rbx
movq 0x1b8(%r14), %r15
movq %r14, %rdi
callq 0x5e40
cmpq %rax, %r15
jne 0x4b0e
testq %rbx, %rbx
je 0x4b2d
movl 0x144(%r14), %ecx
movl %ecx, %esi
subl 0x148(%r14), %esi
xorl %eax, %eax
cmpl %ecx, %esi
jae 0x4aab
movq 0x1b8(%r14), %rdx
movl %esi, %esi
subq %rsi, %rcx
shlq $0x5, %rsi
addq %rbx, %rsi
addq $0x8, %rsi
xorl %edi, %edi
cmpq %rdx, (%rsi)
sete %dil
addl %edi, %eax
addq $0x20, %rsi
decq %rcx
jne 0x4a91
cmpl $0x2, %eax
setae %al
popq %rbx
popq %r14
popq %r15
retq
leaq 0x24a89(%rip), %rdi     # 0x29541
leaq 0x24a86(%rip), %rsi     # 0x29545
leaq 0x24ab8(%rip), %rcx     # 0x2957e
movl $0x41, %edx
callq 0x20d0
leaq 0x24acf(%rip), %rdi     # 0x295a6
leaq 0x24a67(%rip), %rsi     # 0x29545
leaq 0x24a99(%rip), %rcx     # 0x2957e
movl $0x42, %edx
callq 0x20d0
leaq 0x24af1(%rip), %rdi     # 0x295e7
leaq 0x24a48(%rip), %rsi     # 0x29545
leaq 0x24a7a(%rip), %rcx     # 0x2957e
movl $0x43, %edx
callq 0x20d0
leaq 0x24b15(%rip), %rdi     # 0x2962a
leaq 0x24a29(%rip), %rsi     # 0x29545
leaq 0x24a5b(%rip), %rcx     # 0x2957e
movl $0x44, %edx
callq 0x20d0
leaq 0x245fc(%rip), %rdi     # 0x29130
leaq 0x24a0a(%rip), %rsi     # 0x29545
leaq 0x24a3c(%rip), %rcx     # 0x2957e
movl $0x45, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/drawboard.cpp
// Function: draw_bitboard(unsigned long long)
void draw_bitboard(uint64 bb) {
    char text[100];
    strcpy(text,"");

    for (int i=0;i<64;i++) {
        if (bb & bb_squares[i]) {
            strcat(text,"1");
        } else {
            strcat(text,"0");
        }
        if (get_file((square_t)i)==FILE_H) {
            strcat(text,"\n");
        }
    }

    strcat(text,"\n");
    print(text);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movb $0x0, (%r14)
xorl %r15d, %r15d
leaq 0xf5647(%rip), %r12     # 0xfa4b0
movq (%r12,%r15,8), %r13
andq %rbx, %r13
movq %r14, %rdi
callq 0x2080
cmpq $0x1, %r13
movw $0x31, %cx
sbbw $0x0, %cx
movw %cx, (%rsp,%rax)
movl %r15d, %edi
callq 0xca4a
cmpl $0x7, %eax
jne 0x4ea3
movq %r14, %rdi
callq 0x2080
movw $0xa, (%rsp,%rax)
incq %r15
cmpq $0x40, %r15
jne 0x4e69
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x2080
movw $0xa, (%rsp,%rax)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x640d
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_major_on_7th(position*, square_t, bool)
int32 eval_major_on_7th(position *pos,square_t sq,bool wtm) {
    int32 score = 0;

    if (wtm) {
        if (get_rank(sq)==RANK_7 && get_rank(pos->black_king)==RANK_8) {
            score += rook_on_7th;
            score += eval_connected_major_on_7th(pos,sq,wtm);
        }
    } else {
        if (get_rank(sq)==RANK_2 && get_rank(pos->white_king)==RANK_1) {
            score += rook_on_7th;
            score += eval_connected_major_on_7th(pos,sq,wtm);
        }
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %edi
callq 0xca75
testl %r14d, %r14d
je 0x4f72
xorl %r14d, %r14d
cmpl $0x1, %eax
jne 0x4fcc
movl 0x150(%rbx), %edi
callq 0xca75
testl %eax, %eax
jne 0x4fcc
movl $0x198, %r15d           # imm = 0x198
movl $0x188, %r14d           # imm = 0x188
jmp 0x4f96
xorl %r14d, %r14d
cmpl $0x6, %eax
jne 0x4fcc
movl 0x14c(%rbx), %edi
callq 0xca75
cmpl $0x7, %eax
jne 0x4fcc
movl $0x1a0, %r15d           # imm = 0x1A0
movl $0x190, %r14d           # imm = 0x190
movl %ebp, %eax
shlq $0x6, %rax
leaq 0xf5f0d(%rip), %rcx     # 0xfaeb0
movq 0x10(%rcx,%rax), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x677c
movq (%rbx,%r15), %rcx
orq (%rbx,%r14), %rcx
testq %rax, %rcx
movl $0x32, %eax
movl $0x82, %r14d
cmovel %eax, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_knights(position*)
int32 eval_knights(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_knights;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_knight(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_knights;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_knight(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x168(%rdi), %r15
xorl %r14d, %r14d
testq %r15, %r15
je 0x5038
leaq 0x24792(%rip), %r12     # 0x29790
leaq 0xf54ab(%rip), %r13     # 0xfa4b0
movq %r15, %rdi
callq 0x3c25
movl %eax, %ebp
movl 0x150(%rbx), %esi
movl %eax, %edi
callq 0xcba2
addl (%r12,%rbp,4), %r14d
addl %eax, %eax
subl %eax, %r14d
movq (%r13,%rbp,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x5005
movq 0x170(%rbx), %r15
testq %r15, %r15
je 0x5090
leaq 0xf5465(%rip), %rbp     # 0xfa4b0
movq %r15, %rdi
callq 0x3b5b
movl %eax, %r12d
leaq 0x24833(%rip), %rcx     # 0x29890
movslq (%rcx,%r12,4), %r13
movl 0x14c(%rbx), %esi
movl %eax, %edi
callq 0xcba2
leaq 0x2471b(%rip), %rcx     # 0x29790
subl (%rcx,%r13,4), %r14d
leal (%r14,%rax,2), %r14d
movq (%rbp,%r12,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x504b
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_knight(position*, square_t, bool)
int32 eval_knight(position *p,square_t sq,bool wtm) {
    int score;
    if (wtm) {
        score = knight_pst[sq];
        score += knight_tropism * distance(sq,p->black_king);
    } else {
        score = knight_pst[fliprank[sq]];
        score += knight_tropism * distance(sq,p->white_king);
    }
    return score;
}

// Assembly:
movl %esi, %eax
movl %esi, %ecx
testl %edx, %edx
je 0x50b3
addq $0x150, %rdi            # imm = 0x150
jmp 0x50c5
leaq 0x247d6(%rip), %rdx     # 0x29890
movslq (%rdx,%rcx,4), %rcx
addq $0x14c, %rdi            # imm = 0x14C
pushq %rbx
leaq 0x246c3(%rip), %rdx     # 0x29790
movl (%rdx,%rcx,4), %ebx
movl (%rdi), %esi
movl %eax, %edi
callq 0xcba2
addl %eax, %eax
subl %eax, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_bishops(position*)
int32 eval_bishops(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_bishops;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_bishop(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_bishops;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_bishop(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x178(%rdi), %r15
xorl %ebx, %ebx
testq %r15, %r15
je 0x512a
leaq 0x24a8e(%rip), %r12     # 0x29b90
leaq 0xf53a7(%rip), %r13     # 0xfa4b0
movq %r15, %rdi
callq 0x3c25
movl %eax, %eax
addl (%r12,%rax,4), %ebx
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x5109
movq 0x180(%r14), %r14
testq %r14, %r14
je 0x5170
leaq 0x24753(%rip), %r15     # 0x29890
leaq 0x24a4c(%rip), %r12     # 0x29b90
leaq 0xf5365(%rip), %r13     # 0xfa4b0
movq %r14, %rdi
callq 0x3b5b
movl %eax, %eax
movslq (%r15,%rax,4), %rcx
subl (%r12,%rcx,4), %ebx
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x514b
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_rook_open_file(position*, square_t, bool)
int32 eval_rook_open_file(position *p,square_t sq,bool wtm) {
    int32 score = 0;

    uint64 friends,enemies;
    if (wtm) {
        friends = p->white_pawns;
        enemies = p->black_pawns;
    } else {
        friends = p->black_pawns;
        enemies = p->white_pawns;
    }

    uint64 file_mask = bb_files[get_file(sq)] ^ bb_squares[sq];
    if (!(file_mask & friends)) {
        if (file_mask & enemies) {
            score += rook_half_open_file;
        } else {
            score += rook_open_file;
        }
    }

    return score;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edx, %eax
movl %edx, %ecx
xorb $0x1, %cl
movzbl %cl, %ecx
movq 0x158(%rdi,%rax,8), %r14
movq 0x158(%rdi,%rcx,8), %r15
movl %esi, %edi
callq 0xca4a
movl %eax, %eax
leaq 0xf5267(%rip), %rcx     # 0xfa430
movl %ebx, %edx
leaq 0xf52de(%rip), %rsi     # 0xfa4b0
movq (%rsi,%rdx,8), %rdx
xorq (%rcx,%rax,8), %rdx
testq %r14, %rdx
movl $0x19, %eax
movl $0xf, %ecx
cmovel %eax, %ecx
xorl %eax, %eax
testq %r15, %rdx
cmovel %ecx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_rooks(position*)
int32 eval_rooks(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_rooks;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_rook(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_rooks;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_rook(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x188(%rdi), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x5249
leaq 0xf5298(%rip), %r12     # 0xfa4b0
movq %r14, %rdi
callq 0x3c25
movl %eax, %r15d
movq %rbx, %rdi
movl %eax, %esi
movl $0x1, %edx
callq 0x5295
addl %eax, %ebp
movl %r15d, %eax
movq (%r12,%rax,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x5218
movq 0x190(%rbx), %r14
testq %r14, %r14
je 0x528a
leaq 0xf5254(%rip), %r12     # 0xfa4b0
movq %r14, %rdi
callq 0x3b5b
movl %eax, %r15d
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x5295
subl %eax, %ebp
movl %r15d, %eax
movq (%r12,%rax,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x525c
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_rook(position*, square_t, bool)
int32 eval_rook(position *p,square_t sq,bool wtm) {
    int32 score = wtm ? rook_pst[sq] : rook_pst[fliprank[sq]];
    score += eval_major_on_7th(p,sq,wtm);
    score += eval_rook_open_file(p,sq,wtm);
    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %r12d
testl %edx, %edx
je 0x52b1
movq %r12, %r13
jmp 0x52bc
leaq 0x245d8(%rip), %rax     # 0x29890
movslq (%rax,%r12,4), %r13
movzbl %dl, %r15d
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x4f32
movl %eax, %ebp
leaq 0x249ba(%rip), %rax     # 0x29c90
addl (%rax,%r13,4), %ebp
movl %r15d, %eax
xorb $0x1, %al
movzbl %al, %eax
movq 0x158(%r14,%r15,8), %r15
movq 0x158(%r14,%rax,8), %r14
movl %ebx, %edi
callq 0xca4a
movl %eax, %eax
leaq 0xf512e(%rip), %rcx     # 0xfa430
leaq 0xf51a7(%rip), %rdx     # 0xfa4b0
movq (%rdx,%r12,8), %rdx
xorq (%rcx,%rax,8), %rdx
testq %r15, %rdx
movl $0x19, %eax
movl $0xf, %ecx
cmovel %eax, %ecx
xorl %eax, %eax
testq %r14, %rdx
cmovel %ecx, %eax
addl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_queens(position*)
int32 eval_queens(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_queens;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_queen(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_queens;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_queen(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x198(%rdi), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x5396
leaq 0x24633(%rip), %r15     # 0x29990
leaq 0xf514c(%rip), %r12     # 0xfa4b0
movq %r14, %rdi
callq 0x3c25
movl %eax, %r13d
movq %rbx, %rdi
movl %eax, %esi
movl $0x1, %edx
callq 0x4f32
addl (%r15,%r13,4), %ebp
addl %eax, %ebp
movq (%r12,%r13,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x5364
movq 0x1a0(%rbx), %r14
testq %r14, %r14
je 0x53eb
leaq 0xf5107(%rip), %r13     # 0xfa4b0
movq %r14, %rdi
callq 0x3b5b
movl %eax, %r15d
leaq 0x244d5(%rip), %rcx     # 0x29890
movslq (%rcx,%r15,4), %r12
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x4f32
leaq 0x245be(%rip), %rcx     # 0x29990
addl (%rcx,%r12,4), %eax
subl %eax, %ebp
movq (%r13,%r15,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x53a9
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_kings(position*, int32_pair)
int32 eval_kings(position *p,int32_pair npmat) {
    int32 score = 0;

    const int endgame_threshold = knight_val*2 + rook_val;

    // if black has a lot of material then eval white in the middle game
    if (npmat.val2 >= endgame_threshold) {
        score += king_pst[p->white_king];
        score += eval_scale(eval_king_safety(p,true),npmat.val2);
    } else {
        score += king_endgame_pst[p->white_king];
    }

    if (npmat.val1 >= endgame_threshold) {
        score -= king_pst[fliprank[p->black_king]];
        score -= eval_scale(eval_king_safety(p,false),npmat.val1);
    } else {
        score -= king_endgame_pst[fliprank[p->black_king]];
    }

    return score;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rbx
shrq $0x20, %rbx
movl 0x14c(%rdi), %r13d
leaq 0x24640(%rip), %r12     # 0x29a90
cmpl $0x44c, %ebx            # imm = 0x44C
jl 0x5488
movq %r15, %rdi
movl $0x1, %esi
callq 0x58ec
imull %ebx, %eax
movslq %eax, %rbx
imulq $-0x59078029, %rbx, %rax # imm = 0xA6F87FD7
shrq $0x20, %rax
addl %eax, %ebx
movl %ebx, %eax
shrl $0x1f, %eax
sarl $0xb, %ebx
addl %eax, %ebx
addl (%r12,%r13,4), %ebx
jmp 0x5493
leaq 0x24901(%rip), %rax     # 0x29d90
movl (%rax,%r13,4), %ebx
movl 0x150(%r15), %eax
leaq 0x243ef(%rip), %rcx     # 0x29890
movslq (%rcx,%rax,4), %r13
cmpl $0x44c, %r14d           # imm = 0x44C
jl 0x54db
movq %r15, %rdi
xorl %esi, %esi
callq 0x58ec
imull %r14d, %eax
cltq
imulq $-0x59078029, %rax, %rcx # imm = 0xA6F87FD7
shrq $0x20, %rcx
addl %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0xb, %eax
addl %ecx, %eax
addl (%r12,%r13,4), %eax
jmp 0x54e6
leaq 0x248ae(%rip), %rax     # 0x29d90
movl (%rax,%r13,4), %eax
subl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_pawns_no_hash(position*)
int32 eval_pawns_no_hash(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_pawns;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_pawn(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_pawns;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_pawn(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x158(%rdi), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x5563
leaq 0xf4f7e(%rip), %r12     # 0xfa4b0
movq %r14, %rdi
callq 0x3c25
movl %eax, %r15d
movq %rbx, %rdi
movl %eax, %esi
movl $0x1, %edx
callq 0x5b74
addl %eax, %ebp
movl %r15d, %eax
movq (%r12,%rax,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x5532
movq 0x160(%rbx), %r14
testq %r14, %r14
je 0x55a4
leaq 0xf4f3a(%rip), %r12     # 0xfa4b0
movq %r14, %rdi
callq 0x3b5b
movl %eax, %r15d
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x5b74
subl %eax, %ebp
movl %r15d, %eax
movq (%r12,%rax,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x5576
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_pawns(position*)
int32 eval_pawns(position *p) {

    int32 score;

    // try the pawn hash
    uint64 val = get_hash_entry(&phtbl,p->pawn_key);
    if (val != 0) {
        score = get_pawn_hash_entry_score(val);
        assert(score==eval_pawns_no_hash(p));
    } else {
        score = eval_pawns_no_hash(p);
        // store (always replace)
        store_hash_entry(&phtbl,p->pawn_key,build_pawn_hash_val(score));
    }

    return score;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x1c0(%rdi), %rsi
leaq 0xf295c(%rip), %rdi     # 0xf7f20
callq 0x6263
testq %rax, %rax
je 0x5603
movq %rax, %rdi
callq 0x615a
movl %eax, %ebx
movq %r14, %rdi
callq 0x5512
cmpl %eax, %ebx
je 0x562d
leaq 0x248a5(%rip), %rdi     # 0x29e90
leaq 0x248bb(%rip), %rsi     # 0x29ead
leaq 0x248c1(%rip), %rcx     # 0x29eba
movl $0xed, %edx
callq 0x20d0
movq %r14, %rdi
callq 0x5512
movl %eax, %ebx
movq 0x1c0(%r14), %r14
movl %eax, %edi
callq 0x60ed
leaq 0xf28fe(%rip), %rdi     # 0xf7f20
movq %r14, %rsi
movq %rax, %rdx
callq 0x62c0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_nonpawn_material(position*)
int32_pair eval_nonpawn_material(position *p) {
    int32_pair score;

    score.val1 = p->piece_counts[WHITE][ROOK] * rook_val
            + p->piece_counts[WHITE][KNIGHT] * knight_val
            + p->piece_counts[WHITE][BISHOP] * bishop_val
            + p->piece_counts[WHITE][QUEEN] * queen_val;

    score.val2 = p->piece_counts[BLACK][ROOK] * rook_val
            + p->piece_counts[BLACK][KNIGHT] * knight_val
            + p->piece_counts[BLACK][BISHOP] * bishop_val
            + p->piece_counts[BLACK][QUEEN] * queen_val;

    assert(score.val1==eval_nonpawn_material_slow(p).val1);
    assert(score.val2==eval_nonpawn_material_slow(p).val2);


    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
imull $0x1f4, 0x12c(%rdi), %eax # imm = 0x1F4
imull $0x12c, 0x124(%rdi), %ecx # imm = 0x12C
addl %eax, %ecx
movl 0x10c(%rdi), %r14d
movl 0x128(%rdi), %eax
leal (%rax,%rax,4), %eax
shll $0x6, %eax
imull $0x384, 0x130(%rdi), %ebx # imm = 0x384
addl %eax, %ebx
addl %ecx, %ebx
imull $0x1f4, 0x110(%rdi), %r12d # imm = 0x1F4
imull $0x12c, 0x108(%rdi), %ebp # imm = 0x12C
imull $0x384, 0x114(%rdi), %r15d # imm = 0x384
callq 0x5637
cmpl %eax, %ebx
jne 0x573e
addl %r12d, %ebp
leal (%r14,%r14,4), %ecx
shll $0x6, %ecx
addl %r15d, %ecx
addl %ebp, %ecx
shrq $0x20, %rax
cmpl %eax, %ecx
jne 0x575d
shlq $0x20, %rcx
movl %ebx, %eax
orq %rcx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24792(%rip), %rdi     # 0x29ed7
leaq 0x24761(%rip), %rsi     # 0x29ead
leaq 0x247b3(%rip), %rcx     # 0x29f06
movl $0x12a, %edx            # imm = 0x12A
callq 0x20d0
leaq 0x247cf(%rip), %rdi     # 0x29f33
leaq 0x24742(%rip), %rsi     # 0x29ead
leaq 0x24794(%rip), %rcx     # 0x29f06
movl $0x12b, %edx            # imm = 0x12B
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_pawn_material_slow(position*)
int32_pair eval_pawn_material_slow(position *p) {
    int32_pair score;
    score.val1 = 0;
    score.val2 = 0;

    for (int sq=0;sq<64;sq++) {
        switch(p->piece[sq]) {
        case PAWN:
            score.val1 += pawn_val;
            break;
        case -PAWN:
            score.val2 += pawn_val;
            break;
        }
    }

    return score;
}

// Assembly:
xorl %edx, %edx
xorl %ecx, %ecx
xorl %eax, %eax
movl (%rdi,%rdx,4), %esi
cmpl $-0x1, %esi
je 0x5794
cmpl $0x1, %esi
jne 0x5797
addl $0x64, %eax
jmp 0x5797
addl $0x64, %ecx
incq %rdx
cmpq $0x40, %rdx
jne 0x5782
shlq $0x20, %rcx
movl %eax, %eax
orq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval_pawn_material(position*)
int32_pair eval_pawn_material(position *p) {
    int32_pair score;
    score.val1 = p->piece_counts[WHITE][PAWN] * pawn_val;
    score.val2 = p->piece_counts[BLACK][PAWN] * pawn_val;

    assert(score.val1==eval_pawn_material_slow(p).val1);
    assert(score.val2==eval_pawn_material_slow(p).val2);

    return score;
}

// Assembly:
pushq %rax
movl 0x104(%rdi), %ecx
movl 0x120(%rdi), %eax
xorl %edx, %edx
xorl %esi, %esi
movl %esi, %r8d
leal 0x64(%r8), %esi
cmpl $0x1, (%rdi,%rdx,4)
cmovnel %r8d, %esi
incq %rdx
cmpq $0x40, %rdx
jne 0x57bb
imull $0x64, %eax, %eax
cmpl %esi, %eax
jne 0x5808
imull $0x64, %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl %esi, %r8d
leal 0x64(%r8), %esi
cmpl $-0x1, (%rdi,%rdx,4)
cmovnel %r8d, %esi
incq %rdx
cmpq $0x40, %rdx
jne 0x57e1
cmpl %esi, %ecx
jne 0x5827
shlq $0x20, %rcx
movl %eax, %eax
orq %rcx, %rax
popq %rcx
retq
leaq 0x24753(%rip), %rdi     # 0x29f62
leaq 0x24697(%rip), %rsi     # 0x29ead
leaq 0x24771(%rip), %rcx     # 0x29f8e
movl $0x149, %edx            # imm = 0x149
callq 0x20d0
leaq 0x2478a(%rip), %rdi     # 0x29fb8
leaq 0x24678(%rip), %rsi     # 0x29ead
leaq 0x24752(%rip), %rcx     # 0x29f8e
movl $0x14a, %edx            # imm = 0x14A
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/eval.cpp
// Function: eval(position*, bool)
int32 eval(position *p,bool mat_only) {
    int32 score = 0;

    int32_pair npmat = eval_nonpawn_material(p);
    score += npmat.val1 - npmat.val2;

    int32_pair pmat = eval_pawn_material(p);
    score += pmat.val1 - pmat.val2;

    if (!mat_only) {
        score += eval_pawns(p);
        score += eval_knights(p);
        score += eval_bishops(p);
        score += eval_rooks(p);
        score += eval_queens(p);
        score += eval_kings(p,npmat);
    }

    return p->player==WHITE ? score : -score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x56ad
movq %rax, %r14
shrq $0x20, %rax
movl %r14d, %r12d
subl %eax, %r12d
movq %rbx, %rdi
callq 0x57aa
movq %rax, %r15
shrq $0x20, %rax
subl %eax, %r15d
addl %r12d, %r15d
testl %ebp, %ebp
jne 0x58d2
movq %rbx, %rdi
callq 0x55af
movl %eax, %ebp
movq %rbx, %rdi
callq 0x4fda
movl %eax, %r12d
addl %ebp, %r12d
movq %rbx, %rdi
callq 0x50e1
movl %eax, %ebp
addl %r12d, %ebp
movq %rbx, %rdi
callq 0x51f8
movl %eax, %r12d
addl %ebp, %r12d
addl %r15d, %r12d
movq %rbx, %rdi
callq 0x533a
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x542c
movl %eax, %r15d
addl %ebp, %r15d
addl %r12d, %r15d
movl %r15d, %eax
negl %eax
cmpl $0x1, 0x138(%rbx)
cmovel %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/evalp.cpp
// Function: eval_pawn(position*, square_t, bool)
int32 eval_pawn(position *p,square_t sq,bool wtm) {
    int32 score = wtm ? pawn_pst[sq] : pawn_pst[fliprank[sq]];

    if (is_passed(p,sq,wtm)) {
        score += passed_pawn;
    }
    if (is_doubled(p,sq,wtm)) {
        score += doubled_pawn;
    }
    if (is_isolated(p,sq,wtm)) {
        score += isolated_pawn;
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
testl %edx, %edx
jne 0x5b92
leaq 0x24462(%rip), %rcx     # 0x29ff0
movslq (%rcx,%rax,4), %rax
leaq 0x24557(%rip), %rcx     # 0x2a0f0
movl (%rcx,%rax,4), %r15d
movzbl %dl, %ebp
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x5bee
leal 0x14(%r15), %r12d
testb %al, %al
cmovel %r15d, %r12d
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x5c48
leal -0xa(%r12), %r15d
testb %al, %al
cmovel %r12d, %r15d
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x5ccb
leal -0x14(%r15), %ecx
testb %al, %al
cmovel %r15d, %ecx
movl %ecx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/evalp.cpp
// Function: is_doubled(position*, square_t, bool)
bool is_doubled(position *pos,square_t pawn_sq,bool wtm) {
    assert( (wtm && pos->piece[pawn_sq]==PAWN) || (!wtm && pos->piece[pawn_sq]==-PAWN));

    uint64 file_mask = bb_files[get_file(pawn_sq)] ^ bb_squares[pawn_sq];

    if (wtm){
        if (file_mask & pos->white_pawns) return true;
    } else {
        if (file_mask & pos->black_pawns) return true;
    }

    return false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rdi, %rbx
movl %esi, %r14d
testl %edx, %edx
je 0x5c64
cmpl $0x1, (%rbx,%r14,4)
je 0x5c6b
testb %bpl, %bpl
jne 0x5cac
cmpl $-0x1, (%rbx,%r14,4)
jne 0x5cac
movl %esi, %edi
callq 0xca4a
movl %eax, %eax
leaq 0xf47b5(%rip), %rdx     # 0xfa430
leaq 0xf482e(%rip), %rcx     # 0xfa4b0
movq (%rcx,%r14,8), %rcx
xorq (%rdx,%rax,8), %rcx
movb $0x1, %al
testb %bpl, %bpl
je 0x5c9c
testq %rcx, 0x158(%rbx)
jne 0x5ca7
jmp 0x5ca5
testq %rcx, 0x160(%rbx)
jne 0x5ca7
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2453d(%rip), %rdi     # 0x2a1f0
leaq 0x24581(%rip), %rsi     # 0x2a23b
leaq 0x24588(%rip), %rcx     # 0x2a249
movl $0x22, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
pushq %rax
leaq 0xbe5d3(%rip), %r14     # 0xc4300
xorl %ebx, %ebx
leaq 0xf46fa(%rip), %r15     # 0xfa430
movq $0x0, (%r14)
movl %ebx, %edi
callq 0xca4a
testl %eax, %eax
jle 0x5d52
leal -0x1(%rax), %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, (%r14)
cmpl $0x6, %eax
jg 0x5d61
cltq
movq 0x8(%r15,%rax,8), %rax
orq %rax, (%r14)
incq %rbx
addq $0x8, %r14
cmpq $0x40, %rbx
jne 0x5d36
xorl %r14d, %r14d
leaq 0xf5138(%rip), %r15     # 0xfaeb0
leaq 0xbe781(%rip), %r12     # 0xc4500
xorl %ebx, %ebx
movl %ebx, %edi
callq 0xca4a
movq (%r15,%r14,4), %rdx
movq 0x20(%r15,%r14,4), %rcx
movq %rdx, 0x8(%r14,%r12)
movq %rcx, (%r14,%r12)
testl %eax, %eax
jle 0x5db1
orq -0x40(%r15,%r14,4), %rdx
movq %rdx, 0x8(%r14,%r12)
orq -0x20(%r15,%r14,4), %rcx
movq %rcx, (%r14,%r12)
cmpl $0x6, %eax
jg 0x5dc9
movq 0x40(%r15,%r14,4), %rax
orq %rax, 0x8(%r14,%r12)
movq 0x60(%r15,%r14,4), %rax
orq %rax, (%r14,%r12)
incq %rbx
addq $0x10, %r14
cmpq $0x40, %rbx
jne 0x5d81
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xaf39
cmpb %bpl, %al
jne 0x5e1e
movl $0x1, %eax
testb %bpl, %bpl
jne 0x5e17
movq %rbx, %rdi
callq 0x77cb
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x244ba(%rip), %rdi     # 0x2a2df
leaq 0x244d6(%rip), %rsi     # 0x2a302
leaq 0x244de(%rip), %rcx     # 0x2a311
movl $0x10, %edx
callq 0x20d0
nopl (%rax)