// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/test/apply__test.cpp
// Function: test_apply_move()
void test_apply_move() {
    position pos1;
    reset_pos(&pos1);

    move mv = to_move(PAWN,E2,E4);
    apply_move(&pos1,mv,gundos);

    position pos2;
    set_pos(&pos2,"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_move(PAWN,C7,C5);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_move(KNIGHT,G1,F3);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2");
    assert(equal_pos(&pos1,&pos2,true));
    assert(pos2.fifty_counter==1);

    ////
    mv = to_move(QUEEN,D8,A5);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnb1kbnr/pp1ppppp/8/q1p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3");
    assert(equal_pos(&pos1,&pos2,true));
    assert(pos2.fifty_counter==2);

    /////
    mv = to_move(BISHOP,F1,E2);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnb1kbnr/pp1ppppp/8/q1p5/4P3/5N2/PPPPBPPP/RNBQK2R b KQkq - 3 3");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_capture(QUEEN,A5,D2,PAWN);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnb1kbnr/pp1ppppp/8/2p5/4P3/5N2/PPPqBPPP/RNBQK2R w KQkq - 0 4");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_capture(KNIGHT,B1,D2,QUEEN);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnb1kbnr/pp1ppppp/8/2p5/4P3/5N2/PPPNBPPP/R1BQK2R b KQkq - 0 4");
    assert(equal_pos(&pos1,&pos2,true));

    ///
    mv = to_move(PAWN,C5,C4);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnb1kbnr/pp1ppppp/8/8/2p1P3/5N2/PPPNBPPP/R1BQK2R w KQkq - 0 5");
    assert(equal_pos(&pos1,&pos2,true));

    ///
    mv = to_move(KING,E1,G1);
    set_castle(&mv);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnb1kbnr/pp1ppppp/8/8/2p1P3/5N2/PPPNBPPP/R1BQ1RK1 b kq - 0 5");
    assert(equal_pos(&pos1,&pos2,true));


    ///
    mv = to_move(KING,E8,D8);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/2p1P3/5N2/PPPNBPPP/R1BQ1RK1 w - - 1 6");
    assert(equal_pos(&pos1,&pos2,true));

    ///
    mv = to_move(PAWN,B2,B4);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/1Pp1P3/5N2/P1PNBPPP/R1BQ1RK1 b - b3 0 6");
    assert(equal_pos(&pos1,&pos2,true));

    ///
    mv = to_move(PAWN,C4,B3);
    set_epcapture(&mv);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/4P3/1p3N2/P1PNBPPP/R1BQ1RK1 w - - 0 7");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_move(ROOK,F1,E1);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/4P3/1p3N2/P1PNBPPP/R1BQR1K1 b - - 1 7");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_move(PAWN,B3,B2);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/4P3/5N2/PpPNBPPP/R1BQR1K1 w - - 0 8");
    assert(equal_pos(&pos1,&pos2,true));

    ////
    mv = to_move(KING,G1,H1);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/4P3/5N2/PpPNBPPP/R1BQR2K b - - 1 8");
    assert(equal_pos(&pos1,&pos2,true));

    ///
    mv = to_capture(PAWN,B2,A1,ROOK);
    set_promopiece(&mv,KNIGHT);
    apply_move(&pos1,mv,gundos);
    set_pos(&pos2,"rnbk1bnr/pp1ppppp/8/8/4P3/5N2/P1PNBPPP/n1BQR2K w - - 0 9");
    assert(equal_pos(&pos1,&pos2,true));

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa51
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb96c3(%rip), %rdx     # 0xc8af0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e0b4(%rip), %rsi     # 0x2d4f3
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfa27
movl $0x1, %edi
movl $0xa, %esi
movl $0x1a, %edx
callq 0x775c
leaq 0xb9671(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e0c2(%rip), %rsi     # 0x2d55b
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfa46
movl $0x2, %edi
movl $0x3e, %esi
movl $0x2d, %edx
callq 0x775c
leaq 0xb9617(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e0a6(%rip), %rsi     # 0x2d599
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfa65
cmpl $0x1, 0x150(%rsp)
jne 0xfa84
movl $0x5, %edi
movl $0x3, %esi
movl $0x18, %edx
callq 0x775c
leaq 0xb95af(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e093(%rip), %rsi     # 0x2d5ee
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfaa3
cmpl $0x2, 0x150(%rsp)
jne 0xfac2
movl $0x3, %edi
movl $0x3d, %esi
movl $0x34, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb9543(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e07d(%rip), %rsi     # 0x2d644
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfae1
movl $0x5, %edi
movl $0x18, %esi
movl $0x33, %edx
movl $0x1, %ecx
callq 0x777b
leaq 0xb94e4(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e05d(%rip), %rsi     # 0x2d683
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfb00
movl $0x2, %edi
movl $0x39, %esi
movl $0x33, %edx
movl $0x5, %ecx
callq 0x777b
leaq 0xb9485(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e03c(%rip), %rsi     # 0x2d6c1
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfb1f
movl $0x1, %edi
movl $0x1a, %esi
movl $0x22, %edx
callq 0x775c
leaq 0xb942b(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1e020(%rip), %rsi     # 0x2d6ff
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfb3e
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3e, %edx
callq 0x775c
movq %rsp, %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x784f
movq (%rbx), %rsi
leaq 0xb93c0(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e1
leaq 0x1dff6(%rip), %rsi     # 0x2d73d
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfb5d
movl $0x6, %edi
movl $0x4, %esi
movl $0x3, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb9365(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1dfd5(%rip), %rsi     # 0x2d77a
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfb7c
movl $0x1, %edi
movl $0x31, %esi
movl $0x21, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb9307(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1dfb3(%rip), %rsi     # 0x2d7b6
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfb9b
movl $0x1, %edi
movl $0x22, %esi
movl $0x29, %edx
callq 0x775c
movq %rsp, %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x783b
movq (%rbx), %rsi
leaq 0xb929c(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e1
leaq 0x1df89(%rip), %rsi     # 0x2d7f4
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfbba
movl $0x4, %edi
movl $0x3d, %esi
movl $0x3c, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb9241(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1df67(%rip), %rsi     # 0x2d830
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfbd9
movl $0x1, %edi
movl $0x29, %esi
movl $0x31, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb91e3(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1df45(%rip), %rsi     # 0x2d86c
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfbf8
movl $0x6, %edi
movl $0x3e, %esi
movl $0x3f, %edx
callq 0x775c
movq %rax, (%rsp)
leaq 0xb9185(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1df21(%rip), %rsi     # 0x2d8a6
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfc17
movl $0x1, %edi
movl $0x31, %esi
movl $0x38, %edx
movl $0x4, %ecx
callq 0x777b
movq %rsp, %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x7824
movq (%rbx), %rsi
leaq 0xb9110(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e1
leaq 0x1dee8(%rip), %rsi     # 0x2d8df
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa82
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0xfc36
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r14
retq
leaq 0x25fa9(%rip), %rdi     # 0x359d7
leaq 0x1dafa(%rip), %rsi     # 0x2d52f
leaq 0x1db08(%rip), %rcx     # 0x2d544
movl $0x16, %edx
callq 0x20d0
leaq 0x25f8a(%rip), %rdi     # 0x359d7
leaq 0x1dadb(%rip), %rsi     # 0x2d52f
leaq 0x1dae9(%rip), %rcx     # 0x2d544
movl $0x1c, %edx
callq 0x20d0
leaq 0x25f6b(%rip), %rdi     # 0x359d7
leaq 0x1dabc(%rip), %rsi     # 0x2d52f
leaq 0x1daca(%rip), %rcx     # 0x2d544
movl $0x22, %edx
callq 0x20d0
leaq 0x1db4d(%rip), %rdi     # 0x2d5d8
leaq 0x1da9d(%rip), %rsi     # 0x2d52f
leaq 0x1daab(%rip), %rcx     # 0x2d544
movl $0x23, %edx
callq 0x20d0
leaq 0x25f2d(%rip), %rdi     # 0x359d7
leaq 0x1da7e(%rip), %rsi     # 0x2d52f
leaq 0x1da8c(%rip), %rcx     # 0x2d544
movl $0x29, %edx
callq 0x20d0
leaq 0x1db65(%rip), %rdi     # 0x2d62e
leaq 0x1da5f(%rip), %rsi     # 0x2d52f
leaq 0x1da6d(%rip), %rcx     # 0x2d544
movl $0x2a, %edx
callq 0x20d0
leaq 0x25eef(%rip), %rdi     # 0x359d7
leaq 0x1da40(%rip), %rsi     # 0x2d52f
leaq 0x1da4e(%rip), %rcx     # 0x2d544
movl $0x30, %edx
callq 0x20d0
leaq 0x25ed0(%rip), %rdi     # 0x359d7
leaq 0x1da21(%rip), %rsi     # 0x2d52f
leaq 0x1da2f(%rip), %rcx     # 0x2d544
movl $0x36, %edx
callq 0x20d0
leaq 0x25eb1(%rip), %rdi     # 0x359d7
leaq 0x1da02(%rip), %rsi     # 0x2d52f
leaq 0x1da10(%rip), %rcx     # 0x2d544
movl $0x3c, %edx
callq 0x20d0
leaq 0x25e92(%rip), %rdi     # 0x359d7
leaq 0x1d9e3(%rip), %rsi     # 0x2d52f
leaq 0x1d9f1(%rip), %rcx     # 0x2d544
movl $0x42, %edx
callq 0x20d0
leaq 0x25e73(%rip), %rdi     # 0x359d7
leaq 0x1d9c4(%rip), %rsi     # 0x2d52f
leaq 0x1d9d2(%rip), %rcx     # 0x2d544
movl $0x49, %edx
callq 0x20d0
leaq 0x25e54(%rip), %rdi     # 0x359d7
leaq 0x1d9a5(%rip), %rsi     # 0x2d52f
leaq 0x1d9b3(%rip), %rcx     # 0x2d544
movl $0x50, %edx
callq 0x20d0
leaq 0x25e35(%rip), %rdi     # 0x359d7
leaq 0x1d986(%rip), %rsi     # 0x2d52f
leaq 0x1d994(%rip), %rcx     # 0x2d544
movl $0x56, %edx
callq 0x20d0
leaq 0x25e16(%rip), %rdi     # 0x359d7
leaq 0x1d967(%rip), %rsi     # 0x2d52f
leaq 0x1d975(%rip), %rcx     # 0x2d544
movl $0x5d, %edx
callq 0x20d0
leaq 0x25df7(%rip), %rdi     # 0x359d7
leaq 0x1d948(%rip), %rsi     # 0x2d52f
leaq 0x1d956(%rip), %rcx     # 0x2d544
movl $0x63, %edx
callq 0x20d0
leaq 0x25dd8(%rip), %rdi     # 0x359d7
leaq 0x1d929(%rip), %rsi     # 0x2d52f
leaq 0x1d937(%rip), %rcx     # 0x2d544
movl $0x69, %edx
callq 0x20d0
leaq 0x25db9(%rip), %rdi     # 0x359d7
leaq 0x1d90a(%rip), %rsi     # 0x2d52f
leaq 0x1d918(%rip), %rcx     # 0x2d544
movl $0x6f, %edx
callq 0x20d0
leaq 0x25d9a(%rip), %rdi     # 0x359d7
leaq 0x1d8eb(%rip), %rsi     # 0x2d52f
leaq 0x1d8f9(%rip), %rcx     # 0x2d544
movl $0x76, %edx
callq 0x20d0