LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/movegen.cpp
// Function: add_promotion(unsigned long long*, square_t, square_t, piece_t, piece_t)
move* add_promotion(move* m,square_t from,square_t to,piece_t promopiece,piece_t captured_piece) {
    to_move(m,PAWN,from,to);
    if (captured_piece != NO_PIECE) {
        set_capture(m,captured_piece);
    }
    set_promopiece(m,promopiece);
    ++m;
    return m;
}

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

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %r12d
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl %edx, %edi
callq 0xca75
cmpl $0x7, %eax
je 0x846d
testl %eax, %eax
jne 0x84c9
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x5, %ecx
movl %ebx, %r8d
callq 0x8408
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x2, %ecx
movl %ebx, %r8d
callq 0x8408
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x4, %ecx
movl %ebx, %r8d
callq 0x8408
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0x3, %ecx
movl %ebx, %r8d
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8408
movq %r15, %rdi
movl $0x1, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x76c6
testb %r12b, %r12b
je 0x84ea
movq %r15, %rdi
callq 0x7797
jmp 0x84f8
testl %ebx, %ebx
je 0x84f8
movq %r15, %rdi
movl %ebx, %esi
callq 0x771c
addq $0x8, %r15
movq %r15, %rax
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_knight_moves(unsigned long long*, position*, square_t, bool, bool)
move* gen_knight_moves(move* m,position* p,square_t from,bool caps,bool noncaps) {
    assert(m);
    assert(p);
    assert(from >= A8 && from <= H1);

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

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x85cf
movq %rsi, %r14
testq %rsi, %rsi
je 0x85ee
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x860d
movq %rdi, %r15
movl %ebx, %eax
leaq 0xf2171(%rip), %rdx     # 0xfa6b0
testb %cl, %cl
je 0x855a
xorl %ecx, %ecx
cmpl $0x1, 0x138(%r14)
sete %cl
movq 0x1a8(%r14,%rcx,8), %r12
jmp 0x855d
xorl %r12d, %r12d
movq (%rdx,%rax,8), %rax
testb %r8b, %r8b
je 0x857a
movq 0x1b0(%r14), %rcx
orq 0x1a8(%r14), %rcx
notq %rcx
orq %rcx, %r12
andq %rax, %r12
je 0x85bd
leaq 0xf1f2a(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3b5b
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x2, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x8348
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x8586
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24dd5(%rip), %rdi     # 0x2d3ab
leaq 0x2245b(%rip), %rsi     # 0x2aa38
leaq 0x224eb(%rip), %rcx     # 0x2aacf
movl $0x7a, %edx
callq 0x20d0
leaq 0x2cc87(%rip), %rdi     # 0x3527c
leaq 0x2243c(%rip), %rsi     # 0x2aa38
leaq 0x224cc(%rip), %rcx     # 0x2aacf
movl $0x7b, %edx
callq 0x20d0
leaq 0x21fe3(%rip), %rdi     # 0x2a5f7
leaq 0x2241d(%rip), %rsi     # 0x2aa38
leaq 0x224ad(%rip), %rcx     # 0x2aacf
movl $0x7c, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/movegen.cpp
// Function: get_target_squares(position*, bool, bool)
uint64 get_target_squares(position* p,bool caps,bool noncaps) {
    uint64 targets = 0;

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

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

    return targets;
}

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

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

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

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8723
movq %rsi, %r14
testq %rsi, %rsi
je 0x8742
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x8761
movq %rdi, %r15
testb %cl, %cl
je 0x86a6
xorl %eax, %eax
cmpl $0x1, 0x138(%r14)
sete %al
movq 0x1a8(%r14,%rax,8), %rdx
jmp 0x86a8
xorl %edx, %edx
testb %r8b, %r8b
je 0x86c1
movq 0x1b0(%r14), %rax
orq 0x1a8(%r14), %rax
notq %rax
orq %rax, %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x665c
testq %rax, %rax
je 0x8711
movq %rax, %r12
leaq 0xf1dd6(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3c25
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x3, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x8348
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x86da
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24c81(%rip), %rdi     # 0x2d3ab
leaq 0x22307(%rip), %rsi     # 0x2aa38
leaq 0x223d8(%rip), %rcx     # 0x2ab10
movl $0x95, %edx
callq 0x20d0
leaq 0x2cb33(%rip), %rdi     # 0x3527c
leaq 0x222e8(%rip), %rsi     # 0x2aa38
leaq 0x223b9(%rip), %rcx     # 0x2ab10
movl $0x96, %edx
callq 0x20d0
leaq 0x21e8f(%rip), %rdi     # 0x2a5f7
leaq 0x222c9(%rip), %rsi     # 0x2aa38
leaq 0x2239a(%rip), %rcx     # 0x2ab10
movl $0x97, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_rook_moves(unsigned long long*, position*, square_t, bool, bool)
move* gen_rook_moves(move* m,position* p,square_t from,bool caps,bool noncaps) {
    assert(m);
    assert(p);
    assert(from >= A8 && from <= H1);

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

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

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8846
movq %rsi, %r14
testq %rsi, %rsi
je 0x8865
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x8884
movq %rdi, %r15
testb %cl, %cl
je 0x87c9
xorl %eax, %eax
cmpl $0x1, 0x138(%r14)
sete %al
movq 0x1a8(%r14,%rax,8), %rdx
jmp 0x87cb
xorl %edx, %edx
testb %r8b, %r8b
je 0x87e4
movq 0x1b0(%r14), %rax
orq 0x1a8(%r14), %rax
notq %rax
orq %rax, %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x677c
testq %rax, %rax
je 0x8834
movq %rax, %r12
leaq 0xf1cb3(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3c25
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x4, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x8348
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x87fd
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24b5e(%rip), %rdi     # 0x2d3ab
leaq 0x221e4(%rip), %rsi     # 0x2aa38
leaq 0x222f6(%rip), %rcx     # 0x2ab51
movl $0xb1, %edx
callq 0x20d0
leaq 0x2ca10(%rip), %rdi     # 0x3527c
leaq 0x221c5(%rip), %rsi     # 0x2aa38
leaq 0x222d7(%rip), %rcx     # 0x2ab51
movl $0xb2, %edx
callq 0x20d0
leaq 0x21d6c(%rip), %rdi     # 0x2a5f7
leaq 0x221a6(%rip), %rsi     # 0x2aa38
leaq 0x222b8(%rip), %rcx     # 0x2ab51
movl $0xb3, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_queen_moves(unsigned long long*, position*, square_t, bool, bool)
move* gen_queen_moves(move* m,position* p,square_t from,bool caps,bool noncaps) {
    assert(m);
    assert(p);
    assert(from >= A8 && from <= H1);

    uint64 queen_moves = get_queen_moves(p,from,get_target_squares(p,caps,noncaps));

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

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8969
movq %rsi, %r14
testq %rsi, %rsi
je 0x8988
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x89a7
movq %rdi, %r15
testb %cl, %cl
je 0x88ec
xorl %eax, %eax
cmpl $0x1, 0x138(%r14)
sete %al
movq 0x1a8(%r14,%rax,8), %rdx
jmp 0x88ee
xorl %edx, %edx
testb %r8b, %r8b
je 0x8907
movq 0x1b0(%r14), %rax
orq 0x1a8(%r14), %rax
notq %rax
orq %rax, %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x674a
testq %rax, %rax
je 0x8957
movq %rax, %r12
leaq 0xf1b90(%rip), %r13     # 0xfa4b0
movq %r12, %rdi
callq 0x3c25
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
movl $0x5, %edx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x8348
movq %rax, %r15
movl %ebp, %eax
movq (%r13,%rax,8), %rax
movq %rax, %rcx
xorq %r12, %rcx
cmpq %r12, %rax
movq %rcx, %r12
jne 0x8920
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24a3b(%rip), %rdi     # 0x2d3ab
leaq 0x220c1(%rip), %rsi     # 0x2aa38
leaq 0x22212(%rip), %rcx     # 0x2ab90
movl $0xcd, %edx
callq 0x20d0
leaq 0x2c8ed(%rip), %rdi     # 0x3527c
leaq 0x220a2(%rip), %rsi     # 0x2aa38
leaq 0x221f3(%rip), %rcx     # 0x2ab90
movl $0xce, %edx
callq 0x20d0
leaq 0x21c49(%rip), %rdi     # 0x2a5f7
leaq 0x22083(%rip), %rsi     # 0x2aa38
leaq 0x221d4(%rip), %rcx     # 0x2ab90
movl $0xcf, %edx
callq 0x20d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/mvvlva.cpp
// Function: mvvlva_capture(position*, unsigned long long)
int32 mvvlva_capture(position *pos,move mv) {
    piece_t captured;
    if (is_epcapture(mv)) {
        captured = PAWN;
    } else {
        captured = (piece_t)pos->piece[get_to_sq(mv)];
    }
    assert(captured != NO_PIECE);
    int32 captured_val = captured < NO_PIECE ? -captured : captured;

    piece_t mover = (piece_t)pos->piece[get_from_sq(mv)];
    assert(mover != NO_PIECE);
    int32 mover_val = mover < NO_PIECE ? -mover : mover;

    return 1000 + (captured_val * 10) - mover_val;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x77e9
movl $0x1, %ebp
testb %al, %al
jne 0x8a24
movq %r14, %rdi
callq 0x77b7
movl %eax, %eax
movl (%rbx,%rax,4), %ebp
testl %ebp, %ebp
je 0x8a57
movq %r14, %rdi
callq 0x77b0
movl %eax, %eax
movl (%rbx,%rax,4), %eax
testl %eax, %eax
je 0x8a76
movl %ebp, %ecx
negl %ecx
cmovsl %ebp, %ecx
movl %eax, %edx
negl %edx
leal (%rcx,%rcx,4), %ecx
cmovnsl %eax, %edx
leal (%rdx,%rcx,2), %eax
addl $0x3e8, %eax            # imm = 0x3E8
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x20611(%rip), %rdi     # 0x2906f
leaq 0x221de(%rip), %rsi     # 0x2ac43
leaq 0x221ff(%rip), %rcx     # 0x2ac6b
movl $0x1a, %edx
callq 0x20d0
leaq 0x22215(%rip), %rdi     # 0x2ac92
leaq 0x221bf(%rip), %rsi     # 0x2ac43
leaq 0x221e0(%rip), %rcx     # 0x2ac6b
movl $0x1e, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/mvvlva.cpp
// Function: mvvlva(position*, unsigned long long)
int32 mvvlva(position *pos,move mv) {
    int32 score = 0;

    if (get_promopiece(mv)!=NO_PIECE) {
        score = mvvlva_promo(mv);
    }
    if (is_capture(mv)) {
        score += mvvlva_capture(pos,mv);
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x77cb
testl %eax, %eax
je 0x8ab7
movq %rbx, %rdi
callq 0x89c8
movl %eax, %ebp
jmp 0x8ab9
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x77df
testb %al, %al
je 0x8ad2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x89fc
addl %eax, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/next.cpp
// Function: test_good_move(unsigned long long, position*)
bool test_good_move(move mv,position *pos) {
    move moves[MAX_MOVES_PER_PLY];
    move *endp = gen_moves(moves,pos,true,true);

    bool valid =  is_in_move_list(mv,moves,endp);
    if (!valid) {
        char mv_text[10];
        move_to_str(mv,mv_text);
        print("good_move says move %s is good.\n",mv_text);
        draw_board(pos);
    }

    return valid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x978, %rsp            # imm = 0x978
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x78d0
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xe727
movl %eax, %ebp
testb %al, %al
jne 0x9486
leaq 0x6(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xe0f5
leaq 0x21af2(%rip), %rdi     # 0x2af66
movq %r15, %rsi
xorl %eax, %eax
callq 0x640d
movq %rbx, %rdi
callq 0x4b7c
movl %ebp, %eax
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/next.cpp
// Function: best_at_top(unsigned long long*, unsigned long long*)
bool best_at_top(move *startp,move *endp) {

    move *bestp = 0;
    int32 bestscore = 0;

    for (move *mp=startp;mp<endp;mp++) {
        if (*mp != 0) {
            int32 score = get_move_score(mp);
            if (bestp==0 || score > bestscore) {
                bestp = mp;
                bestscore = score;
            }
        }
    }

    if (bestp) {
        move tmpmv = *startp;
        *startp = *bestp;
        *bestp = tmpmv;
        return true;
    }

    return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
xorl %r13d, %r13d
cmpq %rsi, %rdi
jae 0x94eb
movq %rsi, %r14
xorl %r12d, %r12d
movq %rbx, %r15
cmpq $0x0, (%r15)
je 0x94e0
movq %r15, %rdi
callq 0x77fd
testq %r12, %r12
sete %cl
cmpl %r13d, %eax
setg %dl
orb %cl, %dl
movq %r15, %rcx
jne 0x94da
movl %r13d, %eax
movq %r12, %rcx
movl %eax, %r13d
movq %rcx, %r12
addq $0x8, %r15
cmpq %r14, %r15
jb 0x94b3
jmp 0x94ee
xorl %r12d, %r12d
testq %r12, %r12
je 0x9501
movq (%rbx), %rax
movq (%r12), %rcx
movq %rcx, (%rbx)
movq %rax, (%r12)
testq %r12, %r12
setne %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/next.cpp
// Function: place_move_on_top(unsigned long long*, unsigned long long*, unsigned long long)
bool place_move_on_top(move *start,move *end,move top_move) {
    assert(start);
    assert(end);

    if (top_move==BADMOVE) return false;

    assert(clear_score(top_move)==top_move);

    bool found_move=false;
    for (move *mp=start;mp<end;mp++) {
        if (*mp == top_move) {
            move tmp_move = *start;
            *start = top_move;
            *mp = tmp_move;
            found_move=true;
            break;
        }
    }
    return found_move;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x956e
movq %rsi, %r15
testq %rsi, %rsi
je 0x958d
movq %rdx, %rbx
testq %rdx, %rdx
je 0x9559
movq %rdi, %r14
movq %rbx, %rdi
callq 0x783c
cmpq %rbx, %rax
jne 0x95ac
cmpq %r15, %r14
setb %al
jae 0x9568
movq %r14, %rcx
cmpq %rbx, (%rcx)
je 0x955d
addq $0x8, %rcx
cmpq %r15, %rcx
setb %al
jb 0x9546
jmp 0x9568
xorl %eax, %eax
jmp 0x9568
movq (%r14), %rax
movq %rbx, (%r14)
movq %rax, (%rcx)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2199a(%rip), %rdi     # 0x2af0f
leaq 0x21757(%rip), %rsi     # 0x2acd3
leaq 0x21992(%rip), %rcx     # 0x2af15
movl $0xa0, %edx
callq 0x20d0
leaq 0x219ae(%rip), %rdi     # 0x2af42
leaq 0x21738(%rip), %rsi     # 0x2acd3
leaq 0x21973(%rip), %rcx     # 0x2af15
movl $0xa1, %edx
callq 0x20d0
leaq 0x21993(%rip), %rdi     # 0x2af46
leaq 0x21719(%rip), %rsi     # 0x2acd3
leaq 0x21954(%rip), %rcx     # 0x2af15
movl $0xa5, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/next.cpp
// Function: good_pawn_move(position*, unsigned long long)
bool good_pawn_move(position *p,move m) {

    square_t from_sq = get_from_sq(m);
    square_t to_sq = get_to_sq(m);
    piece_t captured_piece = get_captured_piece(m);

    if (captured_piece==NO_PIECE) {
        if (p->piece[to_sq] != NO_PIECE) return false;
        if (p->player==WHITE) {
            square_t nsq = north(from_sq);
            square_t nnsq = north(nsq);
            if (to_sq==nsq || (to_sq==nnsq && p->piece[nsq]==NO_PIECE)) return true;
        } else {
            square_t ssq = south(from_sq);
            square_t sssq = south(ssq);
            if (to_sq==ssq || (to_sq==sssq && p->piece[ssq]==NO_PIECE)) return true;
        }
    } else {
        if (!(bb_pawn_attacks[from_sq][p->player] & bb_squares[to_sq])) return false;
        if (p->player==WHITE) {
            if (is_epcapture(m)) {
                if (to_sq==p->ep_sq && p->piece[south(to_sq)]==-PAWN) return true;
            } else {
                if (p->piece[to_sq]==-captured_piece) return true;
            }
        } else {
            if (is_epcapture(m)) {
                if (to_sq==p->ep_sq && p->piece[north(to_sq)]==PAWN) return true;
            } else {
                if (p->piece[to_sq]==captured_piece) return true;
            }
        }
    }

    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x77b0
movl %eax, %r12d
movq %r15, %rdi
callq 0x77b7
movl %eax, %ebp
movq %r15, %rdi
callq 0x77d5
testl %eax, %eax
je 0x9656
movl %eax, %r14d
movl %r12d, %eax
movl 0x138(%rbx), %r13d
shlq $0x4, %rax
addq 0x389d3(%rip), %rax     # 0x41fe8
movl %ebp, %r12d
leaq 0xf0e91(%rip), %rcx     # 0xfa4b0
movq (%rcx,%r12,8), %rcx
testq %rcx, (%rax,%r13,8)
je 0x965e
movq %r15, %rdi
callq 0x77e9
cmpl $0x1, %r13d
jne 0x966f
testb %al, %al
je 0x96ab
cmpl 0x13c(%rbx), %ebp
jne 0x965e
movl %ebp, %edi
callq 0xcc4a
movl %eax, %eax
cmpl $-0x1, (%rbx,%rax,4)
jne 0x965e
movb $0x1, %al
jmp 0x9660
movl %ebp, %eax
cmpl $0x0, (%rbx,%rax,4)
je 0x968e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %al, %al
je 0x96b5
cmpl 0x13c(%rbx), %ebp
jne 0x965e
movl %ebp, %edi
callq 0xcc11
movl %eax, %ecx
movb $0x1, %al
cmpl $0x1, (%rbx,%rcx,4)
jne 0x965e
jmp 0x9660
cmpl $0x1, 0x138(%rbx)
jne 0x96bf
movl %r12d, %edi
callq 0xcc11
movl %eax, %r14d
movl %eax, %edi
callq 0xcc11
jmp 0x96d1
movb $0x1, %al
addl (%rbx,%r12,4), %r14d
jne 0x965e
jmp 0x9660
movb $0x1, %al
cmpl %r14d, (%rbx,%r12,4)
jne 0x965e
jmp 0x9660
movl %r12d, %edi
callq 0xcc4a
movl %eax, %r14d
movl %eax, %edi
callq 0xcc4a
movl %eax, %ecx
movb $0x1, %al
cmpl %r14d, %ebp
je 0x9660
cmpl %ecx, %ebp
jne 0x965e
movl %r14d, %ecx
cmpl $0x0, (%rbx,%rcx,4)
jne 0x965e
jmp 0x9660
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/perft.cpp
// Function: perft(position*, int)
uint64 perft(position *pos,int32 depth) {
    uint64 nodes=0;
    move moves[MAX_MOVES_PER_PLY];

    move *endp = gen_legal_moves(moves,pos,true,true);

    if (depth == 1) {
        return num_moves(moves,endp,true,true);
    }

    for (move* mp=moves;mp<endp;mp++) {
        if (*mp==0) continue; // move purged as illegal
        apply_move(pos,*mp,gundos);
        nodes += perft(pos,depth-1);
        undo_last_move(pos,gundos);
    }

    return nodes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x968, %rsp            # imm = 0x968
movl %esi, %ebx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7840
movq %rax, %r12
cmpl $0x1, %ebx
jne 0x9740
movq %rsp, %rdi
movq %r12, %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0xe7c9
movl %eax, %r13d
jmp 0x978a
cmpq %r12, %r15
jae 0x9787
decl %ebx
xorl %r13d, %r13d
leaq 0xbf39f(%rip), %rbp     # 0xc8af0
movq (%r15), %rsi
testq %rsi, %rsi
je 0x977c
movq %r14, %rdi
movq %rbp, %rdx
callq 0x30e3
movq %r14, %rdi
movl %ebx, %esi
callq 0x96f0
addq %rax, %r13
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3341
addq $0x8, %r15
cmpq %r12, %r15
jb 0x9751
jmp 0x978a
xorl %r13d, %r13d
movq %r13, %rax
addq $0x968, %rsp            # imm = 0x968
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/perft.cpp
// Function: perft_iterate(int)
uint64 perft_iterate(int32 max_depth) {
    draw_board(&gpos);
    uint64 total_nodes=0;
    for (int d=1;d<=max_depth;d++) {
        print("perft %d: ",d);
        uint64 nodes=perft(&gpos,d);
        print("%llu\n",nodes);
        total_nodes += nodes;
    }

    return total_nodes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0xbf16d(%rip), %rdi     # 0xc8920
callq 0x4b7c
testl %ebx, %ebx
jle 0x9819
negl %ebx
movl $0x1, %r13d
leaq 0xbf155(%rip), %r12     # 0xc8920
leaq 0x218a1(%rip), %rbp     # 0x2b073
xorl %r14d, %r14d
leaq 0x217ab(%rip), %rdi     # 0x2af87
movl %r13d, %esi
xorl %eax, %eax
callq 0x640d
movq %r12, %rdi
movl %r13d, %esi
callq 0x96f0
movq %rax, %r15
movq %rbp, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x640d
addq %r15, %r14
leal (%rbx,%r13), %eax
incl %eax
movl %r13d, %ecx
incl %ecx
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0x97d5
jmp 0x981c
xorl %r14d, %r14d
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/perft.cpp
// Function: get_line(char*, char const*, _IO_FILE*)
bool get_line(char* buffer,const char* line,FILE* file) {
    bool found=false;

    while (fgets(buffer,255,file) != NULL) {
        if (strstr(buffer,line)) {
            found=true;
            break;
        }
    }

    return found;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %r15, %rdi
movl $0xff, %esi
movq %rbx, %rdx
callq 0x22d0
movq %rax, %r12
testq %rax, %rax
je 0x9867
movq %r15, %rdi
movq %r14, %rsi
callq 0x2050
testq %rax, %rax
je 0x983f
testq %r12, %r12
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/perft.cpp
// Function: test_case(position*, char const*, int, unsigned long long)
uint64 test_case(position *pos,const char *fen,int depth,uint64 expected) {
    set_pos(pos,fen);
    draw_board(pos);
    int32 start_time = milli_timer();
    uint64 actual = perft(pos,depth);
    int32 elapsed = milli_timer() - start_time + 1; // div by 0
    print("\nexpected (%d): %llu, actual: %llu\n",depth,expected,actual);
    print("nps: %lu\n\n",actual*1000/elapsed);
    if (actual != expected) {
        exit(1);
    }
    return actual;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %edx, %ebp
movq %rdi, %r14
callq 0xaa74
movq %r14, %rdi
callq 0x4b7c
callq 0xdf58
movl %eax, %r15d
movq %r14, %rdi
movl %ebp, %esi
callq 0x96f0
movq %rax, %r14
callq 0xdf58
movl %eax, %r12d
subl %r15d, %r12d
incl %r12d
leaq 0x21452(%rip), %rdi     # 0x2b055
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x640d
imulq $0x3e8, %r14, %rax      # imm = 0x3E8
movslq %r12d, %rcx
xorl %edx, %edx
divq %rcx
leaq 0x219ca(%rip), %rdi     # 0x2b5f2
movq %rax, %rsi
xorl %eax, %eax
callq 0x640d
cmpq %rbx, %r14
jne 0x9c43
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/pos.cpp
// Function: remove_castling_availability(position*, unsigned long long)
void remove_castling_availability(position *p,move mv) {
    // if capturing a rook remove its castling availability
    if (is_capture(mv)) {
        square_t to_sq = get_to_sq(mv);
        remove_rook_castling_availability(p,to_sq);
    }

    // if a rook or king is moving, remove their castling availability.
    square_t from_sq = get_from_sq(mv);
    int32 piece = p->piece[from_sq];
    if (piece==KING) {
        p->castling_rights &= CASTLE_BLACK;
    } else if (piece==-KING) {
        p->castling_rights &= CASTLE_WHITE;
    } else if (piece==ROOK || piece==-ROOK) {
        remove_rook_castling_availability(p,from_sq);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x77df
testb %al, %al
je 0xa9f3
movq %r14, %rdi
callq 0x77b7
movq %rbx, %rdi
movl %eax, %esi
callq 0xa992
movq %r14, %rdi
callq 0x77b0
movl %eax, %ecx
movl (%rbx,%rcx,4), %ecx
addl $0x6, %ecx
rorl %ecx
cmpl $0x6, %ecx
ja 0xaa3b
leaq 0x20c7f(%rip), %rdx     # 0x2b690
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %rbx, %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa992
andl $0x3, 0x140(%rbx)
jmp 0xaa3b
andl $0xc, 0x140(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/pos.cpp
// Function: is_enemy_occupied(position*, square_t, color_t)
bool is_enemy_occupied(position *pos,square_t sq,color_t player) {
    assert(pos);
    assert(sq >= A8 && sq <= H1);
    assert(player==WHITE || player==BLACK);

    return player==WHITE ? is_black_piece(pos->piece[sq]) : is_white_piece(pos->piece[sq]);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0xae59
cmpl $0x40, %esi
jae 0xae78
cmpl $0x2, %edx
jae 0xae97
movl %esi, %eax
movl (%rdi,%rax,4), %edi
cmpl $0x1, %edx
jne 0xae53
popq %rax
jmp 0xe829
popq %rax
jmp 0xe823
leaq 0x1e6e1(%rip), %rdi     # 0x29541
leaq 0x209aa(%rip), %rsi     # 0x2b811
leaq 0x20f7e(%rip), %rcx     # 0x2bdec
movl $0x17d, %edx            # imm = 0x17D
callq 0x20d0
leaq 0x1e38f(%rip), %rdi     # 0x2920e
leaq 0x2098b(%rip), %rsi     # 0x2b811
leaq 0x20f5f(%rip), %rcx     # 0x2bdec
movl $0x17e, %edx            # imm = 0x17E
callq 0x20d0
leaq 0x1e385(%rip), %rdi     # 0x29223
leaq 0x2096c(%rip), %rsi     # 0x2b811
leaq 0x20f40(%rip), %rcx     # 0x2bdec
movl $0x17f, %edx            # imm = 0x17F
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/pos.cpp
// Function: flip_board(position*)
void flip_board(position *pos) {

    // flip pieces around
    int32 orig_sq[64];
    for (int sq=0;sq<64;sq++) {
        orig_sq[sq] = pos->piece[sq];
        if (pos->piece[sq] != NO_PIECE) {
            remove_piece(pos,(square_t)sq);
        }
    }

    for (int sq=0;sq<64;sq++) {
        if (orig_sq[sq] != NO_PIECE) {
            add_piece(pos,-orig_sq[sq],(square_t)fliprank[sq]);
        }
    }

    square_t orig_white_king_sq = pos->white_king;
    pos->white_king = (square_t)fliprank[pos->black_king];
    pos->black_king = (square_t)fliprank[orig_white_king_sq];

    // swap players
    pos->player = opposite_player(pos->player);

    // flip ep square
    if (pos->ep_sq != NO_SQUARE) {
        pos->ep_sq = (square_t)fliprank[pos->ep_sq];
    }

    // castling rights
    int32 orig_castling_rights = pos->castling_rights;
    pos->castling_rights = 0;
    if (orig_castling_rights & CASTLE_WK) {
        pos->castling_rights |= CASTLE_BK;
    }
    if (orig_castling_rights & CASTLE_WQ) {
        pos->castling_rights |= CASTLE_BQ;
    }
    if (orig_castling_rights & CASTLE_BK) {
        pos->castling_rights |= CASTLE_WK;
    }
    if (orig_castling_rights & CASTLE_BQ) {
        pos->castling_rights |= CASTLE_WQ;
    }

    pos->hash_key = build_hash_key(pos);
    pos->pawn_key = build_pawn_key(pos);
    assert(test_pos_consistency(pos));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
xorl %r14d, %r14d
movl (%rbx,%r14,4), %eax
movl %eax, (%rsp,%r14,4)
testl %eax, %eax
je 0xaf90
movq %rbx, %rdi
movl %r14d, %esi
callq 0xa7d2
incq %r14
cmpq $0x40, %r14
jne 0xaf79
xorl %r15d, %r15d
leaq 0x2074d(%rip), %r14     # 0x2b6f0
movl (%rsp,%r15), %esi
testl %esi, %esi
je 0xafb9
negl %esi
movl (%r15,%r14), %edx
movq %rbx, %rdi
callq 0xa63d
addq $0x4, %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0xafa3
movl 0x138(%rbx), %edi
movl 0x14c(%rbx), %eax
movl 0x150(%rbx), %ecx
movl (%r14,%rcx,4), %ecx
movl %ecx, 0x14c(%rbx)
movl (%r14,%rax,4), %eax
movl %eax, 0x150(%rbx)
callq 0xdfc4
movl %eax, 0x138(%rbx)
movl 0x13c(%rbx), %eax
cmpq $0x40, %rax
je 0xb00d
movl (%r14,%rax,4), %eax
movl %eax, 0x13c(%rbx)
movl 0x140(%rbx), %eax
leal (,%rax,4), %ecx
andl $0xc, %ecx
movl %ecx, 0x140(%rbx)
testb $0x4, %al
je 0xb02e
orb $0x1, 0x140(%rbx)
testb $0x8, %al
je 0xb039
orb $0x2, 0x140(%rbx)
movq %rbx, %rdi
callq 0x5e40
movq %rax, 0x1b8(%rbx)
movq %rbx, %rdi
callq 0x5f0f
movq %rax, 0x1c0(%rbx)
movq %rbx, %rdi
callq 0x23354
testb %al, %al
je 0xb070
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
leaq 0x20de4(%rip), %rdi     # 0x2be5b
leaq 0x20793(%rip), %rsi     # 0x2b811
leaq 0x20df0(%rip), %rcx     # 0x2be75
movl $0x1c4, %edx            # imm = 0x1C4
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/prune.cpp
// Function: prune(position*, unsigned long long, bool, bool, int, int, int, int)
bool prune(position *pos,move last_move,bool incheck,bool gives_check,
        int32 extensions,int32 alpha,int32 beta,int32 depth) {

    if (depth < 3
        && alpha < (CHECKMATE-500) && beta < (CHECKMATE-500)
        && alpha > (-CHECKMATE+500) && beta > (-CHECKMATE+500)
        && extensions==0 && !incheck && !gives_check
        && !is_capture(last_move) && get_promopiece(last_move)==NO_PIECE
        && !(get_piece(last_move)==PAWN && (get_rank(get_to_sq(last_move))==RANK_2 || get_rank(get_to_sq(last_move))==RANK_7))) {

        int32 evalMat = -eval(pos,true);

        return (depth < 2 && (evalMat + pawn_val*2 <= alpha))   // futility pruning
            || (depth < 3 && (evalMat + pawn_val*5 <= alpha)) ;  // extended futility pruning
    }

    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r9d, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl 0x38(%rsp), %ebp
movl 0x30(%rsp), %eax
cmpl $0x3, %ebp
setge %sil
movl $0xfe0b, %edi           # imm = 0xFE0B
cmpl %edi, %r9d
setge %r9b
orb %sil, %r9b
cmpl %edi, %eax
setge %sil
movl $0xffff01f6, %edi       # imm = 0xFFFF01F6
cmpl %edi, %ebx
setl %r10b
orb %sil, %r10b
orb %r9b, %r10b
cmpl %edi, %eax
setl %al
testl %r8d, %r8d
setne %sil
orb %al, %sil
orb %dl, %sil
orb %r10b, %sil
orb %cl, %sil
testb $0x1, %sil
jne 0xb22f
movq %r15, %rdi
callq 0x77df
testb %al, %al
jne 0xb22f
movq %r15, %rdi
callq 0x77cb
testl %eax, %eax
je 0xb23c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x77c1
cmpl $0x1, %eax
jne 0xb271
movq %r15, %rdi
callq 0x77b7
movl %eax, %edi
callq 0xca75
cmpl $0x6, %eax
je 0xb22f
movq %r15, %rdi
callq 0x77b7
movl %eax, %edi
callq 0xca75
cmpl $0x1, %eax
je 0xb22f
movq %r14, %rdi
movl $0x1, %esi
callq 0x5846
movl %eax, %ecx
cmpl $0x2, %ebp
setl %dl
movl $0xc8, %eax
subl %ecx, %eax
cmpl %ebx, %eax
setle %sil
movb $0x1, %al
testb %sil, %dl
jne 0xb231
movl $0x1f4, %eax            # imm = 0x1F4
subl %ecx, %eax
cmpl %ebx, %eax
setle %al
jmp 0xb231
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/search.cpp
// Function: build_move_order_dto(unsigned long long*, unsigned long long, unsigned long long, unsigned long long, unsigned long long, bool)
move_order_dto build_move_order_dto(move *startp,move pvmv,move hashmv,
        move killer1,move killer2,bool caps_only) {
    assert(get_move_score(&pvmv)==0);
    assert(get_move_score(&hashmv)==0);

    move_order_dto dto;
    dto.startp = dto.currentp = dto.endp = startp;
    dto.pv_move = pvmv;
    dto.hash_move = hashmv;
    dto.killer1 = killer1;
    dto.killer2 = killer2;
    dto.next_stage = PVMOVE;
    dto.caps_only = caps_only;
    return dto;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq 0x10(%rsp), %rdi
movq %rdx, (%rdi)
movq %rcx, 0x8(%rsp)
callq 0x77fd
testl %eax, %eax
jne 0xb35a
leaq 0x8(%rsp), %rdi
callq 0x77fd
testl %eax, %eax
jne 0xb379
movb 0x40(%rsp), %al
movq %r12, 0x30(%r14)
movq %r12, 0x38(%r14)
movq %r12, 0x28(%r14)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%r14)
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%r14)
movq %r15, 0x18(%r14)
movq %rbx, 0x20(%r14)
movl $0x0, (%r14)
movb %al, 0x4(%r14)
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x20b6c(%rip), %rdi     # 0x2becd
leaq 0x20b7e(%rip), %rsi     # 0x2bee6
leaq 0x20b86(%rip), %rcx     # 0x2bef5
movl $0x27, %edx
callq 0x20d0
leaq 0x20bbf(%rip), %rdi     # 0x2bf3f
leaq 0x20b5f(%rip), %rsi     # 0x2bee6
leaq 0x20b67(%rip), %rcx     # 0x2bef5
movl $0x28, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/search.cpp
// Function: update_parent_pv(move_line*, move_line*, unsigned long long)
void update_parent_pv(move_line *parent_pv,move_line* pv,move best_move) {
    assert(parent_pv);
    assert(pv);
    assert(best_move != BADMOVE);

    set_move_score(&best_move,0);

    parent_pv->mv[0] = best_move;
    if (pv->n > 0) {
        memcpy(parent_pv->mv+1,pv->mv,pv->n * sizeof(move));
        parent_pv->n = pv->n + 1;
    } else {
        parent_pv->n = 1;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0xc184
movq %rsi, %r14
testq %rsi, %rsi
je 0xc1a3
testq %rdx, %rdx
je 0xc1c2
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x7818
movq (%r15), %rax
movq %rax, 0x8(%rbx)
movslq (%r14), %rdx
testq %rdx, %rdx
jle 0xc173
leaq 0x10(%rbx), %rdi
leaq 0x8(%r14), %rsi
shlq $0x3, %rdx
callq 0x2100
movl (%r14), %eax
incl %eax
jmp 0xc178
movl $0x1, %eax
movl %eax, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1fe30(%rip), %rdi     # 0x2bfbb
leaq 0x1fd54(%rip), %rsi     # 0x2bee6
leaq 0x20094(%rip), %rcx     # 0x2c22d
movl $0x1a5, %edx            # imm = 0x1A5
callq 0x20d0
leaq 0x1fe18(%rip), %rdi     # 0x2bfc2
leaq 0x1fd35(%rip), %rsi     # 0x2bee6
leaq 0x20075(%rip), %rcx     # 0x2c22d
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x20d0
leaq 0x2009a(%rip), %rdi     # 0x2c263
leaq 0x1fd16(%rip), %rsi     # 0x2bee6
leaq 0x20056(%rip), %rcx     # 0x2c22d
movl $0x1a7, %edx            # imm = 0x1A7
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/search.cpp
// Function: adjust_final_score_for_mates(position*, int, unsigned int, int)
int32 adjust_final_score_for_mates(position *pos,int32 score,uint32 moves_searched,int32 ply) {
    int32 adj_score = score;

    if (moves_searched==0) {
        if (in_check(pos,pos->player)) {
            adj_score = -(CHECKMATE-ply);
        } else {
            adj_score = DRAWSCORE;
        }
    }

    return adj_score;
}

// Assembly:
movl %esi, %eax
testl %edx, %edx
je 0xc5df
retq
pushq %rbx
movl %ecx, %ebx
movl 0x138(%rdi), %esi
callq 0xaf39
movl %eax, %ecx
addl $0xffff0001, %ebx       # imm = 0xFFFF0001
xorl %eax, %eax
testb %cl, %cl
cmovnel %ebx, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/see.cpp
// Function: find_least_valuable(position*, unsigned long long)
square_t find_least_valuable(position *pos,uint64 attackers) {
    square_t lv_sq = NO_SQUARE;
    int32 lv_score = 0;

    while (attackers) {
        square_t sq = (square_t)get_lsb(attackers);

        int32 my_val = piece_val(pos->piece[sq]);
        if (lv_sq==NO_SQUARE || my_val < lv_score) {
            lv_score = my_val;
            lv_sq = sq;
        }

        attackers ^= bb_squares[sq];
    }

    return lv_sq;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0xc66e
movq %rsi, %r14
movq %rdi, %rbx
xorl %r12d, %r12d
movl $0x40, %ebp
movq %r14, %rdi
callq 0x3b5b
movl %eax, %r15d
movl %eax, %r13d
movl (%rbx,%r13,4), %edi
callq 0x4ed8
cmpl $0x40, %ebp
sete %cl
cmpl %r12d, %eax
setl %dl
orb %cl, %dl
cmovnel %eax, %r12d
cmovnel %r15d, %ebp
leaq 0xede56(%rip), %rax     # 0xfa4b0
movq (%rax,%r13,8), %rax
movq %rax, %rcx
xorq %r14, %rcx
cmpq %r14, %rax
movq %rcx, %r14
jne 0xc626
jmp 0xc673
movl $0x40, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/see.cpp
// Function: add_xray_attackers(position*, square_t, dir_t, unsigned long long*, unsigned long long*)
void add_xray_attackers(position *pos,square_t from_sq,dir_t dir,
        uint64 *white_attackers,uint64 *black_attackers) {

    assert(dir != NODIR);

    uint64 targets = bb_rays[from_sq][dir];
    uint64 xrays;
    if (dir==NORTH || dir==SOUTH || dir==EAST || dir==WEST) {
        uint64 rook_moves = get_rook_moves(pos,from_sq,targets);
        xrays = rook_moves & (pos->white_rooks | pos->white_queens | pos->black_rooks | pos->black_queens);
    } else {
        uint64 bishop_moves = get_bishop_moves(pos,from_sq,targets);
        xrays = bishop_moves & (pos->white_bishops | pos->white_queens | pos->black_bishops | pos->black_queens);
    }

    assert(get_num_bits(xrays) <= 1);
    if (xrays & pos->white_pieces) {
        *white_attackers |= xrays;
    } else if (xrays & pos->black_pieces) {
        *black_attackers |= xrays;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x8, %edx
je 0xc736
movq %r8, %r14
movq %rcx, %rbx
movq %rdi, %r15
movl %esi, %eax
movl %edx, %ecx
shlq $0x6, %rax
addq 0x358fb(%rip), %rax     # 0x41fa8
movq (%rax,%rcx,8), %rax
cmpl $0x6, %edx
ja 0xc71f
movl $0x55, %ecx
btl %edx, %ecx
jae 0xc71f
movq %r15, %rdi
movq %rax, %rdx
callq 0x677c
movl $0x190, %ecx            # imm = 0x190
movl $0x188, %edx            # imm = 0x188
movq 0x198(%r15), %r12
orq (%r15,%rdx), %r12
orq (%r15,%rcx), %r12
orq 0x1a0(%r15), %r12
andq %rax, %r12
movq %r12, %rdi
callq 0x3b08
cmpl $0x2, %eax
jae 0xc755
testq %r12, 0x1a8(%r15)
jne 0xc710
movq %r14, %rbx
testq %r12, 0x1b0(%r15)
je 0xc713
orq %r12, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rax, %rdx
callq 0x665c
movl $0x180, %ecx            # imm = 0x180
movl $0x178, %edx            # imm = 0x178
jmp 0xc6d5
leaq 0x1fb3b(%rip), %rdi     # 0x2c278
leaq 0x1fb41(%rip), %rsi     # 0x2c285
leaq 0x1fb46(%rip), %rcx     # 0x2c291
movl $0x29, %edx
callq 0x20d0
leaq 0x1fb7e(%rip), %rdi     # 0x2c2da
leaq 0x1fb22(%rip), %rsi     # 0x2c285
leaq 0x1fb27(%rip), %rcx     # 0x2c291
movl $0x35, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/see.cpp
// Function: score_promotion(unsigned long long)
int32 score_promotion(move mv) {
    piece_t promo = get_promopiece(mv);
    if (promo==QUEEN) return 10005;
    if (promo==ROOK) return 10004;
    if (promo==BISHOP) return 10003;
    assert(promo==KNIGHT);
    return 10002;
}

// Assembly:
pushq %rax
callq 0x77cb
leal -0x2(%rax), %ecx
cmpl $0x4, %ecx
jae 0xc789
orl $0x2710, %eax           # imm = 0x2710
popq %rcx
retq
leaq 0x1e4a5(%rip), %rdi     # 0x2ac35
leaq 0x1faee(%rip), %rsi     # 0x2c285
leaq 0x1fb55(%rip), %rcx     # 0x2c2f3
movl $0x42, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/see.cpp
// Function: see(position*, unsigned long long)
int32 see(position *pos,move mv) {
    int32 score = 0;

    if (get_promopiece(mv) != NO_PIECE) {
        score = score_promotion(mv);
    }
    if (is_capture(mv)) {
        score += score_capture(pos,mv);
    }

    return score;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x77cb
testl %eax, %eax
je 0xc993
movq %rbx, %rdi
callq 0xc774
movl %eax, %ebp
jmp 0xc995
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x77df
testb %al, %al
je 0xc9ae
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc7a8
addl %eax, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/square.cpp
// Function: get_dir_slow(square_t, square_t)
dir_t get_dir_slow(square_t from,square_t to) {
    int32 f_diff = get_file(from) - get_file(to);
    int32 r_diff = get_rank(from) - get_rank(to);

    if (f_diff == 0) {
        // same file
        if (r_diff < 0) return SOUTH;
        if (r_diff > 0) return NORTH;
    } else if (f_diff < 0) {
        // from is west of to
        if (r_diff == 0) return EAST;
        if (r_diff == f_diff) return SOUTHEAST;
        if (r_diff == -f_diff) return NORTHEAST;
    } else { // f_diff > 0
        // from is east of to
        if (r_diff == 0) return WEST;
        if (r_diff == f_diff) return NORTHWEST;
        if (r_diff == -f_diff) return SOUTHWEST;
    }

    return NODIR;
}

// Assembly:
pushq %rax
cmpl $0x40, %edi
jae 0xca2b
cmpl $0x40, %esi
jae 0xca2b
movl %edi, %ecx
andl $0x7, %ecx
movl %esi, %eax
andl $0x7, %eax
shrl $0x3, %edi
shrl $0x3, %esi
movl %edi, %edx
subl %esi, %edx
subl %eax, %ecx
jne 0xc9e7
testl %edx, %edx
js 0xca02
xorl %eax, %eax
cmpl %esi, %edi
je 0xca24
jmp 0xca29
js 0xca09
movl $0x6, %eax
cmpl %esi, %edi
je 0xca29
movl $0x7, %eax
cmpl %ecx, %edx
je 0xca29
movl $0x5, %eax
jmp 0xca20
movl $0x4, %eax
jmp 0xca29
movl $0x2, %eax
cmpl %esi, %edi
je 0xca29
movl $0x3, %eax
cmpl %ecx, %edx
je 0xca29
movl $0x1, %eax
addl %ecx, %edx
je 0xca29
movl $0x8, %eax
popq %rcx
retq
leaq 0x1c7dc(%rip), %rdi     # 0x2920e
leaq 0x1f934(%rip), %rsi     # 0x2c36d
leaq 0x1f956(%rip), %rcx     # 0x2c396
movl $0x2e, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/square.cpp
// Function: is_light_sq(square_t)
bool is_light_sq(square_t sq) {
    assert(sq>=A8 && sq<=H1);
    rank_t r = get_rank(sq);
    file_t f = get_file(sq);
    return (r%2) == (f%2);
}

// Assembly:
cmpl $0x40, %edi
jae 0xce14
movl %edi, %eax
shrl $0x3, %eax
xorl %edi, %eax
testb $0x1, %al
sete %al
retq
pushq %rax
leaq 0x1f79b(%rip), %rdi     # 0x2c5b7
leaq 0x1f54a(%rip), %rsi     # 0x2c36d
leaq 0x1f79e(%rip), %rcx     # 0x2c5c8
movl $0x7b, %edx
callq 0x20d0
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/suites.cpp
// Function: get_ts_moves(position*, char*, unsigned long long*)
int get_ts_moves(position *pos,char *buf,move *m) {
    move *m_init = m;
    char *p = strtok(buf," ");

    while (p != NULL && (m-m_init) <= 5) {
        move mv = str_to_move(p,pos);
        if (mv==BADMOVE) {
            error("couldn't parse move.");
            exit(1);
        }
        *m = mv;
        m++;
        p = strtok(NULL," ");
    }

    return m-m_init;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r14
leaq 0x1f4dd(%rip), %rsi     # 0x2c752
movq %rax, %rdi
callq 0x22c0
testq %rax, %rax
je 0xd2c7
movl $0x8, %r13d
xorl %r15d, %r15d
leaq 0x1f4c0(%rip), %r12     # 0x2c752
movq %rax, %rdi
movq %r14, %rsi
callq 0xe195
testq %rax, %rax
je 0xd2d7
movq %rax, (%rbx,%r15,8)
xorl %edi, %edi
movq %r12, %rsi
callq 0x22c0
incq %r15
testq %rax, %rax
je 0xd2ca
leaq 0x8(%r13), %rcx
cmpq $0x30, %r13
movq %rcx, %r13
jl 0xd292
jmp 0xd2ca
xorl %r15d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1f49c(%rip), %rdi     # 0x2c77a
xorl %eax, %eax
callq 0x2330
movl $0x1, %edi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/think.cpp
// Function: think()
void think() {

    // make a copy of the current position.  note that just because we are
    // operating off a copy of the global position, the global position
    // itself should remain unchanged until our search is complete.
    memcpy(&search_pos,&gpos,sizeof(position));

    // initialize the search's undo stack to what's already been played for draw detection
    memcpy(search_undos,gundos,gpos.move_counter * sizeof(undo));

    set_ponder_mode(false);
    set_abort_iterator(false);

    pthread_create(&think_thread,NULL,think_helper,NULL);
}

// Assembly:
pushq %rbx
leaq 0x86f5ee(%rip), %rdi    # 0x87c978
leaq 0xbb58f(%rip), %rbx     # 0xc8920
movl $0x1c8, %edx            # imm = 0x1C8
movq %rbx, %rsi
callq 0x2100
movl 0x144(%rbx), %edx
shlq $0x5, %rdx
leaq 0x879401(%rip), %rdi    # 0x8867b0
leaq 0xbb73a(%rip), %rsi     # 0xc8af0
callq 0x2100
xorl %ebx, %ebx
movb %bl, 0x86f5a2(%rip)     # 0x87c965
xorl %edi, %edi
callq 0xb2af
movb %bl, 0x86f5a0(%rip)     # 0x87c970
xorl %edi, %edi
callq 0xb2be
leaq 0xeb1b2(%rip), %rdi     # 0xf8590
leaq 0xa(%rip), %rdx         # 0xd3ef
xorl %esi, %esi
xorl %ecx, %ecx
popq %rbx
jmp 0x2300
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/think.cpp
// Function: build_search_stats_dto()
search_stats build_search_stats_dto() {
    search_stats stats;
    stats.nodes=0;
    stats.qnodes=0;
    stats.fail_highs=0;
    stats.fail_lows=0;
    stats.hash_exact_scores=0;
    stats.first_line_searched.n=0;
    stats.prunes=0;
    stats.last_pv.n=0;
    for (int i=0;i<MAX_PLY;i++) {
        stats.last_pv.mv[i] = BADMOVE;
        stats.first_line_searched.mv[i] = BADMOVE;
    }

    return stats;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x30, %rdi
leaq 0x358(%rbx), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x1c(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movl $0x324, %edx            # imm = 0x324
xorl %esi, %esi
callq 0x20c0
movl $0x328, %edx            # imm = 0x328
movq %r14, %rdi
xorl %esi, %esi
callq 0x20c0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/jswaff[P]prophet3/src/utils.cpp
// Function: str_to_sq(char const*)
square_t str_to_sq(const char *str_sq) {
    if (strlen(str_sq) != 2) {
        return NO_SQUARE;
    }
    int32 sq;

    // the first character should be a-h or A-H
    if (str_sq[0] >= 'a' && str_sq[0] <= 'h') {
        sq = str_sq[0] - 'a';
    } else if (str_sq[0] >= 'A' && str_sq[0] <= 'H') {
        sq = str_sq[0] - 'A';
    } else {
        return NO_SQUARE;
    }

    // the second character should be a digit 1-8
    if (str_sq[1] >= '1' && str_sq[1] <= '8') {
        sq += 8*(8-(str_sq[1]-'0'));
    } else {
        return NO_SQUARE;
    }

    return (square_t)sq;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2080
movq %rax, %rcx
movl $0x40, %eax
cmpq $0x2, %rcx
jne 0xe019
movb (%rbx), %cl
leal -0x61(%rcx), %esi
movb $-0x61, %dl
cmpb $0x8, %sil
jb 0xdffc
leal -0x41(%rcx), %esi
movb $-0x41, %dl
cmpb $0x7, %sil
ja 0xe019
movzbl 0x1(%rbx), %esi
leal -0x31(%rsi), %edi
cmpb $0x7, %dil
ja 0xe019
addb %dl, %cl
movsbl %cl, %eax
shll $0x3, %esi
andl $0x78, %esi
subl %esi, %eax
addl $0x40, %eax
popq %rbx
retq