// File: /workspace/github_cpp_makefile_star2_O1/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 0xaa43
cmpl $0x4, 0xe0(%rbx)
jne 0x218f1
cmpl $0x2, 0xec(%rsp)
jne 0x21910
cmpl $0x3, 0xf0(%rsp)
jne 0x2192f
cmpl $0x5, 0xf4(%rsp)
jne 0x2194e
cmpl $0x6, 0xf8(%rsp)
jne 0x2196d
cmpl $0x3, 0xfc(%rsp)
jne 0x2198c
cmpl $0x2, 0x100(%rsp)
jne 0x219ab
cmpl $0x4, 0x104(%rsp)
jne 0x219ca
cmpl $-0x4, 0x8(%rsp)
jne 0x219e9
cmpl $-0x2, 0xc(%rsp)
jne 0x21a08
cmpl $-0x3, 0x10(%rsp)
jne 0x21a27
cmpl $-0x5, 0x14(%rsp)
jne 0x21a46
cmpl $-0x6, 0x18(%rsp)
jne 0x21a65
cmpl $-0x3, 0x1c(%rsp)
jne 0x21a84
cmpl $-0x2, 0x20(%rsp)
jne 0x21aa3
cmpl $-0x4, 0x24(%rsp)
jne 0x21ac2
xorl %ebx, %ebx
leaq 0x13e9c(%rip), %r14     # 0x35628
movl 0x8(%rsp,%rbx,4), %ebp
movl %ebx, %edi
callq 0xca75
cmpl $0x7, %eax
ja 0x218d2
movl %eax, %eax
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
testl %ebp, %ebp
jne 0x21894
incq %rbx
cmpq $0x40, %rbx
jne 0x2178c
jmp 0x217ec
cmpl $-0x1, %ebp
je 0x217b3
jmp 0x218b3
cmpl $0x1, %ebp
je 0x217b3
leaq 0x14038(%rip), %rdi     # 0x3580c
leaq 0x13ead(%rip), %rsi     # 0x35688
leaq 0x13eb9(%rip), %rcx     # 0x3569b
movl $0x2f, %edx
callq 0x20d0
cmpl $0x1, 0x140(%rsp)
jne 0x21ae1
cmpl $0x40, 0x144(%rsp)
jne 0x21b00
leaq 0x8(%rsp), %rdi
callq 0xa966
testb %al, %al
je 0x21b1f
leaq 0x8(%rsp), %rdi
callq 0xa96f
testb %al, %al
je 0x21b3e
leaq 0x8(%rsp), %rdi
callq 0xa97a
testb %al, %al
je 0x21b5d
leaq 0x8(%rsp), %rdi
callq 0xa986
testb %al, %al
je 0x21b7c
cmpl $0x0, 0x14c(%rsp)
jne 0x21b9b
cmpl $0x0, 0x150(%rsp)
jne 0x21bba
cmpl $0x3c, 0x154(%rsp)
jne 0x21bd9
cmpl $0x4, 0x158(%rsp)
jne 0x21bf8
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x13f65(%rip), %rdi     # 0x35800
leaq 0x13de6(%rip), %rsi     # 0x35688
leaq 0x13df2(%rip), %rcx     # 0x3569b
movl $0x2d, %edx
callq 0x20d0
leaq 0x13f3d(%rip), %rdi     # 0x357f7
leaq 0x13dc7(%rip), %rsi     # 0x35688
leaq 0x13dd3(%rip), %rcx     # 0x3569b
movl $0x2a, %edx
callq 0x20d0
leaq 0xba27(%rip), %rdi      # 0x2d300
leaq 0x13da8(%rip), %rsi     # 0x35688
leaq 0x13db4(%rip), %rcx     # 0x3569b
movl $0x32, %edx
callq 0x20d0
leaq 0x13d7c(%rip), %rdi     # 0x35674
leaq 0x13d89(%rip), %rsi     # 0x35688
leaq 0x13d95(%rip), %rcx     # 0x3569b
movl $0x12, %edx
callq 0x20d0
leaq 0x13d9a(%rip), %rdi     # 0x356b1
leaq 0x13d6a(%rip), %rsi     # 0x35688
leaq 0x13d76(%rip), %rcx     # 0x3569b
movl $0x13, %edx
callq 0x20d0
leaq 0x13d91(%rip), %rdi     # 0x356c7
leaq 0x13d4b(%rip), %rsi     # 0x35688
leaq 0x13d57(%rip), %rcx     # 0x3569b
movl $0x14, %edx
callq 0x20d0
leaq 0x13d88(%rip), %rdi     # 0x356dd
leaq 0x13d2c(%rip), %rsi     # 0x35688
leaq 0x13d38(%rip), %rcx     # 0x3569b
movl $0x15, %edx
callq 0x20d0
leaq 0x13d7e(%rip), %rdi     # 0x356f2
leaq 0x13d0d(%rip), %rsi     # 0x35688
leaq 0x13d19(%rip), %rcx     # 0x3569b
movl $0x16, %edx
callq 0x20d0
leaq 0x13d73(%rip), %rdi     # 0x35706
leaq 0x13cee(%rip), %rsi     # 0x35688
leaq 0x13cfa(%rip), %rcx     # 0x3569b
movl $0x17, %edx
callq 0x20d0
leaq 0x13d6a(%rip), %rdi     # 0x3571c
leaq 0x13ccf(%rip), %rsi     # 0x35688
leaq 0x13cdb(%rip), %rcx     # 0x3569b
movl $0x18, %edx
callq 0x20d0
leaq 0x13d61(%rip), %rdi     # 0x35732
leaq 0x13cb0(%rip), %rsi     # 0x35688
leaq 0x13cbc(%rip), %rcx     # 0x3569b
movl $0x19, %edx
callq 0x20d0
leaq 0x13d56(%rip), %rdi     # 0x35746
leaq 0x13c91(%rip), %rsi     # 0x35688
leaq 0x13c9d(%rip), %rcx     # 0x3569b
movl $0x1c, %edx
callq 0x20d0
leaq 0x13d4c(%rip), %rdi     # 0x3575b
leaq 0x13c72(%rip), %rsi     # 0x35688
leaq 0x13c7e(%rip), %rcx     # 0x3569b
movl $0x1d, %edx
callq 0x20d0
leaq 0x13d44(%rip), %rdi     # 0x35772
leaq 0x13c53(%rip), %rsi     # 0x35688
leaq 0x13c5f(%rip), %rcx     # 0x3569b
movl $0x1e, %edx
callq 0x20d0
leaq 0x13d3c(%rip), %rdi     # 0x35789
leaq 0x13c34(%rip), %rsi     # 0x35688
leaq 0x13c40(%rip), %rcx     # 0x3569b
movl $0x1f, %edx
callq 0x20d0
leaq 0x13d33(%rip), %rdi     # 0x3579f
leaq 0x13c15(%rip), %rsi     # 0x35688
leaq 0x13c21(%rip), %rcx     # 0x3569b
movl $0x20, %edx
callq 0x20d0
leaq 0x13d29(%rip), %rdi     # 0x357b4
leaq 0x13bf6(%rip), %rsi     # 0x35688
leaq 0x13c02(%rip), %rcx     # 0x3569b
movl $0x21, %edx
callq 0x20d0
leaq 0x13d21(%rip), %rdi     # 0x357cb
leaq 0x13bd7(%rip), %rsi     # 0x35688
leaq 0x13be3(%rip), %rcx     # 0x3569b
movl $0x22, %edx
callq 0x20d0
leaq 0x13d19(%rip), %rdi     # 0x357e2
leaq 0x13bb8(%rip), %rsi     # 0x35688
leaq 0x13bc4(%rip), %rcx     # 0x3569b
movl $0x23, %edx
callq 0x20d0
leaq 0x13d2c(%rip), %rdi     # 0x35814
leaq 0x13b99(%rip), %rsi     # 0x35688
leaq 0x13ba5(%rip), %rcx     # 0x3569b
movl $0x36, %edx
callq 0x20d0
leaq 0x13d1f(%rip), %rdi     # 0x35826
leaq 0x13b7a(%rip), %rsi     # 0x35688
leaq 0x13b86(%rip), %rcx     # 0x3569b
movl $0x37, %edx
callq 0x20d0
leaq 0x1441f(%rip), %rdi     # 0x35f45
leaq 0x13b5b(%rip), %rsi     # 0x35688
leaq 0x13b67(%rip), %rcx     # 0x3569b
movl $0x38, %edx
callq 0x20d0
leaq 0x1437c(%rip), %rdi     # 0x35ec1
leaq 0x13b3c(%rip), %rsi     # 0x35688
leaq 0x13b48(%rip), %rcx     # 0x3569b
movl $0x39, %edx
callq 0x20d0
leaq 0x14387(%rip), %rdi     # 0x35eeb
leaq 0x13b1d(%rip), %rsi     # 0x35688
leaq 0x13b29(%rip), %rcx     # 0x3569b
movl $0x3a, %edx
callq 0x20d0
leaq 0x14353(%rip), %rdi     # 0x35ed6
leaq 0x13afe(%rip), %rsi     # 0x35688
leaq 0x13b0a(%rip), %rcx     # 0x3569b
movl $0x3b, %edx
callq 0x20d0
leaq 0x13c99(%rip), %rdi     # 0x3583b
leaq 0x13adf(%rip), %rsi     # 0x35688
leaq 0x13aeb(%rip), %rcx     # 0x3569b
movl $0x3c, %edx
callq 0x20d0
leaq 0x13c8e(%rip), %rdi     # 0x3584f
leaq 0x13ac0(%rip), %rsi     # 0x35688
leaq 0x13acc(%rip), %rcx     # 0x3569b
movl $0x3d, %edx
callq 0x20d0
leaq 0x13c84(%rip), %rdi     # 0x35864
leaq 0x13aa1(%rip), %rsi     # 0x35688
leaq 0x13aad(%rip), %rcx     # 0x3569b
movl $0x3e, %edx
callq 0x20d0
leaq 0x13c78(%rip), %rdi     # 0x35877
leaq 0x13a82(%rip), %rsi     # 0x35688
leaq 0x13a8e(%rip), %rcx     # 0x3569b
movl $0x3f, %edx
callq 0x20d0