// File: /workspace/github_cpp_makefile_star2_O1/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 0xaa43
movq %rbx, %rdi
callq 0x2119c
movl $0x2, %edi
movl $0x3e, %esi
movl $0x34, %edx
callq 0x76b8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x21524
movl $0x2, %edi
movl $0x39, %esi
movl $0x22, %edx
callq 0x76b8
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x21543
leaq 0x14126(%rip), %rsi     # 0x353b4
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
callq 0x2119c
movl $0x1, %edi
movl $0x8, %esi
xorl %edx, %edx
callq 0x76b8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x21562
movl $0x1, %edi
movl $0x8, %esi
movl $0x1, %edx
callq 0x76b8
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x21581
movl $0x1, %edi
movl $0x8, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x76d7
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x215a0
movl $0x1, %edi
movl $0x8, %esi
xorl %edx, %edx
movl $0x6, %ecx
callq 0x76d7
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x215bf
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaf67
movq %rbx, %rdi
callq 0x2119c
leaq 0x1411d(%rip), %rsi     # 0x35482
movq %rbx, %rdi
callq 0xaa74
movl $0x1, %edi
movl $0x37, %esi
movl $0x27, %edx
callq 0x76b8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x215de
leaq 0x14130(%rip), %rsi     # 0x354cb
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
callq 0x2119c
xorl %r14d, %r14d
movq %rsp, %r15
movl $0x2, %edi
movl $0x1e, %esi
movl %r14d, %edx
callq 0x76b8
movq %rax, (%rsp)
movl 0x8(%rsp,%r14,4), %esi
testl %esi, %esi
je 0x213dd
movq %r15, %rdi
callq 0x771c
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x9052
movl %r14d, %ecx
andl $0x3d, %ecx
cmpq $0xd, %rcx
setne %dl
cmpq $0x24, %r14
setne %sil
andb %dl, %sil
cmpq $0x2d, %rcx
setne %cl
andb %sil, %cl
cmpb %al, %cl
je 0x21505
incq %r14
cmpq $0x40, %r14
jne 0x213b6
leaq 0x1410d(%rip), %rsi     # 0x35530
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
callq 0x2119c
movl $0x3, %edi
movl $0x23, %esi
movl $0x15, %edx
movl $0x5, %ecx
callq 0x76d7
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9052
testb %al, %al
jne 0x215fd
leaq 0x14118(%rip), %rsi     # 0x35583
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
callq 0x2119c
leaq 0x14122(%rip), %rsi     # 0x355a9
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
callq 0x2119c
leaq 0x14131(%rip), %rsi     # 0x355cf
movq %rbx, %rdi
callq 0xaa74
movq %rbx, %rdi
callq 0x23354
testb %al, %al
je 0x2161c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x2119c
movl $0x6, %edi
movl $0x4, %esi
movl $0x6, %edx
callq 0x76b8
movq %rsp, %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x77ab
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x9052
testb %al, %al
jne 0x2163b
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x13fdd(%rip), %rdi     # 0x354e9
leaq 0x13415(%rip), %rsi     # 0x34928
leaq 0x13e5d(%rip), %rcx     # 0x35377
movl $0x21d, %edx            # imm = 0x21D
callq 0x20d0
leaq 0x13e25(%rip), %rdi     # 0x35350
leaq 0x133f6(%rip), %rsi     # 0x34928
leaq 0x13e3e(%rip), %rcx     # 0x35377
movl $0x204, %edx            # imm = 0x204
callq 0x20d0
leaq 0x13e43(%rip), %rdi     # 0x3538d
leaq 0x133d7(%rip), %rsi     # 0x34928
leaq 0x13e1f(%rip), %rcx     # 0x35377
movl $0x205, %edx            # imm = 0x205
callq 0x20d0
leaq 0x13e75(%rip), %rdi     # 0x353de
leaq 0x133b8(%rip), %rsi     # 0x34928
leaq 0x13e00(%rip), %rcx     # 0x35377
movl $0x20a, %edx            # imm = 0x20A
callq 0x20d0
leaq 0x13e7b(%rip), %rdi     # 0x35403
leaq 0x13399(%rip), %rsi     # 0x34928
leaq 0x13de1(%rip), %rcx     # 0x35377
movl $0x20b, %edx            # imm = 0x20B
callq 0x20d0
leaq 0x13e81(%rip), %rdi     # 0x35428
leaq 0x1337a(%rip), %rsi     # 0x34928
leaq 0x13dc2(%rip), %rcx     # 0x35377
movl $0x20c, %edx            # imm = 0x20C
callq 0x20d0
leaq 0x13e8f(%rip), %rdi     # 0x35455
leaq 0x1335b(%rip), %rsi     # 0x34928
leaq 0x13da3(%rip), %rcx     # 0x35377
movl $0x20d, %edx            # imm = 0x20D
callq 0x20d0
leaq 0x13ec1(%rip), %rdi     # 0x354a6
leaq 0x1333c(%rip), %rsi     # 0x34928
leaq 0x13d84(%rip), %rcx     # 0x35377
movl $0x213, %edx            # imm = 0x213
callq 0x20d0
leaq 0x13f4f(%rip), %rdi     # 0x35553
leaq 0x1331d(%rip), %rsi     # 0x34928
leaq 0x13d65(%rip), %rcx     # 0x35377
movl $0x223, %edx            # imm = 0x223
callq 0x20d0
leaq 0x13fd2(%rip), %rdi     # 0x355f5
leaq 0x132fe(%rip), %rsi     # 0x34928
leaq 0x13d46(%rip), %rcx     # 0x35377
movl $0x22f, %edx            # imm = 0x22F
callq 0x20d0
leaq 0x13fce(%rip), %rdi     # 0x35610
leaq 0x132df(%rip), %rsi     # 0x34928
leaq 0x13d27(%rip), %rcx     # 0x35377
movl $0x233, %edx            # imm = 0x233
callq 0x20d0