// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/test/utils__test.cpp
// Function: test_str_to_move()
void test_str_to_move() {
    position pos;
    reset_pos(&pos);
    move actual = str_to_move("e2e4",&pos);
    move expected = to_move(PAWN,E2,E4);

    assert(actual==expected);

    apply_move(&pos,actual,gundos);
    actual = str_to_move("g8f6",&pos);
    expected = to_move(KNIGHT,G8,F6);
    assert(actual==expected);
    apply_move(&pos,actual,gundos);

    // illegal move
    actual = str_to_move("b1d2", &pos);
    expected = BADMOVE;
    assert(actual==expected);

    // capture
    apply_move(&pos,to_move(PAWN,D2,D4),gundos);
    actual = str_to_move("f6e4",&pos);
    expected = to_capture(KNIGHT,F6,E4,PAWN);
    assert(actual==expected);
    assert(get_captured_piece(actual)==PAWN);

    // ep
    set_pos(&pos,"4k3/8/8/8/3pP3/8/7p/R3K3 b Q e3");
    actual = str_to_move("d4e3",&pos);
    expected = to_capture(PAWN,D4,E3,PAWN);
    set_epcapture(&expected);
    assert(actual==expected);
    assert(get_captured_piece(actual)==PAWN);
    apply_move(&pos,actual,gundos);

    // castle
    actual = str_to_move("e1c1",&pos);
    expected = to_move(KING,E1,C1);
    set_castle(&expected);
    assert(actual==expected);
    apply_move(&pos,actual,gundos);

    // promotion
    actual = str_to_move("h2h1r",&pos);
    expected = to_move(PAWN,H2,H1);
    set_promopiece(&expected,ROOK);
    assert(actual==expected);

    // some bogus move
    actual = str_to_move("f3f4",&pos);
    expected = BADMOVE;
    assert(actual==expected);

    //
    set_pos(&pos,"rnb1k2r/ppq1n3/2pppp2/6pp/2PP3N/P2BP3/2PB1PPP/R2Q1RK1 w kq - -");
    actual = str_to_move("h4g6",&pos);
    expected = to_move(KNIGHT,H4,G6);
    assert(actual==expected);

    set_pos(&pos,"r2r2k1/1p2p1b1/1pp1b1pp/4P2n/PP3p1p/2P2N2/5PP1/R3KBNR b KQ b3 -");
    actual = str_to_move("e6b3",&pos);
    expected = to_move(BISHOP,E6,B3);
    assert(actual==expected);

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa51
leaq 0xd389(%rip), %rdi      # 0x34af2
movq %rbx, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0x775c
cmpq %rax, %rbx
jne 0x27a4e
leaq 0xa1358(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e1
leaq 0x10a1c(%rip), %rdi     # 0x381cb
movq %r14, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x2, %edi
movl $0x6, %esi
movl $0x15, %edx
callq 0x775c
cmpq %rax, %rbx
jne 0x27a6d
leaq 0xa1312(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e1
leaq 0x109db(%rip), %rdi     # 0x381d0
movq %r14, %rsi
callq 0xe13f
testq %rax, %rax
jne 0x27a8c
movl $0x1, %edi
movl $0x33, %esi
movl $0x23, %edx
callq 0x775c
leaq 0xa12cf(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e1
leaq 0x1099d(%rip), %rdi     # 0x381d5
movq %rbx, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x2, %edi
movl $0x15, %esi
movl $0x24, %edx
movl $0x1, %ecx
callq 0x777b
cmpq %rax, %rbx
jne 0x27aab
movq %rbx, %rdi
callq 0x7879
cmpl $0x1, %eax
jne 0x27aca
leaq 0x1097e(%rip), %rsi     # 0x381fb
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
leaq 0x1098a(%rip), %rdi     # 0x3821b
movq %rbx, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x1, %edi
movl $0x23, %esi
movl $0x2c, %edx
movl $0x1, %ecx
callq 0x777b
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x783b
cmpq (%r14), %rbx
jne 0x27ae9
movq %rbx, %rdi
callq 0x7879
cmpl $0x1, %eax
jne 0x27b08
leaq 0xa120a(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e1
leaq 0x10923(%rip), %rdi     # 0x38220
movq %r14, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3a, %edx
callq 0x775c
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x784f
cmpq (%r14), %rbx
jne 0x27b27
leaq 0xa11b4(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e1
leaq 0x108d2(%rip), %rdi     # 0x38225
movq %r14, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x1, %edi
movl $0x37, %esi
movl $0x3f, %edx
callq 0x775c
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
movl $0x4, %esi
callq 0x7824
cmpq (%r14), %rbx
jne 0x27b46
leaq 0x10894(%rip), %rdi     # 0x3822b
leaq 0x10(%rsp), %rsi
callq 0xe13f
movq $0x0, 0x8(%rsp)
testq %rax, %rax
jne 0x27b65
leaq 0xc8ec(%rip), %rsi      # 0x342a6
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
leaq 0x10862(%rip), %rdi     # 0x38230
movq %rbx, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x2, %edi
movl $0x27, %esi
movl $0x16, %edx
callq 0x775c
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27b84
leaq 0xc90d(%rip), %rsi      # 0x3430f
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
leaq 0x1081f(%rip), %rdi     # 0x38235
movq %rbx, %rsi
callq 0xe13f
movq %rax, %rbx
movl $0x3, %edi
movl $0x14, %esi
movl $0x29, %edx
callq 0x775c
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27ba3
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
retq
leaq 0x1074d(%rip), %rdi     # 0x381a2
leaq 0x105cb(%rip), %rsi     # 0x38027
leaq 0x10750(%rip), %rcx     # 0x381b3
movl $0x3c, %edx
callq 0x20d0
leaq 0x1072e(%rip), %rdi     # 0x381a2
leaq 0x105ac(%rip), %rsi     # 0x38027
leaq 0x10731(%rip), %rcx     # 0x381b3
movl $0x41, %edx
callq 0x20d0
leaq 0x1070f(%rip), %rdi     # 0x381a2
leaq 0x1058d(%rip), %rsi     # 0x38027
leaq 0x10712(%rip), %rcx     # 0x381b3
movl $0x47, %edx
callq 0x20d0
leaq 0x106f0(%rip), %rdi     # 0x381a2
leaq 0x1056e(%rip), %rsi     # 0x38027
leaq 0x106f3(%rip), %rcx     # 0x381b3
movl $0x4d, %edx
callq 0x20d0
leaq 0x10709(%rip), %rdi     # 0x381da
leaq 0x1054f(%rip), %rsi     # 0x38027
leaq 0x106d4(%rip), %rcx     # 0x381b3
movl $0x4e, %edx
callq 0x20d0
leaq 0x106b2(%rip), %rdi     # 0x381a2
leaq 0x10530(%rip), %rsi     # 0x38027
leaq 0x106b5(%rip), %rcx     # 0x381b3
movl $0x55, %edx
callq 0x20d0
leaq 0x106cb(%rip), %rdi     # 0x381da
leaq 0x10511(%rip), %rsi     # 0x38027
leaq 0x10696(%rip), %rcx     # 0x381b3
movl $0x56, %edx
callq 0x20d0
leaq 0x10674(%rip), %rdi     # 0x381a2
leaq 0x104f2(%rip), %rsi     # 0x38027
leaq 0x10677(%rip), %rcx     # 0x381b3
movl $0x5d, %edx
callq 0x20d0
leaq 0x10655(%rip), %rdi     # 0x381a2
leaq 0x104d3(%rip), %rsi     # 0x38027
leaq 0x10658(%rip), %rcx     # 0x381b3
movl $0x64, %edx
callq 0x20d0
leaq 0x10636(%rip), %rdi     # 0x381a2
leaq 0x104b4(%rip), %rsi     # 0x38027
leaq 0x10639(%rip), %rcx     # 0x381b3
movl $0x69, %edx
callq 0x20d0
leaq 0x10617(%rip), %rdi     # 0x381a2
leaq 0x10495(%rip), %rsi     # 0x38027
leaq 0x1061a(%rip), %rcx     # 0x381b3
movl $0x6f, %edx
callq 0x20d0
leaq 0x105f8(%rip), %rdi     # 0x381a2
leaq 0x10476(%rip), %rsi     # 0x38027
leaq 0x105fb(%rip), %rcx     # 0x381b3
movl $0x74, %edx
callq 0x20d0