// File: 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
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
leaq -0x1c8(%rbp), %rdi
callq 0xf390
cmpl $0x4, -0xe8(%rbp)
jne 0x2c2b2
jmp 0x2c2d1
leaq 0x15c90(%rip), %rdi     # 0x41f49
leaq 0x15c9d(%rip), %rsi     # 0x41f5d
movl $0x12, %edx
leaq 0x15ca4(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x2, -0xe4(%rbp)
jne 0x2c2dc
jmp 0x2c2fb
leaq 0x15ca3(%rip), %rdi     # 0x41f86
leaq 0x15c73(%rip), %rsi     # 0x41f5d
movl $0x13, %edx
leaq 0x15c7a(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x3, -0xe0(%rbp)
jne 0x2c306
jmp 0x2c325
leaq 0x15c8f(%rip), %rdi     # 0x41f9c
leaq 0x15c49(%rip), %rsi     # 0x41f5d
movl $0x14, %edx
leaq 0x15c50(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x5, -0xdc(%rbp)
jne 0x2c330
jmp 0x2c34f
leaq 0x15c7b(%rip), %rdi     # 0x41fb2
leaq 0x15c1f(%rip), %rsi     # 0x41f5d
movl $0x15, %edx
leaq 0x15c26(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x6, -0xd8(%rbp)
jne 0x2c35a
jmp 0x2c379
leaq 0x15c66(%rip), %rdi     # 0x41fc7
leaq 0x15bf5(%rip), %rsi     # 0x41f5d
movl $0x16, %edx
leaq 0x15bfc(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x3, -0xd4(%rbp)
jne 0x2c384
jmp 0x2c3a3
leaq 0x15c50(%rip), %rdi     # 0x41fdb
leaq 0x15bcb(%rip), %rsi     # 0x41f5d
movl $0x17, %edx
leaq 0x15bd2(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x2, -0xd0(%rbp)
jne 0x2c3ae
jmp 0x2c3cd
leaq 0x15c3c(%rip), %rdi     # 0x41ff1
leaq 0x15ba1(%rip), %rsi     # 0x41f5d
movl $0x18, %edx
leaq 0x15ba8(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x4, -0xcc(%rbp)
jne 0x2c3d8
jmp 0x2c3f7
leaq 0x15c28(%rip), %rdi     # 0x42007
leaq 0x15b77(%rip), %rsi     # 0x41f5d
movl $0x19, %edx
leaq 0x15b7e(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x4, -0x1c8(%rbp)
jne 0x2c402
jmp 0x2c421
leaq 0x15c12(%rip), %rdi     # 0x4201b
leaq 0x15b4d(%rip), %rsi     # 0x41f5d
movl $0x1c, %edx
leaq 0x15b54(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x2, -0x1c4(%rbp)
jne 0x2c42c
jmp 0x2c44b
leaq 0x15bfd(%rip), %rdi     # 0x42030
leaq 0x15b23(%rip), %rsi     # 0x41f5d
movl $0x1d, %edx
leaq 0x15b2a(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x3, -0x1c0(%rbp)
jne 0x2c456
jmp 0x2c475
leaq 0x15bea(%rip), %rdi     # 0x42047
leaq 0x15af9(%rip), %rsi     # 0x41f5d
movl $0x1e, %edx
leaq 0x15b00(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x5, -0x1bc(%rbp)
jne 0x2c480
jmp 0x2c49f
leaq 0x15bd7(%rip), %rdi     # 0x4205e
leaq 0x15acf(%rip), %rsi     # 0x41f5d
movl $0x1f, %edx
leaq 0x15ad6(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x6, -0x1b8(%rbp)
jne 0x2c4aa
jmp 0x2c4c9
leaq 0x15bc3(%rip), %rdi     # 0x42074
leaq 0x15aa5(%rip), %rsi     # 0x41f5d
movl $0x20, %edx
leaq 0x15aac(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x3, -0x1b4(%rbp)
jne 0x2c4d4
jmp 0x2c4f3
leaq 0x15bae(%rip), %rdi     # 0x42089
leaq 0x15a7b(%rip), %rsi     # 0x41f5d
movl $0x21, %edx
leaq 0x15a82(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x2, -0x1b0(%rbp)
jne 0x2c4fe
jmp 0x2c51d
leaq 0x15b9b(%rip), %rdi     # 0x420a0
leaq 0x15a51(%rip), %rsi     # 0x41f5d
movl $0x22, %edx
leaq 0x15a58(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $-0x4, -0x1ac(%rbp)
jne 0x2c528
jmp 0x2c547
leaq 0x15b88(%rip), %rdi     # 0x420b7
leaq 0x15a27(%rip), %rsi     # 0x41f5d
movl $0x23, %edx
leaq 0x15a2e(%rip), %rcx     # 0x41f70
callq 0x20c0
movl $0x0, -0x1cc(%rbp)
cmpl $0x3f, -0x1cc(%rbp)
jg 0x2c696
movslq -0x1cc(%rbp), %rax
movl -0x1c8(%rbp,%rax,4), %eax
movl %eax, -0x1d0(%rbp)
movl -0x1cc(%rbp), %edi
callq 0x120d0
movl %eax, -0x1d4(%rbp)
cmpl $0x0, -0x1d4(%rbp)
jne 0x2c591
jmp 0x2c680
cmpl $0x1, -0x1d4(%rbp)
jne 0x2c5c9
cmpl $-0x1, -0x1d0(%rbp)
jne 0x2c5a5
jmp 0x2c5c4
leaq 0x15b20(%rip), %rdi     # 0x420cc
leaq 0x159aa(%rip), %rsi     # 0x41f5d
movl $0x2a, %edx
leaq 0x159b1(%rip), %rcx     # 0x41f70
callq 0x20c0
jmp 0x2c67e
cmpl $0x2, -0x1d4(%rbp)
je 0x2c5ed
cmpl $0x3, -0x1d4(%rbp)
je 0x2c5ed
cmpl $0x4, -0x1d4(%rbp)
je 0x2c5ed
cmpl $0x5, -0x1d4(%rbp)
jne 0x2c619
cmpl $0x0, -0x1d0(%rbp)
jne 0x2c5f8
jmp 0x2c617
leaq 0x15ad6(%rip), %rdi     # 0x420d5
leaq 0x15957(%rip), %rsi     # 0x41f5d
movl $0x2d, %edx
leaq 0x1595e(%rip), %rcx     # 0x41f70
callq 0x20c0
jmp 0x2c67c
cmpl $0x6, -0x1d4(%rbp)
jne 0x2c64e
cmpl $0x1, -0x1d0(%rbp)
jne 0x2c62d
jmp 0x2c64c
leaq 0x15aad(%rip), %rdi     # 0x420e1
leaq 0x15922(%rip), %rsi     # 0x41f5d
movl $0x2f, %edx
leaq 0x15929(%rip), %rcx     # 0x41f70
callq 0x20c0
jmp 0x2c67a
cmpl $0x7, -0x1d4(%rbp)
jne 0x2c659
jmp 0x2c678
leaq 0xcb18(%rip), %rdi      # 0x39178
leaq 0x158f6(%rip), %rsi     # 0x41f5d
movl $0x32, %edx
leaq 0x158fd(%rip), %rcx     # 0x41f70
callq 0x20c0
jmp 0x2c67a
jmp 0x2c67c
jmp 0x2c67e
jmp 0x2c680
jmp 0x2c682
movl -0x1cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1cc(%rbp)
jmp 0x2c551
cmpl $0x1, -0x90(%rbp)
jne 0x2c6a1
jmp 0x2c6c0
leaq 0x15a41(%rip), %rdi     # 0x420e9
leaq 0x158ae(%rip), %rsi     # 0x41f5d
movl $0x36, %edx
leaq 0x158b5(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x40, -0x8c(%rbp)
jne 0x2c6cb
jmp 0x2c6ea
leaq 0x15a29(%rip), %rdi     # 0x420fb
leaq 0x15884(%rip), %rsi     # 0x41f5d
movl $0x37, %edx
leaq 0x1588b(%rip), %rcx     # 0x41f70
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf1e0
testb $0x1, %al
jne 0x2c6fc
jmp 0x2c6fe
jmp 0x2c71d
leaq 0x16115(%rip), %rdi     # 0x4281a
leaq 0x15851(%rip), %rsi     # 0x41f5d
movl $0x38, %edx
leaq 0x15858(%rip), %rcx     # 0x41f70
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf200
testb $0x1, %al
jne 0x2c72f
jmp 0x2c731
jmp 0x2c750
leaq 0x1605e(%rip), %rdi     # 0x42796
leaq 0x1581e(%rip), %rsi     # 0x41f5d
movl $0x39, %edx
leaq 0x15825(%rip), %rcx     # 0x41f70
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf220
testb $0x1, %al
jne 0x2c762
jmp 0x2c764
jmp 0x2c783
leaq 0x16055(%rip), %rdi     # 0x427c0
leaq 0x157eb(%rip), %rsi     # 0x41f5d
movl $0x3a, %edx
leaq 0x157f2(%rip), %rcx     # 0x41f70
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf240
testb $0x1, %al
jne 0x2c795
jmp 0x2c797
jmp 0x2c7b6
leaq 0x1600d(%rip), %rdi     # 0x427ab
leaq 0x157b8(%rip), %rsi     # 0x41f5d
movl $0x3b, %edx
leaq 0x157bf(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x0, -0x84(%rbp)
jne 0x2c7c1
jmp 0x2c7e0
leaq 0x15948(%rip), %rdi     # 0x42110
leaq 0x1578e(%rip), %rsi     # 0x41f5d
movl $0x3c, %edx
leaq 0x15795(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x0, -0x80(%rbp)
jne 0x2c7e8
jmp 0x2c807
leaq 0x15935(%rip), %rdi     # 0x42124
leaq 0x15767(%rip), %rsi     # 0x41f5d
movl $0x3d, %edx
leaq 0x1576e(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x3c, -0x7c(%rbp)
jne 0x2c80f
jmp 0x2c82e
leaq 0x15923(%rip), %rdi     # 0x42139
leaq 0x15740(%rip), %rsi     # 0x41f5d
movl $0x3e, %edx
leaq 0x15747(%rip), %rcx     # 0x41f70
callq 0x20c0
cmpl $0x4, -0x78(%rbp)
jne 0x2c836
jmp 0x2c855
leaq 0x1590f(%rip), %rdi     # 0x4214c
leaq 0x15719(%rip), %rsi     # 0x41f5d
movl $0x3f, %edx
leaq 0x15720(%rip), %rcx     # 0x41f70
callq 0x20c0
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nop