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

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

        if (attacked_by_bishop(&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]));

    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]));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
leaq -0x1c8(%rbp), %rdi
leaq 0x22a2c(%rip), %rsi     # 0x39c85
callq 0xf3e0
movq $0x0, -0x1d0(%rbp)
movq $0x0, -0x1d8(%rbp)
movl $0x0, -0x1dc(%rbp)
cmpl $0x3f, -0x1dc(%rbp)
jg 0x17318
movl -0x1dc(%rbp), %esi
leaq -0x1c8(%rbp), %rdi
movl $0x1, %edx
callq 0x4180
testb $0x1, %al
jne 0x172a8
jmp 0x172c8
movslq -0x1dc(%rbp), %rcx
leaq 0xee3ba(%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 0x4180
testb $0x1, %al
jne 0x172e2
jmp 0x17302
movslq -0x1dc(%rbp), %rcx
leaq 0xee380(%rip), %rax     # 0x105670
movq (%rax,%rcx,8), %rax
orq -0x1d8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
jmp 0x17304
movl -0x1dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
jmp 0x1727e
movq -0x1d0(%rbp), %rax
leaq 0xee34a(%rip), %rcx     # 0x105670
movq 0x98(%rcx), %rcx
leaq 0xee33c(%rip), %rdx     # 0x105670
orq 0x50(%rdx), %rcx
leaq 0xee331(%rip), %rdx     # 0x105670
orq 0x8(%rdx), %rcx
leaq 0xee326(%rip), %rdx     # 0x105670
orq 0xa8(%rdx), %rcx
leaq 0xee318(%rip), %rdx     # 0x105670
orq 0x70(%rdx), %rcx
leaq 0xee30d(%rip), %rdx     # 0x105670
orq 0x38(%rdx), %rcx
leaq 0xee302(%rip), %rdx     # 0x105670
orq 0x118(%rdx), %rcx
leaq 0xee2f4(%rip), %rdx     # 0x105670
orq 0x150(%rdx), %rcx
leaq 0xee2e6(%rip), %rdx     # 0x105670
orq 0x188(%rdx), %rcx
leaq 0xee2d8(%rip), %rdx     # 0x105670
orq 0x1c0(%rdx), %rcx
leaq 0xee2ca(%rip), %rdx     # 0x105670
orq 0x128(%rdx), %rcx
leaq 0xee2bc(%rip), %rdx     # 0x105670
orq 0x170(%rdx), %rcx
leaq 0xee2ae(%rip), %rdx     # 0x105670
orq 0x1b8(%rdx), %rcx
cmpq %rcx, %rax
jne 0x173d0
jmp 0x173ef
leaq 0x228d1(%rip), %rdi     # 0x39ca8
leaq 0x224d0(%rip), %rsi     # 0x398ae
movl $0x73, %edx
leaq 0x229a6(%rip), %rcx     # 0x39d90
callq 0x20c0
movq -0x1d8(%rbp), %rax
leaq 0xee273(%rip), %rcx     # 0x105670
movq 0x90(%rcx), %rcx
leaq 0xee265(%rip), %rdx     # 0x105670
orq 0x48(%rdx), %rcx
leaq 0xee25a(%rip), %rdx     # 0x105670
orq 0xa0(%rdx), %rcx
leaq 0xee24c(%rip), %rdx     # 0x105670
orq 0x68(%rdx), %rcx
leaq 0xee241(%rip), %rdx     # 0x105670
orq 0x110(%rdx), %rcx
leaq 0xee233(%rip), %rdx     # 0x105670
orq 0x148(%rdx), %rcx
leaq 0xee225(%rip), %rdx     # 0x105670
orq 0x180(%rdx), %rcx
leaq 0xee217(%rip), %rdx     # 0x105670
orq 0x120(%rdx), %rcx
leaq 0xee209(%rip), %rdx     # 0x105670
orq 0x168(%rdx), %rcx
leaq 0xee1fb(%rip), %rdx     # 0x105670
orq 0x1b0(%rdx), %rcx
leaq 0xee1ed(%rip), %rdx     # 0x105670
orq 0x1f8(%rdx), %rcx
cmpq %rcx, %rax
jne 0x17491
jmp 0x174b0
leaq 0x22917(%rip), %rdi     # 0x39daf
leaq 0x2240f(%rip), %rsi     # 0x398ae
movl $0x78, %edx
leaq 0x228e5(%rip), %rcx     # 0x39d90
callq 0x20c0
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopl (%rax)