LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: line_to_str(move_line*, char*)
void line_to_str(move_line *line,char *line_buffer) {
    assert(line);
    assert(line_buffer);
    line_buffer[0]='\0';
    char move_buffer[5];
    for (int i=0;i<line->n;i++) {
        move_to_str(line->mv[i],move_buffer);
        if (i>0) {
            int len=strlen(line_buffer);
            line_buffer[len] = ' ';
            line_buffer[len+1] = '\0';
        }
        strcat(line_buffer,move_buffer);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xe0b7
movq %rsi, %rbx
testq %rsi, %rsi
je 0xe0d6
movq %rdi, %r14
movb $0x0, (%rbx)
cmpl $0x0, (%rdi)
jle 0xe0ab
xorl %r12d, %r12d
leaq 0x3(%rsp), %r15
movq 0x8(%r14,%r12,8), %rdi
movq %r15, %rsi
callq 0xe0f5
testq %r12, %r12
je 0xe095
movq %rbx, %rdi
callq 0x2080
cltq
movb $0x20, (%rbx,%rax)
incl %eax
cltq
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22f0
incq %r12
movslq (%r14), %rax
cmpq %rax, %r12
jl 0xe06d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1ed5a(%rip), %rdi     # 0x2ce18
leaq 0x1ed58(%rip), %rsi     # 0x2ce1d
leaq 0x1ed5f(%rip), %rcx     # 0x2ce2b
movl $0x32, %edx
callq 0x20d0
leaq 0x1ed74(%rip), %rdi     # 0x2ce51
leaq 0x1ed39(%rip), %rsi     # 0x2ce1d
leaq 0x1ed40(%rip), %rcx     # 0x2ce2b
movl $0x33, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: move_to_str(unsigned long long, char*)
void move_to_str(move mv,char *buffer) {
    square_t from_sq = get_from_sq(mv);
    square_t to_sq = get_to_sq(mv);
    sq_to_str(from_sq,buffer);
    sq_to_str(to_sq,buffer+2);
    piece_t promo = get_promopiece(mv);
    if (promo != NO_PIECE) {
        if (promo==QUEEN) { buffer[4]='q'; }
        else if (promo==ROOK) { buffer[4]='r'; }
        else if (promo==BISHOP) { buffer[4]='b'; }
        else if (promo==KNIGHT) { buffer[4]='n'; }
        buffer[5]='\0';
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x77b0
movl %eax, %r15d
movq %r14, %rdi
callq 0x77b7
movl %eax, %ebp
movl %r15d, %edi
callq 0xca4a
addb $0x61, %al
movb %al, (%rbx)
movl %r15d, %edi
callq 0xca75
movb $0x38, %r15b
movb $0x38, %cl
subb %al, %cl
movb %cl, 0x1(%rbx)
xorl %r12d, %r12d
movb %r12b, 0x2(%rbx)
movl %ebp, %edi
callq 0xca4a
addb $0x61, %al
movb %al, 0x2(%rbx)
movl %ebp, %edi
callq 0xca75
subb %al, %r15b
movb %r15b, 0x3(%rbx)
movb %r12b, 0x4(%rbx)
movq %r14, %rdi
callq 0x77cb
cmpl $0x5, %eax
ja 0xe188
movl %eax, %eax
leaq 0x1eab2(%rip), %rcx     # 0x2cc20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x6e, %al
jmp 0xe185
movb $0x62, %al
jmp 0xe185
movb $0x72, %al
jmp 0xe185
movb $0x71, %al
movb %al, 0x4(%rbx)
movb $0x0, 0x5(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: is_line_valid(move_line*, position*)
bool is_line_valid(move_line *line,position *pos) {

    // copy the position
    position my_pos;
    memcpy(&my_pos,pos,sizeof(position));

    undo undos[pos->move_counter + line->n];

    for (int i=0;i<line->n;i++) {
        if (!is_legal_move(line->mv[i],&my_pos)) {
            print("invalid line!\n");
            draw_board(pos);
            return false;
        }
        apply_move(&my_pos,line->mv[i],undos);
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb48, %rsp            # imm = 0xB48
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x208(%rbp), %rdi
movl $0x1c8, %edx            # imm = 0x1C8
callq 0x2100
movq %rsp, %rcx
movl (%r14), %eax
addl 0x144(%rbx), %eax
shlq $0x5, %rax
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, -0x40(%rbp)
movq %rdx, %rsp
cmpl $0x0, (%r14)
setle %r15b
jle 0xe712
movq %rcx, -0x30(%rbp)
movq %rbx, -0x38(%rbp)
movq 0x8(%r14), %rbx
leaq -0xb70(%rbp), %r13
leaq -0x208(%rbp), %rsi
movq %r13, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7840
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0xe727
testb %al, %al
je 0xe6f7
movl $0x1, %r13d
movq (%r14,%r13,8), %rsi
leaq -0x208(%rbp), %rdi
movq -0x40(%rbp), %rdx
callq 0x30e3
movslq (%r14), %rax
cmpq %rax, %r13
setge %r15b
jge 0xe70e
movq 0x8(%r14,%r13,8), %rbx
leaq -0xb70(%rbp), %r12
movq %r12, %rdi
leaq -0x208(%rbp), %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7840
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xe727
incq %r13
testb %al, %al
jne 0xe69d
leaq 0x1e771(%rip), %rdi     # 0x2ce6f
xorl %eax, %eax
callq 0x640d
movq -0x38(%rbp), %rdi
callq 0x4b7c
movq -0x30(%rbp), %rcx
movq %rcx, %rsp
movl %r15d, %eax
leaq -0x28(%rbp), %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/utils.cpp
// Function: is_in_move_list(unsigned long long, unsigned long long*, unsigned long long*)
bool is_in_move_list(move mv,move *start,move *end) {
    for (move *mp=start;mp<end;mp++) {
        if (clear_score(*mp) == clear_score(mv)) {
            return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpq %rdx, %rsi
setb %bpl
jae 0xe782
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %rdi
callq 0x783c
movq %rax, %r12
movq %r15, %rdi
callq 0x783c
cmpq %rax, %r12
je 0xe782
addq $0x8, %r14
cmpq %rbx, %r14
setb %bpl
jae 0xe782
movq (%r14), %rdi
callq 0x783c
movq %rax, %r12
movq %r15, %rdi
callq 0x783c
addq $0x8, %r14
cmpq %rax, %r12
jne 0xe75d
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: num_moves(unsigned long long*, unsigned long long*, bool, bool)
uint32 num_moves(move *startp,move *endp,bool caps,bool noncaps) {
    uint32 n=0;
    for (move* mp=startp;mp<endp;mp++) {
        if (*mp != 0) {
            if (is_capture(*mp) || get_promopiece(*mp)) {
                if (caps) n++;
            } else {
                if (noncaps) n++;
            }
        }
    }
    return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
cmpq %rsi, %rdi
jae 0xe818
movq %rsi, %rbx
movq %rdi, %r14
movzbl %cl, %r15d
movzbl %dl, %r12d
xorl %ebp, %ebp
movq (%r14), %rdi
testq %rdi, %rdi
je 0xe808
callq 0x77df
testb %al, %al
jne 0xe805
movq (%r14), %rdi
callq 0x77cb
testl %eax, %eax
je 0xe813
addl %r12d, %ebp
addq $0x8, %r14
cmpq %rbx, %r14
jb 0xe7e8
jmp 0xe818
addl %r15d, %ebp
jmp 0xe808
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: get_game_status()
game_status get_game_status() {
    if (is_checkmate(&gpos)) return CHECKMATED;
    if (is_stalemate(&gpos)) return STALEMATED;
    if (is_lack_of_mating_material(&gpos)) return DRAW_MATERIAL;
    if (is_draw_by_rep(&gpos,gundos)) return DRAW_REP;
    if (is_draw_by_50(&gpos)) return DRAW_BY_50;

    return INPROGRESS;
}

// Assembly:
pushq %rax
leaq 0xba0dd(%rip), %rdi     # 0xc8920
callq 0xb08f
movl %eax, %ecx
movl $0x1, %eax
testb %cl, %cl
jne 0xe8b1
leaq 0xba0c6(%rip), %rdi     # 0xc8920
callq 0xb105
movl %eax, %ecx
movl $0x2, %eax
testb %cl, %cl
jne 0xe8b1
leaq 0xba0af(%rip), %rdi     # 0xc8920
callq 0x4924
movl %eax, %ecx
movl $0x3, %eax
testb %cl, %cl
jne 0xe8b1
leaq 0xba098(%rip), %rdi     # 0xc8920
leaq 0xba261(%rip), %rsi     # 0xc8af0
callq 0x4a11
movl %eax, %ecx
movl $0x5, %eax
testb %cl, %cl
jne 0xe8b1
leaq 0xba07a(%rip), %rdi     # 0xc8920
callq 0x4b4c
movzbl %al, %eax
shll $0x2, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: undo_stacks_equal(undo*, undo*, int)
bool undo_stacks_equal(undo* stack1, undo* stack2,int32 num_elements) {

    for (int32 i=0;i<num_elements;i++) {
        undo e1 = *(stack1 + i);
        undo e2 = *(stack2 + i);

        if (e1.mv != e2.mv || e1.hash_key != e2.hash_key
                || e1.fifty_counter != e2.fifty_counter
                || e1.ep_sq != e2.ep_sq
                || e1.castling_rights != e2.castling_rights
                || e1.captured != e2.captured)
        {
            return false;
        }
    }

    return true;
}

// Assembly:
testl %edx, %edx
setle %al
jle 0xe9f4
movq (%rdi), %rcx
cmpq (%rsi), %rcx
jne 0xe9f4
movl %edx, %ecx
movl $0x8, %r8d
movl $0x1, %edx
movq (%rdi,%r8), %r9
cmpq (%rsi,%r8), %r9
jne 0xe9f4
movl 0x10(%rsi,%r8), %r9d
cmpl %r9d, 0x10(%rdi,%r8)
jne 0xe9f4
movl 0xc(%rsi,%r8), %r9d
cmpl %r9d, 0xc(%rdi,%r8)
jne 0xe9f4
movl 0x14(%rsi,%r8), %r9d
cmpl %r9d, 0x14(%rdi,%r8)
jne 0xe9f4
movl 0x8(%rsi,%r8), %r9d
cmpl %r9d, 0x8(%rdi,%r8)
jne 0xe9f4
cmpq %rcx, %rdx
setae %al
je 0xe9f4
movq 0x18(%rdi,%r8), %r9
leaq 0x20(%r8), %r10
incq %rdx
cmpq 0x18(%rsi,%r8), %r9
movq %r10, %r8
je 0xe99c
andb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_bk()
void handle_bk() {
    if (book_db==0) {
        print("\tbook not enabled\n");
    } else {
        move_freq_pair mfp[300];
        int32 num_book_moves = get_book_moves(mfp,&gpos);

        if (num_book_moves > 0) {
            char move_buffer[8];
            for (int i=0;i<num_book_moves;i++) {
                if (mfp[i].freq > 0) {
                    move_to_str(mfp[i].mv,move_buffer);
                    print("\t%s, freq: %d\n",move_buffer,mfp[i].freq);
                }
            }
        } else {
            print("\tno book moves found\n");
        }
    }
    print("\n"); // blank line required by protocol
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x12d8, %rsp           # imm = 0x12D8
leaq 0xb5f0b(%rip), %rax     # 0xc4918
cmpq $0x0, (%rax)
je 0xea70
leaq 0xb9f06(%rip), %rsi     # 0xc8920
leaq 0x10(%rsp), %rdi
callq 0x4759
testl %eax, %eax
jle 0xea79
movl %eax, %r15d
shlq $0x4, %r15
leaq 0x8(%rsp), %rbx
leaq 0x1e478(%rip), %r14     # 0x2ceb3
xorl %r12d, %r12d
cmpl $0x0, 0x18(%rsp,%r12)
jle 0xea65
movq 0x10(%rsp,%r12), %rdi
movq %rbx, %rsi
callq 0xe0f5
movl 0x18(%rsp,%r12), %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x640d
addq $0x10, %r12
cmpq %r12, %r15
jne 0xea3e
jmp 0xea87
leaq 0x1e429(%rip), %rdi     # 0x2cea0
jmp 0xea80
leaq 0x1e442(%rip), %rdi     # 0x2cec2
xorl %eax, %eax
callq 0x640d
leaq 0x1bdd2(%rip), %rdi     # 0x2a860
xorl %eax, %eax
callq 0x640d
addq $0x12d8, %rsp           # imm = 0x12D8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: print_thinking_output(move_line*, int, int, int, unsigned long long)
void print_thinking_output(move_line* line,int32 depth,int32 score,int32 start_time,uint64 nodes) {
    assert(line);
    assert(line->n > 0);

    char buffer[1024];
    line_to_str(line,buffer);
    int32 time_centis = (milli_timer() - start_time) / 10;
    print("%2d %5d %5d %7llu %s\n",depth,score,time_centis,nodes,buffer);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
testq %rdi, %rdi
je 0xeb88
cmpl $0x0, (%rdi)
jle 0xeba7
movq %r8, %rbx
movl %ecx, %r15d
movl %edx, %ebp
movl %esi, %r14d
movq %rsp, %r12
movq %r12, %rsi
callq 0xe045
callq 0xdf58
subl %r15d, %eax
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x22, %rcx
addl %eax, %ecx
leaq 0x1e3dc(%rip), %rdi     # 0x2cf42
movl %r14d, %esi
movl %ebp, %edx
movq %rbx, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x640d
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e289(%rip), %rdi     # 0x2ce18
leaq 0x1e34c(%rip), %rsi     # 0x2cee2
leaq 0x1e354(%rip), %rcx     # 0x2cef1
movl $0x42, %edx
callq 0x20d0
leaq 0x1e388(%rip), %rdi     # 0x2cf36
leaq 0x1e32d(%rip), %rsi     # 0x2cee2
leaq 0x1e335(%rip), %rcx     # 0x2cef1
movl $0x43, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: think_and_make_move()
void think_and_make_move() {
    // check if game is over before we even get started.
    game_status gs = get_game_status();
    if (gs != INPROGRESS) {
        print_result(gs);
        return;
    }

    think();
}

// Assembly:
pushq %rax
callq 0xe83b
testl %eax, %eax
je 0xec3b
movl %eax, %edi
popq %rax
jmp 0xebc6
popq %rax
jmp 0xd382
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_level()
void handle_level() {
    char mps[10],base[10];
    if (scanf("%s",mps)==EOF) return;
    if (scanf("%s",base)==EOF) return;
    float f_inc = 0.0;
    if (scanf("%f",&f_inc)==EOF) return;
    int32 my_increment = (int32)(f_inc * 1000); // convert to ms
    printd("# increment: %d\n",my_increment);
    set_increment(my_increment);
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
leaq 0x1d9cd(%rip), %rdi     # 0x2c654
leaq 0x16(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xecf7
leaq 0x1d9b5(%rip), %rdi     # 0x2c654
leaq 0xc(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xecf7
leaq 0x8(%rsp), %rsi
movl $0x0, (%rsi)
leaq 0x1e364(%rip), %rdi     # 0x2d026
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xecf7
movss 0x8(%rsp), %xmm0
mulss 0x1e1c0(%rip), %xmm0    # 0x2ce9c
cvttss2si %xmm0, %ebx
leaq 0x1e342(%rip), %rdi     # 0x2d029
movl %ebx, %esi
xorl %eax, %eax
callq 0x652d
movl %ebx, %edi
callq 0xd2f7
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_memory()
void handle_memory() {
    int32 mem_in_mb;
    if (scanf("%d",&mem_in_mb)==EOF) return;

    printd("# received memory command, N=%d\n",mem_in_mb);
    if (mem_in_mb != last_mem_in_mb) {
        free(htbl.tblptr);
        free(phtbl.tblptr);

        uint32 total_hash_size = mem_in_mb * 1024 * 1024; // convert to bytes

        init_hash_table(&htbl,total_hash_size / 2);
        init_hash_table(&phtbl,total_hash_size / 2);

        last_mem_in_mb = mem_in_mb;
    } else {
        printd("# memory usage hasn't changed, skipping free/malloc\n");
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x1e32e(%rip), %rdi     # 0x2d03a
leaq 0xc(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xed94
movl 0xc(%rsp), %esi
leaq 0x1e315(%rip), %rdi     # 0x2d03d
xorl %eax, %eax
callq 0x652d
movl 0xc(%rsp), %eax
cmpl 0x8a705b(%rip), %eax    # 0x8b5d94
jne 0xed4b
leaq 0x1e31c(%rip), %rdi     # 0x2d05e
xorl %eax, %eax
callq 0x652d
jmp 0xed94
leaq 0xe919e(%rip), %rbx     # 0xf7ef0
movq (%rbx), %rdi
callq 0x21e0
leaq 0xe91bf(%rip), %r14     # 0xf7f20
movq (%r14), %rdi
callq 0x21e0
movl 0xc(%rsp), %ebp
shll $0x13, %ebp
andl $0x7ff80000, %ebp       # imm = 0x7FF80000
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6175
movq %r14, %rdi
movl %ebp, %esi
callq 0x6175
movl 0xc(%rsp), %eax
movl %eax, 0x8a7000(%rip)    # 0x8b5d94
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_new()
void handle_new() {
    stop_search_thread();
    force_mode = false;
    reset_pos(&gpos);
    set_max_depth(0);
}

// Assembly:
pushq %rax
movl $0x1, %edi
callq 0xd32b
leaq 0xe97b9(%rip), %rax     # 0xf8590
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2130
movb $0x0, 0x333c8(%rip)     # 0x421b0
leaq 0xb9b31(%rip), %rdi     # 0xc8920
callq 0xaa43
xorl %edi, %edi
popq %rax
jmp 0xd2fe
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_perft()
void handle_perft() {
    draw_board(&gpos);
    int max_depth;
    if (scanf("%d",&max_depth) != EOF) {
        int32 start = milli_timer();
        uint64 nodes=perft_iterate(max_depth);
        int32 end = milli_timer();
        if (end==start) end = start+1;
        print("\n# nodes: %lu\n",nodes);
        print("# elapsed time: %d ms\n",end-start);
        print("# rate: %.2f n/s\n\n",nodes*1000.0/(end-start));
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xb9af7(%rip), %rdi     # 0xc8920
callq 0x4b7c
leaq 0x1e205(%rip), %rdi     # 0x2d03a
leaq 0xc(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xeed3
callq 0xdf58
movl %eax, %r14d
movl 0xc(%rsp), %edi
callq 0x979f
movq %rax, %r15
callq 0xdf58
leal 0x1(%r14), %ebx
cmpl %r14d, %eax
cmovnel %eax, %ebx
leaq 0x1e21f(%rip), %rdi     # 0x2d093
movq %r15, %rsi
xorl %eax, %eax
callq 0x640d
subl %r14d, %ebx
leaq 0x1e21a(%rip), %rdi     # 0x2d0a2
movl %ebx, %esi
xorl %eax, %eax
callq 0x640d
movq %r15, %xmm1
punpckldq 0x1d8f2(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1d8fa(%rip), %xmm1    # 0x2c7a0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x1d8fe(%rip), %xmm0    # 0x2c7b8
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
divsd %xmm1, %xmm0
leaq 0x1e1ed(%rip), %rdi     # 0x2d0b9
movb $0x1, %al
callq 0x640d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_ping()
void handle_ping() {
    if (!is_pondering()) {
        stop_search_thread();
    }
    int n;
    if (scanf("%d",&n) != EOF) {
        print("pong %d\n",n);
    }
}

// Assembly:
pushq %rax
callq 0xd31c
testb %al, %al
jne 0xef2c
movl $0x1, %edi
callq 0xd32b
leaq 0xe966e(%rip), %rax     # 0xf8590
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2130
leaq 0x1e107(%rip), %rdi     # 0x2d03a
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xef56
movl 0x4(%rsp), %esi
leaq 0x1e17d(%rip), %rdi     # 0x2d0cc
xorl %eax, %eax
callq 0x640d
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_probe_book()
void handle_probe_book() {
    move mv = probe_book(&gpos);
    if (mv==0) {
        print("no move found.\n");
    } else {
        print_move(mv);
    }
}

// Assembly:
pushq %rax
leaq 0xb99b6(%rip), %rdi     # 0xc8920
callq 0x4612
testq %rax, %rax
je 0xef7d
movq %rax, %rdi
popq %rax
jmp 0xe8b3
leaq 0x1e151(%rip), %rdi     # 0x2d0d5
xorl %eax, %eax
popq %rcx
jmp 0x640d
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_protover()
void handle_protover() {
    int version;
    if (scanf("%d",&version) != EOF) {
        if (version < 2) {
            error("protover >= 2 expected.\n");
            exit(0);
        }

        print("feature analyze=0 black=0 colors=0 cores=0 ping=1 draw=0 debug=1 edit=0 ics=1\n");
        print("feature level=0 name=1 nps=0 memory=1 playother=1 pause=0 resume=0 reuse=1 san=0\n");
        print("feature setboard=1 sigint=0 sigterm=0 smp=0 st=0 time=1 usermove=1\n");
        print("feature white=0 variants=\"normal\"\n");
        print("feature done=1\n"); // must be last
    }
}

// Assembly:
pushq %rax
leaq 0x1e0a6(%rip), %rdi     # 0x2d03a
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xeff2
cmpl $0x1, 0x4(%rsp)
jle 0xeff4
leaq 0x1e14b(%rip), %rdi     # 0x2d0fe
xorl %eax, %eax
callq 0x640d
leaq 0x1e18c(%rip), %rdi     # 0x2d14d
xorl %eax, %eax
callq 0x640d
leaq 0x1e1d0(%rip), %rdi     # 0x2d19f
xorl %eax, %eax
callq 0x640d
leaq 0x1e206(%rip), %rdi     # 0x2d1e3
xorl %eax, %eax
callq 0x640d
leaq 0x1e21b(%rip), %rdi     # 0x2d206
xorl %eax, %eax
callq 0x640d
popq %rax
retq
leaq 0x1e0ea(%rip), %rdi     # 0x2d0e5
xorl %eax, %eax
callq 0x2330
xorl %edi, %edi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_quit()
void handle_quit() {
    stop_search_thread();
    if (book_db != 0) {
        sqlite3_close(book_db);
    }
    free(htbl.tblptr);
    free(phtbl.tblptr);

    print("bye...\n");
    exit(0);
}

// Assembly:
pushq %rax
movl $0x1, %edi
callq 0xd32b
leaq 0xe9575(%rip), %rax     # 0xf8590
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2130
leaq 0xb58ec(%rip), %rax     # 0xc4918
movq (%rax), %rdi
testq %rdi, %rdi
je 0xf039
callq 0x20a0
leaq 0xe8eb0(%rip), %rax     # 0xf7ef0
movq (%rax), %rdi
callq 0x21e0
leaq 0xe8ed1(%rip), %rax     # 0xf7f20
movq (%rax), %rdi
callq 0x21e0
leaq 0x1e1b8(%rip), %rdi     # 0x2d216
xorl %eax, %eax
callq 0x640d
xorl %edi, %edi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_sd()
void handle_sd() {
    int32 my_max_depth;
    if (scanf("%d",&my_max_depth)==EOF) return;
    printd("# MAX DEPTH: %d\n",my_max_depth);
    set_max_depth(my_max_depth);
}

// Assembly:
pushq %rax
leaq 0x1de70(%rip), %rdi     # 0x2d03a
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xf1f6
movl 0x4(%rsp), %esi
leaq 0x1e055(%rip), %rdi     # 0x2d23b
xorl %eax, %eax
callq 0x652d
movl 0x4(%rsp), %edi
callq 0xd2fe
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_setboard()
void handle_setboard() {
    char fen[255];
    if (!fgets(fen, 255, stdin)) {
        return;
    }
    printd("# SETBOARD FEN: %s\n",fen);
    if (!set_pos(&gpos,fen)) {
        print("tellusererror illegal position\n");
    }
    draw_board(&gpos);
}

// Assembly:
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq 0x32db9(%rip), %rax     # 0x41fc0
movq (%rax), %rdx
movq %rsp, %rdi
movl $0xff, %esi
callq 0x22d0
testq %rax, %rax
je 0xf25d
leaq 0x1e029(%rip), %rdi     # 0x2d24c
movq %rsp, %rbx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x652d
leaq 0xb96e9(%rip), %rdi     # 0xc8920
movq %rbx, %rsi
callq 0xaa74
testb %al, %al
jne 0xf251
leaq 0x1e016(%rip), %rdi     # 0x2d260
xorl %eax, %eax
callq 0x640d
leaq 0xb96c8(%rip), %rdi     # 0xc8920
callq 0x4b7c
addq $0x100, %rsp            # imm = 0x100
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: handle_time()
void handle_time() {
    int32 my_time_remaining;
    if (scanf("%d",&my_time_remaining)==EOF) return;
    my_time_remaining *= 10; // centiseconds to milliseconds
    printd("# TIME REMAINING: %d\n",my_time_remaining);
    set_time_remaining(my_time_remaining);
}

// Assembly:
pushq %rax
leaq 0x1ddcc(%rip), %rdi     # 0x2d03a
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0xf2a3
movl 0x4(%rsp), %eax
addl %eax, %eax
leal (%rax,%rax,4), %esi
movl %esi, 0x4(%rsp)
leaq 0x1dfed(%rip), %rdi     # 0x2d280
xorl %eax, %eax
callq 0x652d
movl 0x4(%rsp), %edi
callq 0xd2f0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/xboard.cpp
// Function: parse_command(char const*)
void parse_command(const char *cmd) {

    last_input_time = milli_timer();
    printd("# RECEIVED: %s\n",cmd);

    int len=sizeof(function_table)/sizeof(function_table_entry);

    for (int i=0;i<len;i++) {
        function_table_entry fte = function_table[i];
        if (strcmp(cmd,fte.name)==0) {
            fte.func();
            return;
        }
    }

    print("Error (unknown command): %s\n",cmd);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0xdf58
movl %eax, 0x8a6948(%rip)    # 0x8b5d90
leaq 0x1dff7(%rip), %rdi     # 0x2d446
movq %rbx, %rsi
xorl %eax, %eax
callq 0x652d
movl $0x8, %eax
leaq 0x32d5b(%rip), %r15     # 0x421c0
movq %rax, %r14
movq -0x8(%rax,%r15), %rsi
movq %rbx, %rdi
callq 0x2260
testl %eax, %eax
je 0xf49e
movq %r14, %rax
addq $0x10, %rax
cmpq $0x2c8, %rax            # imm = 0x2C8
jne 0xf465
leaq 0x1dfc7(%rip), %rdi     # 0x2d456
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x640d
movq %r14, %rax
movq %r15, %rcx
popq %rbx
popq %r14
popq %r15
jmpq *(%rax,%rcx)
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/apply__test.cpp
// Function: test_undo_double_pawn_push()
void test_undo_double_pawn_push() {
    position pos;
    reset_pos(&pos);

    position save_pos;
    memcpy(&save_pos,&pos,sizeof(position));

    move mv = to_move(PAWN,E2,E4);
    apply_move(&pos,mv,gundos);

    undo_last_move(&pos,gundos);
    assert(equal_pos(&pos,&save_pos,true));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x390, %rsp            # imm = 0x390
leaq 0x1c8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa43
movq %rsp, %r14
movl $0x1c8, %edx            # imm = 0x1C8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2100
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0x76b8
leaq 0xb8d81(%rip), %r15     # 0xc8af0
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x30e3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3341
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfda9
addq $0x390, %rsp            # imm = 0x390
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1dae8(%rip), %rdi     # 0x2d898
leaq 0x1d6f8(%rip), %rsi     # 0x2d4af
leaq 0x1daf9(%rip), %rcx     # 0x2d8b7
movl $0x85, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/apply__test.cpp
// Function: test_undo_capturing_promotion()
void test_undo_capturing_promotion() {
    position pos;
    set_pos(&pos,"r7/1PK5/8/8/k7/8/8/8 w - -");

    position save_pos;
    memcpy(&save_pos,&pos,sizeof(position));

    move mv = to_capture(PAWN,B7,A8,ROOK);
    set_promopiece(&mv,QUEEN);
    apply_move(&pos,mv,gundos);

    undo_last_move(&pos,gundos);
    assert(equal_pos(&pos,&save_pos,true));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x3a0, %rsp            # imm = 0x3A0
leaq 0x1dafe(%rip), %rsi     # 0x2d8d9
leaq 0x1d8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x10(%rsp), %r14
movl $0x1c8, %edx            # imm = 0x1C8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2100
movl $0x1, %edi
movl $0x9, %esi
xorl %edx, %edx
movl $0x4, %ecx
callq 0x76d7
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rdi
movl $0x5, %esi
callq 0x7780
movq (%r15), %rsi
leaq 0xb8cbb(%rip), %r15     # 0xc8af0
movq %rbx, %rdi
movq %r15, %rdx
callq 0x30e3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3341
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfe6c
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1da25(%rip), %rdi     # 0x2d898
leaq 0x1d635(%rip), %rsi     # 0x2d4af
leaq 0x1da73(%rip), %rcx     # 0x2d8f4
movl $0x94, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/apply__test.cpp
// Function: test_undo_epcapture()
void test_undo_epcapture() {
    position pos;
    set_pos(&pos,"k7/8/8/8/pP6/8/K7/8 b - b3");

    position save_pos;
    memcpy(&save_pos,&pos,sizeof(position));

    move mv = to_capture(PAWN,A4,B3,PAWN);
    set_epcapture(&mv);
    apply_move(&pos,mv,gundos);

    undo_last_move(&pos,gundos);
    assert(equal_pos(&pos,&save_pos,true));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x3a0, %rsp            # imm = 0x3A0
leaq 0x1da7b(%rip), %rsi     # 0x2d919
leaq 0x1d8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x10(%rsp), %r14
movl $0x1c8, %edx            # imm = 0x1C8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2100
movl $0x1, %edi
movl $0x20, %esi
movl $0x29, %edx
movl $0x1, %ecx
callq 0x76d7
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rdi
callq 0x7797
movq (%r15), %rsi
leaq 0xb8bfa(%rip), %r15     # 0xc8af0
movq %rbx, %rdi
movq %r15, %rdx
callq 0x30e3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3341
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xff2d
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1d964(%rip), %rdi     # 0x2d898
leaq 0x1d574(%rip), %rsi     # 0x2d4af
leaq 0x1d9f2(%rip), %rcx     # 0x2d934
movl $0xa3, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/apply__test.cpp
// Function: test_undo_castle()
void test_undo_castle() {
    position pos;
    set_pos(&pos,"k7/8/8/8/8/8/8/4K2R w K -");

    position save_pos;
    memcpy(&save_pos,&pos,sizeof(position));

    move mv = to_move(KING,E1,G1);
    set_castle(&mv);
    apply_move(&pos,mv,gundos);

    undo_last_move(&pos,gundos);
    assert(equal_pos(&pos,&save_pos,true));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x3a0, %rsp            # imm = 0x3A0
leaq 0x1d9f0(%rip), %rsi     # 0x2d94f
leaq 0x1d8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x10(%rsp), %r14
movl $0x1c8, %edx            # imm = 0x1C8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2100
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3e, %edx
callq 0x76b8
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rdi
callq 0x77ab
movq (%r15), %rsi
leaq 0xb8b3e(%rip), %r15     # 0xc8af0
movq %rbx, %rdi
movq %r15, %rdx
callq 0x30e3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3341
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xffe9
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1d8a8(%rip), %rdi     # 0x2d898
leaq 0x1d4b8(%rip), %rsi     # 0x2d4af
leaq 0x1d96b(%rip), %rcx     # 0x2d969
movl $0xb2, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/apply__test.cpp
// Function: test_apply()
void test_apply() {
    test_apply_move();
    test_undo_double_pawn_push();
    test_undo_capturing_promotion();
    test_undo_epcapture();
    test_undo_castle();
}

// Assembly:
pushq %rax
callq 0xf4ac
callq 0xfd25
callq 0xfdc8
callq 0xfe8b
popq %rax
jmp 0xff4c
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attacked_by_knight()
void test_attacked_by_knight() {
    position pos;
    set_pos(&pos,"3k4/8/8/3n4/3N4/8/8/3K4 w - - 0 1");

    uint64 white_map=0,black_map=0;
    for (int32 sq=A8;sq<=H1;sq++) {
        if (attacked_by_knight(&pos,(square_t)sq,WHITE)) {
            white_map |= bb_squares[sq];
        }

        if (attacked_by_knight(&pos,(square_t)sq,BLACK)) {
            black_map |= bb_squares[sq];
        }
    }

    assert(white_map==(bb_squares[C6] | bb_squares[E6] | bb_squares[F5]
                     | bb_squares[F3] | bb_squares[E2] | bb_squares[C2]
                     | bb_squares[B3] | bb_squares[B5]));


    assert(black_map==(bb_squares[C7] | bb_squares[E7] | bb_squares[F6]
                     | bb_squares[F4] | bb_squares[E3] | bb_squares[C3]
                     | bb_squares[B4] | bb_squares[B6]));


}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1d946(%rip), %rsi     # 0x2d981
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
xorl %r14d, %r14d
leaq 0xea45e(%rip), %r15     # 0xfa4b0
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x36c4
testb %al, %al
je 0x10070
orq (%r15,%r14,8), %r13
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x36c4
testb %al, %al
je 0x10085
orq (%r15,%r14,8), %r12
incq %r14
cmpq $0x40, %r14
jne 0x10058
movq 0xa0(%r15), %rax
orq 0x90(%r15), %rax
orq 0xe8(%r15), %rax
orq 0x168(%r15), %rax
orq 0x1a0(%r15), %rax
orq 0x190(%r15), %rax
orq 0x148(%r15), %rax
orq 0xc8(%r15), %rax
cmpq %rax, %r13
jne 0x10113
movq 0x60(%r15), %rax
orq 0x50(%r15), %rax
orq 0xa8(%r15), %rax
orq 0x128(%r15), %rax
orq 0x160(%r15), %rax
orq 0x150(%r15), %rax
orq 0x108(%r15), %rax
orq 0x88(%r15), %rax
cmpq %rax, %r12
jne 0x10132
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1d889(%rip), %rdi     # 0x2d9a3
leaq 0x1d915(%rip), %rsi     # 0x2da36
leaq 0x1d924(%rip), %rcx     # 0x2da4c
movl $0x1d, %edx
callq 0x20d0
leaq 0x1d932(%rip), %rdi     # 0x2da6b
leaq 0x1d8f6(%rip), %rsi     # 0x2da36
leaq 0x1d905(%rip), %rcx     # 0x2da4c
movl $0x22, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attacked_by_king()
void test_attacked_by_king() {
    position pos;
    set_pos(&pos,"3k4/8/8/3n4/3K4/8/8/8 w - - 0 1");

    uint64 white_map=0,black_map=0;
    for (int32 sq=A8;sq<=H1;sq++) {
        if (attacked_by_king(&pos,(square_t)sq,WHITE)) {
            white_map |= bb_squares[sq];
        }

        if (attacked_by_king(&pos,(square_t)sq,BLACK)) {
            black_map |= bb_squares[sq];
        }
    }
    assert(white_map==(bb_squares[C5] | bb_squares[D5] | bb_squares[E5]
                     | bb_squares[C4] | bb_squares[E4] | bb_squares[C3]
                     | bb_squares[D3] | bb_squares[E3]));


    assert(black_map==(bb_squares[C8] | bb_squares[E8] | bb_squares[C7]
                     | bb_squares[D7] | bb_squares[E7]));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1d996(%rip), %rsi     # 0x2dafe
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
xorl %r14d, %r14d
leaq 0xea331(%rip), %r15     # 0xfa4b0
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x3753
testb %al, %al
je 0x1019d
orq (%r15,%r14,8), %r13
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x3753
testb %al, %al
je 0x101b2
orq (%r15,%r14,8), %r12
incq %r14
cmpq $0x40, %r14
jne 0x10185
movq 0xd8(%r15), %rax
orq 0xd0(%r15), %rax
orq 0xe0(%r15), %rax
orq 0x110(%r15), %rax
orq 0x120(%r15), %rax
orq 0x150(%r15), %rax
orq 0x158(%r15), %rax
orq 0x160(%r15), %rax
cmpq %rax, %r13
jne 0x10222
movq 0x20(%r15), %rax
orq 0x10(%r15), %rax
orq 0x50(%r15), %rax
orq 0x58(%r15), %rax
orq 0x60(%r15), %rax
cmpq %rax, %r12
jne 0x10241
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1d8f5(%rip), %rdi     # 0x2db1e
leaq 0x1d806(%rip), %rsi     # 0x2da36
leaq 0x1d97a(%rip), %rcx     # 0x2dbb1
movl $0x37, %edx
callq 0x20d0
leaq 0x1d986(%rip), %rdi     # 0x2dbce
leaq 0x1d7e7(%rip), %rsi     # 0x2da36
leaq 0x1d95b(%rip), %rcx     # 0x2dbb1
movl $0x3b, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attacked_by_pawn()
void test_attacked_by_pawn() {
    position pos;
    set_pos(&pos,"3k4/8/8/3p4/3P3P/8/8/3K4 w - - 0 1");

    for (int32 sq=A8;sq<=H1;sq++) {
        assert(attacked_by_pawn(&pos,(square_t)sq,WHITE)==
                (sq==C5 || sq==E5 || sq==G5));

        assert(attacked_by_pawn(&pos,(square_t)sq,BLACK)==
                (sq==C4 || sq==E4));
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1d9bc(%rip), %rsi     # 0x2dc2e
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
xorl %r14d, %r14d
movl $0x1, %ebp
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x3846
cmpl $0x1a, %r14d
je 0x102ad
cmpl $0x1c, %r14d
je 0x102ad
xorl %ebp, %ebp
cmpl $0x1e, %r14d
sete %bpl
movzbl %al, %eax
cmpl %eax, %ebp
jne 0x10306
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x3846
leal -0x22(%r14), %ecx
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
setne %cl
cmpb %al, %cl
je 0x102e7
incl %r14d
cmpl $0x40, %r14d
jne 0x10282
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1d9c9(%rip), %rdi     # 0x2dcb7
leaq 0x1d741(%rip), %rsi     # 0x2da36
leaq 0x1d99e(%rip), %rcx     # 0x2dc9a
movl $0x47, %edx
callq 0x20d0
leaq 0x1d944(%rip), %rdi     # 0x2dc51
leaq 0x1d722(%rip), %rsi     # 0x2da36
leaq 0x1d97f(%rip), %rcx     # 0x2dc9a
movl $0x44, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attacked_by_rook()
void test_attacked_by_rook() {
    position pos;
    set_pos(&pos,"8/1r3k2/8/3p4/3P3P/8/1P6/3K4 b - - 0 1");

    uint64 white_map=0,black_map=0;
    for (int32 sq=A8;sq<=H1;sq++) {
        if (attacked_by_rook(&pos,(square_t)sq,WHITE)) {
            white_map |= bb_squares[sq];
        }

        if (attacked_by_rook(&pos,(square_t)sq,BLACK)) {
            black_map |= bb_squares[sq];
        }
    }

    assert(white_map==0);
    assert(black_map==(bb_squares[B8] | bb_squares[A7] | bb_squares[C7]
            | bb_squares[D7] | bb_squares[E7] | bb_squares[F7]
            | bb_squares[B6] | bb_squares[B5] | bb_squares[B4]
            | bb_squares[B3] | bb_squares[B2]));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1d9ba(%rip), %rsi     # 0x2dcf6
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
xorl %r14d, %r14d
leaq 0xea15d(%rip), %r15     # 0xfa4b0
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x37ec
testb %al, %al
je 0x10371
orq (%r15,%r14,8), %r13
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x37ec
testb %al, %al
je 0x10386
orq (%r15,%r14,8), %r12
incq %r14
cmpq $0x40, %r14
jne 0x10359
testq %r13, %r13
jne 0x103e5
movq 0x40(%r15), %rax
orq 0x8(%r15), %rax
orq 0x50(%r15), %rax
orq 0x58(%r15), %rax
orq 0x60(%r15), %rax
orq 0x68(%r15), %rax
orq 0x88(%r15), %rax
orq 0xc8(%r15), %rax
orq 0x108(%r15), %rax
orq 0x148(%r15), %rax
orq 0x188(%r15), %rax
cmpq %rax, %r12
jne 0x10404
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1d931(%rip), %rdi     # 0x2dd1d
leaq 0x1d643(%rip), %rsi     # 0x2da36
leaq 0x1d930(%rip), %rcx     # 0x2dd2a
movl $0x5a, %edx
callq 0x20d0
leaq 0x1d93c(%rip), %rdi     # 0x2dd47
leaq 0x1d624(%rip), %rsi     # 0x2da36
leaq 0x1d911(%rip), %rcx     # 0x2dd2a
movl $0x5e, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attacked_by_bishop()
void test_attacked_by_bishop() {
    position pos;
    set_pos(&pos,"8/1r3k2/8/3bB3/8/8/8/3K4 b - - 0 1");

    uint64 white_map=0,black_map=0;
    for (int32 sq=A8;sq<=H1;sq++) {
        if (attacked_by_bishop(&pos,(square_t)sq,WHITE)) {
            white_map |= bb_squares[sq];
        }

        if (attacked_by_bishop(&pos,(square_t)sq,BLACK)) {
            black_map |= bb_squares[sq];
        }
    }

    assert(white_map==(bb_squares[D6] | bb_squares[C7] | bb_squares[B8]
            | bb_squares[F6] | bb_squares[G7] | bb_squares[H8]
            | bb_squares[D4] | bb_squares[C3] | bb_squares[B2] | bb_squares[A1]
            | bb_squares[F4] | bb_squares[G3] | bb_squares[H2]));

    assert(black_map==(bb_squares[C6] | bb_squares[B7]
            | bb_squares[E6] | bb_squares[F7]
            | bb_squares[C4] | bb_squares[B3] | bb_squares[A2]
            | bb_squares[E4] | bb_squares[F3] | bb_squares[G2] | bb_squares[H1]));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1d9d3(%rip), %rsi     # 0x2de0d
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
xorl %r14d, %r14d
leaq 0xea05f(%rip), %r15     # 0xfa4b0
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x380a
testb %al, %al
je 0x1046f
orq (%r15,%r14,8), %r13
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x380a
testb %al, %al
je 0x10484
orq (%r15,%r14,8), %r12
incq %r14
cmpq $0x40, %r14
jne 0x10457
movq 0x50(%r15), %rax
orq 0x98(%r15), %rax
orq 0x8(%r15), %rax
orq 0xa8(%r15), %rax
orq 0x70(%r15), %rax
orq 0x38(%r15), %rax
orq 0x118(%r15), %rax
orq 0x150(%r15), %rax
orq 0x188(%r15), %rax
orq 0x1c0(%r15), %rax
orq 0x128(%r15), %rax
orq 0x170(%r15), %rax
orq 0x1b8(%r15), %rax
cmpq %rax, %r13
jne 0x1053e
movq 0x48(%r15), %rax
orq 0x90(%r15), %rax
orq 0xa0(%r15), %rax
orq 0x68(%r15), %rax
orq 0x110(%r15), %rax
orq 0x148(%r15), %rax
orq 0x180(%r15), %rax
orq 0x120(%r15), %rax
orq 0x168(%r15), %rax
orq 0x1b0(%r15), %rax
orq 0x1f8(%r15), %rax
cmpq %rax, %r12
jne 0x1055d
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1d8eb(%rip), %rdi     # 0x2de30
leaq 0x1d4ea(%rip), %rsi     # 0x2da36
leaq 0x1d9c5(%rip), %rcx     # 0x2df18
movl $0x73, %edx
callq 0x20d0
leaq 0x1d9d3(%rip), %rdi     # 0x2df37
leaq 0x1d4cb(%rip), %rsi     # 0x2da36
leaq 0x1d9a6(%rip), %rcx     # 0x2df18
movl $0x78, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_get_attackers()
void test_get_attackers() {
    position pos;
    set_pos(&pos,"1k1r3q/1ppn3p/p4b2/4p3/8/P2N2P1/1PP1R1BP/2K1Q3 w - -");

    uint64 attackers = get_attackers(&pos,E5,WHITE);

    assert(attackers & bb_squares[D3]);
    assert(attackers & bb_squares[E2]);
    assert(get_num_bits(attackers)==2);
}

// Assembly:
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1dbd9(%rip), %rsi     # 0x2e363
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
movl $0x1c, %esi
movl $0x1, %edx
callq 0x39df
leaq 0xe9d00(%rip), %rcx     # 0xfa4b0
testq %rax, 0x158(%rcx)
je 0x107d8
testq %rax, 0x1a0(%rcx)
je 0x107f7
movq %rax, %rdi
callq 0x3b08
cmpl $0x2, %eax
jne 0x10816
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
retq
leaq 0x1dbb9(%rip), %rdi     # 0x2e398
leaq 0x1d250(%rip), %rsi     # 0x2da36
leaq 0x1dbc6(%rip), %rcx     # 0x2e3b3
movl $0xa1, %edx
callq 0x20d0
leaq 0x1dbcf(%rip), %rdi     # 0x2e3cd
leaq 0x1d231(%rip), %rsi     # 0x2da36
leaq 0x1dba7(%rip), %rcx     # 0x2e3b3
movl $0xa2, %edx
callq 0x20d0
leaq 0x1dbcb(%rip), %rdi     # 0x2e3e8
leaq 0x1d212(%rip), %rsi     # 0x2da36
leaq 0x1db88(%rip), %rcx     # 0x2e3b3
movl $0xa3, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_get_attackers2()
void test_get_attackers2() {
    position pos;
    set_pos(&pos,"1k1r3q/1ppn3p/p4b2/4p3/8/P2N2P1/1PP1R1BP/2K1Q3 w - -");

    uint64 attackers = get_attackers(&pos,E5,BLACK);

    assert(attackers & bb_squares[D7]);
    assert(attackers & bb_squares[F6]);
    assert(get_num_bits(attackers)==2);
}

// Assembly:
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1db1f(%rip), %rsi     # 0x2e363
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
movl $0x1c, %esi
xorl %edx, %edx
callq 0x39df
leaq 0xe9c49(%rip), %rcx     # 0xfa4b0
testq %rax, 0x58(%rcx)
je 0x1088c
testq %rax, 0xa8(%rcx)
je 0x108ab
movq %rax, %rdi
callq 0x3b08
cmpl $0x2, %eax
jne 0x108ca
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
retq
leaq 0x1db70(%rip), %rdi     # 0x2e403
leaq 0x1d19c(%rip), %rsi     # 0x2da36
leaq 0x1db7d(%rip), %rcx     # 0x2e41e
movl $0xac, %edx
callq 0x20d0
leaq 0x1db87(%rip), %rdi     # 0x2e439
leaq 0x1d17d(%rip), %rsi     # 0x2da36
leaq 0x1db5e(%rip), %rcx     # 0x2e41e
movl $0xad, %edx
callq 0x20d0
leaq 0x1db17(%rip), %rdi     # 0x2e3e8
leaq 0x1d15e(%rip), %rsi     # 0x2da36
leaq 0x1db3f(%rip), %rcx     # 0x2e41e
movl $0xae, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_get_attackers3()
void test_get_attackers3() {
    position pos;
    set_pos(&pos,"8/p1k5/1p6/8/3b4/1Q6/8/7K w - -");

    uint64 attackers = get_attackers(&pos,B6,WHITE);

    assert(attackers & bb_squares[B3]);
    assert(get_num_bits(attackers)==1);
}

// Assembly:
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1db5c(%rip), %rsi     # 0x2e454
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
movl $0x11, %esi
movl $0x1, %edx
callq 0x39df
leaq 0xe9b92(%rip), %rcx     # 0xfa4b0
testq %rax, 0x148(%rcx)
je 0x1093d
movq %rax, %rdi
callq 0x3b08
cmpl $0x1, %eax
jne 0x1095c
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
retq
leaq 0x1db30(%rip), %rdi     # 0x2e474
leaq 0x1d0eb(%rip), %rsi     # 0x2da36
leaq 0x1db3d(%rip), %rcx     # 0x2e48f
movl $0xb7, %edx
callq 0x20d0
leaq 0x1db47(%rip), %rdi     # 0x2e4aa
leaq 0x1d0cc(%rip), %rsi     # 0x2da36
leaq 0x1db1e(%rip), %rcx     # 0x2e48f
movl $0xb8, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_get_attackers4()
void test_get_attackers4() {
    position pos;
    set_pos(&pos,"8/p1k5/1p6/8/3b4/1Q6/8/7K w - -");

    uint64 attackers = get_attackers(&pos,B6,BLACK);

    assert(attackers & bb_squares[C7]);
    assert(attackers & bb_squares[A7]);
    assert(attackers & bb_squares[D4]);
    assert(get_num_bits(attackers)==3);
}

// Assembly:
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1daca(%rip), %rsi     # 0x2e454
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
movl $0x11, %esi
xorl %edx, %edx
callq 0x39df
leaq 0xe9b03(%rip), %rcx     # 0xfa4b0
testq %rax, 0x50(%rcx)
je 0x109d8
testq %rax, 0x40(%rcx)
je 0x109f7
testq %rax, 0x118(%rcx)
je 0x10a16
movq %rax, %rdi
callq 0x3b08
cmpl $0x3, %eax
jne 0x10a35
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
retq
leaq 0x1dae6(%rip), %rdi     # 0x2e4c5
leaq 0x1d050(%rip), %rsi     # 0x2da36
leaq 0x1daf3(%rip), %rcx     # 0x2e4e0
movl $0xc1, %edx
callq 0x20d0
leaq 0x1dafd(%rip), %rdi     # 0x2e4fb
leaq 0x1d031(%rip), %rsi     # 0x2da36
leaq 0x1dad4(%rip), %rcx     # 0x2e4e0
movl $0xc2, %edx
callq 0x20d0
leaq 0x1daf9(%rip), %rdi     # 0x2e516
leaq 0x1d012(%rip), %rsi     # 0x2da36
leaq 0x1dab5(%rip), %rcx     # 0x2e4e0
movl $0xc3, %edx
callq 0x20d0
leaq 0x1daf5(%rip), %rdi     # 0x2e531
leaq 0x1cff3(%rip), %rsi     # 0x2da36
leaq 0x1da96(%rip), %rcx     # 0x2e4e0
movl $0xc4, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attack()
void test_attack() {
    test_attacked_by_knight();
    test_attacked_by_king();
    test_attacked_by_pawn();
    test_attacked_by_rook();
    test_attacked_by_bishop();
    test_attacked_by_queen();
    test_get_attackers();
    test_get_attackers2();
    test_get_attackers3();
    test_get_attackers4();
}

// Assembly:
pushq %rax
callq 0x10024
callq 0x10151
callq 0x10260
callq 0x10325
callq 0x10423
callq 0x1057c
callq 0x1077b
callq 0x10835
callq 0x108e9
popq %rax
jmp 0x1097b
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/test/bitboards__test.cpp
// Function: test_isolate_lsb_bit()
void test_isolate_lsb_bit() {
    uint64 mask = bb_squares[A8] | bb_squares[E4] | bb_squares[F4] | bb_squares[D1];

    assert(isolate_lsb_bit(mask,0)==bb_squares[A8]);
    assert(isolate_lsb_bit(mask,1)==bb_squares[E4]);
    assert(isolate_lsb_bit(mask,2)==bb_squares[F4]);
    assert(isolate_lsb_bit(mask,3)==bb_squares[D1]);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xe98d7(%rip), %r14     # 0xfa4b0
movq 0x120(%r14), %rbx
orq (%r14), %rbx
orq 0x128(%r14), %rbx
orq 0x1d8(%r14), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3c9e
cmpq (%r14), %rax
jne 0x10c4a
movq %rbx, %rdi
movl $0x1, %esi
callq 0x3c9e
cmpq 0x120(%r14), %rax
jne 0x10c69
movq %rbx, %rdi
movl $0x2, %esi
callq 0x3c9e
cmpq 0x128(%r14), %rax
jne 0x10c88
movq %rbx, %rdi
movl $0x3, %esi
callq 0x3c9e
cmpq 0x1d8(%r14), %rax
jne 0x10ca7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1da0b(%rip), %rdi     # 0x2e65c
leaq 0x1d914(%rip), %rsi     # 0x2e56c
leaq 0x1da25(%rip), %rcx     # 0x2e684
movl $0x1e, %edx
callq 0x20d0
leaq 0x1da30(%rip), %rdi     # 0x2e6a0
leaq 0x1d8f5(%rip), %rsi     # 0x2e56c
leaq 0x1da06(%rip), %rcx     # 0x2e684
movl $0x1f, %edx
callq 0x20d0
leaq 0x1da39(%rip), %rdi     # 0x2e6c8
leaq 0x1d8d6(%rip), %rsi     # 0x2e56c
leaq 0x1d9e7(%rip), %rcx     # 0x2e684
movl $0x20, %edx
callq 0x20d0
leaq 0x1da42(%rip), %rdi     # 0x2e6f0
leaq 0x1d8b7(%rip), %rsi     # 0x2e56c
leaq 0x1d9c8(%rip), %rcx     # 0x2e684
movl $0x21, %edx
callq 0x20d0