LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0x61c4
testl %edi, %edi
js 0x61b7
leal 0x1(,%rdi,2), %edi
jmp 0x61c1
addl %edi, %edi
negl %edi
orl $0x20001, %edi          # imm = 0x20001
movl %edi, %eax
retq
pushq %rax
leaq 0x242fd(%rip), %rdi     # 0x2a4c9
leaq 0x2421a(%rip), %rsi     # 0x2a3ed
leaq 0x24307(%rip), %rcx     # 0x2a4e1
movl $0x67, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6297
movl %esi, %ebp
movq %rdi, %rbx
shrl $0x4, %ebp
leaq 0x242ff(%rip), %rdi     # 0x2a53a
movl %ebp, %esi
xorl %eax, %eax
callq 0x65d9
movl $0x2, %eax
movl %eax, %r14d
leal (%r14,%r14), %eax
cmpl %ebp, %r14d
jbe 0x6249
shrl %r14d
leal -0x1(%r14), %eax
cltq
movq %rax, 0x10(%rbx)
leaq 0x242e9(%rip), %rdi     # 0x2a552
movl %r14d, %esi
xorl %eax, %eax
callq 0x65d9
shlq $0x4, %r14
movq %r14, %rdi
callq 0x2220
movq %rax, (%rbx)
leaq 0x242e7(%rip), %rdi     # 0x2a570
movq %r14, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x65d9
leaq 0x24265(%rip), %rdi     # 0x2a503
leaq 0x24148(%rip), %rsi     # 0x2a3ed
leaq 0x24263(%rip), %rcx     # 0x2a50f
movl $0x99, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x62f3
movq 0x10(%rdi), %rcx
movl $0x1, %edx
xorl %esi, %esi
xorps %xmm0, %xmm0
shlq $0x4, %rsi
movups %xmm0, (%rax,%rsi)
movl %edx, %r8d
incl %edx
movq %r8, %rsi
cmpq %r8, %rcx
jae 0x62cd
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movq $0x0, 0x28(%rdi)
popq %rax
retq
leaq 0x24299(%rip), %rdi     # 0x2a593
leaq 0x240ec(%rip), %rsi     # 0x2a3ed
leaq 0x24297(%rip), %rcx     # 0x2a59f
movl $0xae, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x634f
incq 0x18(%rdi)
movq 0x10(%rdi), %rax
andq %rsi, %rax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rdx
testq %rdx, %rdx
je 0x634c
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 0x2423c(%rip), %rdi     # 0x2a593
leaq 0x2408f(%rip), %rsi     # 0x2a3ed
leaq 0x2425e(%rip), %rcx     # 0x2a5c3
movl $0xba, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x638c
movq 0x10(%rdi), %rcx
andq %rsi, %rcx
shlq $0x4, %rcx
movq %rsi, (%rax,%rcx)
movq %rdx, 0x8(%rax,%rcx)
retq
pushq %rax
leaq 0x241ff(%rip), %rdi     # 0x2a593
leaq 0x24052(%rip), %rsi     # 0x2a3ed
leaq 0x2424d(%rip), %rcx     # 0x2a5ef
movl $0xca, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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
movb $0x1, %bpl
xorl %r14d, %r14d
leaq 0xf21d4(%rip), %rbx     # 0xf8598
movq %r14, %r15
shlq $0x9, %r15
addq %rbx, %r15
xorl %r12d, %r12d
movl $0x400, %r13d           # imm = 0x400
callq 0xe8bd
movq %rax, (%r15,%r13)
addq $0x400, %r13            # imm = 0x400
cmpq $0x1c00, %r13           # imm = 0x1C00
jne 0x63d7
incq %r12
addq $0x8, %r15
cmpq $0x40, %r12
jne 0x63d1
callq 0xe8bd
movq %rax, 0x1c00(%rbx,%r14,8)
movl $0x1, %r14d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x63c4
xorl %r14d, %r14d
callq 0xe8bd
movq %rax, 0x1c10(%rbx,%r14,8)
incq %r14
cmpq $0x10, %r14
jne 0x641e
xorl %r14d, %r14d
callq 0xe8bd
movq %rax, 0x1c90(%rbx,%r14,8)
incq %r14
cmpq $0x41, %r14
jne 0x6437
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xce7a
callq 0x63ac
callq 0x4125
callq 0x7353
callq 0x5dc6
leaq 0xc24a3(%rip), %rdi     # 0xc8920
callq 0xaa51
leaq 0xf2107(%rip), %rdi     # 0xf8590
leaq -0xe4(%rip), %rdx       # 0x63ac
xorl %esi, %esi
xorl %ecx, %ecx
popq %rax
jmp 0x2300
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x652c
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 0xf5995(%rip), %rbx     # 0xfbec8
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 0x2180
movq 0x3ba24(%rip), %rax     # 0x41f90
movq (%rax), %rdi
callq 0x21c0
movq %rsp, %r15
movq %r12, 0x10(%r15)
movq %r13, 0x8(%r15)
movq %rbp, (%r15)
movq 0xf5937(%rip), %r12     # 0xfbec0
callq 0xdf08
leaq 0x2409a(%rip), %rsi     # 0x2a62f
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2280
movq 0xf5918(%rip), %rdi     # 0xfbec0
movq %r14, %rsi
movq %r15, %rdx
callq 0x2230
movq 0xf5906(%rip), %rdi     # 0xfbec0
callq 0x21c0
movq %rbx, %rdi
callq 0x20e0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x662b
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, 0xf586e(%rip)     # 0xfbeb9
jne 0x66f4
movq %rdi, %rbx
leaq 0xf586d(%rip), %r14     # 0xfbec8
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 0x2180
movq 0x3b8f7(%rip), %rax     # 0x41f90
movq (%rax), %rdi
callq 0x21c0
movq %rsp, %r15
movq %r12, 0x10(%r15)
movq %r13, 0x8(%r15)
movq %rbp, (%r15)
movq 0xf580a(%rip), %r12     # 0xfbec0
callq 0xdf08
leaq 0x23f6d(%rip), %rsi     # 0x2a62f
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2280
movq 0xf57eb(%rip), %rdi     # 0xfbec0
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2230
movq 0xf57d9(%rip), %rdi     # 0xfbec0
callq 0x21c0
movq %r14, %rdi
callq 0x20e0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x677a
cmpl $0x40, %esi
jae 0x6799
movl %esi, %eax
leaq 0x875ee0(%rip), %rcx    # 0x87c600
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x67b8
leaq 0x8760cc(%rip), %rcx    # 0x87c800
movl (%rcx,%rax,4), %ecx
testq %rcx, %rcx
je 0x67d7
movq 0x1a8(%rdi), %r8
orq 0x1b0(%rdi), %r8
leaq 0x6f5cab(%rip), %rdi    # 0x6fc400
andq (%rdi,%rax,8), %r8
imulq %rsi, %r8
shrq %cl, %r8
movslq %r8d, %rcx
shlq $0xd, %rax
leaq 0x6f5e92(%rip), %rsi    # 0x6fc600
addq %rax, %rsi
andq (%rsi,%rcx,8), %rdx
movq %rdx, %rax
popq %rcx
retq
leaq 0x2eb7b(%rip), %rdi     # 0x352fc
leaq 0x23eab(%rip), %rsi     # 0x2a633
leaq 0x23eb2(%rip), %rcx     # 0x2a641
movl $0x1d, %edx
callq 0x20d0
leaq 0x23ed7(%rip), %rdi     # 0x2a677
leaq 0x23e8c(%rip), %rsi     # 0x2a633
leaq 0x23e93(%rip), %rcx     # 0x2a641
movl $0x1e, %edx
callq 0x20d0
leaq 0x23ed1(%rip), %rdi     # 0x2a690
leaq 0x23e6d(%rip), %rsi     # 0x2a633
leaq 0x23e74(%rip), %rcx     # 0x2a641
movl $0x1f, %edx
callq 0x20d0
leaq 0x23ece(%rip), %rdi     # 0x2a6ac
leaq 0x23e4e(%rip), %rsi     # 0x2a633
leaq 0x23e55(%rip), %rcx     # 0x2a641
movl $0x20, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x689a
cmpl $0x40, %esi
jae 0x68b9
movl %esi, %eax
leaq 0x6f58c0(%rip), %rcx    # 0x6fc100
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x68d8
leaq 0x6f5aac(%rip), %rcx    # 0x6fc300
movl (%rcx,%rax,4), %ecx
testq %rcx, %rcx
je 0x68f7
movq 0x1a8(%rdi), %r8
orq 0x1b0(%rdi), %r8
leaq 0xf568b(%rip), %rdi     # 0xfbf00
andq (%rdi,%rax,8), %r8
imulq %rsi, %r8
shrq %cl, %r8
movslq %r8d, %rcx
shlq $0xf, %rax
leaq 0xf5872(%rip), %rsi     # 0xfc100
addq %rax, %rsi
andq (%rsi,%rcx,8), %rdx
movq %rdx, %rax
popq %rcx
retq
leaq 0x2ea5b(%rip), %rdi     # 0x352fc
leaq 0x23d8b(%rip), %rsi     # 0x2a633
leaq 0x23e1f(%rip), %rcx     # 0x2a6ce
movl $0x2d, %edx
callq 0x20d0
leaq 0x23db7(%rip), %rdi     # 0x2a677
leaq 0x23d6c(%rip), %rsi     # 0x2a633
leaq 0x23e00(%rip), %rcx     # 0x2a6ce
movl $0x2e, %edx
callq 0x20d0
leaq 0x23e23(%rip), %rdi     # 0x2a702
leaq 0x23d4d(%rip), %rsi     # 0x2a633
leaq 0x23de1(%rip), %rcx     # 0x2a6ce
movl $0x2f, %edx
callq 0x20d0
leaq 0x23e1e(%rip), %rdi     # 0x2a71c
leaq 0x23d2e(%rip), %rsi     # 0x2a633
leaq 0x23dc2(%rip), %rcx     # 0x2a6ce
movl $0x30, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
movq %rsi, %r14
callq *%rdx
xorl %r15d, %r15d
cmpl $0x40, %eax
je 0x694c
leaq 0xf3b7b(%rip), %r12     # 0xfa4b0
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %r15
testq %r14, %rcx
jne 0x694c
movl %eax, %edi
callq *%rbx
cmpl $0x40, %eax
jne 0x6935
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6f5a91(%rip), %r12    # 0x6fc400
leaq 0xf3b3a(%rip), %r13     # 0xfa4b0
movq $0x0, (%r12,%rbx,8)
xorl %r14d, %r14d
movl %r14d, %edi
callq 0xca69
movl %eax, %ebp
movl %r14d, %edi
callq 0xca3e
cmpq %r14, %rbx
je 0x69c6
movl %eax, %r15d
movl %ebx, %edi
movl %r14d, %esi
callq 0xce56
cmpl $0x7, %r15d
je 0x69c6
testl %r15d, %r15d
je 0x69c6
testl %ebp, %ebp
je 0x69c6
cmpl $0x7, %ebp
je 0x69c6
testb %al, %al
je 0x69c6
movq (%r13,%r14,8), %rax
orq %rax, (%r12,%rbx,8)
incq %r14
cmpq $0x40, %r14
jne 0x6981
incq %rbx
cmpq $0x40, %rbx
jne 0x6976
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xf5505(%rip), %r13     # 0xfbf00
movq $0x0, (%r13,%rbx,8)
movl %ebx, %edi
callq 0xca69
movl %eax, %ebp
movl %ebx, %edi
callq 0xca3e
movl %eax, %r14d
xorl %r15d, %r15d
movl %r15d, %edi
callq 0xca69
movl %eax, %r12d
movl %r15d, %edi
callq 0xca3e
cmpq %r15, %rbx
je 0x6a60
cmpl %ebp, %r12d
jne 0x6a40
cmpl $0x7, %eax
je 0x6a40
testl %eax, %eax
jne 0x6a50
cmpl %r14d, %eax
jne 0x6a60
testl %r12d, %r12d
je 0x6a60
cmpl $0x7, %r12d
je 0x6a60
leaq 0xf3a59(%rip), %rax     # 0xfa4b0
movq (%rax,%r15,8), %rax
orq %rax, (%r13,%rbx,8)
incq %r15
cmpq $0x40, %r15
jne 0x6a1a
incq %rbx
cmpq $0x40, %rbx
jne 0x69fb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xf3455(%rip), %r15     # 0xfa4b0
leaq 0x6f539e(%rip), %rax    # 0x6fc400
movq (%rax,%r13,8), %rdi
callq 0x3b14
movl %eax, 0x8(%rsp)
movq %r13, %rcx
shlq $0xd, %rcx
leaq 0x775583(%rip), %rax    # 0x77c600
leaq (%rax,%rcx), %rbp
leaq 0x6f5578(%rip), %rax    # 0x6fc600
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
xorl %edx, %edx
movq %r13, (%rsp)
movq %rbp, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movl %edx, %ebx
movq (%rbp,%rbx,8), %r12
leaq 0x875553(%rip), %rax    # 0x87c600
movq (%rax,%r13,8), %rdx
imulq %r12, %rdx
leaq 0x875744(%rip), %rax    # 0x87c800
movb (%rax,%r13,4), %cl
shrq %cl, %rdx
movq %rdx, 0x20(%rsp)
movl %r13d, %edi
callq 0xccf0
xorl %r14d, %r14d
cmpl $0x40, %eax
je 0x70ef
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r14
testq %r12, %rcx
jne 0x70ef
movl %eax, %edi
callq 0xccf0
jmp 0x70d3
leaq (,%rbx,8), %rbx
addq %rbp, %rbx
movq (%rbx), %rbp
movl %r13d, %edi
callq 0xcd33
xorl %r12d, %r12d
cmpl $0x40, %eax
je 0x7124
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r12
testq %rbp, %rcx
jne 0x7124
movl %eax, %edi
callq 0xcd33
jmp 0x7108
movq (%rbx), %r13
movq (%rsp), %rdi
callq 0xcd7a
xorl %ebp, %ebp
cmpl $0x40, %eax
je 0x714e
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %rbp
testq %r13, %rcx
jne 0x714e
movl %eax, %edi
callq 0xcd7a
jmp 0x7132
movq (%rbx), %rbx
movq (%rsp), %rdi
callq 0xcdba
xorl %r13d, %r13d
cmpl $0x40, %eax
je 0x7179
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r13
testq %rbx, %rcx
jne 0x7179
movl %eax, %edi
callq 0xcdba
jmp 0x715d
orq %r14, %r12
orq %rbp, %r12
orq %r13, %r12
movslq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %r12, (%rcx,%rax,8)
movl 0xc(%rsp), %edx
incl %edx
movl %edx, %eax
movl 0x8(%rsp), %ecx
shrl %cl, %eax
testl %eax, %eax
movq (%rsp), %r13
movq 0x10(%rsp), %rbp
je 0x709b
incq %r13
cmpq $0x40, %r13
jne 0x705b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xf32cd(%rip), %r15     # 0xfa4b0
leaq 0xf4d16(%rip), %rax     # 0xfbf00
movq (%rax,%r13,8), %rdi
callq 0x3b14
movl %eax, 0x8(%rsp)
movq %r13, %rcx
shlq $0xf, %rcx
leaq 0x2f4efb(%rip), %rax    # 0x2fc100
leaq (%rax,%rcx), %rbp
leaq 0xf4ef0(%rip), %rax     # 0xfc100
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
xorl %edx, %edx
movq %r13, (%rsp)
movq %rbp, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movl %edx, %ebx
movq (%rbp,%rbx,8), %r12
leaq 0x6f4ecb(%rip), %rax    # 0x6fc100
movq (%rax,%r13,8), %rdx
imulq %r12, %rdx
leaq 0x6f50bc(%rip), %rax    # 0x6fc300
movb (%rax,%r13,4), %cl
shrq %cl, %rdx
movq %rdx, 0x20(%rsp)
movl %r13d, %edi
callq 0xcc05
xorl %r14d, %r14d
cmpl $0x40, %eax
je 0x7277
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r14
testq %r12, %rcx
jne 0x7277
movl %eax, %edi
callq 0xcc05
jmp 0x725b
leaq (,%rbx,8), %rbx
addq %rbp, %rbx
movq (%rbx), %rbp
movl %r13d, %edi
callq 0xcc3e
xorl %r12d, %r12d
cmpl $0x40, %eax
je 0x72ac
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r12
testq %rbp, %rcx
jne 0x72ac
movl %eax, %edi
callq 0xcc3e
jmp 0x7290
movq (%rbx), %r13
movq (%rsp), %rdi
callq 0xcc7d
xorl %ebp, %ebp
cmpl $0x40, %eax
je 0x72d6
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %rbp
testq %r13, %rcx
jne 0x72d6
movl %eax, %edi
callq 0xcc7d
jmp 0x72ba
movq (%rbx), %rbx
movq (%rsp), %rdi
callq 0xccba
xorl %r13d, %r13d
cmpl $0x40, %eax
je 0x7301
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r13
testq %rbx, %rcx
jne 0x7301
movl %eax, %edi
callq 0xccba
jmp 0x72e5
orq %r14, %r12
orq %rbp, %r12
orq %r13, %r12
movslq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %r12, (%rcx,%rax,8)
movl 0xc(%rsp), %edx
incl %edx
movl %edx, %eax
movl 0x8(%rsp), %ecx
shrl %cl, %eax
testl %eax, %eax
movq (%rsp), %r13
movq 0x10(%rsp), %rbp
je 0x7223
incq %r13
cmpq $0x40, %r13
jne 0x71e3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xf3155(%rip), %rax     # 0xfa4b0
cmpq $0x0, 0x118(%rax)
je 0x7395
callq 0x69e7
callq 0x695b
callq 0x6c68
callq 0x6a81
movl $0x1, %edi
callq 0x6e4f
xorl %edi, %edi
callq 0x6e4f
callq 0x71cb
popq %rax
jmp 0x7043
leaq 0x27206(%rip), %rdi     # 0x2e5a2
leaq 0x23290(%rip), %rsi     # 0x2a633
leaq 0x234d1(%rip), %rcx     # 0x2a87b
movl $0x13d, %edx            # imm = 0x13D
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x23507(%rip), %rdi     # 0x2a8e2
xorl %eax, %eax
callq 0x64b9
callq 0x11753
callq 0x1158a
callq 0x18b3f
callq 0x12079
callq 0x18a1d
callq 0x28979
callq 0x272a8
callq 0x24438
callq 0x109a0
callq 0x19bef
callq 0x1df79
callq 0x214dc
callq 0xff38
callq 0x135f0
callq 0x146e5
callq 0x2556d
callq 0x27439
callq 0x1837a
callq 0x1ec7d
callq 0x154ea
callq 0x244a0
callq 0x25f3d
leaq 0x234b7(%rip), %rdi     # 0x2a90e
xorl %eax, %eax
callq 0x64b9
leaq 0xc14bb(%rip), %rdi     # 0xc8920
callq 0xaa51
leaq 0xf0a7f(%rip), %rdi     # 0xf7ef0
callq 0x62b6
leaq 0xf0aa3(%rip), %rdi     # 0xf7f20
callq 0x62b6
movb $0x1, %al
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpl $0x2, %edi
jl 0x75bd
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r12d
movl $0x1, %r15d
leaq 0x23474(%rip), %r14     # 0x2a921
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
movl $0x3d, %esi
callq 0x2070
testq %rax, %rax
je 0x75a3
movq %rax, %rbp
movl $0x5, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2090
testl %eax, %eax
je 0x7551
movl $0x5, %edx
movq %r13, %rdi
leaq 0x2343a(%rip), %rsi     # 0x2a927
callq 0x2090
testl %eax, %eax
je 0x7565
movl $0x6, %edx
movq %r13, %rdi
leaq 0x23428(%rip), %rsi     # 0x2a92d
callq 0x2090
testl %eax, %eax
je 0x757b
movl $0x6, %edx
movq %r13, %rdi
leaq 0x23417(%rip), %rsi     # 0x2a934
callq 0x2090
testl %eax, %eax
je 0x7591
movl $0x5, %edx
movq %r13, %rdi
leaq 0x23406(%rip), %rsi     # 0x2a93b
callq 0x2090
testl %eax, %eax
jne 0x75a3
incq %rbp
movq %rbp, %rdi
callq 0x22b0
movl %eax, 0x3ac51(%rip)     # 0x421a0
jmp 0x75a3
incq %rbp
movq %rbp, %rdi
callq 0x2310
movq %rax, 0x8753a5(%rip)    # 0x87c908
jmp 0x75a3
incq %rbp
movq %rbp, %rdi
callq 0x22b0
shll $0x14, %eax
movl %eax, 0x87539f(%rip)    # 0x87c918
jmp 0x75a3
incq %rbp
movq %rbp, %rdi
callq 0x22b0
shll $0x14, %eax
movl %eax, 0x87538d(%rip)    # 0x87c91c
jmp 0x75a3
incq %rbp
movq %rbp, %rdi
callq 0x2310
movq %rax, 0x87536d(%rip)    # 0x87c910
incq %r15
cmpq %r15, %r12
jne 0x74ad
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x77e6
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
cmpl $0x8, %eax
jae 0x7805
movq $-0x1c0001, %rcx        # imm = 0xFFE3FFFF
andq (%rdi), %rcx
shll $0x12, %eax
orq %rcx, %rax
movq %rax, (%rdi)
popq %rax
retq
leaq 0x231fb(%rip), %rdi     # 0x2a9e8
leaq 0x2320f(%rip), %rsi     # 0x2aa03
leaq 0x23215(%rip), %rcx     # 0x2aa10
movl $0x26, %edx
callq 0x20d0
leaq 0x23226(%rip), %rdi     # 0x2aa32
leaq 0x231f0(%rip), %rsi     # 0x2aa03
leaq 0x231f6(%rip), %rcx     # 0x2aa10
movl $0x28, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x78cb
shlq $0x20, %rsi
orq %rsi, %rax
jmp 0x78d9
negl %esi
shlq $0x20, %rsi
orq %rsi, %rax
btsq $0x3f, %rax
movq %rax, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x7970
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 %r14, %r15
jbe 0x7960
movq (%r14), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x30e1
movl 0x138(%rbx), %edi
callq 0xdf74
movq %rbx, %rdi
movl %eax, %esi
callq 0xaf41
testb %al, %al
je 0x794c
movq $0x0, (%r14)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x334b
addq $0x8, %r14
cmpq %r15, %r14
jb 0x791e
movq %r15, %rax
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x79cf
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7e89
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7f2d
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7fac
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x802b
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x80aa
// File: /workspace/github_cpp_makefile_star2_O3/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 0x7f0e
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
setne %al
movq 0x168(%rsi,%rax,8), %r15
testq %r15, %r15
je 0x7efc
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c31
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x859c
movq %rax, %r14
movl %r13d, %eax
leaq 0xf25c6(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7ec0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x22bf3(%rip), %rdi     # 0x2ab08
leaq 0x22b9c(%rip), %rsi     # 0x2aab8
leaq 0x22bf5(%rip), %rcx     # 0x2ab18
movl $0x6e, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/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
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
movq %rdi, %r14
setne %al
movq 0x178(%rsi,%rax,8), %r15
testq %r15, %r15
je 0x7f9a
movq %rsi, %rbx
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c31
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x86f1
movq %rax, %r14
movl %r13d, %eax
leaq 0xf2528(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7f5e
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_rook_moves(unsigned long long*, position*, bool, bool)
move* gen_rook_moves(move* m,position* p,bool caps,bool noncaps) {

    uint64 pmap = p->player==WHITE ? p->white_rooks : p->black_rooks;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        m = gen_rook_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
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
movq %rdi, %r14
setne %al
movq 0x188(%rsi,%rax,8), %r15
testq %r15, %r15
je 0x8019
movq %rsi, %rbx
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c31
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x8814
movq %rax, %r14
movl %r13d, %eax
leaq 0xf24a9(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7fdd
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_queen_moves(unsigned long long*, position*, bool, bool)
move* gen_queen_moves(move* m,position* p,bool caps,bool noncaps) {

    uint64 pmap = p->player==WHITE ? p->white_queens : p->black_queens;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        m = gen_queen_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
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
movq %rdi, %r14
setne %al
movq 0x198(%rsi,%rax,8), %r15
testq %r15, %r15
je 0x8098
movq %rsi, %rbx
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c31
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x8937
movq %rax, %r14
movl %r13d, %eax
leaq 0xf242a(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x805c
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: add_move(unsigned long long*, position*, piece_t, square_t, square_t)
move* add_move(move* m,position* p,piece_t piece,square_t from,square_t to) {
    piece_t captured_piece = (piece_t)p->piece[to];
    assert( (p->player==WHITE && is_not_white_piece(captured_piece))
        || (p->player==BLACK && is_not_black_piece(captured_piece)));

    to_move(m,piece,from,to);
    if (captured_piece != NO_PIECE) {
        set_capture(m,captured_piece);
    }
    ++m;

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %r15d
movl %edx, %r12d
movq %rdi, %rbx
movl %r8d, %eax
movl (%rsi,%rax,4), %ebp
movl 0x138(%rsi), %eax
cmpl $0x1, %eax
jne 0x8416
movq %rsi, %r13
movl %ebp, %edi
callq 0xe775
testb %al, %al
jne 0x8425
movl 0x138(%r13), %eax
testl %eax, %eax
jne 0x845a
movl %ebp, %edi
callq 0xe77b
testb %al, %al
je 0x845a
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x776a
testl %ebp, %ebp
je 0x8444
movq %rbx, %rdi
movl %ebp, %esi
callq 0x77c0
addq $0x8, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x225e2(%rip), %rdi     # 0x2aa43
leaq 0x22650(%rip), %rsi     # 0x2aab8
leaq 0x22659(%rip), %rcx     # 0x2aac8
movl $0x39, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: add_castle(unsigned long long*, square_t, square_t)
move* add_castle(move* m,square_t from,square_t to) {
    to_move(m,KING,from,to);
    set_castle(m);
    ++m;
    return m;
}

// Assembly:
pushq %rbx
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %rbx
movl $0x6, %esi
callq 0x776a
movq %rbx, %rdi
callq 0x784f
addq $0x8, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: add_promotion(unsigned long long*, square_t, square_t, piece_t, piece_t)
move* add_promotion(move* m,square_t from,square_t to,piece_t promopiece,piece_t captured_piece) {
    to_move(m,PAWN,from,to);
    if (captured_piece != NO_PIECE) {
        set_capture(m,captured_piece);
    }
    set_promopiece(m,promopiece);
    ++m;
    return m;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %r8d, %r14d
movl %ecx, %ebp
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %rbx
movl $0x1, %esi
callq 0x776a
testl %r14d, %r14d
je 0x84c6
movq %rbx, %rdi
movl %r14d, %esi
callq 0x77c0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7824
addq $0x8, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: add_pawn_move(unsigned long long*, square_t, square_t, piece_t, bool)
move* add_pawn_move(move* m,square_t from,square_t to,piece_t captured_piece,bool epcapture) {
    rank_t r = get_rank(to);
    if (r==RANK_8 || r==RANK_1) {
        m = add_promotion(m,from,to,QUEEN,captured_piece);
        m = add_promotion(m,from,to,KNIGHT,captured_piece);
        m = add_promotion(m,from,to,ROOK,captured_piece);
        m = add_promotion(m,from,to,BISHOP,captured_piece);
    } else {
        to_move(m,PAWN,from,to);
        if (epcapture) {
            set_epcapture(m);
        } else if (captured_piece != NO_PIECE) {
            set_capture(m,captured_piece);
        }
        ++m;
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %r12d
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl %edx, %edi
callq 0xca69
cmpl $0x7, %eax
je 0x8501
testl %eax, %eax
jne 0x855d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x5, %ecx
movl %ebx, %r8d
callq 0x849c
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x2, %ecx
movl %ebx, %r8d
callq 0x849c
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x4, %ecx
movl %ebx, %r8d
callq 0x849c
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x3, %ecx
movl %ebx, %r8d
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x849c
movq %r15, %rdi
movl $0x1, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x776a
testb %r12b, %r12b
je 0x857e
movq %r15, %rdi
callq 0x783b
jmp 0x858c
testl %ebx, %ebx
je 0x858c
movq %r15, %rdi
movl %ebx, %esi
callq 0x77c0
addq $0x8, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_knight_moves(unsigned long long*, position*, square_t, bool, bool)
move* gen_knight_moves(move* m,position* p,square_t from,bool caps,bool noncaps) {
    assert(m);
    assert(p);
    assert(from >= A8 && from <= H1);

    uint64 mv_map = bb_knight_moves[from] & get_target_squares(p,caps,noncaps);
    while (mv_map) {
        square_t sq = (square_t)get_lsb(mv_map);
        m=add_move(m,p,KNIGHT,from,sq);
        mv_map ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8663
movq %rsi, %r14
testq %rsi, %rsi
je 0x8682
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x86a1
movq %rdi, %r15
movl %ebx, %eax
leaq 0xf20dd(%rip), %rdx     # 0xfa6b0
testb %cl, %cl
je 0x85ee
xorl %ecx, %ecx
cmpl $0x1, 0x138(%r14)
sete %cl
movq 0x1a8(%r14,%rcx,8), %r12
jmp 0x85f1
xorl %r12d, %r12d
movq (%rdx,%rax,8), %rax
testb %r8b, %r8b
je 0x860e
movq 0x1b0(%r14), %rcx
orq 0x1a8(%r14), %rcx
notq %rcx
orq %rcx, %r12
andq %rax, %r12
je 0x8651
leaq 0xf1e96(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3b67
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x2, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x83d9
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x861a
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24dc1(%rip), %rdi     # 0x2d42b
leaq 0x22447(%rip), %rsi     # 0x2aab8
leaq 0x224d7(%rip), %rcx     # 0x2ab4f
movl $0x7a, %edx
callq 0x20d0
leaq 0x2cc73(%rip), %rdi     # 0x352fc
leaq 0x22428(%rip), %rsi     # 0x2aab8
leaq 0x224b8(%rip), %rcx     # 0x2ab4f
movl $0x7b, %edx
callq 0x20d0
leaq 0x21fcf(%rip), %rdi     # 0x2a677
leaq 0x22409(%rip), %rsi     # 0x2aab8
leaq 0x22499(%rip), %rcx     # 0x2ab4f
movl $0x7c, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: get_target_squares(position*, bool, bool)
uint64 get_target_squares(position* p,bool caps,bool noncaps) {
    uint64 targets = 0;

    if (caps) {
        targets = (p->player==WHITE ? p->black_pieces : p->white_pieces);
    }

    if (noncaps) {
        targets |= ~(p->white_pieces | p->black_pieces);
    }

    return targets;
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
je 0x86d8
cmpl $0x1, 0x138(%rdi)
sete %al
movq 0x1a8(%rdi,%rax,8), %rax
testb %dl, %dl
je 0x86f0
movq 0x1b0(%rdi), %rcx
orq 0x1a8(%rdi), %rcx
notq %rcx
orq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_bishop_moves(unsigned long long*, position*, square_t, bool, bool)
move* gen_bishop_moves(move* m,position* p,square_t from,bool caps,bool noncaps) {
    assert(m);
    assert(p);
    assert(from >= A8 && from <= H1);

    uint64 bishop_moves = get_bishop_moves(p,from,get_target_squares(p,caps,noncaps));

    while (bishop_moves) {
        square_t sq = (square_t)get_msb(bishop_moves);
        m = add_move(m,p,BISHOP,from,sq);
        bishop_moves ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x87b7
movq %rsi, %r14
testq %rsi, %rsi
je 0x87d6
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x87f5
movq %rdi, %r15
testb %cl, %cl
je 0x873a
xorl %eax, %eax
cmpl $0x1, 0x138(%r14)
sete %al
movq 0x1a8(%r14,%rax,8), %rdx
jmp 0x873c
xorl %edx, %edx
testb %r8b, %r8b
je 0x8755
movq 0x1b0(%r14), %rax
orq 0x1a8(%r14), %rax
notq %rax
orq %rax, %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x6708
testq %rax, %rax
je 0x87a5
movq %rax, %r12
leaq 0xf1d42(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3c31
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x3, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x83d9
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x876e
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24c6d(%rip), %rdi     # 0x2d42b
leaq 0x222f3(%rip), %rsi     # 0x2aab8
leaq 0x223c4(%rip), %rcx     # 0x2ab90
movl $0x95, %edx
callq 0x20d0
leaq 0x2cb1f(%rip), %rdi     # 0x352fc
leaq 0x222d4(%rip), %rsi     # 0x2aab8
leaq 0x223a5(%rip), %rcx     # 0x2ab90
movl $0x96, %edx
callq 0x20d0
leaq 0x21e7b(%rip), %rdi     # 0x2a677
leaq 0x222b5(%rip), %rsi     # 0x2aab8
leaq 0x22386(%rip), %rcx     # 0x2ab90
movl $0x97, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_rook_moves(unsigned long long*, position*, square_t, bool, bool)
move* gen_rook_moves(move* m,position* p,square_t from,bool caps,bool noncaps) {
    assert(m);
    assert(p);
    assert(from >= A8 && from <= H1);

    uint64 rook_moves = get_rook_moves(p,from,get_target_squares(p,caps,noncaps));

    while (rook_moves) {
        square_t sq = (square_t)get_msb(rook_moves);
        m = add_move(m,p,ROOK,from,sq);
        rook_moves ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x88da
movq %rsi, %r14
testq %rsi, %rsi
je 0x88f9
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x8918
movq %rdi, %r15
testb %cl, %cl
je 0x885d
xorl %eax, %eax
cmpl $0x1, 0x138(%r14)
sete %al
movq 0x1a8(%r14,%rax,8), %rdx
jmp 0x885f
xorl %edx, %edx
testb %r8b, %r8b
je 0x8878
movq 0x1b0(%r14), %rax
orq 0x1a8(%r14), %rax
notq %rax
orq %rax, %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x6828
testq %rax, %rax
je 0x88c8
movq %rax, %r12
leaq 0xf1c1f(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3c31
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x4, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x83d9
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x8891
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24b4a(%rip), %rdi     # 0x2d42b
leaq 0x221d0(%rip), %rsi     # 0x2aab8
leaq 0x222e2(%rip), %rcx     # 0x2abd1
movl $0xb1, %edx
callq 0x20d0
leaq 0x2c9fc(%rip), %rdi     # 0x352fc
leaq 0x221b1(%rip), %rsi     # 0x2aab8
leaq 0x222c3(%rip), %rcx     # 0x2abd1
movl $0xb2, %edx
callq 0x20d0
leaq 0x21d58(%rip), %rdi     # 0x2a677
leaq 0x22192(%rip), %rsi     # 0x2aab8
leaq 0x222a4(%rip), %rcx     # 0x2abd1
movl $0xb3, %edx
callq 0x20d0