// File: /workspace/github_cpp_makefile_star2_O1/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 0xaa43
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb960b(%rip), %rdx     # 0xc8af0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1df7c(%rip), %rsi     # 0x2d473
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfaf7
movl $0x1, %edi
movl $0xa, %esi
movl $0x1a, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb95b5(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1df86(%rip), %rsi     # 0x2d4db
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfb16
movl $0x2, %edi
movl $0x3e, %esi
movl $0x2d, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb9557(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1df66(%rip), %rsi     # 0x2d519
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfb35
cmpl $0x1, 0x150(%rsp)
jne 0xfb54
movl $0x5, %edi
movl $0x3, %esi
movl $0x18, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb94eb(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1df4f(%rip), %rsi     # 0x2d56e
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfb73
cmpl $0x2, 0x150(%rsp)
jne 0xfb92
movl $0x3, %edi
movl $0x3d, %esi
movl $0x34, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb947f(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1df39(%rip), %rsi     # 0x2d5c4
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfbb1
movl $0x5, %edi
movl $0x18, %esi
movl $0x33, %edx
movl $0x1, %ecx
callq 0x76d7
movq %rax, (%rsp)
leaq 0xb941c(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1df15(%rip), %rsi     # 0x2d603
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfbd0
movl $0x2, %edi
movl $0x39, %esi
movl $0x33, %edx
movl $0x5, %ecx
callq 0x76d7
movq %rax, (%rsp)
leaq 0xb93b9(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1def0(%rip), %rsi     # 0x2d641
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfbef
movl $0x1, %edi
movl $0x1a, %esi
movl $0x22, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb935b(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1ded0(%rip), %rsi     # 0x2d67f
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfc0e
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3e, %edx
callq 0x76b8
movq %rsp, %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x77ab
movq (%rbx), %rsi
leaq 0xb92f0(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e3
leaq 0x1dea6(%rip), %rsi     # 0x2d6bd
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfc2d
movl $0x6, %edi
movl $0x4, %esi
movl $0x3, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb9295(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1de85(%rip), %rsi     # 0x2d6fa
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfc4c
movl $0x1, %edi
movl $0x31, %esi
movl $0x21, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb9237(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1de63(%rip), %rsi     # 0x2d736
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfc6b
movl $0x1, %edi
movl $0x22, %esi
movl $0x29, %edx
callq 0x76b8
movq %rsp, %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x7797
movq (%rbx), %rsi
leaq 0xb91cc(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e3
leaq 0x1de39(%rip), %rsi     # 0x2d774
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfc8a
movl $0x4, %edi
movl $0x3d, %esi
movl $0x3c, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb9171(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1de17(%rip), %rsi     # 0x2d7b0
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfca9
movl $0x1, %edi
movl $0x29, %esi
movl $0x31, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb9113(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1ddf5(%rip), %rsi     # 0x2d7ec
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfcc8
movl $0x6, %edi
movl $0x3e, %esi
movl $0x3f, %edx
callq 0x76b8
movq %rax, (%rsp)
leaq 0xb90b5(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x1ddd1(%rip), %rsi     # 0x2d826
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfce7
movl $0x1, %edi
movl $0x31, %esi
movl $0x38, %edx
movl $0x4, %ecx
callq 0x76d7
movq %rsp, %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x7780
movq (%rbx), %rsi
leaq 0xb9040(%rip), %rdx     # 0xc8af0
leaq 0x1d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e3
leaq 0x1dd98(%rip), %rsi     # 0x2d85f
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xaa74
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0xfd06
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r14
retq
leaq 0x25e59(%rip), %rdi     # 0x35957
leaq 0x1d9aa(%rip), %rsi     # 0x2d4af
leaq 0x1d9b8(%rip), %rcx     # 0x2d4c4
movl $0x16, %edx
callq 0x20d0
leaq 0x25e3a(%rip), %rdi     # 0x35957
leaq 0x1d98b(%rip), %rsi     # 0x2d4af
leaq 0x1d999(%rip), %rcx     # 0x2d4c4
movl $0x1c, %edx
callq 0x20d0
leaq 0x25e1b(%rip), %rdi     # 0x35957
leaq 0x1d96c(%rip), %rsi     # 0x2d4af
leaq 0x1d97a(%rip), %rcx     # 0x2d4c4
movl $0x22, %edx
callq 0x20d0
leaq 0x1d9fd(%rip), %rdi     # 0x2d558
leaq 0x1d94d(%rip), %rsi     # 0x2d4af
leaq 0x1d95b(%rip), %rcx     # 0x2d4c4
movl $0x23, %edx
callq 0x20d0
leaq 0x25ddd(%rip), %rdi     # 0x35957
leaq 0x1d92e(%rip), %rsi     # 0x2d4af
leaq 0x1d93c(%rip), %rcx     # 0x2d4c4
movl $0x29, %edx
callq 0x20d0
leaq 0x1da15(%rip), %rdi     # 0x2d5ae
leaq 0x1d90f(%rip), %rsi     # 0x2d4af
leaq 0x1d91d(%rip), %rcx     # 0x2d4c4
movl $0x2a, %edx
callq 0x20d0
leaq 0x25d9f(%rip), %rdi     # 0x35957
leaq 0x1d8f0(%rip), %rsi     # 0x2d4af
leaq 0x1d8fe(%rip), %rcx     # 0x2d4c4
movl $0x30, %edx
callq 0x20d0
leaq 0x25d80(%rip), %rdi     # 0x35957
leaq 0x1d8d1(%rip), %rsi     # 0x2d4af
leaq 0x1d8df(%rip), %rcx     # 0x2d4c4
movl $0x36, %edx
callq 0x20d0
leaq 0x25d61(%rip), %rdi     # 0x35957
leaq 0x1d8b2(%rip), %rsi     # 0x2d4af
leaq 0x1d8c0(%rip), %rcx     # 0x2d4c4
movl $0x3c, %edx
callq 0x20d0
leaq 0x25d42(%rip), %rdi     # 0x35957
leaq 0x1d893(%rip), %rsi     # 0x2d4af
leaq 0x1d8a1(%rip), %rcx     # 0x2d4c4
movl $0x42, %edx
callq 0x20d0
leaq 0x25d23(%rip), %rdi     # 0x35957
leaq 0x1d874(%rip), %rsi     # 0x2d4af
leaq 0x1d882(%rip), %rcx     # 0x2d4c4
movl $0x49, %edx
callq 0x20d0
leaq 0x25d04(%rip), %rdi     # 0x35957
leaq 0x1d855(%rip), %rsi     # 0x2d4af
leaq 0x1d863(%rip), %rcx     # 0x2d4c4
movl $0x50, %edx
callq 0x20d0
leaq 0x25ce5(%rip), %rdi     # 0x35957
leaq 0x1d836(%rip), %rsi     # 0x2d4af
leaq 0x1d844(%rip), %rcx     # 0x2d4c4
movl $0x56, %edx
callq 0x20d0
leaq 0x25cc6(%rip), %rdi     # 0x35957
leaq 0x1d817(%rip), %rsi     # 0x2d4af
leaq 0x1d825(%rip), %rcx     # 0x2d4c4
movl $0x5d, %edx
callq 0x20d0
leaq 0x25ca7(%rip), %rdi     # 0x35957
leaq 0x1d7f8(%rip), %rsi     # 0x2d4af
leaq 0x1d806(%rip), %rcx     # 0x2d4c4
movl $0x63, %edx
callq 0x20d0
leaq 0x25c88(%rip), %rdi     # 0x35957
leaq 0x1d7d9(%rip), %rsi     # 0x2d4af
leaq 0x1d7e7(%rip), %rcx     # 0x2d4c4
movl $0x69, %edx
callq 0x20d0
leaq 0x25c69(%rip), %rdi     # 0x35957
leaq 0x1d7ba(%rip), %rsi     # 0x2d4af
leaq 0x1d7c8(%rip), %rcx     # 0x2d4c4
movl $0x6f, %edx
callq 0x20d0
leaq 0x25c4a(%rip), %rdi     # 0x35957
leaq 0x1d79b(%rip), %rsi     # 0x2d4af
leaq 0x1d7a9(%rip), %rcx     # 0x2d4c4
movl $0x76, %edx
callq 0x20d0