// File: /workspace/github_cpp_makefile_star2_O1/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 0x1df92
movq %rax, %rcx
movslq %r15d, %r12
leaq 0xf9ec9(%rip), %rdx     # 0x1181a0
movb $0x1, %al
testq %rcx, (%rdx,%r12,8)
jne 0x1e43b
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 0x27493(%rip), %rax     # 0x457a0
movq (%rax,%r12,8), %r11
movq %r13, %rdx
andq %r11, %rdx
leaq 0x27682(%rip), %rax     # 0x459a0
movl (%rax,%r12,4), %edi
leaq 0x10217(%rip), %rax     # 0x2e540
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 0x104f5(%rip), %rax     # 0x2e840
movl (%rax,%r12,4), %eax
movl %eax, %ecx
shrl %cl, %edx
movl %edi, 0xc(%rsp)
addl %edi, %edx
leaq 0x27740(%rip), %rcx     # 0x45aa0
movq 0x120(%rbx), %rdi
orq %rsi, %rdi
andq (%rcx,%rdx,8), %rdi
leaq 0xef72b(%rip), %rcx     # 0x10daa0
movq (%rcx,%r12,8), %rbp
andq %rbp, %r13
leaq 0xffbd(%rip), %rcx      # 0x2e340
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 0x10399(%rip), %rcx     # 0x2e740
movl (%rcx,%r12,4), %edx
movl %edx, %ecx
shrl %cl, %r13d
leaq 0xef8e9(%rip), %rcx     # 0x10dca0
movl (%rcx,%r12,4), %r12d
orq 0x118(%rbx), %rsi
addl %r12d, %r13d
leaq 0xef9d4(%rip), %rcx     # 0x10dda0
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 0x1e439
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 0x27676(%rip), %rcx     # 0x45aa0
orq (%rcx,%r8,8), %rax
notq %rax
testq %rax, %rsi
setne %al
jmp 0x1e43b
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq