// File: jswaff[P]prophet3/test/next__test.cpp
// Function: test_caps_in_order_black()
void test_caps_in_order_black() {
    position pos;
    set_pos(&pos,"7k/8/4p3/r2P2q1/4P3/1b6/8/7K b - - ");

    move moves[50];
    move *endp = gen_legal_moves(moves,&pos,true,false);

    move e6d5 = to_capture(PAWN,E6,D5,PAWN);
    assert(is_in_move_list(e6d5,moves,endp));

    move b3d5 = to_capture(BISHOP,B3,D5,PAWN);
    assert(is_in_move_list(b3d5,moves,endp));

    move a5d5 = to_capture(ROOK,A5,D5,PAWN);
    assert(is_in_move_list(a5d5,moves,endp));

    move g5d5 = to_capture(QUEEN,G5,D5,PAWN);
    assert(is_in_move_list(g5d5,moves,endp));

    move_order_dto mo_dto;
    mo_dto.startp = mo_dto.currentp = mo_dto.endp = moves;
    mo_dto.pv_move = 0;
    mo_dto.hash_move = 0;
    mo_dto.killer1 = 0;
    mo_dto.killer2 = 0;
    mo_dto.next_stage = PVMOVE;

    move *m;
    next(&pos,&m,&mo_dto);
    assert(clear_score(*m) == e6d5);

    next(&pos,&m,&mo_dto);
    assert(clear_score(*m) == b3d5);

    next(&pos,&m,&mo_dto);
    assert(clear_score(*m) == a5d5);

    next(&pos,&m,&mo_dto);
    assert(clear_score(*m) == g5d5);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
leaq -0x1c8(%rbp), %rdi
leaq 0x16541(%rip), %rsi     # 0x41aaa
callq 0xf3e0
leaq -0x360(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0xac70
movq %rax, -0x368(%rbp)
movl $0x1, %ecx
movl $0x14, %esi
movl $0x1b, %edx
movl %ecx, %edi
callq 0xa890
movq %rax, -0x370(%rbp)
movq -0x370(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movq -0x368(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x2b5cc
jmp 0x2b5ce
jmp 0x2b5ed
leaq 0x164f9(%rip), %rdi     # 0x41ace
leaq 0x15c6e(%rip), %rsi     # 0x4124a
movl $0x19d, %edx            # imm = 0x19D
leaq 0x16507(%rip), %rcx     # 0x41aef
callq 0x20c0
movl $0x3, %edi
movl $0x29, %esi
movl $0x1b, %edx
movl $0x1, %ecx
callq 0xa890
movq %rax, -0x378(%rbp)
movq -0x378(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movq -0x368(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x2b62d
jmp 0x2b62f
jmp 0x2b64e
leaq 0x163b1(%rip), %rdi     # 0x419e7
leaq 0x15c0d(%rip), %rsi     # 0x4124a
movl $0x1a0, %edx            # imm = 0x1A0
leaq 0x164a6(%rip), %rcx     # 0x41aef
callq 0x20c0
movl $0x4, %edi
movl $0x18, %esi
movl $0x1b, %edx
movl $0x1, %ecx
callq 0xa890
movq %rax, -0x380(%rbp)
movq -0x380(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movq -0x368(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x2b68e
jmp 0x2b690
jmp 0x2b6af
leaq 0x16371(%rip), %rdi     # 0x41a08
leaq 0x15bac(%rip), %rsi     # 0x4124a
movl $0x1a3, %edx            # imm = 0x1A3
leaq 0x16445(%rip), %rcx     # 0x41aef
callq 0x20c0
movl $0x5, %edi
movl $0x1e, %esi
movl $0x1b, %edx
movl $0x1, %ecx
callq 0xa890
movq %rax, -0x388(%rbp)
movq -0x388(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movq -0x368(%rbp), %rdx
callq 0x14c10
testb $0x1, %al
jne 0x2b6ef
jmp 0x2b6f1
jmp 0x2b710
leaq 0x16331(%rip), %rdi     # 0x41a29
leaq 0x15b4b(%rip), %rsi     # 0x4124a
movl $0x1a6, %edx            # imm = 0x1A6
leaq 0x163e4(%rip), %rcx     # 0x41aef
callq 0x20c0
leaq -0x360(%rbp), %rax
movq %rax, -0x398(%rbp)
movq %rax, -0x390(%rbp)
movq %rax, -0x3a0(%rbp)
movq $0x0, -0x3c0(%rbp)
movq $0x0, -0x3b8(%rbp)
movq $0x0, -0x3b0(%rbp)
movq $0x0, -0x3a8(%rbp)
movl $0x0, -0x3c8(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x3c8(%rbp), %rdx
callq 0xc670
movq -0x3d0(%rbp), %rax
movq (%rax), %rdi
callq 0xac50
cmpq -0x370(%rbp), %rax
jne 0x2b796
jmp 0x2b7b5
leaq 0x16372(%rip), %rdi     # 0x41b0f
leaq 0x15aa6(%rip), %rsi     # 0x4124a
movl $0x1b2, %edx            # imm = 0x1B2
leaq 0x1633f(%rip), %rcx     # 0x41aef
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x3c8(%rbp), %rdx
callq 0xc670
movq -0x3d0(%rbp), %rax
movq (%rax), %rdi
callq 0xac50
cmpq -0x378(%rbp), %rax
jne 0x2b7e9
jmp 0x2b808
leaq 0x16272(%rip), %rdi     # 0x41a62
leaq 0x15a53(%rip), %rsi     # 0x4124a
movl $0x1b5, %edx            # imm = 0x1B5
leaq 0x162ec(%rip), %rcx     # 0x41aef
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x3c8(%rbp), %rdx
callq 0xc670
movq -0x3d0(%rbp), %rax
movq (%rax), %rdi
callq 0xac50
cmpq -0x380(%rbp), %rax
jne 0x2b83c
jmp 0x2b85b
leaq 0x16237(%rip), %rdi     # 0x41a7a
leaq 0x15a00(%rip), %rsi     # 0x4124a
movl $0x1b8, %edx            # imm = 0x1B8
leaq 0x16299(%rip), %rcx     # 0x41aef
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x3c8(%rbp), %rdx
callq 0xc670
movq -0x3d0(%rbp), %rax
movq (%rax), %rdi
callq 0xac50
cmpq -0x388(%rbp), %rax
jne 0x2b88f
jmp 0x2b8ae
leaq 0x161fc(%rip), %rdi     # 0x41a92
leaq 0x159ad(%rip), %rsi     # 0x4124a
movl $0x1bb, %edx            # imm = 0x1BB
leaq 0x16246(%rip), %rcx     # 0x41aef
callq 0x20c0
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
nopw (%rax,%rax)