// File: jswaff[P]prophet3/test/attack__test.cpp
// Function: test_attacked_by_queen()
void test_attacked_by_queen() {
    position pos;
    set_pos(&pos,"8/1r3k2/8/3qQ3/8/8/8/3K4 b - - 0 1");

    uint64 white_map=0,black_map=0;
    for (int32 sq=A8;sq<=H1;sq++) {
        if (attacked_by_queen(&pos,(square_t)sq,WHITE)) {
            white_map |= bb_squares[sq];
        }

        if (attacked_by_queen(&pos,(square_t)sq,BLACK)) {
            black_map |= bb_squares[sq];
        }
    }

    assert(white_map==(bb_squares[D6] | bb_squares[C7] | bb_squares[B8]
            | bb_squares[F6] | bb_squares[G7] | bb_squares[H8]
            | bb_squares[D4] | bb_squares[C3] | bb_squares[B2] | bb_squares[A1]
            | bb_squares[F4] | bb_squares[G3] | bb_squares[H2]
            | bb_squares[E6] | bb_squares[E7] | bb_squares[E8]
            | bb_squares[E4] | bb_squares[E3] | bb_squares[E2] | bb_squares[E1]
            | bb_squares[D5] | bb_squares[F5] | bb_squares[G5] | bb_squares[H5] ));

    assert(black_map==(bb_squares[C6] | bb_squares[B7]
            | bb_squares[E6] | bb_squares[F7]
            | bb_squares[C4] | bb_squares[B3] | bb_squares[A2]
            | bb_squares[E4] | bb_squares[F3] | bb_squares[G2] | bb_squares[H1]
            | bb_squares[C5] | bb_squares[B5] | bb_squares[A5] | bb_squares[E5]
            | bb_squares[D6] | bb_squares[D7] | bb_squares[D8]
            | bb_squares[D4] | bb_squares[D3] | bb_squares[D2] | bb_squares[D1]));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
leaq -0x1c8(%rbp), %rdi
leaq 0x2299c(%rip), %rsi     # 0x39e75
callq 0xf3e0
movq $0x0, -0x1d0(%rbp)
movq $0x0, -0x1d8(%rbp)
movl $0x0, -0x1dc(%rbp)
cmpl $0x3f, -0x1dc(%rbp)
jg 0x17598
movl -0x1dc(%rbp), %esi
leaq -0x1c8(%rbp), %rdi
movl $0x1, %edx
callq 0x41f0
testb $0x1, %al
jne 0x17528
jmp 0x17548
movslq -0x1dc(%rbp), %rcx
leaq 0xee13a(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
orq -0x1d0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movl -0x1dc(%rbp), %esi
leaq -0x1c8(%rbp), %rdi
xorl %edx, %edx
callq 0x41f0
testb $0x1, %al
jne 0x17562
jmp 0x17582
movslq -0x1dc(%rbp), %rcx
leaq 0xee100(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
orq -0x1d8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
jmp 0x17584
movl -0x1dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
jmp 0x174fe
movq -0x1d0(%rbp), %rax
leaq 0xee0ca(%rip), %rcx     # 0x105670
movq 0x98(%rcx), %rcx
leaq 0xee0bc(%rip), %rdx     # 0x105670
orq 0x50(%rdx), %rcx
leaq 0xee0b1(%rip), %rdx     # 0x105670
orq 0x8(%rdx), %rcx
leaq 0xee0a6(%rip), %rdx     # 0x105670
orq 0xa8(%rdx), %rcx
leaq 0xee098(%rip), %rdx     # 0x105670
orq 0x70(%rdx), %rcx
leaq 0xee08d(%rip), %rdx     # 0x105670
orq 0x38(%rdx), %rcx
leaq 0xee082(%rip), %rdx     # 0x105670
orq 0x118(%rdx), %rcx
leaq 0xee074(%rip), %rdx     # 0x105670
orq 0x150(%rdx), %rcx
leaq 0xee066(%rip), %rdx     # 0x105670
orq 0x188(%rdx), %rcx
leaq 0xee058(%rip), %rdx     # 0x105670
orq 0x1c0(%rdx), %rcx
leaq 0xee04a(%rip), %rdx     # 0x105670
orq 0x128(%rdx), %rcx
leaq 0xee03c(%rip), %rdx     # 0x105670
orq 0x170(%rdx), %rcx
leaq 0xee02e(%rip), %rdx     # 0x105670
orq 0x1b8(%rdx), %rcx
leaq 0xee020(%rip), %rdx     # 0x105670
orq 0xa0(%rdx), %rcx
leaq 0xee012(%rip), %rdx     # 0x105670
orq 0x60(%rdx), %rcx
leaq 0xee007(%rip), %rdx     # 0x105670
orq 0x20(%rdx), %rcx
leaq 0xedffc(%rip), %rdx     # 0x105670
orq 0x120(%rdx), %rcx
leaq 0xedfee(%rip), %rdx     # 0x105670
orq 0x160(%rdx), %rcx
leaq 0xedfe0(%rip), %rdx     # 0x105670
orq 0x1a0(%rdx), %rcx
leaq 0xedfd2(%rip), %rdx     # 0x105670
orq 0x1e0(%rdx), %rcx
leaq 0xedfc4(%rip), %rdx     # 0x105670
orq 0xd8(%rdx), %rcx
leaq 0xedfb6(%rip), %rdx     # 0x105670
orq 0xe8(%rdx), %rcx
leaq 0xedfa8(%rip), %rdx     # 0x105670
orq 0xf0(%rdx), %rcx
leaq 0xedf9a(%rip), %rdx     # 0x105670
orq 0xf8(%rdx), %rcx
cmpq %rcx, %rax
jne 0x176e4
jmp 0x17703
leaq 0x227ad(%rip), %rdi     # 0x39e98
leaq 0x221bc(%rip), %rsi     # 0x398ae
movl $0x90, %edx
leaq 0x2293e(%rip), %rcx     # 0x3a03c
callq 0x20c0
movq -0x1d8(%rbp), %rax
leaq 0xedf5f(%rip), %rcx     # 0x105670
movq 0x90(%rcx), %rcx
leaq 0xedf51(%rip), %rdx     # 0x105670
orq 0x48(%rdx), %rcx
leaq 0xedf46(%rip), %rdx     # 0x105670
orq 0xa0(%rdx), %rcx
leaq 0xedf38(%rip), %rdx     # 0x105670
orq 0x68(%rdx), %rcx
leaq 0xedf2d(%rip), %rdx     # 0x105670
orq 0x110(%rdx), %rcx
leaq 0xedf1f(%rip), %rdx     # 0x105670
orq 0x148(%rdx), %rcx
leaq 0xedf11(%rip), %rdx     # 0x105670
orq 0x180(%rdx), %rcx
leaq 0xedf03(%rip), %rdx     # 0x105670
orq 0x120(%rdx), %rcx
leaq 0xedef5(%rip), %rdx     # 0x105670
orq 0x168(%rdx), %rcx
leaq 0xedee7(%rip), %rdx     # 0x105670
orq 0x1b0(%rdx), %rcx
leaq 0xeded9(%rip), %rdx     # 0x105670
orq 0x1f8(%rdx), %rcx
leaq 0xedecb(%rip), %rdx     # 0x105670
orq 0xd0(%rdx), %rcx
leaq 0xedebd(%rip), %rdx     # 0x105670
orq 0xc8(%rdx), %rcx
leaq 0xedeaf(%rip), %rdx     # 0x105670
orq 0xc0(%rdx), %rcx
leaq 0xedea1(%rip), %rdx     # 0x105670
orq 0xe0(%rdx), %rcx
leaq 0xede93(%rip), %rdx     # 0x105670
orq 0x98(%rdx), %rcx
leaq 0xede85(%rip), %rdx     # 0x105670
orq 0x58(%rdx), %rcx
leaq 0xede7a(%rip), %rdx     # 0x105670
orq 0x18(%rdx), %rcx
leaq 0xede6f(%rip), %rdx     # 0x105670
orq 0x118(%rdx), %rcx
leaq 0xede61(%rip), %rdx     # 0x105670
orq 0x158(%rdx), %rcx
leaq 0xede53(%rip), %rdx     # 0x105670
orq 0x198(%rdx), %rcx
leaq 0xede45(%rip), %rdx     # 0x105670
orq 0x1d8(%rdx), %rcx
cmpq %rcx, %rax
jne 0x17839
jmp 0x17858
leaq 0x2281a(%rip), %rdi     # 0x3a05a
leaq 0x22067(%rip), %rsi     # 0x398ae
movl $0x98, %edx
leaq 0x227e9(%rip), %rcx     # 0x3a03c
callq 0x20c0
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopw %cs:(%rax,%rax)