// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::move_attacks_square(Move, Square) const
bool Position::move_attacks_square(Move m, Square s) const {

  assert(move_is_ok(m));
  assert(square_is_ok(s));

  Bitboard occ, xray;
  Square f = move_from(m), t = move_to(m);

  assert(square_is_occupied(f));

  if (bit_is_set(attacks_from(piece_on(f), t), s))
      return true;

  // Move the piece and scan for X-ray attacks behind it
  occ = occupied_squares();
  do_move_bb(&occ, make_move_bb(f, t));
  xray = ( (rook_attacks_bb(s, occ)   & pieces(ROOK, QUEEN))
          |(bishop_attacks_bb(s, occ) & pieces(BISHOP, QUEEN)))
         & pieces_of_color(color_of_piece_on(f));

  // If we have attacks we need to verify that are caused by our move
  // and are not already existent ones.
  return xray && (xray ^ (xray & attacks_from<QUEEN>(s)));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %r14d
shrl $0x6, %r14d
andl $0x3f, %r14d
andl $0x3f, %ebp
movl (%rdi,%r14,4), %r13d
movl %r13d, %esi
movl %ebp, %edx
callq 0x1e4b4
movq %rax, %rcx
movslq %r15d, %r12
leaq 0xfa9a7(%rip), %rdx     # 0x1191a0
movb $0x1, %al
testq %rcx, (%rdx,%r12,8)
jne 0x1e95d
movq 0x100(%rbx), %rcx
movq 0x128(%rbx), %rsi
movl %ebp, %eax
movq %r13, 0x10(%rsp)
movq (%rdx,%rax,8), %r13
orq (%rdx,%r14,8), %r13
movq %rcx, %r14
xorq %rcx, %r13
leaq 0x27f71(%rip), %rax     # 0x467a0
movq (%rax,%r12,8), %r11
movq %r13, %rdx
andq %r11, %rdx
leaq 0x28160(%rip), %rax     # 0x469a0
movl (%rax,%r12,4), %edi
leaq 0x10d75(%rip), %rax     # 0x2f5c0
movq (%rax,%r12,8), %r15
movl %r15d, %eax
imull %edx, %eax
shrq $0x20, %rdx
movq %r15, %r8
shrq $0x20, %r8
imull %r8d, %edx
xorl %eax, %edx
leaq 0x11053(%rip), %rax     # 0x2f8c0
movl (%rax,%r12,4), %eax
movl %eax, %ecx
shrl %cl, %edx
movl %edi, 0xc(%rsp)
addl %edi, %edx
leaq 0x2821e(%rip), %rcx     # 0x46aa0
movq 0x120(%rbx), %rdi
orq %rsi, %rdi
andq (%rcx,%rdx,8), %rdi
leaq 0xf0209(%rip), %rcx     # 0x10eaa0
movq (%rcx,%r12,8), %rbp
andq %rbp, %r13
leaq 0x10b1b(%rip), %rcx     # 0x2f3c0
movq (%rcx,%r12,8), %r9
movl %r9d, %ecx
imull %r13d, %ecx
shrq $0x20, %r13
movq %r9, %r10
shrq $0x20, %r10
imull %r10d, %r13d
xorl %ecx, %r13d
leaq 0x10ef7(%rip), %rcx     # 0x2f7c0
movl (%rcx,%r12,4), %edx
movl %edx, %ecx
shrl %cl, %r13d
leaq 0xf03c7(%rip), %rcx     # 0x10eca0
movl (%rcx,%r12,4), %r12d
orq 0x118(%rbx), %rsi
addl %r12d, %r13d
leaq 0xf04b2(%rip), %rcx     # 0x10eda0
andq (%rcx,%r13,8), %rsi
movq %rcx, %r13
orq %rdi, %rsi
movq 0x10(%rsp), %rcx
sarl $0x3, %ecx
andq 0x140(%rbx,%rcx,8), %rsi
je 0x1e95b
andq %r14, %r11
imull %r11d, %r15d
shrq $0x20, %r11
imull %r11d, %r8d
xorl %r15d, %r8d
movl %eax, %ecx
shrl %cl, %r8d
addl 0xc(%rsp), %r8d
andq %r14, %rbp
imull %ebp, %r9d
shrq $0x20, %rbp
imull %ebp, %r10d
xorl %r9d, %r10d
movl %edx, %ecx
shrl %cl, %r10d
addl %r12d, %r10d
movq (%r13,%r10,8), %rax
leaq 0x28154(%rip), %rcx     # 0x46aa0
orq (%rcx,%r8,8), %rax
notq %rax
testq %rax, %rsi
setne %al
jmp 0x1e95d
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq