// File: /workspace/github_cpp_makefile_star2_O3/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 0x16e10(%rip), %rsi     # 0x33ad3
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x80aa
movq %rax, %rbx
subq %r14, %rax
cmpq $0x30, %rax
jne 0x1cf09
movl $0x6, %edi
movl $0x13, %esi
movl $0xb, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1cf28
movl $0x6, %edi
movl $0x13, %esi
movl $0xc, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1cf47
movl $0x6, %edi
movl $0x13, %esi
movl $0x14, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1cf66
movl $0x6, %edi
movl $0x13, %esi
movl $0x1b, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1cf85
movl $0x6, %edi
movl $0x13, %esi
movl $0x12, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1cfa4
movl $0x6, %edi
movl $0x13, %esi
movl $0xa, %edx
callq 0x775c
leaq 0x10(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1cfc3
leaq 0x12063(%rip), %rsi     # 0x2ee6f
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xaa82
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x80aa
movq %rax, %rbx
subq %r14, %rax
cmpq $0x20, %rax
jne 0x1cfe2
movl $0x6, %edi
movl $0x3c, %esi
movl $0x35, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1d001
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3d, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1d020
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3b, %edx
callq 0x775c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1d03f
movl $0x6, %edi
movl $0x3c, %esi
movl $0x3e, %edx
callq 0x775c
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x784f
movq (%r14), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0xe682
testb %al, %al
je 0x1d05e
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r14
retq
leaq 0x17145(%rip), %rdi     # 0x34055
leaq 0x15e37(%rip), %rsi     # 0x32d4e
leaq 0x17149(%rip), %rcx     # 0x34067
movl $0x15d, %edx            # imm = 0x15D
callq 0x20d0
leaq 0x16bf9(%rip), %rdi     # 0x33b28
leaq 0x15e18(%rip), %rsi     # 0x32d4e
leaq 0x1712a(%rip), %rcx     # 0x34067
movl $0x15e, %edx            # imm = 0x15E
callq 0x20d0
leaq 0x16c08(%rip), %rdi     # 0x33b56
leaq 0x15df9(%rip), %rsi     # 0x32d4e
leaq 0x1710b(%rip), %rcx     # 0x34067
movl $0x15f, %edx            # imm = 0x15F
callq 0x20d0
leaq 0x16c17(%rip), %rdi     # 0x33b84
leaq 0x15dda(%rip), %rsi     # 0x32d4e
leaq 0x170ec(%rip), %rcx     # 0x34067
movl $0x160, %edx            # imm = 0x160
callq 0x20d0
leaq 0x16c5c(%rip), %rdi     # 0x33be8
leaq 0x15dbb(%rip), %rsi     # 0x32d4e
leaq 0x170cd(%rip), %rcx     # 0x34067
movl $0x161, %edx            # imm = 0x161
callq 0x20d0
leaq 0x16c6b(%rip), %rdi     # 0x33c16
leaq 0x15d9c(%rip), %rsi     # 0x32d4e
leaq 0x170ae(%rip), %rcx     # 0x34067
movl $0x162, %edx            # imm = 0x162
callq 0x20d0
leaq 0x16c7a(%rip), %rdi     # 0x33c44
leaq 0x15d7d(%rip), %rsi     # 0x32d4e
leaq 0x1708f(%rip), %rcx     # 0x34067
movl $0x163, %edx            # imm = 0x163
callq 0x20d0
leaq 0x16efa(%rip), %rdi     # 0x33ee3
leaq 0x15d5e(%rip), %rsi     # 0x32d4e
leaq 0x17070(%rip), %rcx     # 0x34067
movl $0x168, %edx            # imm = 0x168
callq 0x20d0
leaq 0x16c7a(%rip), %rdi     # 0x33c82
leaq 0x15d3f(%rip), %rsi     # 0x32d4e
leaq 0x17051(%rip), %rcx     # 0x34067
movl $0x169, %edx            # imm = 0x169
callq 0x20d0
leaq 0x16c89(%rip), %rdi     # 0x33cb0
leaq 0x15d20(%rip), %rsi     # 0x32d4e
leaq 0x17032(%rip), %rcx     # 0x34067
movl $0x16a, %edx            # imm = 0x16A
callq 0x20d0
leaq 0x16c98(%rip), %rdi     # 0x33cde
leaq 0x15d01(%rip), %rsi     # 0x32d4e
leaq 0x17013(%rip), %rcx     # 0x34067
movl $0x16b, %edx            # imm = 0x16B
callq 0x20d0
leaq 0x16cdd(%rip), %rdi     # 0x33d42
leaq 0x15ce2(%rip), %rsi     # 0x32d4e
leaq 0x16ff4(%rip), %rcx     # 0x34067
movl $0x16e, %edx            # imm = 0x16E
callq 0x20d0