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

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

    move e4d5 = to_capture(PAWN,E4,D5,PAWN);
    assert(is_in_move_list(e4d5,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) == e4d5);

    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 0x16789(%rip), %rsi     # 0x41982
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 $0x24, %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 0x2b25c
jmp 0x2b25e
jmp 0x2b27d
leaq 0x16741(%rip), %rdi     # 0x419a6
leaq 0x15fde(%rip), %rsi     # 0x4124a
movl $0x174, %edx            # imm = 0x174
leaq 0x1674f(%rip), %rcx     # 0x419c7
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 0x2b2bd
jmp 0x2b2bf
jmp 0x2b2de
leaq 0x16721(%rip), %rdi     # 0x419e7
leaq 0x15f7d(%rip), %rsi     # 0x4124a
movl $0x177, %edx            # imm = 0x177
leaq 0x166ee(%rip), %rcx     # 0x419c7
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 0x2b31e
jmp 0x2b320
jmp 0x2b33f
leaq 0x166e1(%rip), %rdi     # 0x41a08
leaq 0x15f1c(%rip), %rsi     # 0x4124a
movl $0x17a, %edx            # imm = 0x17A
leaq 0x1668d(%rip), %rcx     # 0x419c7
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 0x2b37f
jmp 0x2b381
jmp 0x2b3a0
leaq 0x166a1(%rip), %rdi     # 0x41a29
leaq 0x15ebb(%rip), %rsi     # 0x4124a
movl $0x17d, %edx            # imm = 0x17D
leaq 0x1662c(%rip), %rcx     # 0x419c7
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 0x2b426
jmp 0x2b445
leaq 0x1661d(%rip), %rdi     # 0x41a4a
leaq 0x15e16(%rip), %rsi     # 0x4124a
movl $0x189, %edx            # imm = 0x189
leaq 0x16587(%rip), %rcx     # 0x419c7
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 0x2b479
jmp 0x2b498
leaq 0x165e2(%rip), %rdi     # 0x41a62
leaq 0x15dc3(%rip), %rsi     # 0x4124a
movl $0x18c, %edx            # imm = 0x18C
leaq 0x16534(%rip), %rcx     # 0x419c7
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 0x2b4cc
jmp 0x2b4eb
leaq 0x165a7(%rip), %rdi     # 0x41a7a
leaq 0x15d70(%rip), %rsi     # 0x4124a
movl $0x18f, %edx            # imm = 0x18F
leaq 0x164e1(%rip), %rcx     # 0x419c7
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 0x2b51f
jmp 0x2b53e
leaq 0x1656c(%rip), %rdi     # 0x41a92
leaq 0x15d1d(%rip), %rsi     # 0x4124a
movl $0x192, %edx            # imm = 0x192
leaq 0x1648e(%rip), %rcx     # 0x419c7
callq 0x20c0
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
nopw (%rax,%rax)