// File: /workspace/github_cpp_makefile_star2_O1/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 0xaa43
leaq 0xd153(%rip), %rdi      # 0x34a72
movq %rbx, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x1, %edi
movl $0x34, %esi
movl $0x24, %edx
callq 0x76b8
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27c1c
leaq 0xa119d(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e3
leaq 0x107e1(%rip), %rdi     # 0x3814b
movq %r14, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x2, %edi
movl $0x6, %esi
movl $0x15, %edx
callq 0x76b8
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27c3b
leaq 0xa1152(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e3
leaq 0x1079b(%rip), %rdi     # 0x38150
movq %r14, %rsi
callq 0xe195
movq $0x0, 0x8(%rsp)
testq %rax, %rax
jne 0x27c5a
movl $0x1, %edi
movl $0x33, %esi
movl $0x23, %edx
callq 0x76b8
leaq 0xa1106(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30e3
leaq 0x10754(%rip), %rdi     # 0x38155
movq %rbx, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x2, %edi
movl $0x15, %esi
movl $0x24, %edx
movl $0x1, %ecx
callq 0x76d7
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27c79
movq %rbx, %rdi
callq 0x77d5
cmpl $0x1, %eax
jne 0x27c98
leaq 0x10730(%rip), %rsi     # 0x3817b
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x1073c(%rip), %rdi     # 0x3819b
movq %rbx, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x1, %edi
movl $0x23, %esi
movl $0x2c, %edx
movl $0x1, %ecx
callq 0x76d7
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x7797
cmpq (%r14), %rbx
jne 0x27cb7
movq %rbx, %rdi
callq 0x77d5
cmpl $0x1, %eax
jne 0x27cd6
leaq 0xa103c(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e3
leaq 0x106d5(%rip), %rdi     # 0x381a0
movq %r14, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3a, %edx
callq 0x76b8
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x77ab
cmpq (%r14), %rbx
jne 0x27cf5
leaq 0xa0fe6(%rip), %rdx     # 0xc8af0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e3
leaq 0x10684(%rip), %rdi     # 0x381a5
movq %r14, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x1, %edi
movl $0x37, %esi
movl $0x3f, %edx
callq 0x76b8
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
movl $0x4, %esi
callq 0x7780
cmpq (%r14), %rbx
jne 0x27d14
leaq 0x10646(%rip), %rdi     # 0x381ab
leaq 0x10(%rsp), %rsi
callq 0xe195
movq $0x0, 0x8(%rsp)
testq %rax, %rax
jne 0x27d33
leaq 0xc69e(%rip), %rsi      # 0x34226
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x10614(%rip), %rdi     # 0x381b0
movq %rbx, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x2, %edi
movl $0x27, %esi
movl $0x16, %edx
callq 0x76b8
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27d52
leaq 0xc6bf(%rip), %rsi      # 0x3428f
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x105d1(%rip), %rdi     # 0x381b5
movq %rbx, %rsi
callq 0xe195
movq %rax, %rbx
movl $0x3, %edi
movl $0x14, %esi
movl $0x29, %edx
callq 0x76b8
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x27d71
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
retq
leaq 0x104ff(%rip), %rdi     # 0x38122
leaq 0x1037d(%rip), %rsi     # 0x37fa7
leaq 0x10502(%rip), %rcx     # 0x38133
movl $0x3c, %edx
callq 0x20d0
leaq 0x104e0(%rip), %rdi     # 0x38122
leaq 0x1035e(%rip), %rsi     # 0x37fa7
leaq 0x104e3(%rip), %rcx     # 0x38133
movl $0x41, %edx
callq 0x20d0
leaq 0x104c1(%rip), %rdi     # 0x38122
leaq 0x1033f(%rip), %rsi     # 0x37fa7
leaq 0x104c4(%rip), %rcx     # 0x38133
movl $0x47, %edx
callq 0x20d0
leaq 0x104a2(%rip), %rdi     # 0x38122
leaq 0x10320(%rip), %rsi     # 0x37fa7
leaq 0x104a5(%rip), %rcx     # 0x38133
movl $0x4d, %edx
callq 0x20d0
leaq 0x104bb(%rip), %rdi     # 0x3815a
leaq 0x10301(%rip), %rsi     # 0x37fa7
leaq 0x10486(%rip), %rcx     # 0x38133
movl $0x4e, %edx
callq 0x20d0
leaq 0x10464(%rip), %rdi     # 0x38122
leaq 0x102e2(%rip), %rsi     # 0x37fa7
leaq 0x10467(%rip), %rcx     # 0x38133
movl $0x55, %edx
callq 0x20d0
leaq 0x1047d(%rip), %rdi     # 0x3815a
leaq 0x102c3(%rip), %rsi     # 0x37fa7
leaq 0x10448(%rip), %rcx     # 0x38133
movl $0x56, %edx
callq 0x20d0
leaq 0x10426(%rip), %rdi     # 0x38122
leaq 0x102a4(%rip), %rsi     # 0x37fa7
leaq 0x10429(%rip), %rcx     # 0x38133
movl $0x5d, %edx
callq 0x20d0
leaq 0x10407(%rip), %rdi     # 0x38122
leaq 0x10285(%rip), %rsi     # 0x37fa7
leaq 0x1040a(%rip), %rcx     # 0x38133
movl $0x64, %edx
callq 0x20d0
leaq 0x103e8(%rip), %rdi     # 0x38122
leaq 0x10266(%rip), %rsi     # 0x37fa7
leaq 0x103eb(%rip), %rcx     # 0x38133
movl $0x69, %edx
callq 0x20d0
leaq 0x103c9(%rip), %rdi     # 0x38122
leaq 0x10247(%rip), %rsi     # 0x37fa7
leaq 0x103cc(%rip), %rcx     # 0x38133
movl $0x6f, %edx
callq 0x20d0
leaq 0x103aa(%rip), %rdi     # 0x38122
leaq 0x10228(%rip), %rsi     # 0x37fa7
leaq 0x103ad(%rip), %rcx     # 0x38133
movl $0x74, %edx
callq 0x20d0