// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/test/pos__test.cpp
// Function: test_reset_pos()
void test_reset_pos() {
    position pos;
    reset_pos(&pos);

    // first rank (white)
    assert(pos.piece[A1]==ROOK);
    assert(pos.piece[B1]==KNIGHT);
    assert(pos.piece[C1]==BISHOP);
    assert(pos.piece[D1]==QUEEN);
    assert(pos.piece[E1]==KING);
    assert(pos.piece[F1]==BISHOP);
    assert(pos.piece[G1]==KNIGHT);
    assert(pos.piece[H1]==ROOK);

    // back rank (black)
    assert(pos.piece[A8]==-ROOK);
    assert(pos.piece[B8]==-KNIGHT);
    assert(pos.piece[C8]==-BISHOP);
    assert(pos.piece[D8]==-QUEEN);
    assert(pos.piece[E8]==-KING);
    assert(pos.piece[F8]==-BISHOP);
    assert(pos.piece[G8]==-KNIGHT);
    assert(pos.piece[H8]==-ROOK);

    for (int32 sq=A8;sq<=H1;sq++) {
        int32 p = pos.piece[sq];
        rank_t r = get_rank((square_t)sq);
        if (r==RANK_8) { ;
        } else if (r==RANK_7) {
            assert(p==-PAWN);
        } else if (r==RANK_6  || r==RANK_5
                || r==RANK_4 || r==RANK_3) {
            assert(p==NO_PIECE);
        } else if (r==RANK_2) {
            assert(p==PAWN);
        } else if (r==RANK_1) { ;
        } else {
            assert(false);
        }
    }

    assert(pos.player==WHITE);
    assert(pos.ep_sq==NO_SQUARE);
    assert(can_castle_wk(&pos));
    assert(can_castle_wq(&pos));
    assert(can_castle_bk(&pos));
    assert(can_castle_bq(&pos));
    assert(pos.move_counter==0);
    assert(pos.fifty_counter==0);
    assert(pos.white_king==E1);
    assert(pos.black_king==E8);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa187
cmpl $0x4, 0xe0(%rbx)
jne 0x1f83d
cmpl $0x2, 0xec(%rsp)
jne 0x1f859
cmpl $0x3, 0xf0(%rsp)
jne 0x1f875
cmpl $0x5, 0xf4(%rsp)
jne 0x1f891
cmpl $0x6, 0xf8(%rsp)
jne 0x1f8ad
cmpl $0x3, 0xfc(%rsp)
jne 0x1f8c9
cmpl $0x2, 0x100(%rsp)
jne 0x1f8e5
cmpl $0x4, 0x104(%rsp)
jne 0x1f901
cmpl $-0x4, 0x8(%rsp)
jne 0x1f91d
cmpl $-0x2, 0xc(%rsp)
jne 0x1f939
cmpl $-0x3, 0x10(%rsp)
jne 0x1f955
cmpl $-0x5, 0x14(%rsp)
jne 0x1f971
cmpl $-0x6, 0x18(%rsp)
jne 0x1f98d
cmpl $-0x3, 0x1c(%rsp)
jne 0x1f9a9
cmpl $-0x2, 0x20(%rsp)
jne 0x1f9c5
cmpl $-0x4, 0x24(%rsp)
jne 0x1f9e1
xorl %ebx, %ebx
leaq 0x14088(%rip), %r14     # 0x3376c
cmpq $0x40, %rbx
je 0x1f741
movl 0x8(%rsp,%rbx,4), %ebp
movl %ebx, %edi
callq 0xc001
cmpl $0x7, %eax
ja 0x1f821
movl %eax, %eax
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
testl %ebp, %ebp
jne 0x1f7e9
incq %rbx
jmp 0x1f6e4
cmpl $-0x1, %ebp
je 0x1f711
jmp 0x1f805
cmpl $0x1, %ebp
je 0x1f711
leaq 0x14224(%rip), %rdi     # 0x33950
leaq 0x14099(%rip), %rsi     # 0x337cc
leaq 0x140a5(%rip), %rcx     # 0x337df
pushq $0x2f
jmp 0x1fb01
cmpl $0x1, 0x140(%rsp)
jne 0x1f9fd
cmpl $0x40, 0x144(%rsp)
jne 0x1fa19
leaq 0x8(%rsp), %rdi
callq 0xa0ba
testb %al, %al
je 0x1fa35
leaq 0x8(%rsp), %rdi
callq 0xa0c3
testb %al, %al
je 0x1fa51
leaq 0x8(%rsp), %rdi
callq 0xa0ce
testb %al, %al
je 0x1fa6d
leaq 0x8(%rsp), %rdi
callq 0xa0da
testb %al, %al
je 0x1fa86
cmpl $0x0, 0x14c(%rsp)
jne 0x1fa9f
cmpl $0x0, 0x150(%rsp)
jne 0x1fab8
cmpl $0x3c, 0x154(%rsp)
jne 0x1fad1
cmpl $0x4, 0x158(%rsp)
jne 0x1faea
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x14154(%rip), %rdi     # 0x33944
leaq 0x13fd5(%rip), %rsi     # 0x337cc
leaq 0x13fe1(%rip), %rcx     # 0x337df
pushq $0x2d
jmp 0x1fb01
leaq 0x1412f(%rip), %rdi     # 0x3393b
leaq 0x13fb9(%rip), %rsi     # 0x337cc
leaq 0x13fc5(%rip), %rcx     # 0x337df
pushq $0x2a
jmp 0x1fb01
leaq 0xbb08(%rip), %rdi      # 0x2b330
leaq 0x13f9d(%rip), %rsi     # 0x337cc
leaq 0x13fa9(%rip), %rcx     # 0x337df
pushq $0x32
jmp 0x1fb01
leaq 0x13f74(%rip), %rdi     # 0x337b8
leaq 0x13f81(%rip), %rsi     # 0x337cc
leaq 0x13f8d(%rip), %rcx     # 0x337df
pushq $0x12
jmp 0x1fb01
leaq 0x13f95(%rip), %rdi     # 0x337f5
leaq 0x13f65(%rip), %rsi     # 0x337cc
leaq 0x13f71(%rip), %rcx     # 0x337df
pushq $0x13
jmp 0x1fb01
leaq 0x13f8f(%rip), %rdi     # 0x3380b
leaq 0x13f49(%rip), %rsi     # 0x337cc
leaq 0x13f55(%rip), %rcx     # 0x337df
pushq $0x14
jmp 0x1fb01
leaq 0x13f89(%rip), %rdi     # 0x33821
leaq 0x13f2d(%rip), %rsi     # 0x337cc
leaq 0x13f39(%rip), %rcx     # 0x337df
pushq $0x15
jmp 0x1fb01
leaq 0x13f82(%rip), %rdi     # 0x33836
leaq 0x13f11(%rip), %rsi     # 0x337cc
leaq 0x13f1d(%rip), %rcx     # 0x337df
pushq $0x16
jmp 0x1fb01
leaq 0x13f7a(%rip), %rdi     # 0x3384a
leaq 0x13ef5(%rip), %rsi     # 0x337cc
leaq 0x13f01(%rip), %rcx     # 0x337df
pushq $0x17
jmp 0x1fb01
leaq 0x13f74(%rip), %rdi     # 0x33860
leaq 0x13ed9(%rip), %rsi     # 0x337cc
leaq 0x13ee5(%rip), %rcx     # 0x337df
pushq $0x18
jmp 0x1fb01
leaq 0x13f6e(%rip), %rdi     # 0x33876
leaq 0x13ebd(%rip), %rsi     # 0x337cc
leaq 0x13ec9(%rip), %rcx     # 0x337df
pushq $0x19
jmp 0x1fb01
leaq 0x13f66(%rip), %rdi     # 0x3388a
leaq 0x13ea1(%rip), %rsi     # 0x337cc
leaq 0x13ead(%rip), %rcx     # 0x337df
pushq $0x1c
jmp 0x1fb01
leaq 0x13f5f(%rip), %rdi     # 0x3389f
leaq 0x13e85(%rip), %rsi     # 0x337cc
leaq 0x13e91(%rip), %rcx     # 0x337df
pushq $0x1d
jmp 0x1fb01
leaq 0x13f5a(%rip), %rdi     # 0x338b6
leaq 0x13e69(%rip), %rsi     # 0x337cc
leaq 0x13e75(%rip), %rcx     # 0x337df
pushq $0x1e
jmp 0x1fb01
leaq 0x13f55(%rip), %rdi     # 0x338cd
leaq 0x13e4d(%rip), %rsi     # 0x337cc
leaq 0x13e59(%rip), %rcx     # 0x337df
pushq $0x1f
jmp 0x1fb01
leaq 0x13f4f(%rip), %rdi     # 0x338e3
leaq 0x13e31(%rip), %rsi     # 0x337cc
leaq 0x13e3d(%rip), %rcx     # 0x337df
pushq $0x20
jmp 0x1fb01
leaq 0x13f48(%rip), %rdi     # 0x338f8
leaq 0x13e15(%rip), %rsi     # 0x337cc
leaq 0x13e21(%rip), %rcx     # 0x337df
pushq $0x21
jmp 0x1fb01
leaq 0x13f43(%rip), %rdi     # 0x3390f
leaq 0x13df9(%rip), %rsi     # 0x337cc
leaq 0x13e05(%rip), %rcx     # 0x337df
pushq $0x22
jmp 0x1fb01
leaq 0x13f3e(%rip), %rdi     # 0x33926
leaq 0x13ddd(%rip), %rsi     # 0x337cc
leaq 0x13de9(%rip), %rcx     # 0x337df
pushq $0x23
jmp 0x1fb01
leaq 0x13f54(%rip), %rdi     # 0x33958
leaq 0x13dc1(%rip), %rsi     # 0x337cc
leaq 0x13dcd(%rip), %rcx     # 0x337df
pushq $0x36
jmp 0x1fb01
leaq 0x13f4a(%rip), %rdi     # 0x3396a
leaq 0x13da5(%rip), %rsi     # 0x337cc
leaq 0x13db1(%rip), %rcx     # 0x337df
pushq $0x37
jmp 0x1fb01
leaq 0x1464d(%rip), %rdi     # 0x34089
leaq 0x13d89(%rip), %rsi     # 0x337cc
leaq 0x13d95(%rip), %rcx     # 0x337df
pushq $0x38
jmp 0x1fb01
leaq 0x145ad(%rip), %rdi     # 0x34005
leaq 0x13d6d(%rip), %rsi     # 0x337cc
leaq 0x13d79(%rip), %rcx     # 0x337df
pushq $0x39
jmp 0x1fb01
leaq 0x145bb(%rip), %rdi     # 0x3402f
leaq 0x13d51(%rip), %rsi     # 0x337cc
leaq 0x13d5d(%rip), %rcx     # 0x337df
pushq $0x3a
jmp 0x1fb01
leaq 0x1458d(%rip), %rdi     # 0x3401a
leaq 0x13d38(%rip), %rsi     # 0x337cc
leaq 0x13d44(%rip), %rcx     # 0x337df
pushq $0x3b
jmp 0x1fb01
leaq 0x13ed9(%rip), %rdi     # 0x3397f
leaq 0x13d1f(%rip), %rsi     # 0x337cc
leaq 0x13d2b(%rip), %rcx     # 0x337df
pushq $0x3c
jmp 0x1fb01
leaq 0x13ed4(%rip), %rdi     # 0x33993
leaq 0x13d06(%rip), %rsi     # 0x337cc
leaq 0x13d12(%rip), %rcx     # 0x337df
pushq $0x3d
jmp 0x1fb01
leaq 0x13ed0(%rip), %rdi     # 0x339a8
leaq 0x13ced(%rip), %rsi     # 0x337cc
leaq 0x13cf9(%rip), %rcx     # 0x337df
pushq $0x3e
jmp 0x1fb01
leaq 0x13eca(%rip), %rdi     # 0x339bb
leaq 0x13cd4(%rip), %rsi     # 0x337cc
leaq 0x13ce0(%rip), %rcx     # 0x337df
pushq $0x3f
popq %rdx
callq 0x20c0