// File: /workspace/github_cpp_makefile_star2_O1/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 0x16c1c(%rip), %rsi     # 0x33a53
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x8018
movq %rax, %rbx
subq %r14, %rax
cmpq $0x30, %rax
jne 0x1d07d
movl $0x6, %edi
movl $0x13, %esi
movl $0xb, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d09c
movl $0x6, %edi
movl $0x13, %esi
movl $0xc, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d0bb
movl $0x6, %edi
movl $0x13, %esi
movl $0x14, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d0da
movl $0x6, %edi
movl $0x13, %esi
movl $0x1b, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d0f9
movl $0x6, %edi
movl $0x13, %esi
movl $0x12, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d118
movl $0x6, %edi
movl $0x13, %esi
movl $0xa, %edx
callq 0x76b8
leaq 0x10(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d137
leaq 0x11e6f(%rip), %rsi     # 0x2edef
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa74
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x8018
movq %rax, %rbx
subq %r14, %rax
cmpq $0x20, %rax
jne 0x1d156
movl $0x6, %edi
movl $0x3c, %esi
movl $0x35, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d175
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3d, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d194
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3b, %edx
callq 0x76b8
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d1b3
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3e, %edx
callq 0x76b8
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x77ab
movq (%r14), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0xe727
testb %al, %al
je 0x1d1d2
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r14
retq
leaq 0x16f51(%rip), %rdi     # 0x33fd5
leaq 0x15c43(%rip), %rsi     # 0x32cce
leaq 0x16f55(%rip), %rcx     # 0x33fe7
movl $0x15d, %edx            # imm = 0x15D
callq 0x20d0
leaq 0x16a05(%rip), %rdi     # 0x33aa8
leaq 0x15c24(%rip), %rsi     # 0x32cce
leaq 0x16f36(%rip), %rcx     # 0x33fe7
movl $0x15e, %edx            # imm = 0x15E
callq 0x20d0
leaq 0x16a14(%rip), %rdi     # 0x33ad6
leaq 0x15c05(%rip), %rsi     # 0x32cce
leaq 0x16f17(%rip), %rcx     # 0x33fe7
movl $0x15f, %edx            # imm = 0x15F
callq 0x20d0
leaq 0x16a23(%rip), %rdi     # 0x33b04
leaq 0x15be6(%rip), %rsi     # 0x32cce
leaq 0x16ef8(%rip), %rcx     # 0x33fe7
movl $0x160, %edx            # imm = 0x160
callq 0x20d0
leaq 0x16a68(%rip), %rdi     # 0x33b68
leaq 0x15bc7(%rip), %rsi     # 0x32cce
leaq 0x16ed9(%rip), %rcx     # 0x33fe7
movl $0x161, %edx            # imm = 0x161
callq 0x20d0
leaq 0x16a77(%rip), %rdi     # 0x33b96
leaq 0x15ba8(%rip), %rsi     # 0x32cce
leaq 0x16eba(%rip), %rcx     # 0x33fe7
movl $0x162, %edx            # imm = 0x162
callq 0x20d0
leaq 0x16a86(%rip), %rdi     # 0x33bc4
leaq 0x15b89(%rip), %rsi     # 0x32cce
leaq 0x16e9b(%rip), %rcx     # 0x33fe7
movl $0x163, %edx            # imm = 0x163
callq 0x20d0
leaq 0x16d06(%rip), %rdi     # 0x33e63
leaq 0x15b6a(%rip), %rsi     # 0x32cce
leaq 0x16e7c(%rip), %rcx     # 0x33fe7
movl $0x168, %edx            # imm = 0x168
callq 0x20d0
leaq 0x16a86(%rip), %rdi     # 0x33c02
leaq 0x15b4b(%rip), %rsi     # 0x32cce
leaq 0x16e5d(%rip), %rcx     # 0x33fe7
movl $0x169, %edx            # imm = 0x169
callq 0x20d0
leaq 0x16a95(%rip), %rdi     # 0x33c30
leaq 0x15b2c(%rip), %rsi     # 0x32cce
leaq 0x16e3e(%rip), %rcx     # 0x33fe7
movl $0x16a, %edx            # imm = 0x16A
callq 0x20d0
leaq 0x16aa4(%rip), %rdi     # 0x33c5e
leaq 0x15b0d(%rip), %rsi     # 0x32cce
leaq 0x16e1f(%rip), %rcx     # 0x33fe7
movl $0x16b, %edx            # imm = 0x16B
callq 0x20d0
leaq 0x16ae9(%rip), %rdi     # 0x33cc2
leaq 0x15aee(%rip), %rsi     # 0x32cce
leaq 0x16e00(%rip), %rcx     # 0x33fe7
movl $0x16e, %edx            # imm = 0x16E
callq 0x20d0