// File: jswaff[P]prophet3/test/next__test.cpp
// Function: test_place_move_on_top()
void test_place_move_on_top() {
    move moves[5];
    move e2e3 = moves[0] = to_move(PAWN,E2,E3);
    move e2e4 = moves[1] = to_move(PAWN,E2,E4);
    moves[2] = BADMOVE;
    move a2a3 = moves[3] = to_move(PAWN,A2,A3);
    move g1f3 = moves[4] = to_move(KNIGHT,G1,F3);

    assert(!place_move_on_top(moves,moves+5,BADMOVE));
    assert(!place_move_on_top(moves,moves+5,to_move(PAWN,B1,B2)));
    assert(place_move_on_top(moves,moves+5,a2a3));
    assert(moves[0]==a2a3);
    assert(moves[3]==e2e3);

    assert(place_move_on_top(moves+1,moves+5,g1f3));
    assert(moves[1]==g1f3);
    assert(moves[4]==e2e4);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x1, %edi
movl $0x34, %esi
movl $0x2c, %edx
callq 0xa830
movq %rax, -0x30(%rbp)
movq %rax, -0x38(%rbp)
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0xa830
movq %rax, -0x28(%rbp)
movq %rax, -0x40(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x1, %edi
movl $0x30, %esi
movl $0x28, %edx
callq 0xa830
movq %rax, -0x18(%rbp)
movq %rax, -0x48(%rbp)
movl $0x2, %edi
movl $0x3e, %esi
movl $0x2d, %edx
callq 0xa830
movq %rax, -0x10(%rbp)
movq %rax, -0x50(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
addq $0x28, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xd570
xorb $-0x1, %al
testb $0x1, %al
jne 0x2952d
jmp 0x2952f
jmp 0x2954e
leaq 0x17d5b(%rip), %rdi     # 0x41291
leaq 0x17d0d(%rip), %rsi     # 0x4124a
movl $0x35, %edx
leaq 0x17d72(%rip), %rcx     # 0x412bb
callq 0x20c0
leaq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x58(%rbp)
movl $0x1, %edi
movl $0x39, %esi
movl $0x31, %edx
callq 0xa830
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %rax, %rdx
callq 0xd570
xorb $-0x1, %al
testb $0x1, %al
jne 0x2958e
jmp 0x29590
jmp 0x295af
leaq 0x17d42(%rip), %rdi     # 0x412d9
leaq 0x17cac(%rip), %rsi     # 0x4124a
movl $0x36, %edx
leaq 0x17d11(%rip), %rcx     # 0x412bb
callq 0x20c0
leaq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
addq $0x28, %rsi
movq -0x48(%rbp), %rdx
callq 0xd570
testb $0x1, %al
jne 0x295ca
jmp 0x295cc
jmp 0x295eb
leaq 0x17d3c(%rip), %rdi     # 0x4130f
leaq 0x17c70(%rip), %rsi     # 0x4124a
movl $0x37, %edx
leaq 0x17cd5(%rip), %rcx     # 0x412bb
callq 0x20c0
movq -0x30(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x295f7
jmp 0x29616
leaq 0x17d37(%rip), %rdi     # 0x41335
leaq 0x17c45(%rip), %rsi     # 0x4124a
movl $0x38, %edx
leaq 0x17caa(%rip), %rcx     # 0x412bb
callq 0x20c0
movq -0x18(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x29622
jmp 0x29641
leaq 0x17d1b(%rip), %rdi     # 0x41344
leaq 0x17c1a(%rip), %rsi     # 0x4124a
movl $0x39, %edx
leaq 0x17c7f(%rip), %rcx     # 0x412bb
callq 0x20c0
leaq -0x30(%rbp), %rdi
addq $0x8, %rdi
leaq -0x30(%rbp), %rsi
addq $0x28, %rsi
movq -0x50(%rbp), %rdx
callq 0xd570
testb $0x1, %al
jne 0x29660
jmp 0x29662
jmp 0x29681
leaq 0x17cea(%rip), %rdi     # 0x41353
leaq 0x17bda(%rip), %rsi     # 0x4124a
movl $0x3b, %edx
leaq 0x17c3f(%rip), %rcx     # 0x412bb
callq 0x20c0
movq -0x28(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x2968d
jmp 0x296ac
leaq 0x17ce7(%rip), %rdi     # 0x4137b
leaq 0x17baf(%rip), %rsi     # 0x4124a
movl $0x3c, %edx
leaq 0x17c14(%rip), %rcx     # 0x412bb
callq 0x20c0
movq -0x10(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0x296b8
jmp 0x296d7
leaq 0x17ccb(%rip), %rdi     # 0x4138a
leaq 0x17b84(%rip), %rsi     # 0x4124a
movl $0x3d, %edx
leaq 0x17be9(%rip), %rcx     # 0x412bb
callq 0x20c0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)