LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/hash.cpp
// Function: build_hash_key(position*)
uint64 build_hash_key(position *pos) {
    uint64 hkey = 0;

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

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

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

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

    return hkey;
}

// Assembly:
pushq %rax
leaq 0xf2750(%rip), %rax     # 0xf8598
xorl %edx, %edx
movq %rax, %rsi
xorl %ecx, %ecx
movslq (%rdi,%rdx,4), %r8
testq %r8, %r8
jle 0x5e6f
shlq $0xa, %r8
addq %rax, %r8
leaq (%r8,%rdx,8), %r8
addq $0x200, %r8             # imm = 0x200
xorq (%r8), %rcx
jmp 0x5e74
testl %r8d, %r8d
js 0x5e83
incq %rdx
addq $0x8, %rsi
cmpq $0x40, %rdx
jne 0x5e4f
jmp 0x5e8f
negl %r8d
shlq $0xa, %r8
addq %rsi, %r8
jmp 0x5e6a
movl 0x140(%rdi), %edx
cmpq $0x10, %rdx
jae 0x5ed1
movl 0x13c(%rdi), %esi
cmpq $0x41, %rsi
jae 0x5ef0
movl 0x138(%rdi), %eax
leaq 0xf26e4(%rip), %rdi     # 0xf8598
movq 0x1c00(%rdi,%rax,8), %rax
xorq 0x1c10(%rdi,%rdx,8), %rax
xorq 0x1c90(%rdi,%rsi,8), %rax
xorq %rcx, %rax
popq %rcx
retq
leaq 0x2445e(%rip), %rdi     # 0x2a336
leaq 0x2448e(%rip), %rsi     # 0x2a36d
leaq 0x24494(%rip), %rcx     # 0x2a37a
movl $0x1e, %edx
callq 0x20d0
leaq 0x244a5(%rip), %rdi     # 0x2a39c
leaq 0x2446f(%rip), %rsi     # 0x2a36d
leaq 0x24475(%rip), %rcx     # 0x2a37a
movl $0x22, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/hash.cpp
// Function: build_pawn_key(position*)
uint64 build_pawn_key(position *pos) {
    uint64 pkey = 0;

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

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

    return pkey;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x158(%rdi), %r15
xorl %ebx, %ebx
testq %r15, %r15
je 0x5f5c
leaq 0xf2668(%rip), %r12     # 0xf8598
leaq 0xf4579(%rip), %r13     # 0xfa4b0
movq %r15, %rdi
callq 0x3c25
movl %eax, %eax
xorq 0x600(%r12,%rax,8), %rbx
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x5f37
movq 0x160(%r14), %r14
testq %r14, %r14
je 0x5f9a
leaq 0xf2629(%rip), %r15     # 0xf8598
leaq 0xf453a(%rip), %r12     # 0xfa4b0
movq %r14, %rdi
callq 0x3b5b
movl %eax, %eax
xorq 0x400(%r15,%rax,8), %rbx
movq (%r12,%rax,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0x5f76
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/hash.cpp
// Function: build_hash_val(hash_entry_t, int, int, unsigned long long)
uint64 build_hash_val(hash_entry_t entry_type,int32 depth,int32 score,move mv) {
    assert(entry_type >= LOWER_BOUND && entry_type <= EXACT_SCORE);
    assert(depth >= 0);
    assert(depth <= 0xFFFF);
    assert(abs(score) <= CHECKMATE);
    assert(abs(score) <= 0xFFFF);
    set_move_score(&mv,0);

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

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

    return val;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %r14d
movq %rcx, 0x8(%rsp)
leal -0x1(%r14), %eax
cmpl $0x3, %eax
jae 0x6071
movl %esi, %ebp
testl %esi, %esi
js 0x6090
cmpl $0x10000, %ebp          # imm = 0x10000
jge 0x60af
movl %edx, %ebx
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x60ce
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x7818
cmpl $0xfe0c, %ebx           # imm = 0xFE0C
jl 0x6015
xorl %eax, %eax
cmpl $0x2, %r14d
setne %al
movl $0xfe0b, %ecx           # imm = 0xFE0B
cmovnel %ecx, %ebx
jmp 0x6030
cmpl $0xffff01f4, %ebx       # imm = 0xFFFF01F4
jg 0x6033
xorl %eax, %eax
cmpl $0x1, %r14d
setne %al
movl $0xffff01f5, %ecx       # imm = 0xFFFF01F5
cmovnel %ecx, %ebx
addl %eax, %eax
movl %eax, %r14d
movl %r14d, %eax
movl %ebp, %ecx
leaq (%rax,%rcx,4), %rax
testl %ebx, %ebx
js 0x604b
movl %ebx, %ecx
shlq $0x12, %rcx
orq %rax, %rcx
jmp 0x605c
negl %ebx
shlq $0x12, %rbx
orq %rbx, %rax
btsq $0x22, %rax
movq %rax, %rcx
movq 0x8(%rsp), %rax
shlq $0x23, %rax
orq %rcx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x24347(%rip), %rdi     # 0x2a3bf
leaq 0x242ee(%rip), %rsi     # 0x2a36d
leaq 0x24370(%rip), %rcx     # 0x2a3f6
movl $0x3d, %edx
callq 0x20d0
leaq 0x24397(%rip), %rdi     # 0x2a42e
leaq 0x242cf(%rip), %rsi     # 0x2a36d
leaq 0x24351(%rip), %rcx     # 0x2a3f6
movl $0x3e, %edx
callq 0x20d0
leaq 0x24383(%rip), %rdi     # 0x2a439
leaq 0x242b0(%rip), %rsi     # 0x2a36d
leaq 0x24332(%rip), %rcx     # 0x2a3f6
movl $0x3f, %edx
callq 0x20d0
leaq 0x24374(%rip), %rdi     # 0x2a449
leaq 0x24291(%rip), %rsi     # 0x2a36d
leaq 0x24313(%rip), %rcx     # 0x2a3f6
movl $0x40, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x6115
testl %edi, %edi
js 0x6108
leal 0x1(,%rdi,2), %edi
jmp 0x6112
addl %edi, %edi
negl %edi
orl $0x20001, %edi          # imm = 0x20001
movl %edi, %eax
retq
pushq %rax
leaq 0x2432c(%rip), %rdi     # 0x2a449
leaq 0x24249(%rip), %rsi     # 0x2a36d
leaq 0x24336(%rip), %rcx     # 0x2a461
movl $0x67, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x61e8
movl %esi, %ebp
movq %rdi, %rbx
shrl $0x4, %ebp
leaq 0x2432e(%rip), %rdi     # 0x2a4ba
movl %ebp, %esi
xorl %eax, %eax
callq 0x652d
movl $0x2, %eax
movl %eax, %r14d
leal (%r14,%r14), %eax
cmpl %ebp, %r14d
jbe 0x619a
shrl %r14d
leal -0x1(%r14), %eax
cltq
movq %rax, 0x10(%rbx)
leaq 0x24318(%rip), %rdi     # 0x2a4d2
movl %r14d, %esi
xorl %eax, %eax
callq 0x652d
shlq $0x4, %r14
movq %r14, %rdi
callq 0x2220
movq %rax, (%rbx)
leaq 0x24316(%rip), %rdi     # 0x2a4f0
movq %r14, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x652d
leaq 0x24294(%rip), %rdi     # 0x2a483
leaq 0x24177(%rip), %rsi     # 0x2a36d
leaq 0x24292(%rip), %rcx     # 0x2a48f
movl $0x99, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x6244
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 0x621e
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movq $0x0, 0x28(%rdi)
popq %rax
retq
leaq 0x242c8(%rip), %rdi     # 0x2a513
leaq 0x2411b(%rip), %rsi     # 0x2a36d
leaq 0x242c6(%rip), %rcx     # 0x2a51f
movl $0xae, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x62a0
incq 0x18(%rdi)
movq 0x10(%rdi), %rax
andq %rsi, %rax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rdx
testq %rdx, %rdx
je 0x629d
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 0x2426b(%rip), %rdi     # 0x2a513
leaq 0x240be(%rip), %rsi     # 0x2a36d
leaq 0x2428d(%rip), %rcx     # 0x2a543
movl $0xba, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x62dd
movq 0x10(%rdi), %rcx
andq %rsi, %rcx
shlq $0x4, %rcx
movq %rsi, (%rax,%rcx)
movq %rdx, 0x8(%rax,%rcx)
retq
pushq %rax
leaq 0x2422e(%rip), %rdi     # 0x2a513
leaq 0x24081(%rip), %rsi     # 0x2a36d
leaq 0x2427c(%rip), %rcx     # 0x2a56f
movl $0xca, %edx
callq 0x20d0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/init.cpp
// Function: init_helper(void*)
void init_zkeys() {

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

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

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

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

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xf2286(%rip), %rbx     # 0xf8598
xorl %r15d, %r15d
movq %rbx, %r14
movq %r14, %r12
xorl %r13d, %r13d
movl $0x400, %ebp            # imm = 0x400
callq 0xe965
movq %rax, (%r12,%rbp)
addq $0x400, %rbp            # imm = 0x400
cmpq $0x1c00, %rbp           # imm = 0x1C00
jne 0x6323
incq %r13
addq $0x8, %r12
cmpq $0x40, %r13
jne 0x631e
callq 0xe965
movq %rax, 0x1c00(%rbx,%r15,8)
leaq 0x1(%r15), %rax
addq $0x200, %r14            # imm = 0x200
testq %r15, %r15
movq %rax, %r15
je 0x6318
xorl %r14d, %r14d
leaq 0xf2225(%rip), %rbx     # 0xf8598
callq 0xe965
movq %rax, 0x1c10(%rbx,%r14,8)
incq %r14
cmpq $0x10, %r14
jne 0x6373
xorl %r14d, %r14d
callq 0xe965
movq %rax, 0x1c90(%rbx,%r14,8)
incq %r14
cmpq $0x41, %r14
jne 0x638c
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/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 0xce87
callq 0x6300
callq 0x4106
callq 0x72ac
callq 0x5d1e
leaq 0xc254e(%rip), %rdi     # 0xc8920
callq 0xaa43
leaq 0xf21b2(%rip), %rdi     # 0xf8590
leaq -0xe5(%rip), %rdx       # 0x6300
xorl %esi, %esi
xorl %ecx, %ecx
popq %rax
jmp 0x2300
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x6480
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 0xf5a41(%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 0x3bad0(%rip), %rax     # 0x41f90
movq (%rax), %rdi
callq 0x21c0
movq %rsp, %r15
movq %r12, 0x10(%r15)
movq %r13, 0x8(%r15)
movq %rbp, (%r15)
movq 0xf59e3(%rip), %r12     # 0xfbec0
callq 0xdf58
leaq 0x240c6(%rip), %rsi     # 0x2a5af
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2280
movq 0xf59c4(%rip), %rdi     # 0xfbec0
movq %r14, %rsi
movq %r15, %rdx
callq 0x2230
movq 0xf59b2(%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_O1/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 0x657f
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, 0xf591a(%rip)     # 0xfbeb9
jne 0x6648
movq %rdi, %rbx
leaq 0xf5919(%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 0x3b9a3(%rip), %rax     # 0x41f90
movq (%rax), %rdi
callq 0x21c0
movq %rsp, %r15
movq %r12, 0x10(%r15)
movq %r13, 0x8(%r15)
movq %rbp, (%r15)
movq 0xf58b6(%rip), %r12     # 0xfbec0
callq 0xdf58
leaq 0x23f99(%rip), %rsi     # 0x2a5af
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2280
movq 0xf5897(%rip), %rdi     # 0xfbec0
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2230
movq 0xf5885(%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_O1/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 0x66ce
cmpl $0x40, %esi
jae 0x66ed
movl %esi, %eax
leaq 0x875f8c(%rip), %rcx    # 0x87c600
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x670c
leaq 0x876178(%rip), %rcx    # 0x87c800
movl (%rcx,%rax,4), %ecx
testq %rcx, %rcx
je 0x672b
movq 0x1a8(%rdi), %r8
orq 0x1b0(%rdi), %r8
leaq 0x6f5d57(%rip), %rdi    # 0x6fc400
andq (%rdi,%rax,8), %r8
imulq %rsi, %r8
shrq %cl, %r8
movslq %r8d, %rcx
shlq $0xd, %rax
leaq 0x6f5f3e(%rip), %rsi    # 0x6fc600
addq %rax, %rsi
andq (%rsi,%rcx,8), %rdx
movq %rdx, %rax
popq %rcx
retq
leaq 0x2eba7(%rip), %rdi     # 0x3527c
leaq 0x23ed7(%rip), %rsi     # 0x2a5b3
leaq 0x23ede(%rip), %rcx     # 0x2a5c1
movl $0x1d, %edx
callq 0x20d0
leaq 0x23f03(%rip), %rdi     # 0x2a5f7
leaq 0x23eb8(%rip), %rsi     # 0x2a5b3
leaq 0x23ebf(%rip), %rcx     # 0x2a5c1
movl $0x1e, %edx
callq 0x20d0
leaq 0x23efd(%rip), %rdi     # 0x2a610
leaq 0x23e99(%rip), %rsi     # 0x2a5b3
leaq 0x23ea0(%rip), %rcx     # 0x2a5c1
movl $0x1f, %edx
callq 0x20d0
leaq 0x23efa(%rip), %rdi     # 0x2a62c
leaq 0x23e7a(%rip), %rsi     # 0x2a5b3
leaq 0x23e81(%rip), %rcx     # 0x2a5c1
movl $0x20, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x67ee
cmpl $0x40, %esi
jae 0x680d
movl %esi, %eax
leaq 0x6f596c(%rip), %rcx    # 0x6fc100
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x682c
leaq 0x6f5b58(%rip), %rcx    # 0x6fc300
movl (%rcx,%rax,4), %ecx
testq %rcx, %rcx
je 0x684b
movq 0x1a8(%rdi), %r8
orq 0x1b0(%rdi), %r8
leaq 0xf5737(%rip), %rdi     # 0xfbf00
andq (%rdi,%rax,8), %r8
imulq %rsi, %r8
shrq %cl, %r8
movslq %r8d, %rcx
shlq $0xf, %rax
leaq 0xf591e(%rip), %rsi     # 0xfc100
addq %rax, %rsi
andq (%rsi,%rcx,8), %rdx
movq %rdx, %rax
popq %rcx
retq
leaq 0x2ea87(%rip), %rdi     # 0x3527c
leaq 0x23db7(%rip), %rsi     # 0x2a5b3
leaq 0x23e4b(%rip), %rcx     # 0x2a64e
movl $0x2d, %edx
callq 0x20d0
leaq 0x23de3(%rip), %rdi     # 0x2a5f7
leaq 0x23d98(%rip), %rsi     # 0x2a5b3
leaq 0x23e2c(%rip), %rcx     # 0x2a64e
movl $0x2e, %edx
callq 0x20d0
leaq 0x23e4f(%rip), %rdi     # 0x2a682
leaq 0x23d79(%rip), %rsi     # 0x2a5b3
leaq 0x23e0d(%rip), %rcx     # 0x2a64e
movl $0x2f, %edx
callq 0x20d0
leaq 0x23e4a(%rip), %rdi     # 0x2a69c
leaq 0x23d5a(%rip), %rsi     # 0x2a5b3
leaq 0x23dee(%rip), %rcx     # 0x2a64e
movl $0x30, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x68a0
leaq 0xf3c27(%rip), %r12     # 0xfa4b0
movl %eax, %ecx
movq (%r12,%rcx,8), %rcx
orq %rcx, %r15
testq %r14, %rcx
jne 0x68a0
movl %eax, %edi
callq *%rbx
cmpl $0x40, %eax
jne 0x6889
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x6f5b3d(%rip), %r12    # 0x6fc400
leaq 0xf3be6(%rip), %r13     # 0xfa4b0
movq $0x0, (%r12,%rbx,8)
xorl %r14d, %r14d
movl %r14d, %edi
callq 0xca75
movl %eax, %ebp
movl %r14d, %edi
callq 0xca4a
cmpq %r14, %rbx
je 0x691a
movl %eax, %r15d
movl %ebx, %edi
movl %r14d, %esi
callq 0xce63
cmpl $0x7, %r15d
je 0x691a
testl %r15d, %r15d
je 0x691a
testl %ebp, %ebp
je 0x691a
cmpl $0x7, %ebp
je 0x691a
testb %al, %al
je 0x691a
movq (%r13,%r14,8), %rax
orq %rax, (%r12,%rbx,8)
incq %r14
cmpq $0x40, %r14
jne 0x68d5
incq %rbx
cmpq $0x40, %rbx
jne 0x68ca
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/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 0xf55b1(%rip), %r13     # 0xfbf00
movq $0x0, (%r13,%rbx,8)
movl %ebx, %edi
callq 0xca75
movl %eax, %ebp
movl %ebx, %edi
callq 0xca4a
movl %eax, %r14d
xorl %r15d, %r15d
movl %r15d, %edi
callq 0xca75
movl %eax, %r12d
movl %r15d, %edi
callq 0xca4a
cmpq %r15, %rbx
je 0x69b4
cmpl %ebp, %r12d
jne 0x6994
cmpl $0x7, %eax
je 0x6994
testl %eax, %eax
jne 0x69a4
cmpl %r14d, %eax
jne 0x69b4
testl %r12d, %r12d
je 0x69b4
cmpl $0x7, %r12d
je 0x69b4
leaq 0xf3b05(%rip), %rax     # 0xfa4b0
movq (%rax,%r15,8), %rax
orq %rax, (%r13,%rbx,8)
incq %r15
cmpq $0x40, %r15
jne 0x696e
incq %rbx
cmpq $0x40, %rbx
jne 0x694f
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/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 0xf34fc(%rip), %r15     # 0xfa4b0
leaq 0x6f5445(%rip), %rax    # 0x6fc400
movq (%rax,%r13,8), %rdi
callq 0x3b08
movl %eax, 0x8(%rsp)
movq %r13, %rcx
shlq $0xd, %rcx
leaq 0x77562a(%rip), %rax    # 0x77c600
leaq (%rax,%rcx), %rbp
leaq 0x6f561f(%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 0x8755fa(%rip), %rax    # 0x87c600
movq (%rax,%r13,8), %rdx
imulq %r12, %rdx
leaq 0x8757eb(%rip), %rax    # 0x87c800
movb (%rax,%r13,4), %cl
shrq %cl, %rdx
movq %rdx, 0x20(%rsp)
movl %r13d, %edi
callq 0xccfc
xorl %r14d, %r14d
cmpl $0x40, %eax
je 0x7048
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r14
testq %r12, %rcx
jne 0x7048
movl %eax, %edi
callq 0xccfc
jmp 0x702c
leaq (,%rbx,8), %rbx
addq %rbp, %rbx
movq (%rbx), %rbp
movl %r13d, %edi
callq 0xcd3f
xorl %r12d, %r12d
cmpl $0x40, %eax
je 0x707d
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r12
testq %rbp, %rcx
jne 0x707d
movl %eax, %edi
callq 0xcd3f
jmp 0x7061
movq (%rbx), %r13
movq (%rsp), %rdi
callq 0xcd87
xorl %ebp, %ebp
cmpl $0x40, %eax
je 0x70a7
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %rbp
testq %r13, %rcx
jne 0x70a7
movl %eax, %edi
callq 0xcd87
jmp 0x708b
movq (%rbx), %rbx
movq (%rsp), %rdi
callq 0xcdc7
xorl %r13d, %r13d
cmpl $0x40, %eax
je 0x70d2
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r13
testq %rbx, %rcx
jne 0x70d2
movl %eax, %edi
callq 0xcdc7
jmp 0x70b6
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 0x6ff4
incq %r13
cmpq $0x40, %r13
jne 0x6fb4
addq $0x28, %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/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 0xf3374(%rip), %r15     # 0xfa4b0
leaq 0xf4dbd(%rip), %rax     # 0xfbf00
movq (%rax,%r13,8), %rdi
callq 0x3b08
movl %eax, 0x8(%rsp)
movq %r13, %rcx
shlq $0xf, %rcx
leaq 0x2f4fa2(%rip), %rax    # 0x2fc100
leaq (%rax,%rcx), %rbp
leaq 0xf4f97(%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 0x6f4f72(%rip), %rax    # 0x6fc100
movq (%rax,%r13,8), %rdx
imulq %r12, %rdx
leaq 0x6f5163(%rip), %rax    # 0x6fc300
movb (%rax,%r13,4), %cl
shrq %cl, %rdx
movq %rdx, 0x20(%rsp)
movl %r13d, %edi
callq 0xcc11
xorl %r14d, %r14d
cmpl $0x40, %eax
je 0x71d0
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r14
testq %r12, %rcx
jne 0x71d0
movl %eax, %edi
callq 0xcc11
jmp 0x71b4
leaq (,%rbx,8), %rbx
addq %rbp, %rbx
movq (%rbx), %rbp
movl %r13d, %edi
callq 0xcc4a
xorl %r12d, %r12d
cmpl $0x40, %eax
je 0x7205
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r12
testq %rbp, %rcx
jne 0x7205
movl %eax, %edi
callq 0xcc4a
jmp 0x71e9
movq (%rbx), %r13
movq (%rsp), %rdi
callq 0xcc89
xorl %ebp, %ebp
cmpl $0x40, %eax
je 0x722f
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %rbp
testq %r13, %rcx
jne 0x722f
movl %eax, %edi
callq 0xcc89
jmp 0x7213
movq (%rbx), %rbx
movq (%rsp), %rdi
callq 0xccc6
xorl %r13d, %r13d
cmpl $0x40, %eax
je 0x725a
movl %eax, %ecx
movq (%r15,%rcx,8), %rcx
orq %rcx, %r13
testq %rbx, %rcx
jne 0x725a
movl %eax, %edi
callq 0xccc6
jmp 0x723e
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 0x717c
incq %r13
cmpq $0x40, %r13
jne 0x713c
addq $0x28, %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/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 0xf31fc(%rip), %rax     # 0xfa4b0
cmpq $0x0, 0x118(%rax)
je 0x72ee
callq 0x693b
callq 0x68af
callq 0x6bb7
callq 0x69d5
movl $0x1, %edi
callq 0x6d99
xorl %edi, %edi
callq 0x6d99
callq 0x7124
popq %rax
jmp 0x6f9c
leaq 0x2722d(%rip), %rdi     # 0x2e522
leaq 0x232b7(%rip), %rsi     # 0x2a5b3
leaq 0x234f8(%rip), %rcx     # 0x2a7fb
movl $0x13d, %edx            # imm = 0x13D
callq 0x20d0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/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 0x2352b(%rip), %rdi     # 0x2a862
xorl %eax, %eax
callq 0x640d
callq 0x11807
callq 0x1163c
callq 0x18c9f
callq 0x1212d
callq 0x18b7c
callq 0x28b47
callq 0x27454
callq 0x245e3
callq 0x10a54
callq 0x19d63
callq 0x1e0ed
callq 0x2165a
callq 0x10008
callq 0x136a4
callq 0x14799
callq 0x25719
callq 0x275e5
callq 0x184c9
callq 0x1edf1
callq 0x1559e
callq 0x2464c
callq 0x260e9
leaq 0x234db(%rip), %rdi     # 0x2a88e
xorl %eax, %eax
callq 0x640d
leaq 0xc155f(%rip), %rdi     # 0xc8920
callq 0xaa43
leaq 0xf0b23(%rip), %rdi     # 0xf7ef0
callq 0x6207
leaq 0xf0b47(%rip), %rdi     # 0xf7f20
callq 0x6207
movb $0x1, %al
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x7519
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r12d
movl $0x1, %r15d
leaq 0x23498(%rip), %r14     # 0x2a8a1
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
movl $0x3d, %esi
callq 0x2070
testq %rax, %rax
je 0x74ff
movq %rax, %rbp
movl $0x5, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2090
testl %eax, %eax
je 0x74ad
movl $0x5, %edx
movq %r13, %rdi
leaq 0x2345e(%rip), %rsi     # 0x2a8a7
callq 0x2090
testl %eax, %eax
je 0x74c1
movl $0x6, %edx
movq %r13, %rdi
leaq 0x2344c(%rip), %rsi     # 0x2a8ad
callq 0x2090
testl %eax, %eax
je 0x74d7
movl $0x6, %edx
movq %r13, %rdi
leaq 0x2343b(%rip), %rsi     # 0x2a8b4
callq 0x2090
testl %eax, %eax
je 0x74ed
movl $0x5, %edx
movq %r13, %rdi
leaq 0x2342a(%rip), %rsi     # 0x2a8bb
callq 0x2090
testl %eax, %eax
jne 0x74ff
incq %rbp
movq %rbp, %rdi
callq 0x22b0
movl %eax, 0x3acf5(%rip)     # 0x421a0
jmp 0x74ff
incq %rbp
movq %rbp, %rdi
callq 0x2310
movq %rax, 0x875449(%rip)    # 0x87c908
jmp 0x74ff
incq %rbp
movq %rbp, %rdi
callq 0x22b0
shll $0x14, %eax
movl %eax, 0x875443(%rip)    # 0x87c918
jmp 0x74ff
incq %rbp
movq %rbp, %rdi
callq 0x22b0
shll $0x14, %eax
movl %eax, 0x875431(%rip)    # 0x87c91c
jmp 0x74ff
incq %rbp
movq %rbp, %rdi
callq 0x2310
movq %rax, 0x875411(%rip)    # 0x87c910
incq %r15
cmpq %r15, %r12
jne 0x7409
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/main.cpp
// Function: main
int main(int argc,char *argv[]) {
    setbuf(stdin, NULL);
    setbuf(stdout, NULL);
    init_logfile();

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

    process_args(argc,argv);

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

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

    assert(run_tests());

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

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

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

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %rbx
movl %edi, %ebp
movq 0x3aa8f(%rip), %rax     # 0x41fc0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2270
movq 0x3aa4e(%rip), %rax     # 0x41f90
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2270
callq 0x63f0
leaq 0x232b6(%rip), %rdi     # 0x2a80e
xorl %eax, %eax
callq 0x640d
leaq 0x232e0(%rip), %rdi     # 0x2a846
xorl %eax, %eax
callq 0x640d
callq 0x63b1
movl %ebp, %edi
movq %rbx, %rsi
callq 0x73e2
cmpl $0x0, 0x875395(%rip)    # 0x87c918
jne 0x758f
movl $0x10000000, 0x875389(%rip) # imm = 0x10000000
movl 0x875383(%rip), %esi    # 0x87c918
leaq 0x23325(%rip), %rdi     # 0x2a8c1
xorl %eax, %eax
callq 0x640d
movl 0x87536f(%rip), %esi    # 0x87c918
leaq 0xf0940(%rip), %rdi     # 0xf7ef0
callq 0x6175
cmpl $0x0, 0x875360(%rip)    # 0x87c91c
jne 0x75c8
movl $0x10000000, 0x875354(%rip) # imm = 0x10000000
movl 0x87534e(%rip), %esi    # 0x87c91c
leaq 0x23313(%rip), %rdi     # 0x2a8e8
xorl %eax, %eax
callq 0x640d
movl 0x87533a(%rip), %esi    # 0x87c91c
leaq 0xf0937(%rip), %rdi     # 0xf7f20
callq 0x6175
callq 0x732f
movq 0x875316(%rip), %rdi    # 0x87c910
testq %rdi, %rdi
jne 0x7686
movq 0x8752fe(%rip), %rdi    # 0x87c908
testq %rdi, %rdi
je 0x7634
callq 0x4472
movq 0x8752ed(%rip), %rsi    # 0x87c908
leaq 0x23316(%rip), %rdi     # 0x2a938
movl %eax, %edx
xorl %eax, %eax
callq 0x640d
callq 0x117f8
testb %al, %al
je 0x7698
leaq 0x25019(%rip), %rdi     # 0x2c654
movq %rsp, %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0x766e
movq %rsp, %rbx
leaq 0x25000(%rip), %r14     # 0x2c654
movq %rbx, %rdi
callq 0xf435
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
jne 0x7654
leaq 0x232ee(%rip), %rdi     # 0x2a963
xorl %eax, %eax
callq 0x2330
movl $0x1, %edi
callq 0x21f0
movl 0x3ab14(%rip), %esi     # 0x421a0
callq 0xcec8
xorl %edi, %edi
callq 0x21f0
leaq 0x232b8(%rip), %rdi     # 0x2a957
leaq 0x2326e(%rip), %rsi     # 0x2a914
leaq 0x23274(%rip), %rcx     # 0x2a921
movl $0x7d, %edx
callq 0x20d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x7742
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
cmpl $0x8, %eax
jae 0x7761
movq $-0x1c0001, %rcx        # imm = 0xFFE3FFFF
andq (%rdi), %rcx
shll $0x12, %eax
orq %rcx, %rax
movq %rax, (%rdi)
popq %rax
retq
leaq 0x2321f(%rip), %rdi     # 0x2a968
leaq 0x23233(%rip), %rsi     # 0x2a983
leaq 0x23239(%rip), %rcx     # 0x2a990
movl $0x26, %edx
callq 0x20d0
leaq 0x2324a(%rip), %rdi     # 0x2a9b2
leaq 0x23214(%rip), %rsi     # 0x2a983
leaq 0x2321a(%rip), %rcx     # 0x2a990
movl $0x28, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rax, (%rdi)
testl %esi, %esi
js 0x782a
shlq $0x20, %rsi
orq %rsi, %rax
jmp 0x7838
negl %esi
shlq $0x20, %rsi
orq %rsi, %rax
btsq $0x3f, %rax
movq %rax, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x78d0
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 0x78c0
movq (%r14), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x30e3
movl 0x138(%rbx), %edi
callq 0xdfc4
movq %rbx, %rdi
movl %eax, %esi
callq 0xaf39
testb %al, %al
je 0x78ac
movq $0x0, (%r14)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3341
addq $0x8, %r14
cmpq %r15, %r14
jb 0x787e
movq %r15, %rax
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x792f
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7df7
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7e9b
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7f1a
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7f99
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x8018
// File: /workspace/github_cpp_makefile_star2_O1/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 0x7e7c
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 0x7e6a
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c25
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x8508
movq %rax, %r14
movl %r13d, %eax
leaq 0xf2658(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7e2e
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x22c05(%rip), %rdi     # 0x2aa88
leaq 0x22bae(%rip), %rsi     # 0x2aa38
leaq 0x22c07(%rip), %rcx     # 0x2aa98
movl $0x6e, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x7f08
movq %rsi, %rbx
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c25
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x865d
movq %rax, %r14
movl %r13d, %eax
leaq 0xf25ba(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7ecc
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_O1/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 0x7f87
movq %rsi, %rbx
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c25
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x8780
movq %rax, %r14
movl %r13d, %eax
leaq 0xf253b(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7f4b
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_O1/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 0x8006
movq %rsi, %rbx
movzbl %dl, %ebp
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x3c25
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x88a3
movq %rax, %r14
movl %r13d, %eax
leaq 0xf24bc(%rip), %rcx     # 0xfa4b0
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
xorq %r15, %rcx
cmpq %r15, %rax
movq %rcx, %r15
jne 0x7fca
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_O1/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 %rsi, %r13
movq %rdi, %rbx
movl %r8d, %eax
movl (%rsi,%rax,4), %ebp
cmpl $0x1, 0x138(%rsi)
jne 0x837c
movl %ebp, %edi
callq 0xe82f
testb %al, %al
jne 0x8391
cmpl $0x0, 0x138(%r13)
jne 0x83c6
movl %ebp, %edi
callq 0xe835
testb %al, %al
je 0x83c6
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x76c6
testl %ebp, %ebp
je 0x83b0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x771c
addq $0x8, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x225f6(%rip), %rdi     # 0x2a9c3
leaq 0x22664(%rip), %rsi     # 0x2aa38
leaq 0x2266d(%rip), %rcx     # 0x2aa48
movl $0x39, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x76c6
movq %rbx, %rdi
callq 0x77ab
addq $0x8, %rbx
movq %rbx, %rax
popq %rbx
retq