// File: jswaff[P]prophet3/test/movegen__test.cpp
// Function: test_gen_pawn_captures()
void test_gen_pawn_captures() {
    position pos;
    set_pos(&pos,"2b1k3/PP6/8/3pP3/4P3/8/6P1/4K3 w - d6 0 1");
    move moves[20],*mp,mv;

    mp = gen_pawn_moves(moves,&pos,true,false);

    assert((mp - moves)==14);

    mv = to_move(PAWN,A7,A8);
    set_promopiece(&mv,QUEEN);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,ROOK);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,BISHOP);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,KNIGHT);
    assert(is_in_move_list(mv,moves,mp));

    mv = to_move(PAWN,B7,B8);
    set_promopiece(&mv,QUEEN);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,ROOK);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,BISHOP);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,KNIGHT);
    assert(is_in_move_list(mv,moves,mp));

    mv = to_capture(PAWN,B7,C8,BISHOP);
    set_promopiece(&mv,QUEEN);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,ROOK);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,BISHOP);
    assert(is_in_move_list(mv,moves,mp));
    set_promopiece(&mv,KNIGHT);
    assert(is_in_move_list(mv,moves,mp));

    mv = to_capture(PAWN,E4,D5,PAWN);
    assert(is_in_move_list(mv,moves,mp));

    mv = to_move(PAWN,E5,D6);
    set_epcapture(&mv);
    assert(is_in_move_list(mv,moves,mp));

    // from black
    set_pos(&pos,"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1");
    mp = gen_pawn_moves(moves,&pos,true,false);

    assert((mp - moves)==0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
leaq -0x1c8(%rbp), %rdi
leaq 0x19011(%rip), %rsi     # 0x4092a
callq 0xf3e0
leaq -0x270(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0xae70
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
leaq -0x270(%rbp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0xe, %rax
jne 0x2795c
jmp 0x2797b
leaq 0x19114(%rip), %rdi     # 0x40a77
leaq 0x17c86(%rip), %rsi     # 0x3f5f0
movl $0x1b2, %edx            # imm = 0x1B2
leaq 0x19112(%rip), %rcx     # 0x40a88
callq 0x20c0
movl $0x1, %edi
movl $0x8, %esi
xorl %edx, %edx
callq 0xa830
movq %rax, -0x280(%rbp)
leaq -0x280(%rbp), %rdi
movl $0x5, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x279c4
jmp 0x279c6
jmp 0x279e5
leaq 0x18c17(%rip), %rdi     # 0x405e4
leaq 0x17c1c(%rip), %rsi     # 0x3f5f0
movl $0x1b6, %edx            # imm = 0x1B6
leaq 0x190a8(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x4, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27a16
jmp 0x27a18
jmp 0x27a37
leaq 0x18bc5(%rip), %rdi     # 0x405e4
leaq 0x17bca(%rip), %rsi     # 0x3f5f0
movl $0x1b8, %edx            # imm = 0x1B8
leaq 0x19056(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x3, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27a68
jmp 0x27a6a
jmp 0x27a89
leaq 0x18b73(%rip), %rdi     # 0x405e4
leaq 0x17b78(%rip), %rsi     # 0x3f5f0
movl $0x1ba, %edx            # imm = 0x1BA
leaq 0x19004(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x2, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27aba
jmp 0x27abc
jmp 0x27adb
leaq 0x18b21(%rip), %rdi     # 0x405e4
leaq 0x17b26(%rip), %rsi     # 0x3f5f0
movl $0x1bc, %edx            # imm = 0x1BC
leaq 0x18fb2(%rip), %rcx     # 0x40a88
callq 0x20c0
movl $0x1, %edx
movl $0x9, %esi
movl %edx, %edi
callq 0xa830
movq %rax, -0x280(%rbp)
leaq -0x280(%rbp), %rdi
movl $0x5, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27b24
jmp 0x27b26
jmp 0x27b45
leaq 0x18ab7(%rip), %rdi     # 0x405e4
leaq 0x17abc(%rip), %rsi     # 0x3f5f0
movl $0x1c0, %edx            # imm = 0x1C0
leaq 0x18f48(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x4, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27b76
jmp 0x27b78
jmp 0x27b97
leaq 0x18a65(%rip), %rdi     # 0x405e4
leaq 0x17a6a(%rip), %rsi     # 0x3f5f0
movl $0x1c2, %edx            # imm = 0x1C2
leaq 0x18ef6(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x3, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27bc8
jmp 0x27bca
jmp 0x27be9
leaq 0x18a13(%rip), %rdi     # 0x405e4
leaq 0x17a18(%rip), %rsi     # 0x3f5f0
movl $0x1c4, %edx            # imm = 0x1C4
leaq 0x18ea4(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x2, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27c1a
jmp 0x27c1c
jmp 0x27c3b
leaq 0x189c1(%rip), %rdi     # 0x405e4
leaq 0x179c6(%rip), %rsi     # 0x3f5f0
movl $0x1c6, %edx            # imm = 0x1C6
leaq 0x18e52(%rip), %rcx     # 0x40a88
callq 0x20c0
movl $0x1, %edi
movl $0x9, %esi
movl $0x2, %edx
movl $0x3, %ecx
callq 0xa890
movq %rax, -0x280(%rbp)
leaq -0x280(%rbp), %rdi
movl $0x5, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27c8c
jmp 0x27c8e
jmp 0x27cad
leaq 0x1894f(%rip), %rdi     # 0x405e4
leaq 0x17954(%rip), %rsi     # 0x3f5f0
movl $0x1ca, %edx            # imm = 0x1CA
leaq 0x18de0(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x4, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27cde
jmp 0x27ce0
jmp 0x27cff
leaq 0x188fd(%rip), %rdi     # 0x405e4
leaq 0x17902(%rip), %rsi     # 0x3f5f0
movl $0x1cc, %edx            # imm = 0x1CC
leaq 0x18d8e(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x3, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27d30
jmp 0x27d32
jmp 0x27d51
leaq 0x188ab(%rip), %rdi     # 0x405e4
leaq 0x178b0(%rip), %rsi     # 0x3f5f0
movl $0x1ce, %edx            # imm = 0x1CE
leaq 0x18d3c(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x280(%rbp), %rdi
movl $0x2, %esi
callq 0xa9e0
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27d82
jmp 0x27d84
jmp 0x27da3
leaq 0x18859(%rip), %rdi     # 0x405e4
leaq 0x1785e(%rip), %rsi     # 0x3f5f0
movl $0x1d0, %edx            # imm = 0x1D0
leaq 0x18cea(%rip), %rcx     # 0x40a88
callq 0x20c0
movl $0x1, %ecx
movl $0x24, %esi
movl $0x1b, %edx
movl %ecx, %edi
callq 0xa890
movq %rax, -0x280(%rbp)
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27de0
jmp 0x27de2
jmp 0x27e01
leaq 0x187fb(%rip), %rdi     # 0x405e4
leaq 0x17800(%rip), %rsi     # 0x3f5f0
movl $0x1d3, %edx            # imm = 0x1D3
leaq 0x18c8c(%rip), %rcx     # 0x40a88
callq 0x20c0
movl $0x1, %edi
movl $0x1c, %esi
movl $0x13, %edx
callq 0xa830
movq %rax, -0x280(%rbp)
leaq -0x280(%rbp), %rdi
callq 0xaa20
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq -0x278(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x27e48
jmp 0x27e4a
jmp 0x27e69
leaq 0x18793(%rip), %rdi     # 0x405e4
leaq 0x17798(%rip), %rsi     # 0x3f5f0
movl $0x1d7, %edx            # imm = 0x1D7
leaq 0x18c24(%rip), %rcx     # 0x40a88
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x11474(%rip), %rsi     # 0x392eb
callq 0xf3e0
leaq -0x270(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0xae70
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
leaq -0x270(%rbp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x0, %rax
jne 0x27eba
jmp 0x27ed9
leaq 0x18a26(%rip), %rdi     # 0x408e7
leaq 0x17728(%rip), %rsi     # 0x3f5f0
movl $0x1dd, %edx            # imm = 0x1DD
leaq 0x18bb4(%rip), %rcx     # 0x40a88
callq 0x20c0
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
nopw %cs:(%rax,%rax)