// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/test/movegen__test.cpp
// Function: test_gen_king_noncaptures()
void test_gen_king_noncaptures() {
    position pos;

    set_pos(&pos,"8/8/3k4/2n1P3/8/8/3rP3/R3K2R b KQ - 0 1");
    move moves[20];
    move *mp = gen_king_moves(moves,&pos,false,true);
    assert((mp - moves) == 6);
    assert(is_in_move_list(to_move(KING,D6,D7),moves,mp));
    assert(is_in_move_list(to_move(KING,D6,E7),moves,mp));
    assert(is_in_move_list(to_move(KING,D6,E6),moves,mp));
    assert(is_in_move_list(to_move(KING,D6,D5),moves,mp));
    assert(is_in_move_list(to_move(KING,D6,C6),moves,mp));
    assert(is_in_move_list(to_move(KING,D6,C7),moves,mp));

    // flip sides
    set_pos(&pos,"8/8/3k4/2n1P3/8/8/3rP3/RN2K2R w KQ - 0 1");
    mp = gen_king_moves(moves,&pos,false,true);
    assert((mp - moves)==4);
    assert(is_in_move_list(to_move(KING,E1,F2),moves,mp));
    assert(is_in_move_list(to_move(KING,E1,F1),moves,mp));
    assert(is_in_move_list(to_move(KING,E1,D1),moves,mp)); // NOTE: illegal move
    move mv = to_move(KING,E1,G1);
    set_castle(&mv);
    assert(is_in_move_list(mv,moves,mp));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
leaq 0x169ff(%rip), %rsi     # 0x31b96
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
leaq 0x10(%rsp), %r14
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x7b3b
movq %rax, %rbx
subq %r14, %rax
cmpq $0x30, %rax
jne 0x1b39d
pushq $0x6
popq %rdi
pushq $0x13
popq %rsi
pushq $0xb
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b3bc
pushq $0x6
popq %rdi
pushq $0x13
popq %rsi
pushq $0xc
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b3db
pushq $0x6
popq %rdi
pushq $0x13
popq %rsi
pushq $0x14
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b3fa
pushq $0x6
popq %rdi
pushq $0x13
popq %rsi
pushq $0x1b
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b419
pushq $0x6
popq %rdi
pushq $0x13
popq %rsi
pushq $0x12
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b438
pushq $0x6
popq %rdi
pushq $0x13
popq %rsi
pushq $0xa
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b457
leaq 0x11b65(%rip), %rsi     # 0x2ce1f
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x7b3b
movq %rax, %rbx
subq %r14, %rax
cmpq $0x20, %rax
jne 0x1b476
pushq $0x6
popq %rdi
pushq $0x3c
popq %rsi
pushq $0x35
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b495
pushq $0x6
popq %rdi
pushq $0x3c
popq %rsi
pushq $0x3d
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b4b4
pushq $0x6
popq %rdi
pushq $0x3c
popq %rsi
pushq $0x3b
popq %rdx
callq 0x7284
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b4d3
pushq $0x6
popq %rdi
pushq $0x3c
popq %rsi
pushq $0x3e
popq %rdx
callq 0x7284
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x7366
movq (%r14), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0xdacb
testb %al, %al
je 0x1b4f2
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r14
retq
leaq 0x16d74(%rip), %rdi     # 0x32118
leaq 0x15a66(%rip), %rsi     # 0x30e11
leaq 0x16d78(%rip), %rcx     # 0x3212a
movl $0x15d, %edx            # imm = 0x15D
callq 0x20c0
leaq 0x16828(%rip), %rdi     # 0x31beb
leaq 0x15a47(%rip), %rsi     # 0x30e11
leaq 0x16d59(%rip), %rcx     # 0x3212a
movl $0x15e, %edx            # imm = 0x15E
callq 0x20c0
leaq 0x16837(%rip), %rdi     # 0x31c19
leaq 0x15a28(%rip), %rsi     # 0x30e11
leaq 0x16d3a(%rip), %rcx     # 0x3212a
movl $0x15f, %edx            # imm = 0x15F
callq 0x20c0
leaq 0x16846(%rip), %rdi     # 0x31c47
leaq 0x15a09(%rip), %rsi     # 0x30e11
leaq 0x16d1b(%rip), %rcx     # 0x3212a
movl $0x160, %edx            # imm = 0x160
callq 0x20c0
leaq 0x1688b(%rip), %rdi     # 0x31cab
leaq 0x159ea(%rip), %rsi     # 0x30e11
leaq 0x16cfc(%rip), %rcx     # 0x3212a
movl $0x161, %edx            # imm = 0x161
callq 0x20c0
leaq 0x1689a(%rip), %rdi     # 0x31cd9
leaq 0x159cb(%rip), %rsi     # 0x30e11
leaq 0x16cdd(%rip), %rcx     # 0x3212a
movl $0x162, %edx            # imm = 0x162
callq 0x20c0
leaq 0x168a9(%rip), %rdi     # 0x31d07
leaq 0x159ac(%rip), %rsi     # 0x30e11
leaq 0x16cbe(%rip), %rcx     # 0x3212a
movl $0x163, %edx            # imm = 0x163
callq 0x20c0
leaq 0x16b29(%rip), %rdi     # 0x31fa6
leaq 0x1598d(%rip), %rsi     # 0x30e11
leaq 0x16c9f(%rip), %rcx     # 0x3212a
movl $0x168, %edx            # imm = 0x168
callq 0x20c0
leaq 0x168a9(%rip), %rdi     # 0x31d45
leaq 0x1596e(%rip), %rsi     # 0x30e11
leaq 0x16c80(%rip), %rcx     # 0x3212a
movl $0x169, %edx            # imm = 0x169
callq 0x20c0
leaq 0x168b8(%rip), %rdi     # 0x31d73
leaq 0x1594f(%rip), %rsi     # 0x30e11
leaq 0x16c61(%rip), %rcx     # 0x3212a
movl $0x16a, %edx            # imm = 0x16A
callq 0x20c0
leaq 0x168c7(%rip), %rdi     # 0x31da1
leaq 0x15930(%rip), %rsi     # 0x30e11
leaq 0x16c42(%rip), %rcx     # 0x3212a
movl $0x16b, %edx            # imm = 0x16B
callq 0x20c0
leaq 0x1690c(%rip), %rdi     # 0x31e05
leaq 0x15911(%rip), %rsi     # 0x30e11
leaq 0x16c23(%rip), %rcx     # 0x3212a
movl $0x16e, %edx            # imm = 0x16E
callq 0x20c0