// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/test/next__test.cpp
// Function: test_good_move()
void test_good_move() {
    position pos;
    reset_pos(&pos);

    // all moves from the initial position
    assert_all_moves_good(&pos);

    // some moves that are not legal from the initial position
    assert(!good_move(&pos,to_move(KNIGHT,G1,E2)));
    assert(!good_move(&pos,to_move(KNIGHT,B1,C4)));

    // some pawn tests
    set_pos(&pos,"k7/P6P/8/4Pp2/1p6/3p4/1PPP4/K7 w - f6 0 1");
    assert_all_moves_good(&pos);
    assert(!good_move(&pos,to_move(PAWN,A7,A8)));
    assert(!good_move(&pos,to_move(PAWN,A7,B8)));
    assert(!good_move(&pos,to_capture(PAWN,A7,B8,PAWN)));
    assert(!good_move(&pos,to_capture(PAWN,A7,A8,KING)));

    flip_board(&pos);
    assert_all_moves_good(&pos);

    set_pos(&pos,"r5k1/6rp/5B2/8/8/7R/7P/7K w - - 0 1");
    assert(!good_move(&pos,to_move(PAWN,H2,H4)));

    // some knight tests
    set_pos(&pos,"k7/8/4p3/6n1/4P3/8/8/K7 b - -");
    assert_all_moves_good(&pos);
    for (int i=0;i<64;i++) {
        move test_move = to_move(KNIGHT,G5,(square_t)i);
        if (pos.piece[i] != NO_PIECE) {
            set_capture(&test_move,(piece_t)pos.piece[i]);
        }
        assert(good_move(&pos,test_move)==(i==F7 || i==H7 || i==E4 || i==F3 || i==H3));
    }

    // some bishop tests
    set_pos(&pos,"k7/8/1Q3q2/8/3b4/8/8/1K6 b - - 0 1");
    assert_all_moves_good(&pos);
    assert(!good_move(&pos,to_capture(BISHOP,D4,F6,QUEEN)));

    // some rook tests
    set_pos(&pos,"k7/8/1Q3q2/8/2PR1p2/8/8/1K6 w - - 0 1");
    assert_all_moves_good(&pos);

    // some queen tests
    set_pos(&pos,"k7/8/1Q3q2/8/2PQ1p2/8/8/1K6 w - - 0 1");
    assert_all_moves_good(&pos);

    // king tests
    set_pos(&pos,"r3kb1r/8/8/8/8/8/8/R3K2R b KQkq - 0 1");
    assert(test_pos_consistency(&pos));
    assert_all_moves_good(&pos);
    move bogus = to_move(KING,E8,G8);
    set_castle(&bogus);
    assert(!good_move(&pos,bogus)); // bishop in the path
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa51
movq %rbx, %rdi
callq 0x21028
movl $0x2, %edi
movl $0x3e, %esi
movl $0x34, %edx
callq 0x775c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x213a6
movl $0x2, %edi
movl $0x39, %esi
movl $0x22, %edx
callq 0x775c
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x213c5
leaq 0x1431a(%rip), %rsi     # 0x35434
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
movq %rbx, %rdi
callq 0x21028
movl $0x1, %edi
movl $0x8, %esi
xorl %edx, %edx
callq 0x775c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x213e4
movl $0x1, %edi
movl $0x8, %esi
movl $0x1, %edx
callq 0x775c
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x21403
movl $0x1, %edi
movl $0x8, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x777b
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x21422
movl $0x1, %edi
movl $0x8, %esi
xorl %edx, %edx
movl $0x6, %ecx
callq 0x777b
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x21441
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaf6f
movq %rbx, %rdi
callq 0x21028
leaq 0x14311(%rip), %rsi     # 0x35502
movq %rbx, %rdi
callq 0xaa82
movl $0x1, %edi
movl $0x37, %esi
movl $0x27, %edx
callq 0x775c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x21460
leaq 0x14324(%rip), %rsi     # 0x3554b
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
movq %rbx, %rdi
callq 0x21028
xorl %r14d, %r14d
movq %rsp, %r15
movl $0x2, %edi
movl $0x1e, %esi
movl %r14d, %edx
callq 0x775c
movq %rax, (%rsp)
movl 0x8(%rsp,%r14,4), %esi
testl %esi, %esi
je 0x2126d
movq %r15, %rdi
callq 0x77c0
movq (%rsp), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x910b
cmpq $0x24, %r14
setne %cl
movl %r14d, %edx
andl $0x1d, %edx
cmpl $0xd, %edx
setne %dl
andb %cl, %dl
cmpb %al, %dl
je 0x21387
incq %r14
cmpq $0x40, %r14
jne 0x21242
leaq 0x1430b(%rip), %rsi     # 0x355b0
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
movq %rbx, %rdi
callq 0x21028
movl $0x3, %edi
movl $0x23, %esi
movl $0x15, %edx
movl $0x5, %ecx
callq 0x777b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x910b
testb %al, %al
jne 0x2147f
leaq 0x14316(%rip), %rsi     # 0x35603
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
movq %rbx, %rdi
callq 0x21028
leaq 0x14320(%rip), %rsi     # 0x35629
movq %rbx, %rdi
callq 0xaa82
movq %rbx, %rdi
callq 0x21028
leaq 0x1432f(%rip), %rsi     # 0x3564f
movq %rbx, %rdi
callq 0xaa82
movq %rbx, %rdi
callq 0x231d4
testb %al, %al
je 0x2149e
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x21028
movl $0x6, %edi
movl $0x4, %esi
movl $0x6, %edx
callq 0x775c
movq %rsp, %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x784f
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x910b
testb %al, %al
jne 0x214bd
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x141db(%rip), %rdi     # 0x35569
leaq 0x13613(%rip), %rsi     # 0x349a8
leaq 0x1405b(%rip), %rcx     # 0x353f7
movl $0x21d, %edx            # imm = 0x21D
callq 0x20d0
leaq 0x14023(%rip), %rdi     # 0x353d0
leaq 0x135f4(%rip), %rsi     # 0x349a8
leaq 0x1403c(%rip), %rcx     # 0x353f7
movl $0x204, %edx            # imm = 0x204
callq 0x20d0
leaq 0x14041(%rip), %rdi     # 0x3540d
leaq 0x135d5(%rip), %rsi     # 0x349a8
leaq 0x1401d(%rip), %rcx     # 0x353f7
movl $0x205, %edx            # imm = 0x205
callq 0x20d0
leaq 0x14073(%rip), %rdi     # 0x3545e
leaq 0x135b6(%rip), %rsi     # 0x349a8
leaq 0x13ffe(%rip), %rcx     # 0x353f7
movl $0x20a, %edx            # imm = 0x20A
callq 0x20d0
leaq 0x14079(%rip), %rdi     # 0x35483
leaq 0x13597(%rip), %rsi     # 0x349a8
leaq 0x13fdf(%rip), %rcx     # 0x353f7
movl $0x20b, %edx            # imm = 0x20B
callq 0x20d0
leaq 0x1407f(%rip), %rdi     # 0x354a8
leaq 0x13578(%rip), %rsi     # 0x349a8
leaq 0x13fc0(%rip), %rcx     # 0x353f7
movl $0x20c, %edx            # imm = 0x20C
callq 0x20d0
leaq 0x1408d(%rip), %rdi     # 0x354d5
leaq 0x13559(%rip), %rsi     # 0x349a8
leaq 0x13fa1(%rip), %rcx     # 0x353f7
movl $0x20d, %edx            # imm = 0x20D
callq 0x20d0
leaq 0x140bf(%rip), %rdi     # 0x35526
leaq 0x1353a(%rip), %rsi     # 0x349a8
leaq 0x13f82(%rip), %rcx     # 0x353f7
movl $0x213, %edx            # imm = 0x213
callq 0x20d0
leaq 0x1414d(%rip), %rdi     # 0x355d3
leaq 0x1351b(%rip), %rsi     # 0x349a8
leaq 0x13f63(%rip), %rcx     # 0x353f7
movl $0x223, %edx            # imm = 0x223
callq 0x20d0
leaq 0x141d0(%rip), %rdi     # 0x35675
leaq 0x134fc(%rip), %rsi     # 0x349a8
leaq 0x13f44(%rip), %rcx     # 0x353f7
movl $0x22f, %edx            # imm = 0x22F
callq 0x20d0
leaq 0x141cc(%rip), %rdi     # 0x35690
leaq 0x134dd(%rip), %rsi     # 0x349a8
leaq 0x13f25(%rip), %rcx     # 0x353f7
movl $0x233, %edx            # imm = 0x233
callq 0x20d0