LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_rook_moves(unsigned long long*, position*, bool, bool)
move* gen_rook_moves(move* m,position* p,bool caps,bool noncaps) {

    uint64 pmap = p->player==WHITE ? p->white_rooks : p->black_rooks;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        m = gen_rook_moves(m,p,sq,caps,noncaps);
        pmap ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
setne %al
movq 0x188(%rsi,%rax,8), %r15
movzbl %dl, %ebp
movzbl %cl, %r12d
testq %r15, %r15
je 0x7ab6
movq %r15, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x819f
movq %rax, %r14
movl %r13d, %eax
leaq 0xf5a00(%rip), %rcx     # 0xfd4b0
xorq (%rcx,%rax,8), %r15
jmp 0x7a81
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_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: gen_queen_moves(unsigned long long*, position*, bool, bool)
move* gen_queen_moves(move* m,position* p,bool caps,bool noncaps) {

    uint64 pmap = p->player==WHITE ? p->white_queens : p->black_queens;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        m = gen_queen_moves(m,p,sq,caps,noncaps);
        pmap ^= bb_squares[sq];
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, 0x138(%rsi)
setne %al
movq 0x198(%rsi,%rax,8), %r15
movzbl %dl, %ebp
movzbl %cl, %r12d
testq %r15, %r15
je 0x7b29
movq %r15, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x8292
movq %rax, %r14
movl %r13d, %eax
leaq 0xf598d(%rip), %rcx     # 0xfd4b0
xorq (%rcx,%rax,8), %r15
jmp 0x7af4
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_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: add_move(unsigned long long*, position*, piece_t, square_t, square_t)
move* add_move(move* m,position* p,piece_t piece,square_t from,square_t to) {
    piece_t captured_piece = (piece_t)p->piece[to];
    assert( (p->player==WHITE && is_not_white_piece(captured_piece))
        || (p->player==BLACK && is_not_black_piece(captured_piece)));

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

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %r15d
movl %edx, %r12d
movq %rdi, %rbx
movl %r8d, %eax
movl (%rsi,%rax,4), %ebp
movl 0x138(%rsi), %eax
cmpl $0x1, %eax
jne 0x7e1d
movq %rsi, %r13
movl %ebp, %edi
callq 0xdbac
testb %al, %al
jne 0x7e2c
movl 0x138(%r13), %eax
testl %eax, %eax
jne 0x7e61
movl %ebp, %edi
callq 0xdbb2
testb %al, %al
je 0x7e61
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x7292
testl %ebp, %ebp
je 0x7e4b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x72df
addq $0x8, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20b8b(%rip), %rdi     # 0x289f3
leaq 0x20bf9(%rip), %rsi     # 0x28a68
leaq 0x20c02(%rip), %rcx     # 0x28a78
pushq $0x39
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/movegen.cpp
// Function: add_castle(unsigned long long*, square_t, square_t)
move* add_castle(move* m,square_t from,square_t to) {
    to_move(m,KING,from,to);
    set_castle(m);
    ++m;
    return m;
}

// Assembly:
pushq %rbx
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %rbx
pushq $0x6
popq %rsi
callq 0x7292
movq %rbx, %rdi
callq 0x7366
addq $0x8, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rsi
callq 0x7292
testl %r14d, %r14d
je 0x7ec7
movq %rbx, %rdi
movl %r14d, %esi
callq 0x72df
movq %rbx, %rdi
movl %ebp, %esi
callq 0x733b
addq $0x8, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xc001
cmpl $0x7, %eax
je 0x7f02
testl %eax, %eax
jne 0x7f56
pushq $0x5
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %r8d
callq 0x7e9f
pushq $0x2
popq %rcx
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %r8d
callq 0x7e9f
pushq $0x4
popq %rcx
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %r8d
callq 0x7e9f
pushq $0x3
popq %rcx
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %r8d
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7e9f
pushq $0x1
popq %rsi
movq %r15, %rdi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x7292
testb %r12b, %r12b
je 0x7f75
movq %r15, %rdi
callq 0x7352
jmp 0x7f83
testl %ebx, %ebx
je 0x7f83
movq %r15, %rdi
movl %ebx, %esi
callq 0x72df
addq $0x8, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x802c
movq %rsi, %r14
testq %rsi, %rsi
je 0x8045
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x805e
movq %rdi, %r15
movl %ebx, %eax
leaq 0xf56e6(%rip), %rdx     # 0xfd6b0
movq (%rdx,%rax,8), %r13
movzbl %cl, %esi
movzbl %r8b, %edx
movq %r14, %rdi
callq 0x807b
movq %rax, %r12
andq %r13, %r12
leaq 0xf54c6(%rip), %rbp     # 0xfd4b0
testq %r12, %r12
je 0x801a
movq %r12, %rdi
callq 0x397d
movl %eax, %r13d
movq %r15, %rdi
movq %r14, %rsi
pushq $0x2
popq %rdx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x7de0
movq %rax, %r15
movl %r13d, %eax
xorq (%rbp,%rax,8), %r12
jmp 0x7fea
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x233a8(%rip), %rdi     # 0x2b3db
leaq 0x20a2e(%rip), %rsi     # 0x28a68
leaq 0x20abe(%rip), %rcx     # 0x28aff
pushq $0x7a
jmp 0x8075
leaq 0x2b373(%rip), %rdi     # 0x333bf
leaq 0x20a15(%rip), %rsi     # 0x28a68
leaq 0x20aa5(%rip), %rcx     # 0x28aff
pushq $0x7b
jmp 0x8075
leaq 0x205c2(%rip), %rdi     # 0x28627
leaq 0x209fc(%rip), %rsi     # 0x28a68
leaq 0x20a8c(%rip), %rcx     # 0x28aff
pushq $0x7c
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8093
cmpl $0x1, 0x138(%rdi)
sete %al
movq 0x1a8(%rdi,%rax,8), %rax
testb %dl, %dl
je 0x80ab
movq 0x1b0(%rdi), %rcx
orq 0x1a8(%rdi), %rcx
notq %rcx
orq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8142
movq %rsi, %r14
testq %rsi, %rsi
je 0x8161
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x8180
movq %rdi, %r15
movzbl %cl, %esi
movzbl %r8b, %edx
movq %r14, %rdi
callq 0x807b
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x62e4
movq %rax, %r12
leaq 0xf53b0(%rip), %rbp     # 0xfd4b0
testq %r12, %r12
je 0x8130
movq %r12, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r15, %rdi
movq %r14, %rsi
pushq $0x3
popq %rdx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x7de0
movq %rax, %r15
movl %r13d, %eax
xorq (%rbp,%rax,8), %r12
jmp 0x8100
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23292(%rip), %rdi     # 0x2b3db
leaq 0x20918(%rip), %rsi     # 0x28a68
leaq 0x209e9(%rip), %rcx     # 0x28b40
movl $0x95, %edx
callq 0x20c0
leaq 0x2b257(%rip), %rdi     # 0x333bf
leaq 0x208f9(%rip), %rsi     # 0x28a68
leaq 0x209ca(%rip), %rcx     # 0x28b40
movl $0x96, %edx
callq 0x20c0
leaq 0x204a0(%rip), %rdi     # 0x28627
leaq 0x208da(%rip), %rsi     # 0x28a68
leaq 0x209ab(%rip), %rcx     # 0x28b40
movl $0x97, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8235
movq %rsi, %r14
testq %rsi, %rsi
je 0x8254
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x8273
movq %rdi, %r15
movzbl %cl, %esi
movzbl %r8b, %edx
movq %r14, %rdi
callq 0x807b
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x63e8
movq %rax, %r12
leaq 0xf52bd(%rip), %rbp     # 0xfd4b0
testq %r12, %r12
je 0x8223
movq %r12, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r15, %rdi
movq %r14, %rsi
pushq $0x4
popq %rdx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x7de0
movq %rax, %r15
movl %r13d, %eax
xorq (%rbp,%rax,8), %r12
jmp 0x81f3
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2319f(%rip), %rdi     # 0x2b3db
leaq 0x20825(%rip), %rsi     # 0x28a68
leaq 0x20937(%rip), %rcx     # 0x28b81
movl $0xb1, %edx
callq 0x20c0
leaq 0x2b164(%rip), %rdi     # 0x333bf
leaq 0x20806(%rip), %rsi     # 0x28a68
leaq 0x20918(%rip), %rcx     # 0x28b81
movl $0xb2, %edx
callq 0x20c0
leaq 0x203ad(%rip), %rdi     # 0x28627
leaq 0x207e7(%rip), %rsi     # 0x28a68
leaq 0x208f9(%rip), %rcx     # 0x28b81
movl $0xb3, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8328
movq %rsi, %r14
testq %rsi, %rsi
je 0x8347
movl %edx, %ebx
cmpl $0x40, %edx
jae 0x8366
movq %rdi, %r15
movzbl %cl, %esi
movzbl %r8b, %edx
movq %r14, %rdi
callq 0x807b
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x63b6
movq %rax, %r12
leaq 0xf51ca(%rip), %rbp     # 0xfd4b0
testq %r12, %r12
je 0x8316
movq %r12, %rdi
callq 0x3a44
movl %eax, %r13d
movq %r15, %rdi
movq %r14, %rsi
pushq $0x5
popq %rdx
movl %ebx, %ecx
movl %eax, %r8d
callq 0x7de0
movq %rax, %r15
movl %r13d, %eax
xorq (%rbp,%rax,8), %r12
jmp 0x82e6
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x230ac(%rip), %rdi     # 0x2b3db
leaq 0x20732(%rip), %rsi     # 0x28a68
leaq 0x20883(%rip), %rcx     # 0x28bc0
movl $0xcd, %edx
callq 0x20c0
leaq 0x2b071(%rip), %rdi     # 0x333bf
leaq 0x20713(%rip), %rsi     # 0x28a68
leaq 0x20864(%rip), %rcx     # 0x28bc0
movl $0xce, %edx
callq 0x20c0
leaq 0x202ba(%rip), %rdi     # 0x28627
leaq 0x206f4(%rip), %rsi     # 0x28a68
leaq 0x20845(%rip), %rcx     # 0x28bc0
movl $0xcf, %edx
callq 0x20c0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/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 0x73a4
testb %al, %al
je 0x83d5
pushq $0x1
popq %rbp
jmp 0x83e6
movq %r14, %rdi
callq 0x7372
movl %eax, %eax
movl (%rbx,%rax,4), %ebp
testl %ebp, %ebp
je 0x842e
movq %r14, %rdi
callq 0x736b
movl %eax, %eax
movl (%rbx,%rax,4), %eax
testl %eax, %eax
je 0x8415
movl %ebp, %ecx
negl %ecx
cmovsl %ebp, %ecx
imull $0xa, %ecx, %ecx
movl %eax, %edx
negl %edx
cmovnsl %eax, %edx
leal (%rcx,%rdx), %eax
addl $0x3e8, %eax            # imm = 0x3E8
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x208a6(%rip), %rdi     # 0x28cc2
leaq 0x20850(%rip), %rsi     # 0x28c73
leaq 0x20871(%rip), %rcx     # 0x28c9b
pushq $0x1e
jmp 0x8445
leaq 0x1ec3a(%rip), %rdi     # 0x2706f
leaq 0x20837(%rip), %rsi     # 0x28c73
leaq 0x20858(%rip), %rcx     # 0x28c9b
pushq $0x1a
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x7386
testl %eax, %eax
je 0x846d
movq %rbx, %rdi
callq 0x8388
movl %eax, %ebp
jmp 0x846f
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x739a
testb %al, %al
je 0x8488
movq %r14, %rdi
movq %rbx, %rsi
callq 0x83ba
addl %eax, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rcx
movq %r15, %rdi
movl %ecx, %edx
callq 0x7482
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xdacb
movl %eax, %ebp
testb %al, %al
jne 0x8dd5
leaq 0x6(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xd5f6
leaq 0x201d3(%rip), %rdi     # 0x28f96
movq %r15, %rsi
xorl %eax, %eax
callq 0x5fdd
movq %rbx, %rdi
callq 0x4938
movl %ebp, %eax
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %r14
movq %rdi, %rbx
xorl %r13d, %r13d
movq %rdi, %r15
xorl %r12d, %r12d
cmpq %r14, %r15
jae 0x8e35
cmpq $0x0, (%r15)
je 0x8e2f
movq %r15, %rdi
callq 0x73b8
testq %r12, %r12
sete %cl
cmpl %r13d, %eax
setg %dl
orb %cl, %dl
movq %r15, %rcx
jne 0x8e29
movl %r13d, %eax
movq %r12, %rcx
movl %eax, %r13d
movq %rcx, %r12
addq $0x8, %r15
jmp 0x8dfd
testq %r12, %r12
je 0x8e48
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_O2/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 0x8eaa
movq %rsi, %r15
testq %rsi, %rsi
je 0x8ec9
movq %rdx, %rbx
testq %rdx, %rdx
je 0x8e95
movq %rdi, %r14
movq %rbx, %rdi
callq 0x73f4
cmpq %rbx, %rax
jne 0x8ee8
movq %r14, %rax
cmpq %r15, %rax
jae 0x8e95
cmpq %rbx, (%rax)
je 0x8e99
addq $0x8, %rax
jmp 0x8e85
xorl %eax, %eax
jmp 0x8ea4
movq (%r14), %rcx
movq %rbx, (%r14)
movq %rcx, (%rax)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2008e(%rip), %rdi     # 0x28f3f
leaq 0x1fe4b(%rip), %rsi     # 0x28d03
leaq 0x20086(%rip), %rcx     # 0x28f45
movl $0xa0, %edx
callq 0x20c0
leaq 0x200a2(%rip), %rdi     # 0x28f72
leaq 0x1fe2c(%rip), %rsi     # 0x28d03
leaq 0x20067(%rip), %rcx     # 0x28f45
movl $0xa1, %edx
callq 0x20c0
leaq 0x20087(%rip), %rdi     # 0x28f76
leaq 0x1fe0d(%rip), %rsi     # 0x28d03
leaq 0x20048(%rip), %rcx     # 0x28f45
movl $0xa5, %edx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x736b
movl %eax, %r12d
movq %r15, %rdi
callq 0x7372
movl %eax, %ebp
movq %r15, %rdi
callq 0x7390
testl %eax, %eax
je 0x8f92
movl %eax, %r14d
movl %r12d, %eax
movl 0x138(%rbx), %r13d
shlq $0x4, %rax
addq 0x3c097(%rip), %rax     # 0x44fe8
movl %ebp, %r12d
leaq 0xf4555(%rip), %rcx     # 0xfd4b0
movq (%rcx,%r12,8), %rcx
testq %rcx, (%rax,%r13,8)
je 0x8f9a
movq %r15, %rdi
callq 0x73a4
cmpl $0x1, %r13d
jne 0x8fab
testb %al, %al
je 0x8fe7
cmpl 0x13c(%rbx), %ebp
jne 0x8f9a
movl %ebp, %edi
callq 0xc1e0
movl %eax, %eax
cmpl $-0x1, (%rbx,%rax,4)
jne 0x8f9a
movb $0x1, %al
jmp 0x8f9c
movl %ebp, %eax
cmpl $0x0, (%rbx,%rax,4)
je 0x8fca
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %al, %al
je 0x8ff1
cmpl 0x13c(%rbx), %ebp
jne 0x8f9a
movl %ebp, %edi
callq 0xc19d
movl %eax, %ecx
movb $0x1, %al
cmpl $0x1, (%rbx,%rcx,4)
jne 0x8f9a
jmp 0x8f9c
cmpl $0x1, 0x138(%rbx)
jne 0x8ffb
movl %r12d, %edi
callq 0xc19d
movl %eax, %r14d
movl %eax, %edi
callq 0xc19d
jmp 0x900d
movb $0x1, %al
addl (%rbx,%r12,4), %r14d
jne 0x8f9a
jmp 0x8f9c
movb $0x1, %al
cmpl %r14d, (%rbx,%r12,4)
jne 0x8f9a
jmp 0x8f9c
movl %r12d, %edi
callq 0xc1e0
movl %eax, %r14d
movl %eax, %edi
callq 0xc1e0
movl %eax, %ecx
movb $0x1, %al
cmpl %r14d, %ebp
je 0x8f9c
cmpl %ecx, %ebp
jne 0x8f9a
movl %r14d, %ecx
cmpl $0x0, (%rbx,%rcx,4)
jne 0x8f9a
jmp 0x8f9c
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rcx
movq %r15, %rdi
movq %r14, %rsi
movl %ecx, %edx
callq 0x73f8
movq %rax, %r12
cmpl $0x1, %ebx
jne 0x9085
movq %rsp, %rdi
pushq $0x1
popq %rcx
movq %r12, %rsi
movl %ecx, %edx
callq 0xdb4d
movl %eax, %r13d
movq %r13, %rax
addq $0x968, %rsp            # imm = 0x968
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl %ebx
xorl %r13d, %r13d
leaq 0xc2a5f(%rip), %rbp     # 0xcbaf0
cmpq %r12, %r15
jae 0x9070
movq (%r15), %rsi
testq %rsi, %rsi
je 0x90c1
movq %r14, %rdi
movq %rbp, %rdx
callq 0x2fa5
movq %r14, %rdi
movl %ebx, %esi
callq 0x902c
addq %rax, %r13
movq %r14, %rdi
movq %rbp, %rsi
callq 0x31f8
addq $0x8, %r15
jmp 0x9091
// File: /workspace/github_cpp_makefile_star2_O2/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 0xc2845(%rip), %rdi     # 0xcb920
callq 0x4938
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
negl %ebx
pushq $0x1
popq %r15
leaq 0x1fec3(%rip), %r12     # 0x28fb7
leaq 0x1ffa8(%rip), %r13     # 0x290a3
xorl %ebp, %ebp
leal (%rbx,%r15), %eax
cmpl $0x1, %eax
je 0x913a
movq %r12, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x5fdd
leaq 0xc2806(%rip), %rdi     # 0xcb920
movl %r15d, %esi
callq 0x902c
movq %rax, %r14
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x5fdd
addq %r14, %rbp
incl %r15d
jmp 0x90fd
movq %rbp, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x9185
movq %r15, %rdi
movq %r14, %rsi
callq 0x2050
testq %rax, %rax
je 0x915d
testq %r12, %r12
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa1b8
movq %r14, %rdi
callq 0x4938
callq 0xd470
movl %eax, %r15d
movq %r14, %rdi
movl %ebp, %esi
callq 0x902c
movq %rax, %r14
callq 0xd470
movl %eax, %r12d
subl %r15d, %r12d
incl %r12d
leaq 0x1fb8c(%rip), %rdi     # 0x29085
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x5fdd
imulq $0x3e8, %r14, %rax      # imm = 0x3E8
movslq %r12d, %rcx
xorl %edx, %edx
divq %rcx
leaq 0x20104(%rip), %rdi     # 0x29622
movq %rax, %rsi
xorl %eax, %eax
callq 0x5fdd
cmpq %rbx, %r14
jne 0x9539
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x739a
testb %al, %al
je 0xa137
movq %r14, %rdi
callq 0x7372
movq %rbx, %rdi
movl %eax, %esi
callq 0xa0e6
movq %r14, %rdi
callq 0x736b
movl %eax, %ecx
movl (%rbx,%rcx,4), %ecx
addl $0x6, %ecx
rorl %ecx
cmpl $0x6, %ecx
ja 0xa17f
leaq 0x1f56b(%rip), %rdx     # 0x296c0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %rbx, %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa0e6
andl $0x3, 0x140(%rbx)
jmp 0xa17f
andl $0xc, 0x140(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa53f
cmpl $0x40, %esi
jae 0xa55e
cmpl $0x2, %edx
jae 0xa57d
movl %esi, %eax
movl (%rdi,%rax,4), %edi
cmpl $0x1, %edx
jne 0xa539
popq %rax
jmp 0xdba6
popq %rax
jmp 0xdba0
leaq 0x1d013(%rip), %rdi     # 0x27559
leaq 0x1f2f4(%rip), %rsi     # 0x29841
leaq 0x1f8c8(%rip), %rcx     # 0x29e1c
movl $0x17d, %edx            # imm = 0x17D
callq 0x20c0
leaq 0x1cca9(%rip), %rdi     # 0x2720e
leaq 0x1f2d5(%rip), %rsi     # 0x29841
leaq 0x1f8a9(%rip), %rcx     # 0x29e1c
movl $0x17e, %edx            # imm = 0x17E
callq 0x20c0
leaq 0x1cc9f(%rip), %rdi     # 0x27223
leaq 0x1f2b6(%rip), %rsi     # 0x29841
leaq 0x1f88a(%rip), %rcx     # 0x29e1c
movl $0x17f, %edx            # imm = 0x17F
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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
cmpq $0x40, %r14
je 0xa681
movl (%rbx,%r14,4), %eax
movl %eax, (%rsp,%r14,4)
testl %eax, %eax
je 0xa67c
movq %rbx, %rdi
movl %r14d, %esi
callq 0x9f37
incq %r14
jmp 0xa65f
xorl %r15d, %r15d
leaq 0x1f095(%rip), %r14     # 0x29720
cmpq $0x100, %r15            # imm = 0x100
je 0xa6b0
movl (%rsp,%r15), %esi
testl %esi, %esi
je 0xa6aa
negl %esi
movl (%r15,%r14), %edx
movq %rbx, %rdi
callq 0x9db0
addq $0x4, %r15
jmp 0xa68b
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 0xd4d8
movl %eax, 0x138(%rbx)
movl 0x13c(%rbx), %eax
cmpq $0x40, %rax
je 0xa6f7
movl (%r14,%rax,4), %eax
movl %eax, 0x13c(%rbx)
movl 0x140(%rbx), %eax
movl %eax, %ecx
andl $0x3, %ecx
shrl $0x2, %eax
movl %eax, %edx
andl $0x1, %edx
leal (%rdx,%rcx,4), %ecx
andl $0x2, %eax
orl %ecx, %eax
movl %eax, 0x140(%rbx)
movq %rbx, %rdi
callq 0x5a50
movq %rax, 0x1b8(%rbx)
movq %rbx, %rdi
callq 0x5b17
movq %rax, 0x1c0(%rbx)
movq %rbx, %rdi
callq 0x21176
testb %al, %al
je 0xa74f
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1f735(%rip), %rdi     # 0x29e8b
leaq 0x1f0e4(%rip), %rsi     # 0x29841
leaq 0x1f741(%rip), %rcx     # 0x29ea5
movl $0x1c4, %edx            # imm = 0x1C4
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa8bf
movq %r15, %rdi
callq 0x739a
testb %al, %al
jne 0xa8bf
movq %r15, %rdi
callq 0x7386
testl %eax, %eax
je 0xa8cc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x737c
cmpl $0x1, %eax
jne 0xa901
movq %r15, %rdi
callq 0x7372
movl %eax, %edi
callq 0xc001
cmpl $0x6, %eax
je 0xa8bf
movq %r15, %rdi
callq 0x7372
movl %eax, %edi
callq 0xc001
cmpl $0x1, %eax
je 0xa8bf
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x547b
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 0xa8c1
movl $0x1f4, %eax            # imm = 0x1F4
subl %ecx, %eax
cmpl %ebx, %eax
setle %al
jmp 0xa8c1
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x73b8
testl %eax, %eax
jne 0xa9e7
leaq 0x8(%rsp), %rdi
callq 0x73b8
testl %eax, %eax
jne 0xaa00
movq %r12, 0x30(%r14)
movq %r12, 0x38(%r14)
movq %r12, 0x28(%r14)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%r14)
movq %r15, 0x18(%r14)
movq %rbx, 0x20(%r14)
andl $0x0, (%r14)
movb 0x40(%rsp), %al
movb %al, 0x4(%r14)
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1f50f(%rip), %rdi     # 0x29efd
leaq 0x1f521(%rip), %rsi     # 0x29f16
leaq 0x1f529(%rip), %rcx     # 0x29f25
pushq $0x27
jmp 0xaa17
leaq 0x1f568(%rip), %rdi     # 0x29f6f
leaq 0x1f508(%rip), %rsi     # 0x29f16
leaq 0x1f510(%rip), %rcx     # 0x29f25
pushq $0x28
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0xb78c
movq %rsi, %r14
testq %rsi, %rsi
je 0xb7ab
testq %rdx, %rdx
je 0xb7ca
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x73d3
movq (%r15), %rax
movq %rax, 0x8(%rbx)
movslq (%r14), %rdx
testq %rdx, %rdx
jle 0xb77d
leaq 0x10(%rbx), %rdi
leaq 0x8(%r14), %rsi
shlq $0x3, %rdx
callq 0x20f0
movl (%r14), %eax
incl %eax
jmp 0xb780
pushq $0x1
popq %rax
movl %eax, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1e858(%rip), %rdi     # 0x29feb
leaq 0x1e77c(%rip), %rsi     # 0x29f16
leaq 0x1eabc(%rip), %rcx     # 0x2a25d
movl $0x1a5, %edx            # imm = 0x1A5
callq 0x20c0
leaq 0x1e840(%rip), %rdi     # 0x29ff2
leaq 0x1e75d(%rip), %rsi     # 0x29f16
leaq 0x1ea9d(%rip), %rcx     # 0x2a25d
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x20c0
leaq 0x1eac2(%rip), %rdi     # 0x2a293
leaq 0x1e73e(%rip), %rsi     # 0x29f16
leaq 0x1ea7e(%rip), %rcx     # 0x2a25d
movl $0x1a7, %edx            # imm = 0x1A7
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0xbbb1
retq
pushq %rbx
movl %ecx, %ebx
movl 0x138(%rdi), %esi
callq 0xa61f
movl %eax, %ecx
addl $0xffff0001, %ebx       # imm = 0xFFFF0001
xorl %eax, %eax
testb %cl, %cl
cmovnel %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x40
popq %rbp
xorl %r12d, %r12d
testq %rbx, %rbx
je 0xbc2e
movq %rbx, %rdi
callq 0x397d
movl %eax, %r15d
movl %eax, %r13d
movl (%r14,%r13,4), %edi
callq 0x4c9c
cmpl $0x40, %ebp
sete %cl
cmpl %r12d, %eax
setl %dl
orb %cl, %dl
cmovnel %eax, %r12d
cmovnel %r15d, %ebp
leaq 0xf1888(%rip), %rax     # 0xfd4b0
xorq (%rax,%r13,8), %rbx
jmp 0xbbef
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_O2/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 0xbcef
movq %r8, %r14
movq %rcx, %rbx
movq %rdi, %r15
movl %esi, %eax
movl %edx, %ecx
shlq $0x6, %rax
addq 0x39340(%rip), %rax     # 0x44fa8
movq (%rax,%rcx,8), %rax
cmpl $0x6, %edx
ja 0xbcd8
pushq $0x55
popq %rcx
btl %edx, %ecx
jae 0xbcd8
movq %r15, %rdi
movq %rax, %rdx
callq 0x63e8
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 0x3928
cmpl $0x2, %eax
jae 0xbd08
testq %r12, 0x1a8(%r15)
jne 0xbcc9
movq %r14, %rbx
testq %r12, 0x1b0(%r15)
je 0xbccc
orq %r12, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rax, %rdx
callq 0x62e4
movl $0x180, %ecx            # imm = 0x180
movl $0x178, %edx            # imm = 0x178
jmp 0xbc8e
leaq 0x1e5b2(%rip), %rdi     # 0x2a2a8
leaq 0x1e5b8(%rip), %rsi     # 0x2a2b5
leaq 0x1e5bd(%rip), %rcx     # 0x2a2c1
pushq $0x29
jmp 0xbd1f
leaq 0x1e5fb(%rip), %rdi     # 0x2a30a
leaq 0x1e59f(%rip), %rsi     # 0x2a2b5
leaq 0x1e5a4(%rip), %rcx     # 0x2a2c1
pushq $0x35
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x7386
leal -0x2(%rax), %ecx
cmpl $0x4, %ecx
jae 0xbd3a
orl $0x2710, %eax           # imm = 0x2710
popq %rcx
retq
leaq 0x1cf24(%rip), %rdi     # 0x28c65
leaq 0x1e56d(%rip), %rsi     # 0x2a2b5
leaq 0x1e5d4(%rip), %rcx     # 0x2a323
pushq $0x42
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x7386
testl %eax, %eax
je 0xbf2d
movq %rbx, %rdi
callq 0xbd25
movl %eax, %ebp
jmp 0xbf2f
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x739a
testb %al, %al
je 0xbf48
movq %r14, %rdi
movq %rbx, %rsi
callq 0xbd57
addl %eax, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebp
callq 0xbfd8
movl %eax, %ebx
movl %r14d, %edi
callq 0xbfd8
movl %eax, %r15d
movl %ebp, %edi
callq 0xc001
movl %eax, %ebp
movl %r14d, %edi
callq 0xc001
movl %eax, %ecx
movl %ebp, %eax
subl %ecx, %eax
subl %r15d, %ebx
jne 0xbf98
testl %eax, %eax
js 0xbfa2
xorl %eax, %eax
cmpl %ecx, %ebp
jne 0xbfcd
pushq $0x8
jmp 0xbfcc
js 0xbfa6
cmpl %ecx, %ebp
jne 0xbfae
pushq $0x6
jmp 0xbfcc
pushq $0x4
jmp 0xbfcc
cmpl %ecx, %ebp
jne 0xbfb6
pushq $0x2
jmp 0xbfcc
cmpl %ebx, %eax
jne 0xbfbe
pushq $0x7
jmp 0xbfcc
cmpl %ebx, %eax
jne 0xbfc6
pushq $0x3
jmp 0xbfcc
addl %ebx, %eax
jne 0xbf94
pushq $0x5
jmp 0xbfcc
addl %ebx, %eax
jne 0xbf94
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x40, %edi
jae 0xc427
movl %edi, %ebx
callq 0xc001
movl %eax, %ebp
movl %ebx, %edi
callq 0xbfd8
xorl %ebp, %eax
testb $0x1, %al
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1e1b9(%rip), %rdi     # 0x2a5e7
leaq 0x1df68(%rip), %rsi     # 0x2a39d
leaq 0x1e1bc(%rip), %rcx     # 0x2a5f8
pushq $0x7b
popq %rdx
callq 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x1df08(%rip), %r15     # 0x2a782
movq %rsi, %rdi
movq %r15, %rsi
callq 0x22c0
xorl %r12d, %r12d
xorl %ebp, %ebp
testq %rax, %rax
je 0xc8bb
cmpq $0x2f, %r12
jg 0xc8bb
movq %rax, %rdi
movq %r14, %rsi
callq 0xd66a
testq %rax, %rax
je 0xc8c6
movq %rax, (%rbx,%r12)
xorl %edi, %edi
movq %r15, %rsi
callq 0x22c0
incl %ebp
addq $0x8, %r12
jmp 0xc88a
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1dedd(%rip), %rdi     # 0x2a7aa
xorl %eax, %eax
callq 0x622a
pushq $0x1
popq %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x873002(%rip), %rdi    # 0x87f978
leaq 0xbefa3(%rip), %rbx     # 0xcb920
movl $0x1c8, %edx            # imm = 0x1C8
movq %rbx, %rsi
callq 0x20f0
movl 0x144(%rbx), %edx
shlq $0x5, %rdx
leaq 0x87ce15(%rip), %rdi    # 0x8897b0
leaq 0xbf14e(%rip), %rsi     # 0xcbaf0
callq 0x20f0
xorl %edi, %edi
callq 0xc923
xorl %edi, %edi
callq 0xc917
leaq 0xeebd4(%rip), %rdi     # 0xfb590
leaq 0xa(%rip), %rdx         # 0xc9cd
xorl %esi, %esi
xorl %ecx, %ecx
popq %rbx
jmp 0x2300