// File: jswaff[P]prophet3/test/hash__test.cpp
// Function: test_pawn_store_and_probe()
void test_pawn_store_and_probe() {
    clear_hash_table(&phtbl);
    position pos;
    reset_pos(&pos);

    uint64 key = build_pawn_key(&pos);

    // shouldn't be anything
    uint64 val = get_hash_entry(&phtbl,key);
    assert(val==0);

    move mv = to_move(PAWN,E2,E4);
    store_hash_entry(&phtbl,key,build_pawn_hash_val(-100));
    val = get_hash_entry(&phtbl,key);
    assert(val > 0);
    assert(get_pawn_hash_entry_score(val)==-100);

    // now make move and reprobe
    apply_move(&pos,mv,gundos);
    uint64 key2 = build_pawn_key(&pos);
    uint64 val2 = get_hash_entry(&phtbl,key2);
    assert(val2==0);

    // finally undo and reprobe
    undo_last_move(&pos,gundos);
    key2 = build_pawn_key(&pos);
    assert(key==key2);
    val2 = get_hash_entry(&phtbl,key2);
    assert(val==val2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
leaq 0xe2f4e(%rip), %rdi     # 0x1030e0
callq 0x88c0
leaq -0x1c8(%rbp), %rdi
callq 0xf390
leaq -0x1c8(%rbp), %rdi
callq 0x83a0
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rsi
leaq 0xe2f1c(%rip), %rdi     # 0x1030e0
callq 0x8980
movq %rax, -0x1d8(%rbp)
cmpq $0x0, -0x1d8(%rbp)
jne 0x201dc
jmp 0x201fb
leaq 0x1e459(%rip), %rdi     # 0x3e63c
leaq 0x1e111(%rip), %rsi     # 0x3e2fb
movl $0x17d, %edx            # imm = 0x17D
leaq 0x1e4c1(%rip), %rcx     # 0x3e6b7
callq 0x20c0
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0xa830
movq %rax, -0x1e0(%rbp)
movq -0x1d0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movl $0xffffff9c, %edi       # imm = 0xFFFFFF9C
callq 0x8650
movq -0x1f8(%rbp), %rsi
movq %rax, %rdx
leaq 0xe2ea1(%rip), %rdi     # 0x1030e0
callq 0x8a50
movq -0x1d0(%rbp), %rsi
leaq 0xe2e8e(%rip), %rdi     # 0x1030e0
callq 0x8980
movq %rax, -0x1d8(%rbp)
cmpq $0x0, -0x1d8(%rbp)
jbe 0x2026a
jmp 0x20289
leaq 0x1506f(%rip), %rdi     # 0x352e0
leaq 0x1e083(%rip), %rsi     # 0x3e2fb
movl $0x182, %edx            # imm = 0x182
leaq 0x1e433(%rip), %rcx     # 0x3e6b7
callq 0x20c0
movq -0x1d8(%rbp), %rdi
callq 0x8790
cmpl $-0x64, %eax
jne 0x2029c
jmp 0x202bb
leaq 0x1e435(%rip), %rdi     # 0x3e6d8
leaq 0x1e051(%rip), %rsi     # 0x3e2fb
movl $0x183, %edx            # imm = 0x183
leaq 0x1e401(%rip), %rcx     # 0x3e6b7
callq 0x20c0
movq -0x1e0(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
leaq 0xb39e0(%rip), %rdx     # 0xd3cb0
callq 0x3620
leaq -0x1c8(%rbp), %rdi
callq 0x83a0
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rsi
leaq 0xe2dea(%rip), %rdi     # 0x1030e0
callq 0x8980
movq %rax, -0x1f0(%rbp)
cmpq $0x0, -0x1f0(%rbp)
jne 0x2030e
jmp 0x2032d
leaq 0x1e386(%rip), %rdi     # 0x3e69b
leaq 0x1dfdf(%rip), %rsi     # 0x3e2fb
movl $0x189, %edx            # imm = 0x189
leaq 0x1e38f(%rip), %rcx     # 0x3e6b7
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0xb3975(%rip), %rsi     # 0xd3cb0
callq 0x39a0
leaq -0x1c8(%rbp), %rdi
callq 0x83a0
movq %rax, -0x1e8(%rbp)
movq -0x1d0(%rbp), %rax
cmpq -0x1e8(%rbp), %rax
jne 0x20365
jmp 0x20384
leaq 0x1e337(%rip), %rdi     # 0x3e6a3
leaq 0x1df88(%rip), %rsi     # 0x3e2fb
movl $0x18e, %edx            # imm = 0x18E
leaq 0x1e338(%rip), %rcx     # 0x3e6b7
callq 0x20c0
movq -0x1e8(%rbp), %rsi
leaq 0xe2d4e(%rip), %rdi     # 0x1030e0
callq 0x8980
movq %rax, -0x1f0(%rbp)
movq -0x1d8(%rbp), %rax
cmpq -0x1f0(%rbp), %rax
jne 0x203b0
jmp 0x203cf
leaq 0x1e2f6(%rip), %rdi     # 0x3e6ad
leaq 0x1df3d(%rip), %rsi     # 0x3e2fb
movl $0x190, %edx            # imm = 0x190
leaq 0x1e2ed(%rip), %rcx     # 0x3e6b7
callq 0x20c0
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
nopl (%rax,%rax)