LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: jswaff[P]prophet3/src/apply.cpp
// Function: apply_null_move(position*)
square_t apply_null_move(position *p) {
    square_t ep_sq = p->ep_sq;

    // clear current values
    p->hash_key ^= zkeys.ptm[p->player];
    p->hash_key ^= zkeys.ep[p->ep_sq];

    // change player and reset EP square
    p->player = opposite_player(p->player);
    p->ep_sq = NO_SQUARE;

    // set current values
    p->hash_key ^= zkeys.ep[p->ep_sq];
    p->hash_key ^= zkeys.ptm[p->player];

    return ep_sq;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x13c(%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %eax
movl %eax, %ecx
leaq 0xffa4c(%rip), %rax     # 0x103758
movq 0x1c00(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movl 0x13c(%rax), %eax
movl %eax, %ecx
leaq 0xffa1f(%rip), %rax     # 0x103758
movq 0x1c90(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %edi
callq 0x14130
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x138(%rax)
movq -0x8(%rbp), %rax
movl $0x40, 0x13c(%rax)
movq -0x8(%rbp), %rax
movl 0x13c(%rax), %eax
movl %eax, %ecx
leaq 0xff9c9(%rip), %rax     # 0x103758
movq 0x1c90(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %eax
movl %eax, %ecx
leaq 0xff99c(%rip), %rax     # 0x103758
movq 0x1c00(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/apply.cpp
// Function: undo_null_move(position*, square_t)
void undo_null_move(position *p,square_t ep_sq) {
    // clear current values
    p->hash_key ^= zkeys.ptm[p->player];
    p->hash_key ^= zkeys.ep[p->ep_sq];

    // change player and reset EP square
    p->player = opposite_player(p->player);
    p->ep_sq = ep_sq;

    // set current values
    p->hash_key ^= zkeys.ep[p->ep_sq];
    p->hash_key ^= zkeys.ptm[p->player];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %eax
movl %eax, %ecx
leaq 0xff956(%rip), %rax     # 0x103758
movq 0x1c00(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movl 0x13c(%rax), %eax
movl %eax, %ecx
leaq 0xff929(%rip), %rax     # 0x103758
movq 0x1c90(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %edi
callq 0x14130
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x138(%rax)
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x13c(%rax)
movq -0x8(%rbp), %rax
movl 0x13c(%rax), %eax
movl %eax, %ecx
leaq 0xff8d4(%rip), %rax     # 0x103758
movq 0x1c90(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %eax
movl %eax, %ecx
leaq 0xff8a7(%rip), %rax     # 0x103758
movq 0x1c00(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
xorq 0x1b8(%rax), %rcx
movq %rcx, 0x1b8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: jswaff[P]prophet3/src/attack.cpp
// Function: attacked_by_knight(position*, square_t, color_t)
bool attacked_by_knight(position *p,square_t sq,color_t player) {
    assert(p);
    assert(sq >= A8 && sq <= H1);
    assert(player==WHITE || player==BLACK);

    return bb_knight_moves[sq] & (player==WHITE ? p->white_knights : p->black_knights);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3efb
jmp 0x3f1a
leaq 0x3dc9c(%rip), %rdi     # 0x41b9e
leaq 0x312f3(%rip), %rsi     # 0x351fc
movl $0xf, %edx
leaq 0x312f6(%rip), %rcx     # 0x3520b
callq 0x20c0
xorl %eax, %eax
cmpl $0x0, -0xc(%rbp)
movb %al, -0x11(%rbp)
jl 0x3f2f
cmpl $0x3f, -0xc(%rbp)
setle %al
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0x3f38
jmp 0x3f3a
jmp 0x3f59
leaq 0x31301(%rip), %rdi     # 0x35242
leaq 0x312b4(%rip), %rsi     # 0x351fc
movl $0x10, %edx
leaq 0x312b7(%rip), %rcx     # 0x3520b
callq 0x20c0
movb $0x1, %al
cmpl $0x1, -0x10(%rbp)
movb %al, -0x12(%rbp)
je 0x3f6e
cmpl $0x0, -0x10(%rbp)
sete %al
movb %al, -0x12(%rbp)
movb -0x12(%rbp), %al
testb $0x1, %al
jne 0x3f77
jmp 0x3f79
jmp 0x3f98
leaq 0x312d7(%rip), %rdi     # 0x35257
leaq 0x31275(%rip), %rsi     # 0x351fc
movl $0x11, %edx
leaq 0x31278(%rip), %rcx     # 0x3520b
callq 0x20c0
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x1018cc(%rip), %rax    # 0x105870
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpl $0x1, -0x10(%rbp)
jne 0x3fc3
movq -0x8(%rbp), %rax
movq 0x168(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3fd2
movq -0x8(%rbp), %rax
movq 0x170(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
andq %rcx, %rax
cmpq $0x0, %rax
setne %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/attack.cpp
// Function: attacked_by_king(position*, square_t, color_t)
bool attacked_by_king(position *p,square_t sq,color_t player) {
    assert(p);
    assert(sq >= A8 && sq <= H1);
    assert(player==WHITE || player==BLACK);

    return bb_king_moves[sq] & bb_squares[player==WHITE ? p->white_king : p->black_king];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x400b
jmp 0x402a
leaq 0x3db8c(%rip), %rdi     # 0x41b9e
leaq 0x311e3(%rip), %rsi     # 0x351fc
movl $0x17, %edx
leaq 0x31251(%rip), %rcx     # 0x35276
callq 0x20c0
xorl %eax, %eax
cmpl $0x0, -0xc(%rbp)
movb %al, -0x11(%rbp)
jl 0x403f
cmpl $0x3f, -0xc(%rbp)
setle %al
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0x4048
jmp 0x404a
jmp 0x4069
leaq 0x311f1(%rip), %rdi     # 0x35242
leaq 0x311a4(%rip), %rsi     # 0x351fc
movl $0x18, %edx
leaq 0x31212(%rip), %rcx     # 0x35276
callq 0x20c0
movb $0x1, %al
cmpl $0x1, -0x10(%rbp)
movb %al, -0x12(%rbp)
je 0x407e
cmpl $0x0, -0x10(%rbp)
sete %al
movb %al, -0x12(%rbp)
movb -0x12(%rbp), %al
testb $0x1, %al
jne 0x4087
jmp 0x4089
jmp 0x40a8
leaq 0x311c7(%rip), %rdi     # 0x35257
leaq 0x31165(%rip), %rsi     # 0x351fc
movl $0x19, %edx
leaq 0x311d3(%rip), %rcx     # 0x35276
callq 0x20c0
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x1019bc(%rip), %rax    # 0x105a70
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpl $0x1, -0x10(%rbp)
jne 0x40d1
movq -0x8(%rbp), %rax
movl 0x14c(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x40de
movq -0x8(%rbp), %rax
movl 0x150(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x101580(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
setne %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jswaff[P]prophet3/src/attack.cpp
// Function: attacked_by_pawn(position*, square_t, color_t)
bool attacked_by_pawn(position *p,square_t sq,color_t player) {
    assert(p);
    assert(sq >= A8 && sq <= H1);
    assert(player==WHITE || player==BLACK);

    if (player==WHITE) {
        if (((p->white_pawns & ~bb_files[FILE_A]) >> 9) & bb_squares[sq]) return true;
        if (((p->white_pawns & ~bb_files[FILE_H]) >> 7) & bb_squares[sq]) return true;
    } else {
        if (((p->black_pawns & ~bb_files[FILE_A]) << 7) & bb_squares[sq]) return true;
        if (((p->black_pawns & ~bb_files[FILE_H]) << 9) & bb_squares[sq]) return true;
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x427b
jmp 0x429a
leaq 0x3d91c(%rip), %rdi     # 0x41b9e
leaq 0x30f73(%rip), %rsi     # 0x351fc
movl $0x2f, %edx
leaq 0x31016(%rip), %rcx     # 0x352ab
callq 0x20c0
xorl %eax, %eax
cmpl $0x0, -0x14(%rbp)
movb %al, -0x19(%rbp)
jl 0x42af
cmpl $0x3f, -0x14(%rbp)
setle %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x42b8
jmp 0x42ba
jmp 0x42d9
leaq 0x30f81(%rip), %rdi     # 0x35242
leaq 0x30f34(%rip), %rsi     # 0x351fc
movl $0x30, %edx
leaq 0x30fd7(%rip), %rcx     # 0x352ab
callq 0x20c0
movb $0x1, %al
cmpl $0x1, -0x18(%rbp)
movb %al, -0x1a(%rbp)
je 0x42ee
cmpl $0x0, -0x18(%rbp)
sete %al
movb %al, -0x1a(%rbp)
movb -0x1a(%rbp), %al
testb $0x1, %al
jne 0x42f7
jmp 0x42f9
jmp 0x4318
leaq 0x30f57(%rip), %rdi     # 0x35257
leaq 0x30ef5(%rip), %rsi     # 0x351fc
movl $0x31, %edx
leaq 0x30f98(%rip), %rcx     # 0x352ab
callq 0x20c0
cmpl $0x1, -0x18(%rbp)
jne 0x43a3
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
leaq 0x1012bc(%rip), %rcx    # 0x1055f0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
shrq $0x9, %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
leaq 0x101322(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x4361
movb $0x1, -0x1(%rbp)
jmp 0x4422
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
leaq 0x10127d(%rip), %rcx    # 0x1055f0
movq 0x38(%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
shrq $0x7, %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
leaq 0x1012e2(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x43a1
movb $0x1, -0x1(%rbp)
jmp 0x4422
jmp 0x441e
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rax
leaq 0x10123b(%rip), %rcx    # 0x1055f0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
shlq $0x7, %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
leaq 0x1012a1(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x43df
movb $0x1, -0x1(%rbp)
jmp 0x4422
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rax
leaq 0x1011ff(%rip), %rcx    # 0x1055f0
movq 0x38(%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
shlq $0x9, %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
leaq 0x101264(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x441c
movb $0x1, -0x1(%rbp)
jmp 0x4422
jmp 0x441e
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/attack.cpp
// Function: attacked(position*, square_t, color_t)
bool attacked(position *p,square_t sq,color_t player) {

    if (attacked_by_pawn(p,sq,player)) return true;
    if (attacked_by_knight(p,sq,player)) return true;
    if (attacked_by_king(p,sq,player)) return true;
    if (attacked_by_rook(p,sq,player)) return true;
    if (attacked_by_bishop(p,sq,player)) return true;
    if (attacked_by_queen(p,sq,player)) return true;

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x4260
testb $0x1, %al
jne 0x4457
jmp 0x4460
movb $0x1, -0x1(%rbp)
jmp 0x44eb
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x3ee0
testb $0x1, %al
jne 0x4475
jmp 0x447b
movb $0x1, -0x1(%rbp)
jmp 0x44eb
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x3ff0
testb $0x1, %al
jne 0x4490
jmp 0x4496
movb $0x1, -0x1(%rbp)
jmp 0x44eb
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x4110
testb $0x1, %al
jne 0x44ab
jmp 0x44b1
movb $0x1, -0x1(%rbp)
jmp 0x44eb
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x4180
testb $0x1, %al
jne 0x44c6
jmp 0x44cc
movb $0x1, -0x1(%rbp)
jmp 0x44eb
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x41f0
testb $0x1, %al
jne 0x44e1
jmp 0x44e7
movb $0x1, -0x1(%rbp)
jmp 0x44eb
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: get_num_bits(unsigned long long)
uint32 get_num_bits(uint64 val) {
    uint32 n = 0;

    // Brian Kernighan's approach
    while (val) {
        n++;
        val &= val-1;
    }

    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x47e1
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
subq $0x1, %rax
andq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x47bf
movl -0xc(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: get_lsb_slow(unsigned long long)
uint32 get_lsb_slow(uint64 val) {
    assert(val > 0);

    for (int i=0;i<64;i++) {
        if (val & bb_squares[i]) {
            return i;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x4805
jmp 0x4824
leaq 0x30ad4(%rip), %rdi     # 0x352e0
leaq 0x30ad5(%rip), %rsi     # 0x352e8
movl $0x1c, %edx
leaq 0x30adb(%rip), %rcx     # 0x352fa
callq 0x20c0
movl $0x0, -0x14(%rbp)
cmpl $0x40, -0x14(%rbp)
jge 0x485f
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x100e30(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x4852
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4866
jmp 0x4854
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x482b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: get_lsb(unsigned long long)
uint32 get_lsb(uint64 val) {
    assert(val > 0);

    if (val & 65535) {
        return lsb[(uint32)(val & 65535)];
    }

    val >>= 16;
    if (val & 65535) {
        return lsb[(uint32)(val & 65535)] + 16;
    }

    val >>= 16;
    if (val & 65535) {
        return lsb[(uint32)(val & 65535)] + 32;
    }

    val >>= 16;
    return lsb[(uint32)val] + 48;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x4885
jmp 0x48a4
leaq 0x30a54(%rip), %rdi     # 0x352e0
leaq 0x30a55(%rip), %rsi     # 0x352e8
movl $0x28, %edx
leaq 0x30a77(%rip), %rcx     # 0x35316
callq 0x20c0
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0x0, %rax
je 0x48d4
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x48d97(%rip), %rax     # 0x4d660
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x4970
movq -0x10(%rbp), %rax
shrq $0x10, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0x0, %rax
je 0x4910
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x48d5b(%rip), %rax     # 0x4d660
movl (%rax,%rcx,4), %eax
addl $0x10, %eax
movl %eax, -0x4(%rbp)
jmp 0x4970
movq -0x10(%rbp), %rax
shrq $0x10, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0x0, %rax
je 0x494c
movq -0x10(%rbp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x48d1f(%rip), %rax     # 0x4d660
movl (%rax,%rcx,4), %eax
addl $0x20, %eax
movl %eax, -0x4(%rbp)
jmp 0x4970
movq -0x10(%rbp), %rax
shrq $0x10, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
leaq 0x48cf9(%rip), %rax     # 0x4d660
movl (%rax,%rcx,4), %eax
addl $0x30, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: get_msb_slow(unsigned long long)
uint32 get_msb_slow(uint64 val) {
    assert(val > 0);

    for (int i=63;i>=0;i--) {
        if (val & bb_squares[i]) {
            return i;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x4995
jmp 0x49b4
leaq 0x30944(%rip), %rdi     # 0x352e0
leaq 0x30945(%rip), %rsi     # 0x352e8
movl $0x3d, %edx
leaq 0x3097e(%rip), %rcx     # 0x3532d
callq 0x20c0
movl $0x3f, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x49ef
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x100ca0(%rip), %rcx    # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x49e2
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x49f6
jmp 0x49e4
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x49bb
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: get_msb(unsigned long long)
uint32 get_msb(uint64 val) {
    assert(val > 0);

    if ((val >> 48) & 65535) {
        return msb[(uint32)((val>>48)&65535)] + 48;
    }

    if ((val >> 32) & 65535) {
        return msb[(uint32)((val>>32)&65535)] + 32;
    }

    if ((val >> 16) & 65535) {
        return msb[(uint32)((val>>16)&65535)] + 16;
    }

    return msb[(uint32)val];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x4a15
jmp 0x4a34
leaq 0x308c4(%rip), %rdi     # 0x352e0
leaq 0x308c5(%rip), %rsi     # 0x352e8
movl $0x49, %edx
leaq 0x3091a(%rip), %rcx     # 0x35349
callq 0x20c0
movq -0x10(%rbp), %rax
shrq $0x30, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0x0, %rax
je 0x4a6f
movq -0x10(%rbp), %rax
shrq $0x30, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x88bff(%rip), %rax     # 0x8d660
movl (%rax,%rcx,4), %eax
addl $0x30, %eax
movl %eax, -0x4(%rbp)
jmp 0x4af4
movq -0x10(%rbp), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0x0, %rax
je 0x4aa7
movq -0x10(%rbp), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x88bc4(%rip), %rax     # 0x8d660
movl (%rax,%rcx,4), %eax
addl $0x20, %eax
movl %eax, -0x4(%rbp)
jmp 0x4af4
movq -0x10(%rbp), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpq $0x0, %rax
je 0x4adf
movq -0x10(%rbp), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x88b8c(%rip), %rax     # 0x8d660
movl (%rax,%rcx,4), %eax
addl $0x10, %eax
movl %eax, -0x4(%rbp)
jmp 0x4af4
movq -0x10(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
leaq 0x88b72(%rip), %rax     # 0x8d660
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: isolate_lsb_bit(unsigned long long, unsigned int)
uint64 isolate_lsb_bit(uint64 mask,uint32 bit_pos) {

    uint32 n=0;
    for (int i=0;i<64;i++) {
        if (bb_squares[i] & mask) {
            if (n==bit_pos) {
                return bb_squares[i];
            }
            n++;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x40, -0x1c(%rbp)
jge 0x4b6b
movslq -0x1c(%rbp), %rcx
leaq 0x100b46(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rax
andq -0x10(%rbp), %rax
cmpq $0x0, %rax
je 0x4b5e
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x4b55
movslq -0x1c(%rbp), %rcx
leaq 0x100b25(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x4b73
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4b60
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4b19
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: init_pawn_attacks()
void init_pawn_attacks() {
    for (int i=0;i<64;i++) {
        square_t sq = (square_t)i;
        file_t file_i = get_file(sq);
        rank_t rank_i = get_rank(sq);

        bb_pawn_attacks[i][BLACK] = bb_pawn_attacks[i][WHITE] = 0;
        if (rank_i != RANK_1 && rank_i != RANK_8) {
            if (file_i > FILE_A) {
                bb_pawn_attacks[i][WHITE] |= bb_squares[northwest(sq)];
                bb_pawn_attacks[i][BLACK] |= bb_squares[southwest(sq)];
            }
            if (file_i < FILE_H) {
                bb_pawn_attacks[i][WHITE] |= bb_squares[northeast(sq)];
                bb_pawn_attacks[i][BLACK] |= bb_squares[southeast(sq)];
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x40, -0x4(%rbp)
jge 0x542a
movl -0x4(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %edi
callq 0x12070
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %edi
callq 0x120d0
movl %eax, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x100960(%rip), %rax    # 0x105c70
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x100946(%rip), %rax    # 0x105c70
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
cmpl $0x7, -0x10(%rbp)
je 0x541a
cmpl $0x0, -0x10(%rbp)
je 0x541a
cmpl $0x0, -0xc(%rbp)
jle 0x53b2
movl -0x8(%rbp), %edi
callq 0x127c0
movl %eax, %eax
movl %eax, %ecx
leaq 0x10030b(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rcx
movslq -0x4(%rbp), %rdx
leaq 0x1008fc(%rip), %rax    # 0x105c70
shlq $0x4, %rdx
addq %rdx, %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x8(%rbp), %edi
callq 0x12730
movl %eax, %eax
movl %eax, %ecx
leaq 0x1002da(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rcx
movslq -0x4(%rbp), %rdx
leaq 0x1008cb(%rip), %rax    # 0x105c70
shlq $0x4, %rdx
addq %rdx, %rax
orq (%rax), %rcx
movq %rcx, (%rax)
cmpl $0x7, -0xc(%rbp)
jge 0x5418
movl -0x8(%rbp), %edi
callq 0x12610
movl %eax, %eax
movl %eax, %ecx
leaq 0x1002a5(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rcx
movslq -0x4(%rbp), %rdx
leaq 0x100896(%rip), %rax    # 0x105c70
shlq $0x4, %rdx
addq %rdx, %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x8(%rbp), %edi
callq 0x126a0
movl %eax, %eax
movl %eax, %ecx
leaq 0x100274(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rcx
movslq -0x4(%rbp), %rdx
leaq 0x100865(%rip), %rax    # 0x105c70
shlq $0x4, %rdx
addq %rdx, %rax
orq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x541a
jmp 0x541c
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x52df
addq $0x10, %rsp
popq %rbp
retq
// File: jswaff[P]prophet3/src/bitboards.cpp
// Function: init_bitboards()
void init_bitboards() {

    for (int i=0;i<64;i++) {
        bb_squares[i] = ((uint64)1) << i;
    }

    for (int i=0;i<8;i++) {
        bb_ranks[i] = 0;
        bb_files[i] = 0;
    }

    for (int i=0;i<64;i++) {
        bb_ranks[get_rank((square_t)i)] |= bb_squares[i];
        bb_files[get_file((square_t)i)] |= bb_squares[i];
    }

    lsb[0] = 0; msb[0] = 0;
    for (uint32 i=1;i<65536;i++) {
        lsb[i] = get_lsb_slow(i);
        msb[i] = get_msb_slow(i);
    }

    init_knight_moves();
    init_king_moves();
    init_pawn_attacks();
    init_rays();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x40, -0x4(%rbp)
jge 0x546c
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movslq -0x4(%rbp), %rcx
leaq 0x100213(%rip), %rax    # 0x105670
movq %rdx, (%rax,%rcx,8)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x543f
movl $0x0, -0x8(%rbp)
cmpl $0x8, -0x8(%rbp)
jge 0x54aa
movslq -0x8(%rbp), %rcx
leaq 0x1001ac(%rip), %rax    # 0x105630
movq $0x0, (%rax,%rcx,8)
movslq -0x8(%rbp), %rcx
leaq 0x100159(%rip), %rax    # 0x1055f0
movq $0x0, (%rax,%rcx,8)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x5473
movl $0x0, -0xc(%rbp)
cmpl $0x40, -0xc(%rbp)
jge 0x553b
movslq -0xc(%rbp), %rcx
leaq 0x1001aa(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movl -0xc(%rbp), %edi
callq 0x120d0
movq -0x20(%rbp), %rdx
movl %eax, %eax
movl %eax, %ecx
leaq 0x10014b(%rip), %rax    # 0x105630
orq (%rax,%rcx,8), %rdx
leaq 0x100140(%rip), %rax    # 0x105630
movq %rdx, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0x100171(%rip), %rax    # 0x105670
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %edi
callq 0x12070
movq -0x18(%rbp), %rdx
movl %eax, %eax
movl %eax, %ecx
leaq 0x1000d2(%rip), %rax    # 0x1055f0
orq (%rax,%rcx,8), %rdx
leaq 0x1000c7(%rip), %rax    # 0x1055f0
movq %rdx, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x54b1
movl $0x0, 0x4811b(%rip)     # 0x4d660
movl $0x0, 0x88111(%rip)     # 0x8d660
movl $0x1, -0x10(%rbp)
cmpl $0x10000, -0x10(%rbp)   # imm = 0x10000
jae 0x55a0
movl -0x10(%rbp), %eax
movl %eax, %edi
callq 0x47f0
movl %eax, %edx
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x480e9(%rip), %rax     # 0x4d660
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
movl %eax, %edi
callq 0x4980
movl %eax, %edx
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x880ce(%rip), %rax     # 0x8d660
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5556
callq 0x4b80
callq 0x4e10
callq 0x52d0
callq 0x5040
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: jswaff[P]prophet3/src/book.cpp
// Function: load_zkeys()
void load_zkeys() {
    printd("loading zkeys from book...\n");

    char* sql = "select key from zobrist_keys order by id";
    char *err_msg = 0;
    int num_keys = 0;

    int rc = sqlite3_exec(book_db,sql,load_zkeys_callback,(void*)&num_keys,&err_msg);
    if( rc != SQLITE_OK ){
        error("SQL error: %s\n",err_msg);
        sqlite3_free(err_msg);
    }
    printd("loaded %d keys\n",num_keys);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x2fd99(%rip), %rdi     # 0x35368
movb $0x0, %al
callq 0x8db0
leaq 0x2fda7(%rip), %rax     # 0x35384
movq %rax, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
leaq 0xca4e1(%rip), %rax     # 0xcfad8
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
leaq 0x4b(%rip), %rdx        # 0x5650
leaq -0x14(%rbp), %rcx
leaq -0x10(%rbp), %r8
callq 0x2250
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x5636
movq -0x10(%rbp), %rsi
leaq 0x2fd87(%rip), %rdi     # 0x353ad
movb $0x0, %al
callq 0x8f00
movq -0x10(%rbp), %rdi
callq 0x2200
movl -0x14(%rbp), %esi
leaq 0x2fd7c(%rip), %rdi     # 0x353bc
movb $0x0, %al
callq 0x8db0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/book.cpp
// Function: open_book_db(char*)
int32 open_book_db(char *path) {

    int rc = sqlite3_open(path, &book_db);
    if (rc){
        error("Can't open database: %s\n", sqlite3_errmsg(book_db));
        sqlite3_close(book_db);
        book_db = 0;
        return 0;
    }

    char* sql = "select count(*) from book_moves";
    char *err_msg = 0;
    int num_moves = 0;

    rc = sqlite3_exec(book_db,sql,num_moves_callback,(void*)&num_moves,&err_msg);
    if( rc != SQLITE_OK ){
        error("SQL error: %s\n",err_msg);
        sqlite3_free(err_msg);
    }

    load_zkeys();

    return num_moves;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xca121(%rip), %rsi     # 0xcfad8
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x5a0b
leaq 0xca10c(%rip), %rax     # 0xcfad8
movq (%rax), %rdi
callq 0x2160
movq %rax, %rsi
leaq 0x2f9ee(%rip), %rdi     # 0x353cc
movb $0x0, %al
callq 0x8f00
leaq 0xca0ec(%rip), %rax     # 0xcfad8
movq (%rax), %rdi
callq 0x20a0
leaq 0xca0dd(%rip), %rax     # 0xcfad8
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x5a76
leaq 0x2f9d3(%rip), %rax     # 0x353e5
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
leaq 0xca0ac(%rip), %rax     # 0xcfad8
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
leaq 0x46(%rip), %rdx        # 0x5a80
leaq -0x2c(%rbp), %rcx
leaq -0x28(%rbp), %r8
callq 0x2250
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x5a6b
movq -0x28(%rbp), %rsi
leaq 0x2f952(%rip), %rdi     # 0x353ad
movb $0x0, %al
callq 0x8f00
movq -0x28(%rbp), %rdi
callq 0x2200
callq 0x55c0
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/book.cpp
// Function: num_moves_callback(void*, int, char**, char**)
static int num_moves_callback(void *data, int argc, char **argv, char **azColName){

    int* num_moves = (int*)data;

    if (argc==1 && argv[0]) {
        *num_moves = atoi(argv[0]);
    }

    printd("num moves: %d\n",*num_moves);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x1, -0xc(%rbp)
jne 0x5ac3
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x5ac3
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x22b0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movl (%rax), %esi
leaq 0x2fa6a(%rip), %rdi     # 0x3553a
movb $0x0, %al
callq 0x8db0
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/book.cpp
// Function: build_book_key(position*)
int64 build_book_key(position *p) {
    int64 key = 0;

    for (int32 sq=0;sq<64;sq++) {
        if (p->piece[sq] != NO_PIECE) {
            int32 pc = p->piece[sq];
            int32 ptm = WHITE;
            if (pc < 0) {
                pc = -pc;
                ptm = BLACK;
            }
            key ^= bk_pieces[pc][ptm][sq];
        }
    }

    if (p->castling_rights & 1) {
        key ^= bk_castling_rights[bk_cr_wk];
    }
    if (p->castling_rights & 2) {
        key ^= bk_castling_rights[bk_cr_wq];
    }
    if (p->castling_rights & 4) {
        key ^= bk_castling_rights[bk_cr_bk];
    }
    if (p->castling_rights & 8) {
        key ^= bk_castling_rights[bk_cr_bq];
    }

    if (p->ep_sq != NO_SQUARE) {
        key ^= bk_ep[p->ep_sq];
    }

    key ^= bk_ptm[p->player];

    return key;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x40, -0x14(%rbp)
jge 0x5b6f
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x5b62
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x5b35
xorl %eax, %eax
subl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0xc7b30(%rip), %rax     # 0xcd670
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x1c(%rbp), %rcx
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x5b64
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5af7
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5b90
movq 0xc9710(%rip), %rax     # 0xcf298
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x5bb1
movq 0xc96e7(%rip), %rax     # 0xcf290
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x5bd2
movq 0xc96be(%rip), %rax     # 0xcf288
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x5bf3
movq 0xc9695(%rip), %rax     # 0xcf280
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x40, 0x13c(%rax)
je 0x5c1f
movq -0x8(%rbp), %rax
movl 0x13c(%rax), %eax
movl %eax, %ecx
leaq 0xc968d(%rip), %rax     # 0xcf2a0
movq (%rax,%rcx,8), %rax
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x138(%rax), %eax
movl %eax, %ecx
leaq 0xc963e(%rip), %rax     # 0xcf270
movq (%rax,%rcx,8), %rax
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jswaff[P]prophet3/src/book.cpp
// Function: get_book_moves(move_freq_pair*, position*)
int32 get_book_moves(move_freq_pair *mfp,position *p) {
    if (book_db==0) {
        printd("# can't probe - no book database\n");
        return 0;
    }

    printd("# probing book...\n");

    long long key = build_book_key(p);

    char sql[128];
    sprintf(sql,"select fromsq,tosq,frequency,wins,losses,draws from book_moves where key=%lld",key);

    char *err_msg = 0;

    move moves[300],*endp;
    endp = gen_legal_moves(moves,p,true,true);

    int mv_ind=0;
    for (move *mp=moves;mp<endp;mp++) {
        if (*mp) {
            mfp[mv_ind].mv=*mp;
            mfp[mv_ind].freq=0;
            mv_ind++;
        }
    }
    assert(mv_ind<300);

    mfpn_type mfpn;
    mfpn.mfp = &mfp[0];
    mfpn.n = mv_ind;
    int rc = sqlite3_exec(book_db,sql,get_moves_callback,(void*)&mfpn,&err_msg);
    if( rc != SQLITE_OK ){
        error("SQL error: %s\n",err_msg);
        sqlite3_free(err_msg);
    }

    return mv_ind;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa40, %rsp            # imm = 0xA40
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq 0xc9bee(%rip), %rax     # 0xcfad8
cmpq $0x0, (%rax)
jne 0x5f0a
leaq 0x2f575(%rip), %rdi     # 0x3546c
movb $0x0, %al
callq 0x8db0
movl $0x0, -0x4(%rbp)
jmp 0x60a1
leaq 0x2f57d(%rip), %rdi     # 0x3548e
movb $0x0, %al
callq 0x8db0
movq -0x18(%rbp), %rdi
callq 0x5ae0
movq %rax, -0x20(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2f56a(%rip), %rsi     # 0x354a1
movb $0x0, %al
callq 0x2040
movq $0x0, -0xa8(%rbp)
leaq -0xa10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %ecx
movl %ecx, %edx
callq 0xac70
movq %rax, -0xa18(%rbp)
movl $0x0, -0xa1c(%rbp)
leaq -0xa10(%rbp), %rax
movq %rax, -0xa28(%rbp)
movq -0xa28(%rbp), %rax
cmpq -0xa18(%rbp), %rax
jae 0x5ff9
movq -0xa28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x5fe3
movq -0xa28(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movslq -0xa1c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movslq -0xa1c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movl -0xa1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa1c(%rbp)
jmp 0x5fe5
movq -0xa28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xa28(%rbp)
jmp 0x5f7f
cmpl $0x12c, -0xa1c(%rbp)    # imm = 0x12C
jge 0x6007
jmp 0x6026
leaq 0x2f4e1(%rip), %rdi     # 0x354ef
leaq 0x2f4e5(%rip), %rsi     # 0x354fa
movl $0x104, %edx            # imm = 0x104
leaq 0x2f4e6(%rip), %rcx     # 0x35507
callq 0x20c0
movq -0x10(%rbp), %rax
movq %rax, -0xa38(%rbp)
movl -0xa1c(%rbp), %eax
movl %eax, -0xa30(%rbp)
leaq 0xc9a94(%rip), %rax     # 0xcfad8
movq (%rax), %rdi
leaq -0xa0(%rbp), %rsi
leaq 0x5b(%rip), %rdx        # 0x60b0
leaq -0xa38(%rbp), %rcx
leaq -0xa8(%rbp), %r8
callq 0x2250
movl %eax, -0xa3c(%rbp)
cmpl $0x0, -0xa3c(%rbp)
je 0x6098
movq -0xa8(%rbp), %rsi
leaq 0x2f328(%rip), %rdi     # 0x353ad
movb $0x0, %al
callq 0x8f00
movq -0xa8(%rbp), %rdi
callq 0x2200
movl -0xa1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa40, %rsp            # imm = 0xA40
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/book.cpp
// Function: get_moves_callback(void*, int, char**, char**)
static int get_moves_callback(void *data,int argc,char **argv,char **azColName) {

    mfpn_type* mfpn = (mfpn_type*)data;

    int fromsq = atoi(argv[0]);
    int tosq = atoi(argv[1]);
    int freq = atoi(argv[2]);

    for (int i=0;i<mfpn->n;i++) {
        if (get_from_sq(mfpn->mfp[i].mv)==fromsq && get_to_sq(mfpn->mfp[i].mv)==tosq) {
            mfpn->mfp[i].freq += freq;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x22b0
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x22b0
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x22b0
movl %eax, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x6177
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0xaa80
cmpl -0x2c(%rbp), %eax
jne 0x616a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0xaaa0
cmpl -0x30(%rbp), %eax
jne 0x616a
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
jmp 0x616c
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x6105
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/draw.cpp
// Function: is_draw_by_rep(position*, undo*)
bool is_draw_by_rep(position *pos,undo *undo_stack) {
    assert(pos);
    assert(pos->move_counter >= 0 && pos->move_counter < MAX_MOVES_PER_GAME);
    assert(pos->fifty_counter >= 0 && pos->fifty_counter <= pos->move_counter);
    assert(pos->hash_key==build_hash_key(pos));
    assert(undo_stack);

    uint32 reps = 0;
    for (uint32 i=(pos->move_counter-pos->fifty_counter);i<pos->move_counter;i++) {
        if ((undo_stack+i)->hash_key==pos->hash_key) {
            reps++;
        }
    }

    return reps >= 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x62e9
jmp 0x6308
leaq 0x2f259(%rip), %rdi     # 0x35549
leaq 0x2f256(%rip), %rsi     # 0x3554d
movl $0x41, %edx
leaq 0x2f283(%rip), %rcx     # 0x35586
callq 0x20c0
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x144(%rcx)
movb %al, -0x19(%rbp)
jb 0x632e
movq -0x8(%rbp), %rax
cmpl $0x173c, 0x144(%rax)    # imm = 0x173C
setb %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x6337
jmp 0x6339
jmp 0x6358
leaq 0x2f26e(%rip), %rdi     # 0x355ae
leaq 0x2f206(%rip), %rsi     # 0x3554d
movl $0x42, %edx
leaq 0x2f233(%rip), %rcx     # 0x35586
callq 0x20c0
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x148(%rcx)
movb %al, -0x1a(%rbp)
jb 0x6384
movq -0x8(%rbp), %rax
movl 0x148(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x144(%rcx), %eax
setbe %al
movb %al, -0x1a(%rbp)
movb -0x1a(%rbp), %al
testb $0x1, %al
jne 0x638d
jmp 0x638f
jmp 0x63ae
leaq 0x2f259(%rip), %rdi     # 0x355ef
leaq 0x2f1b0(%rip), %rsi     # 0x3554d
movl $0x43, %edx
leaq 0x2f1dd(%rip), %rcx     # 0x35586
callq 0x20c0
movq -0x8(%rbp), %rax
movq 0x1b8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x81f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jne 0x63d4
jmp 0x63f3
leaq 0x2f257(%rip), %rdi     # 0x35632
leaq 0x2f16b(%rip), %rsi     # 0x3554d
movl $0x44, %edx
leaq 0x2f198(%rip), %rcx     # 0x35586
callq 0x20c0
cmpq $0x0, -0x10(%rbp)
je 0x63fc
jmp 0x641b
leaq 0x2ed61(%rip), %rdi     # 0x35164
leaq 0x2f143(%rip), %rsi     # 0x3554d
movl $0x45, %edx
leaq 0x2f170(%rip), %rcx     # 0x35586
callq 0x20c0
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x144(%rax), %eax
movq -0x8(%rbp), %rcx
subl 0x148(%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x144(%rcx), %eax
jae 0x647d
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x1b8(%rcx), %rax
jne 0x6470
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6472
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x6439
cmpl $0x2, -0x14(%rbp)
setae %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: jswaff[P]prophet3/src/drawboard.cpp
// Function: draw_bitboard(unsigned long long)
void draw_bitboard(uint64 bb) {
    char text[100];
    strcpy(text,"");

    for (int i=0;i<64;i++) {
        if (bb & bb_squares[i]) {
            strcat(text,"1");
        } else {
            strcat(text,"0");
        }
        if (get_file((square_t)i)==FILE_H) {
            strcat(text,"\n");
        }
    }

    strcat(text,"\n");
    print(text);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x70(%rbp), %rdi
leaq 0x31edf(%rip), %rsi     # 0x386f9
callq 0x2140
movl $0x0, -0x74(%rbp)
cmpl $0x40, -0x74(%rbp)
jge 0x6891
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rdx
leaq 0xfee35(%rip), %rcx     # 0x105670
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x6857
leaq -0x70(%rbp), %rdi
leaq 0x3a2b9(%rip), %rsi     # 0x40b09
callq 0x22f0
jmp 0x6867
leaq -0x70(%rbp), %rdi
leaq 0x382a9(%rip), %rsi     # 0x3eb0b
callq 0x22f0
movl -0x74(%rbp), %edi
callq 0x12070
cmpl $0x7, %eax
jne 0x6884
leaq -0x70(%rbp), %rdi
leaq 0x30006(%rip), %rsi     # 0x36885
callq 0x22f0
jmp 0x6886
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x6826
leaq -0x70(%rbp), %rdi
leaq 0x2ffe9(%rip), %rsi     # 0x36885
callq 0x22f0
leaq -0x70(%rbp), %rdi
movb $0x0, %al
callq 0x8c60
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: jswaff[P]prophet3/src/eval.cpp
// Function: eval_connected_major_on_7th(position*, square_t, bool)
int32 eval_connected_major_on_7th(position *pos,square_t sq,bool wtm) {
    int32 score = 0;

    uint64 rook_moves = get_rook_moves(pos,sq,bb_rays[sq][EAST]);
    if (wtm) {
        if (rook_moves & (pos->white_rooks | pos->white_queens)) {
            score += connected_majors_on_7th;
        }
    } else {
        if (rook_moves & (pos->black_rooks | pos->black_queens)) {
            score += connected_majors_on_7th;
        }
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0xff760(%rip), %rax     # 0x106070
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdx
callq 0x9170
movq %rax, -0x20(%rbp)
testb $0x1, -0xd(%rbp)
je 0x6958
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x188(%rcx), %rcx
movq -0x8(%rbp), %rdx
orq 0x198(%rdx), %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x6956
movl -0x14(%rbp), %eax
addl $0x50, %eax
movl %eax, -0x14(%rbp)
jmp 0x6986
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x190(%rcx), %rcx
movq -0x8(%rbp), %rdx
orq 0x1a0(%rdx), %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x6984
movl -0x14(%rbp), %eax
addl $0x50, %eax
movl %eax, -0x14(%rbp)
jmp 0x6986
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: jswaff[P]prophet3/src/eval.cpp
// Function: eval_major_on_7th(position*, square_t, bool)
int32 eval_major_on_7th(position *pos,square_t sq,bool wtm) {
    int32 score = 0;

    if (wtm) {
        if (get_rank(sq)==RANK_7 && get_rank(pos->black_king)==RANK_8) {
            score += rook_on_7th;
            score += eval_connected_major_on_7th(pos,sq,wtm);
        }
    } else {
        if (get_rank(sq)==RANK_2 && get_rank(pos->white_king)==RANK_1) {
            score += rook_on_7th;
            score += eval_connected_major_on_7th(pos,sq,wtm);
        }
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movl $0x0, -0x14(%rbp)
testb $0x1, -0xd(%rbp)
je 0x69f9
movl -0xc(%rbp), %edi
callq 0x120d0
cmpl $0x1, %eax
jne 0x69f7
movq -0x8(%rbp), %rax
movl 0x150(%rax), %edi
callq 0x120d0
cmpl $0x0, %eax
jne 0x69f7
movl -0x14(%rbp), %eax
addl $0x32, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movb -0xd(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x68e0
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x6a3f
movl -0xc(%rbp), %edi
callq 0x120d0
cmpl $0x6, %eax
jne 0x6a3d
movq -0x8(%rbp), %rax
movl 0x14c(%rax), %edi
callq 0x120d0
cmpl $0x7, %eax
jne 0x6a3d
movl -0x14(%rbp), %eax
addl $0x32, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movb -0xd(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x68e0
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x6a3f
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: jswaff[P]prophet3/src/eval.cpp
// Function: eval_knights(position*)
int32 eval_knights(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_knights;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_knight(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_knights;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_knight(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x168(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6ab6
movq -0x18(%rbp), %rdi
callq 0x4a00
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0x6b20
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0xfebc8(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
xorq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x6a72
movq -0x8(%rbp), %rax
movq 0x170(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6b0a
movq -0x18(%rbp), %rdi
callq 0x4870
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
xorl %edx, %edx
callq 0x6b20
movl %eax, %ecx
movl -0xc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %ecx
leaq 0xfeb74(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
xorq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x6ac5
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jswaff[P]prophet3/src/eval.cpp
// Function: eval_knight(position*, square_t, bool)
int32 eval_knight(position *p,square_t sq,bool wtm) {
    int score;
    if (wtm) {
        score = knight_pst[sq];
        score += knight_tropism * distance(sq,p->black_king);
    } else {
        score = knight_pst[fliprank[sq]];
        score += knight_tropism * distance(sq,p->white_king);
    }
    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
testb $0x1, -0xd(%rbp)
je 0x6b6e
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x2ec58(%rip), %rax     # 0x357a0
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %edi
movq -0x8(%rbp), %rax
movl 0x150(%rax), %esi
callq 0x12350
imull $0xfffffffe, %eax, %eax # imm = 0xFFFFFFFE
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x6ba9
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x2ed26(%rip), %rax     # 0x358a0
movslq (%rax,%rcx,4), %rcx
leaq 0x2ec1b(%rip), %rax     # 0x357a0
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %edi
movq -0x8(%rbp), %rax
movl 0x14c(%rax), %esi
callq 0x12350
imull $0xfffffffe, %eax, %eax # imm = 0xFFFFFFFE
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jswaff[P]prophet3/src/eval.cpp
// Function: eval_bishops(position*)
int32 eval_bishops(position *p) {
    int32 score = 0;

    uint64 pmap = p->white_bishops;
    while (pmap) {
        square_t sq = (square_t)get_msb(pmap);
        score += eval_bishop(p,sq,true);
        pmap ^= bb_squares[sq];
    }

    pmap = p->black_bishops;
    while (pmap) {
        square_t sq = (square_t)get_lsb(pmap);
        score -= eval_bishop(p,sq,false);
        pmap ^= bb_squares[sq];
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x178(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6c26
movq -0x18(%rbp), %rdi
callq 0x4a00
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0x6c90
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0xfea58(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
xorq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x6be2
movq -0x8(%rbp), %rax
movq 0x180(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6c7a
movq -0x18(%rbp), %rdi
callq 0x4870
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
xorl %edx, %edx
callq 0x6c90
movl %eax, %ecx
movl -0xc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %ecx
leaq 0xfea04(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
xorq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x6c35
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)