// File: jswaff[P]prophet3/test/draw__test.cpp
// Function: test_is_lack_of_mating_material()
void test_is_lack_of_mating_material() {
    position pos;

    // any position with a pawn is not drawn
    reset_pos(&pos);
    assert(!is_lack_of_mating_material(&pos));

    // one pawn
    set_pos(&pos,"4k3/8/8/8/8/8/P7/4K3 w - -");
    assert(!is_lack_of_mating_material(&pos));

    // one bishop
    set_pos(&pos,"4k3/8/8/8/8/8/B7/4K3 w - -");
    assert(is_lack_of_mating_material(&pos));

    // one knight
    set_pos(&pos,"4k3/8/8/8/8/8/n7/4K3 w - -");
    assert(is_lack_of_mating_material(&pos));

    // one rook
    set_pos(&pos,"4k3/8/8/8/8/8/r7/4K3 b - -");
    assert(!is_lack_of_mating_material(&pos));

    // one queen
    set_pos(&pos,"4k3/8/8/8/8/8/Q7/4K3 w - -");
    assert(!is_lack_of_mating_material(&pos));

    // just kings
    set_pos(&pos,"4k3/8/8/8/8/8/8/4K3 w - -");
    assert(is_lack_of_mating_material(&pos));

    // two knights, both white's
    set_pos(&pos,"4k3/8/8/8/8/8/NN6/4K3 w - -");
    assert(!is_lack_of_mating_material(&pos));

    // two knights, one white's one black's
    set_pos(&pos,"4k3/8/8/8/8/8/Nn6/4K3 b - -");
    assert(!is_lack_of_mating_material(&pos));

    // two bishops, one white one black opposite colors
    set_pos(&pos,"4k3/8/8/8/8/8/Bb6/4K3 w - -");
    assert(!is_lack_of_mating_material(&pos));

    // two bishops, one white one black same color
    set_pos(&pos,"4k3/8/8/8/8/8/B1b5/4K3 b - -");
    assert(is_lack_of_mating_material(&pos));

    // knight vs bishop
    set_pos(&pos,"4k3/8/8/8/8/8/B1n5/4K3 b - -");
    assert(!is_lack_of_mating_material(&pos));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
leaq -0x1c8(%rbp), %rdi
callq 0xf390
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x1901b
jmp 0x1901d
jmp 0x1903c
leaq 0x21e73(%rip), %rdi     # 0x3ae97
leaq 0x21e3e(%rip), %rsi     # 0x3ae69
movl $0x26, %edx
leaq 0x21e82(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21e96(%rip), %rsi     # 0x3aee0
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x19063
jmp 0x19065
jmp 0x19084
leaq 0x21e2b(%rip), %rdi     # 0x3ae97
leaq 0x21df6(%rip), %rsi     # 0x3ae69
movl $0x2a, %edx
leaq 0x21e3a(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21e69(%rip), %rsi     # 0x3aefb
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
testb $0x1, %al
jne 0x190a9
jmp 0x190ab
jmp 0x190ca
leaq 0x21de6(%rip), %rdi     # 0x3ae98
leaq 0x21db0(%rip), %rsi     # 0x3ae69
movl $0x2e, %edx
leaq 0x21df4(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21e3e(%rip), %rsi     # 0x3af16
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
testb $0x1, %al
jne 0x190ef
jmp 0x190f1
jmp 0x19110
leaq 0x21da0(%rip), %rdi     # 0x3ae98
leaq 0x21d6a(%rip), %rsi     # 0x3ae69
movl $0x32, %edx
leaq 0x21dae(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21e13(%rip), %rsi     # 0x3af31
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x19137
jmp 0x19139
jmp 0x19158
leaq 0x21d57(%rip), %rdi     # 0x3ae97
leaq 0x21d22(%rip), %rsi     # 0x3ae69
movl $0x36, %edx
leaq 0x21d66(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21de6(%rip), %rsi     # 0x3af4c
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x1917f
jmp 0x19181
jmp 0x191a0
leaq 0x21d0f(%rip), %rdi     # 0x3ae97
leaq 0x21cda(%rip), %rsi     # 0x3ae69
movl $0x3a, %edx
leaq 0x21d1e(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21db9(%rip), %rsi     # 0x3af67
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
testb $0x1, %al
jne 0x191c5
jmp 0x191c7
jmp 0x191e6
leaq 0x21cca(%rip), %rdi     # 0x3ae98
leaq 0x21c94(%rip), %rsi     # 0x3ae69
movl $0x3e, %edx
leaq 0x21cd8(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21d8d(%rip), %rsi     # 0x3af81
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x1920d
jmp 0x1920f
jmp 0x1922e
leaq 0x21c81(%rip), %rdi     # 0x3ae97
leaq 0x21c4c(%rip), %rsi     # 0x3ae69
movl $0x42, %edx
leaq 0x21c90(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21d61(%rip), %rsi     # 0x3af9d
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x19255
jmp 0x19257
jmp 0x19276
leaq 0x21c39(%rip), %rdi     # 0x3ae97
leaq 0x21c04(%rip), %rsi     # 0x3ae69
movl $0x46, %edx
leaq 0x21c48(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21d35(%rip), %rsi     # 0x3afb9
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x1929d
jmp 0x1929f
jmp 0x192be
leaq 0x21bf1(%rip), %rdi     # 0x3ae97
leaq 0x21bbc(%rip), %rsi     # 0x3ae69
movl $0x4a, %edx
leaq 0x21c00(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21d09(%rip), %rsi     # 0x3afd5
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
testb $0x1, %al
jne 0x192e3
jmp 0x192e5
jmp 0x19304
leaq 0x21bac(%rip), %rdi     # 0x3ae98
leaq 0x21b76(%rip), %rsi     # 0x3ae69
movl $0x4e, %edx
leaq 0x21bba(%rip), %rcx     # 0x3aeb9
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
leaq 0x21ce0(%rip), %rsi     # 0x3aff2
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0x6180
xorb $-0x1, %al
testb $0x1, %al
jne 0x1932b
jmp 0x1932d
jmp 0x1934c
leaq 0x21b63(%rip), %rdi     # 0x3ae97
leaq 0x21b2e(%rip), %rsi     # 0x3ae69
movl $0x52, %edx
leaq 0x21b72(%rip), %rcx     # 0x3aeb9
callq 0x20c0
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)