// File: /workspace/github_cpp_makefile_star2_O3/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 0xaa51
cmpl $0x4, 0xe0(%rbx)
jne 0x21771
cmpl $0x2, 0xec(%rsp)
jne 0x21790
cmpl $0x3, 0xf0(%rsp)
jne 0x217af
cmpl $0x5, 0xf4(%rsp)
jne 0x217ce
cmpl $0x6, 0xf8(%rsp)
jne 0x217ed
cmpl $0x3, 0xfc(%rsp)
jne 0x2180c
cmpl $0x2, 0x100(%rsp)
jne 0x2182b
cmpl $0x4, 0x104(%rsp)
jne 0x2184a
cmpl $-0x4, 0x8(%rsp)
jne 0x21869
cmpl $-0x2, 0xc(%rsp)
jne 0x21888
cmpl $-0x3, 0x10(%rsp)
jne 0x218a7
cmpl $-0x5, 0x14(%rsp)
jne 0x218c6
cmpl $-0x6, 0x18(%rsp)
jne 0x218e5
cmpl $-0x3, 0x1c(%rsp)
jne 0x21904
cmpl $-0x2, 0x20(%rsp)
jne 0x21923
cmpl $-0x4, 0x24(%rsp)
jne 0x21942
xorl %ebx, %ebx
leaq 0x1409c(%rip), %r14     # 0x356a8
movl 0x8(%rsp,%rbx,4), %ebp
movl %ebx, %edi
callq 0xca69
cmpl $0x7, %eax
ja 0x21752
movl %eax, %eax
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
testl %ebp, %ebp
jne 0x21714
incq %rbx
cmpq $0x40, %rbx
jne 0x2160c
jmp 0x2166c
cmpl $-0x1, %ebp
je 0x21633
jmp 0x21733
cmpl $0x1, %ebp
je 0x21633
leaq 0x14238(%rip), %rdi     # 0x3588c
leaq 0x140ad(%rip), %rsi     # 0x35708
leaq 0x140b9(%rip), %rcx     # 0x3571b
movl $0x2f, %edx
callq 0x20d0
cmpl $0x1, 0x140(%rsp)
jne 0x21961
cmpl $0x40, 0x144(%rsp)
jne 0x21980
leaq 0x8(%rsp), %rdi
callq 0xa921
testb %al, %al
je 0x2199f
leaq 0x8(%rsp), %rdi
callq 0xa92a
testb %al, %al
je 0x219be
leaq 0x8(%rsp), %rdi
callq 0xa935
testb %al, %al
je 0x219dd
leaq 0x8(%rsp), %rdi
callq 0xa941
testb %al, %al
je 0x219fc
cmpl $0x0, 0x14c(%rsp)
jne 0x21a1b
cmpl $0x0, 0x150(%rsp)
jne 0x21a3a
cmpl $0x3c, 0x154(%rsp)
jne 0x21a59
cmpl $0x4, 0x158(%rsp)
jne 0x21a78
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x14165(%rip), %rdi     # 0x35880
leaq 0x13fe6(%rip), %rsi     # 0x35708
leaq 0x13ff2(%rip), %rcx     # 0x3571b
movl $0x2d, %edx
callq 0x20d0
leaq 0x1413d(%rip), %rdi     # 0x35877
leaq 0x13fc7(%rip), %rsi     # 0x35708
leaq 0x13fd3(%rip), %rcx     # 0x3571b
movl $0x2a, %edx
callq 0x20d0
leaq 0xbc27(%rip), %rdi      # 0x2d380
leaq 0x13fa8(%rip), %rsi     # 0x35708
leaq 0x13fb4(%rip), %rcx     # 0x3571b
movl $0x32, %edx
callq 0x20d0
leaq 0x13f7c(%rip), %rdi     # 0x356f4
leaq 0x13f89(%rip), %rsi     # 0x35708
leaq 0x13f95(%rip), %rcx     # 0x3571b
movl $0x12, %edx
callq 0x20d0
leaq 0x13f9a(%rip), %rdi     # 0x35731
leaq 0x13f6a(%rip), %rsi     # 0x35708
leaq 0x13f76(%rip), %rcx     # 0x3571b
movl $0x13, %edx
callq 0x20d0
leaq 0x13f91(%rip), %rdi     # 0x35747
leaq 0x13f4b(%rip), %rsi     # 0x35708
leaq 0x13f57(%rip), %rcx     # 0x3571b
movl $0x14, %edx
callq 0x20d0
leaq 0x13f88(%rip), %rdi     # 0x3575d
leaq 0x13f2c(%rip), %rsi     # 0x35708
leaq 0x13f38(%rip), %rcx     # 0x3571b
movl $0x15, %edx
callq 0x20d0
leaq 0x13f7e(%rip), %rdi     # 0x35772
leaq 0x13f0d(%rip), %rsi     # 0x35708
leaq 0x13f19(%rip), %rcx     # 0x3571b
movl $0x16, %edx
callq 0x20d0
leaq 0x13f73(%rip), %rdi     # 0x35786
leaq 0x13eee(%rip), %rsi     # 0x35708
leaq 0x13efa(%rip), %rcx     # 0x3571b
movl $0x17, %edx
callq 0x20d0
leaq 0x13f6a(%rip), %rdi     # 0x3579c
leaq 0x13ecf(%rip), %rsi     # 0x35708
leaq 0x13edb(%rip), %rcx     # 0x3571b
movl $0x18, %edx
callq 0x20d0
leaq 0x13f61(%rip), %rdi     # 0x357b2
leaq 0x13eb0(%rip), %rsi     # 0x35708
leaq 0x13ebc(%rip), %rcx     # 0x3571b
movl $0x19, %edx
callq 0x20d0
leaq 0x13f56(%rip), %rdi     # 0x357c6
leaq 0x13e91(%rip), %rsi     # 0x35708
leaq 0x13e9d(%rip), %rcx     # 0x3571b
movl $0x1c, %edx
callq 0x20d0
leaq 0x13f4c(%rip), %rdi     # 0x357db
leaq 0x13e72(%rip), %rsi     # 0x35708
leaq 0x13e7e(%rip), %rcx     # 0x3571b
movl $0x1d, %edx
callq 0x20d0
leaq 0x13f44(%rip), %rdi     # 0x357f2
leaq 0x13e53(%rip), %rsi     # 0x35708
leaq 0x13e5f(%rip), %rcx     # 0x3571b
movl $0x1e, %edx
callq 0x20d0
leaq 0x13f3c(%rip), %rdi     # 0x35809
leaq 0x13e34(%rip), %rsi     # 0x35708
leaq 0x13e40(%rip), %rcx     # 0x3571b
movl $0x1f, %edx
callq 0x20d0
leaq 0x13f33(%rip), %rdi     # 0x3581f
leaq 0x13e15(%rip), %rsi     # 0x35708
leaq 0x13e21(%rip), %rcx     # 0x3571b
movl $0x20, %edx
callq 0x20d0
leaq 0x13f29(%rip), %rdi     # 0x35834
leaq 0x13df6(%rip), %rsi     # 0x35708
leaq 0x13e02(%rip), %rcx     # 0x3571b
movl $0x21, %edx
callq 0x20d0
leaq 0x13f21(%rip), %rdi     # 0x3584b
leaq 0x13dd7(%rip), %rsi     # 0x35708
leaq 0x13de3(%rip), %rcx     # 0x3571b
movl $0x22, %edx
callq 0x20d0
leaq 0x13f19(%rip), %rdi     # 0x35862
leaq 0x13db8(%rip), %rsi     # 0x35708
leaq 0x13dc4(%rip), %rcx     # 0x3571b
movl $0x23, %edx
callq 0x20d0
leaq 0x13f2c(%rip), %rdi     # 0x35894
leaq 0x13d99(%rip), %rsi     # 0x35708
leaq 0x13da5(%rip), %rcx     # 0x3571b
movl $0x36, %edx
callq 0x20d0
leaq 0x13f1f(%rip), %rdi     # 0x358a6
leaq 0x13d7a(%rip), %rsi     # 0x35708
leaq 0x13d86(%rip), %rcx     # 0x3571b
movl $0x37, %edx
callq 0x20d0
leaq 0x1461f(%rip), %rdi     # 0x35fc5
leaq 0x13d5b(%rip), %rsi     # 0x35708
leaq 0x13d67(%rip), %rcx     # 0x3571b
movl $0x38, %edx
callq 0x20d0
leaq 0x1457c(%rip), %rdi     # 0x35f41
leaq 0x13d3c(%rip), %rsi     # 0x35708
leaq 0x13d48(%rip), %rcx     # 0x3571b
movl $0x39, %edx
callq 0x20d0
leaq 0x14587(%rip), %rdi     # 0x35f6b
leaq 0x13d1d(%rip), %rsi     # 0x35708
leaq 0x13d29(%rip), %rcx     # 0x3571b
movl $0x3a, %edx
callq 0x20d0
leaq 0x14553(%rip), %rdi     # 0x35f56
leaq 0x13cfe(%rip), %rsi     # 0x35708
leaq 0x13d0a(%rip), %rcx     # 0x3571b
movl $0x3b, %edx
callq 0x20d0
leaq 0x13e99(%rip), %rdi     # 0x358bb
leaq 0x13cdf(%rip), %rsi     # 0x35708
leaq 0x13ceb(%rip), %rcx     # 0x3571b
movl $0x3c, %edx
callq 0x20d0
leaq 0x13e8e(%rip), %rdi     # 0x358cf
leaq 0x13cc0(%rip), %rsi     # 0x35708
leaq 0x13ccc(%rip), %rcx     # 0x3571b
movl $0x3d, %edx
callq 0x20d0
leaq 0x13e84(%rip), %rdi     # 0x358e4
leaq 0x13ca1(%rip), %rsi     # 0x35708
leaq 0x13cad(%rip), %rcx     # 0x3571b
movl $0x3e, %edx
callq 0x20d0
leaq 0x13e78(%rip), %rdi     # 0x358f7
leaq 0x13c82(%rip), %rsi     # 0x35708
leaq 0x13c8e(%rip), %rcx     # 0x3571b
movl $0x3f, %edx
callq 0x20d0