// File: jswaff[P]prophet3/test/movegen__test.cpp
// Function: test_gen_rook_moves()
void test_gen_rook_moves() {
    position pos;
    reset_pos(&pos);

    move moves[20];
    move *mp = gen_rook_moves(moves,&pos,H1,true,true);
    assert((mp - moves) == 0);

    set_pos(&pos,"8/8/3k1p2/8/3K4/8/1R3r2/8 b - - 0 1");

    mp = gen_rook_moves(moves,&pos,F2,true,true);
    assert((mp - moves) == 10);

    assert(is_in_move_list(to_move(ROOK,F2,F3),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,F4),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,F5),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,F1),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,G2),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,H2),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,E2),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,D2),moves,mp));
    assert(is_in_move_list(to_move(ROOK,F2,C2),moves,mp));
    assert(is_in_move_list(to_capture(ROOK,F2,B2,ROOK),moves,mp));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
leaq -0x1c8(%rbp), %rdi
callq 0xf390
leaq -0x270(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movl $0x3f, %edx
movl $0x1, %r8d
movl %r8d, %ecx
callq 0xc210
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
leaq -0x270(%rbp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x0, %rax
jne 0x2494c
jmp 0x2496b
leaq 0x1b39e(%rip), %rdi     # 0x3fcf1
leaq 0x1ac96(%rip), %rsi     # 0x3f5f0
movl $0x82, %edx
leaq 0x1b39d(%rip), %rcx     # 0x3fd03
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x1b3a5(%rip), %rsi     # 0x3fd1e
callq 0xf3e0
leaq -0x270(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movl $0x35, %edx
movl $0x1, %r8d
movl %r8d, %ecx
callq 0xc210
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
leaq -0x270(%rbp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0xa, %rax
jne 0x249c3
jmp 0x249e2
leaq 0x1b378(%rip), %rdi     # 0x3fd42
leaq 0x1ac1f(%rip), %rsi     # 0x3f5f0
movl $0x87, %edx
leaq 0x1b326(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x2d, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24a12
jmp 0x24a14
jmp 0x24a33
leaq 0x1b33a(%rip), %rdi     # 0x3fd55
leaq 0x1abce(%rip), %rsi     # 0x3f5f0
movl $0x89, %edx
leaq 0x1b2d5(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x25, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24a63
jmp 0x24a65
jmp 0x24a84
leaq 0x1b317(%rip), %rdi     # 0x3fd83
leaq 0x1ab7d(%rip), %rsi     # 0x3f5f0
movl $0x8a, %edx
leaq 0x1b284(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x1d, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24ab4
jmp 0x24ab6
jmp 0x24ad5
leaq 0x1b2f4(%rip), %rdi     # 0x3fdb1
leaq 0x1ab2c(%rip), %rsi     # 0x3f5f0
movl $0x8b, %edx
leaq 0x1b233(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x3d, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24b05
jmp 0x24b07
jmp 0x24b26
leaq 0x1b2d1(%rip), %rdi     # 0x3fddf
leaq 0x1aadb(%rip), %rsi     # 0x3f5f0
movl $0x8c, %edx
leaq 0x1b1e2(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x36, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24b56
jmp 0x24b58
jmp 0x24b77
leaq 0x1b2ae(%rip), %rdi     # 0x3fe0d
leaq 0x1aa8a(%rip), %rsi     # 0x3f5f0
movl $0x8d, %edx
leaq 0x1b191(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x37, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24ba7
jmp 0x24ba9
jmp 0x24bc8
leaq 0x1b28b(%rip), %rdi     # 0x3fe3b
leaq 0x1aa39(%rip), %rsi     # 0x3f5f0
movl $0x8e, %edx
leaq 0x1b140(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x34, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24bf8
jmp 0x24bfa
jmp 0x24c19
leaq 0x1b268(%rip), %rdi     # 0x3fe69
leaq 0x1a9e8(%rip), %rsi     # 0x3f5f0
movl $0x8f, %edx
leaq 0x1b0ef(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x33, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24c49
jmp 0x24c4b
jmp 0x24c6a
leaq 0x1b245(%rip), %rdi     # 0x3fe97
leaq 0x1a997(%rip), %rsi     # 0x3f5f0
movl $0x90, %edx
leaq 0x1b09e(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %edi
movl $0x35, %esi
movl $0x32, %edx
callq 0xa830
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24c9a
jmp 0x24c9c
jmp 0x24cbb
leaq 0x1b222(%rip), %rdi     # 0x3fec5
leaq 0x1a946(%rip), %rsi     # 0x3f5f0
movl $0x91, %edx
leaq 0x1b04d(%rip), %rcx     # 0x3fd03
callq 0x20c0
movl $0x4, %ecx
movl $0x35, %esi
movl $0x31, %edx
movl %ecx, %edi
callq 0xa890
movq %rax, %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x24ced
jmp 0x24cef
jmp 0x24d0e
leaq 0x1b1fd(%rip), %rdi     # 0x3fef3
leaq 0x1a8f3(%rip), %rsi     # 0x3f5f0
movl $0x92, %edx
leaq 0x1affa(%rip), %rcx     # 0x3fd03
callq 0x20c0
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
nopw (%rax,%rax)