LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/material.cpp
// Function: int MaterialInfoTable::imbalance<(Color)0>(int const (*) [8])
int MaterialInfoTable::imbalance(const int pieceCount[][8]) {

  const Color Them = (Us == WHITE ? BLACK : WHITE);

  int pt1, pt2, pc, v;
  int value = 0;

  // Redundancy of major pieces, formula based on Kaufman's paper
  // "The Evaluation of Material Imbalances in Chess"
  if (pieceCount[Us][ROOK] > 0)
      value -=  RedundantRookPenalty * (pieceCount[Us][ROOK] - 1)
              + RedundantQueenPenalty * pieceCount[Us][QUEEN];

  // Second-degree polynomial material imbalance by Tord Romstad
  for (pt1 = PIECE_TYPE_NONE; pt1 <= QUEEN; pt1++)
  {
      pc = pieceCount[Us][pt1];
      if (!pc)
          continue;

      v = LinearCoefficients[pt1];

      for (pt2 = PIECE_TYPE_NONE; pt2 <= pt1; pt2++)
          v +=  QuadraticCoefficientsSameColor[pt1][pt2] * pieceCount[Us][pt2]
              + QuadraticCoefficientsOppositeColor[pt1][pt2] * pieceCount[Them][pt2];

      value += pc * v;
  }
  return value;
}

// Assembly:
movl 0x10(%rdi), %eax
testl %eax, %eax
jle 0x12a17
imull $0xfffffdd6, %eax, %eax # imm = 0xFFFFFDD6
imull $0xfffffec0, 0x14(%rdi), %ecx # imm = 0xFFFFFEC0
addl %ecx, %eax
addl $0x22a, %eax            # imm = 0x22A
jmp 0x12a19
xorl %eax, %eax
pushq %rbp
pushq %r14
pushq %rbx
movabsq $0x1, %rcx
leaq 0x168c2(%rip), %rdx     # 0x292f0
leaq 0x1697b(%rip), %rsi     # 0x293b0
xorl %r8d, %r8d
leaq 0x16891(%rip), %r9      # 0x292d0
cmpq $0x6, %r8
je 0x12a8f
movl (%rdi,%r8,4), %r10d
testl %r10d, %r10d
je 0x12a7f
movl (%r9,%r8,4), %r11d
xorl %ebx, %ebx
cmpq %rbx, %rcx
je 0x12a78
movl (%rdi,%rbx,4), %ebp
movl 0x20(%rdi,%rbx,4), %r14d
imull (%rdx,%rbx,4), %ebp
imull (%rsi,%rbx,4), %r14d
addl %r11d, %ebp
addl %r14d, %ebp
incq %rbx
movl %ebp, %r11d
jmp 0x12a54
imull %r10d, %r11d
addl %r11d, %eax
incq %r8
incq %rcx
addq $0x20, %rdx
addq $0x20, %rsi
jmp 0x12a3f
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/misc.cpp
// Function: input_available()
int input_available() {

  fd_set readfds;
  struct timeval  timeout;

  FD_ZERO(&readfds);
  FD_SET(fileno(stdin), &readfds);
  timeout.tv_sec = 0; // Set to timeout immediately
  timeout.tv_usec = 0;
  select(16, &readfds, 0, 0, &timeout);

  return (FD_ISSET(fileno(stdin), &readfds));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
xorl %eax, %eax
cmpq $0x10, %rax
je 0x13169
andq $0x0, 0x10(%rsp,%rax,8)
incq %rax
jmp 0x13158
movq 0x21e08(%rip), %r14     # 0x34f78
movq (%r14), %rdi
callq 0x5420
pushq $0x40
popq %rbx
cltd
idivl %ebx
movl %edx, %ecx
pushq $0x1
popq %r15
shlq %cl, %r15
movq (%r14), %rdi
callq 0x5420
cltd
idivl %ebx
cltq
orq %r15, 0x10(%rsp,%rax,8)
xorps %xmm0, %xmm0
movq %rsp, %r8
movaps %xmm0, (%r8)
pushq $0x10
popq %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5390
movq (%r14), %rdi
callq 0x5420
cltd
idivl %ebx
cltq
movq 0x10(%rsp,%rax,8), %r15
movq (%r14), %rdi
callq 0x5420
cltd
idivl %ebx
xorl %eax, %eax
btq %rdx, %r15
setb %al
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/move.cpp
// Function: move_from_uci(Position const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
Move move_from_uci(const Position& pos, const string& str) {
	
	
  MoveStack mlist[MAX_MOVES];
  MoveStack* last = generate<MV_LEGAL>(pos, mlist);
  
  for (MoveStack* cur = mlist; cur != last; cur++)
      if (str == move_to_uci(cur->move, pos.is_chess960()))
          return cur->move;

  return MOVE_NONE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x828, %rsp            # imm = 0x828
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x1543a
movq %rax, %r12
movq %rsp, %r13
cmpq %r12, %r15
je 0x136bb
movl (%r15), %esi
movzbl 0x1924(%r14), %edx
movq %r13, %rdi
callq 0x1348d
movq %rbx, %rdi
movq %r13, %rsi
callq 0x14028
movl %eax, %ebp
movq %r13, %rdi
callq 0x5858
testb %bpl, %bpl
jne 0x136bf
addq $0x8, %r15
jmp 0x13683
xorl %eax, %eax
jmp 0x136c2
movl (%r15), %eax
addq $0x828, %rsp            # imm = 0x828
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movegen.cpp
// Function: MoveStack* generate<(MoveType)6>(Position const&, MoveStack*)
MoveStack* generate<MV_LEGAL>(const Position& pos, MoveStack* mlist) {
  STARTNEW
  if (!(pos.piece_count(WHITE, KING) && pos.piece_count(BLACK, KING))) {
	  return mlist;
  }
  ENDNEW
  //NEW assert(pos.piece_count(WHITE, KING) && pos.piece_count(BLACK, KING));
		
  assert(pos.is_ok());
  

  MoveStack *last, *cur = mlist;
  Bitboard pinned = pos.pinned_pieces(pos.side_to_move());

  last = generate<MV_PSEUDO_LEGAL>(pos, mlist);
  
  
  
  // Remove illegal moves from the list
  while (cur != last) {
	  //NEW assert(pos.color_of_piece_on(move_from(cur->move)) == pos.side_to_move());
      if (!pos.pl_move_is_legal(cur->move, pinned))
          cur->move = (--last)->move;
      else
          cur++;
      
  }

  return last;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x0, 0x168(%rdi)
je 0x154a6
movq %rdi, %r14
cmpl $0x0, 0x188(%rdi)
je 0x154a6
movl 0x1090(%r14), %esi
movq %r14, %rdi
callq 0x18582
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1540d
movq %rax, %r12
cmpq %r12, %rbx
je 0x154a3
movl (%rbx), %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x187c6
testb %al, %al
je 0x15496
addq $0x8, %rbx
jmp 0x1547a
movl -0x8(%r12), %eax
addq $-0x8, %r12
movl %eax, (%rbx)
jmp 0x1547a
movq %r12, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movepick.cpp
// Function: MovePicker::MovePicker(Position const&, Move, Depth, History const&, SearchStack*, Value)
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
                       SearchStack* ss, Value beta) : pos(p), H(h) {
  int searchTT = ttm;
  ttMoves[0].move = ttm;
  
  //NEW badCaptureThreshold = PawnValueMidgame;
  badCaptureThreshold = 0;
  
  badCaptures = moves + MAX_MOVES;

  assert(d > DEPTH_ZERO);

  pinned = p.pinned_pieces(pos.side_to_move());

  if (p.in_check())
  {
      ttMoves[1].move = killers[0].move = killers[1].move = MOVE_NONE;
      phasePtr = EvasionTable;
  }
  else
  {
      ttMoves[1].move = (ss->mateKiller == ttm) ? MOVE_NONE : ss->mateKiller;
      searchTT |= ttMoves[1].move;
      killers[0].move = ss->killers[0];
      killers[1].move = ss->killers[1];

      // Consider sligtly negative captures as good if at low
      // depth and far from beta.
      if (ss && ss->eval < beta - PawnValueMidgame && d < 3 * ONE_PLY) { 
    	  //NEW badCaptureThreshold = 0;
    	  badCaptureThreshold = -PawnValueMidgame;
      }

      phasePtr = MainSearchTable;
  }

  phasePtr += int(!searchTT) - 1;
  go_next_phase();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
movl 0x40(%rsp), %r13d
movq %rsi, (%rdi)
movq %r8, 0x8(%rdi)
movl %edx, 0x18(%rdi)
andl $0x0, 0x38(%rdi)
movl %ecx, %r15d
leaq 0x868(%rdi), %rax
movq %rax, 0x60(%rdi)
movl 0x1090(%rsi), %esi
movq %r12, %rdi
callq 0x18582
movq %rax, 0x10(%rbx)
movq 0x1938(%r12), %rax
cmpq $0x0, 0x40(%rax)
je 0x1619d
andl $0x0, 0x30(%rbx)
andl $0x0, 0x28(%rbx)
andl $0x0, 0x20(%rbx)
leaq 0x136ed(%rip), %rax     # 0x29888
jmp 0x161df
movl 0x8(%r14), %eax
xorl %ecx, %ecx
cmpl %ebp, %eax
cmovnel %eax, %ecx
movl %ecx, 0x20(%rbx)
orl %ecx, %ebp
movl 0x14(%r14), %eax
movl %eax, 0x28(%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x30(%rbx)
leaq 0x136fe(%rip), %rax     # 0x298c0
cmpl $0x5, %r15d
jg 0x161df
leaq 0x1f279(%rip), %rcx     # 0x35448
movl (%rcx), %ecx
subl %ecx, %r13d
cmpl %r13d, 0x20(%r14)
jge 0x161df
negl %ecx
movl %ecx, 0x38(%rbx)
cmpl $0x1, %ebp
adcq $-0x1, %rax
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16200
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movepick.cpp
// Function: MovePicker::go_next_phase()
void MovePicker::go_next_phase() {

  curMove = moves;
  phase = *(++phasePtr);
  switch (phase) {

  case PH_TT_MOVES:
      curMove = ttMoves;
      lastMove = curMove + 2;
      return;

  case PH_GOOD_CAPTURES:
      lastMove = generate<MV_CAPTURE>(pos, moves);
      score_captures();
      return;

  case PH_KILLERS:
      curMove = killers;
      lastMove = curMove + 2;
      return;

  case PH_NONCAPTURES:
      lastMove = generate<MV_NON_CAPTURE>(pos, moves);
      score_noncaptures();
      sort_moves(moves, lastMove, &lastGoodNonCapture);
      return;

  case PH_BAD_CAPTURES:
      // Bad captures SEE value is already calculated so just pick
      // them in order to get SEE move ordering.
      curMove = badCaptures;
      lastMove = moves + MAX_MOVES;
      return;

  case PH_EVASIONS:
      assert(pos.in_check());
      lastMove = generate<MV_EVASION>(pos, moves);
      score_evasions();
      return;

  case PH_QCAPTURES:
      lastMove = generate<MV_CAPTURE>(pos, moves);
      score_captures();
      return;

  case PH_QCHECKS:
      lastMove = generate<MV_NON_CAPTURE_CHECK>(pos, moves);
      return;

  case PH_STOP:
      lastMove = curMove + 1; // Avoid another go_next_phase() call
      return;

  default:
      assert(false);
      return;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x68(%rdi), %r14
movq %r14, 0x48(%rdi)
movq 0x40(%rdi), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x40(%rdi)
movzbl 0x1(%rax), %eax
movl %eax, 0x3c(%rdi)
cmpq $0x8, %rax
ja 0x162eb
movq %rdi, %rbx
leaq 0x1360d(%rip), %rcx     # 0x29840
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x159a9
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x163a4
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x15ba8
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
callq 0x1640e
movq 0x50(%rbx), %rsi
addq $0x58, %rbx
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x166fc
leaq 0x18(%rbx), %rax
movq %rax, 0x48(%rbx)
leaq 0x28(%rbx), %rax
jmp 0x162e7
leaq 0x28(%rbx), %rax
movq %rax, 0x48(%rbx)
leaq 0x38(%rbx), %rax
jmp 0x162e7
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x1445b
jmp 0x162e7
movq 0x60(%rbx), %rax
movq %rax, 0x48(%rbx)
leaq 0x868(%rbx), %rax
jmp 0x162e7
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x14bdf
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1644e
leaq 0x70(%rbx), %rax
movq %rax, 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movepick.cpp
// Function: MovePicker::MovePicker(Position const&, Move, Depth, History const&)
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h)
                      : pos(p), H(h) {
  int searchTT = ttm;
  ttMoves[0].move = ttm;
  ttMoves[1].move = MOVE_NONE;

  assert(d <= DEPTH_ZERO);

  pinned = p.pinned_pieces(pos.side_to_move());

  if (p.in_check())
      phasePtr = EvasionTable;
  else if (d >= DEPTH_QS_CHECKS)
      phasePtr = QsearchWithChecksTable;
  else
  {
      phasePtr = QsearchWithoutChecksTable;

      // Skip TT move if is not a capture or a promotion, this avoids
      // qsearch tree explosion due to a possible perpetual check or
      // similar rare cases when TT table is full.
      if (ttm != MOVE_NONE && !pos.move_is_capture_or_promotion(ttm))
          searchTT = ttMoves[0].move = MOVE_NONE;
  }

  phasePtr += int(!searchTT) - 1;
  go_next_phase();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, (%rdi)
movq %r8, 0x8(%rdi)
movl %edx, 0x18(%rdi)
andl $0x0, 0x20(%rdi)
movl 0x1090(%rsi), %esi
movq %r15, %rdi
callq 0x18582
movq %rax, 0x10(%rbx)
movq 0x1938(%r15), %rax
cmpq $0x0, 0x40(%rax)
je 0x1633d
leaq 0x1354d(%rip), %rax     # 0x29888
jmp 0x16349
cmpl $-0x3, %ebp
jle 0x16369
leaq 0x1357d(%rip), %rax     # 0x298c6
movl %r14d, %ecx
cmpl $0x1, %ecx
adcq $-0x1, %rax
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x16200
xorl %ecx, %ecx
leaq 0x13558(%rip), %rax     # 0x298ca
testl %r14d, %r14d
je 0x1634c
testl $0x1f000, %r14d         # imm = 0x1F000
je 0x16391
notl %r14d
testw $0xc000, %r14w          # imm = 0xC000
jne 0x1639f
andl $0x0, 0x18(%rbx)
jmp 0x1634c
movq (%rbx), %rdx
andl $0x3f, %r14d
cmpl $0x10, (%rdx,%r14,4)
je 0x1638b
pushq $0x1
popq %rcx
jmp 0x1634c
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movepick.cpp
// Function: MovePicker::score_captures()
void MovePicker::score_captures() {
  // Winning and equal captures in the main search are ordered by MVV/LVA.
  // Suprisingly, this appears to perform slightly better than SEE based
  // move ordering. The reason is probably that in a position with a winning
  // capture, capturing a more valuable (but sufficiently defended) piece
  // first usually doesn't hurt. The opponent will have to recapture, and
  // the hanging piece will still be hanging (except in the unusual cases
  // where it is possible to recapture with the hanging piece). Exchanging
  // big pieces before capturing a hanging piece probably helps to reduce
  // the subtree size.
  // In main search we want to push captures with negative SEE values to
  // badCaptures[] array, but instead of doing it now we delay till when
  // the move has been picked up in pick_move_from_list(), this way we save
  // some SEE calls in case we get a cutoff (idea from Pablo Vazquez).
  Move m;

  // Use MVV/LVA ordering
  for (MoveStack* cur = moves; cur != lastMove; cur++)
  {
      m = cur->move;
      if (move_is_promotion(m))
          cur->score = QueenValueMidgame; NEW // this never happens in atomic chess
      else
          cur->score =  pos.midgame_value_of_piece_on(move_to(m))
                      - pos.type_of_piece_on(move_from(m));
  }
}

// Assembly:
leaq 0x68(%rdi), %rax
movq (%rdi), %rcx
movq 0x50(%rdi), %rdx
leaq 0x1f0b2(%rip), %rsi     # 0x35468
movl (%rsi), %esi
leaq 0x39de61(%rip), %rdi    # 0x3b4220
cmpq %rdx, %rax
je 0x1640c
movl (%rax), %r8d
movl %r8d, %r10d
andl $0xc000, %r10d          # imm = 0xC000
movl %esi, %r9d
cmpl $0x4000, %r10d          # imm = 0x4000
je 0x16402
movl %r8d, %r9d
andl $0x3f, %r9d
movl (%rcx,%r9,4), %r9d
movl (%rdi,%r9,4), %r9d
shrl $0x4, %r8d
andl $0xfc, %r8d
movl (%rcx,%r8), %r8d
andl $0x7, %r8d
subl %r8d, %r9d
movl %r9d, 0x4(%rax)
addq $0x8, %rax
jmp 0x163bf
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movepick.cpp
// Function: MovePicker::score_noncaptures()
void MovePicker::score_noncaptures() {

  Move m;
  Square from;

  for (MoveStack* cur = moves; cur != lastMove; cur++)
  {
      m = cur->move;
      from = move_from(m);
      cur->score = H.value(pos.piece_on(from), move_to(m));
  }
}

// Assembly:
leaq 0x68(%rdi), %rax
movq 0x50(%rdi), %rcx
movq (%rdi), %rdx
movq 0x8(%rdi), %rsi
cmpq %rcx, %rax
je 0x1644d
movl (%rax), %edi
movl %edi, %r8d
shrl $0x4, %r8d
andl $0xfc, %r8d
movl (%rdx,%r8), %r8d
andl $0x3f, %edi
shlq $0x8, %r8
addq %rsi, %r8
movl (%r8,%rdi,4), %edi
movl %edi, 0x4(%rax)
addq $0x8, %rax
jmp 0x1641d
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/movepick.cpp
// Function: MovePicker::score_evasions()
void MovePicker::score_evasions() {
  // Try good captures ordered by MVV/LVA, then non-captures if
  // destination square is not under attack, ordered by history
  // value, and at the end bad-captures and non-captures with a
  // negative SEE. This last group is ordered by the SEE score.
  Move m;
  int seeScore;

  // Skip if we don't have at least two moves to order
  if (lastMove < moves + 2)
      return;

  for (MoveStack* cur = moves; cur != lastMove; cur++)
  {
      m = cur->move;
      if ((seeScore = pos.see_sign(m)) < 0)
          cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom
      else if (pos.move_is_capture(m))
          cur->score =  pos.midgame_value_of_piece_on(move_to(m))
                      - pos.type_of_piece_on(move_from(m)) + History::MaxValue;
      else
          cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
  }
}

// Assembly:
movq 0x50(%rdi), %rax
leaq 0x78(%rdi), %rcx
cmpq %rcx, %rax
jb 0x1651b
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x68(%rdi), %r15
leaq 0x39ddab(%rip), %r12    # 0x3b4220
cmpq %rax, %r15
je 0x16510
movl (%r15), %r14d
movq (%rbx), %rdi
movl %r14d, %esi
callq 0x1a668
testl %eax, %eax
js 0x164ca
movq (%rbx), %rcx
testl $0x18000, %r14d         # imm = 0x18000
je 0x164d1
movl %r14d, %edx
notl %edx
movl %r14d, %eax
andl $0x3f, %eax
testw $0xc000, %dx            # imm = 0xC000
jne 0x164df
shrl $0x4, %r14d
andl $0xfc, %r14d
movl (%rcx,%r14), %ecx
shlq $0x8, %rcx
addq 0x8(%rbx), %rcx
movl (%rcx,%rax,4), %eax
jmp 0x164ff
addl $0xfffff830, %eax       # imm = 0xFFFFF830
jmp 0x164ff
movl %r14d, %eax
andl $0x3f, %eax
movl %eax, %edx
cmpl $0x10, (%rcx,%rdx,4)
je 0x164ae
movl (%rcx,%rax,4), %eax
movl (%r12,%rax,4), %eax
shrl $0x4, %r14d
andl $0xfc, %r14d
movl (%rcx,%r14), %ecx
andl $0x7, %ecx
subl %ecx, %eax
addl $0x7d0, %eax            # imm = 0x7D0
movl %eax, 0x4(%r15)
addq $0x8, %r15
movq 0x50(%rbx), %rax
jmp 0x16475
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/./move.h
// Function: void sort_moves<MoveStack>(MoveStack*, MoveStack*, MoveStack**)
inline void sort_moves(T* firstMove, T* lastMove, T** lastPositive)
{
    T tmp;
    T *p, *d;

    d = lastMove;
    p = firstMove - 1;

    d->score = -1; // right guard

    // Split positives vs non-positives
    do {
        while ((++p)->score > 0) {}

        if (p != d)
        {
            while (--d != p && d->score <= 0) {}

            tmp = *p;
            *p = *d;
            *d = tmp;
        }

    } while (p != d);

    // Sort just positive scored moves, remaining only when we get there
    insertion_sort<T, T*>(firstMove, p);
    *lastPositive = p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
leaq -0x8(%rdi), %r14
orl $-0x1, 0x4(%rsi)
cmpl $0x0, 0xc(%r14)
leaq 0x8(%r14), %r14
jg 0x1670b
cmpq %rsi, %r14
je 0x16740
addq $-0x8, %rsi
movq %rsi, %rax
movq %rax, %rsi
cmpq %r14, %rax
je 0x16734
leaq -0x8(%rsi), %rax
cmpl $0x0, 0x4(%rsi)
jle 0x16722
movq (%r14), %rax
movq (%rsi), %rcx
movq %rcx, (%r14)
movq %rax, (%rsi)
cmpq %rsi, %r14
jne 0x1670b
movq %r14, %rsi
callq 0x16782
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/./move.h
// Function: MoveStack pick_best<MoveStack>(MoveStack*, MoveStack*)
inline T pick_best(T* curMove, T* lastMove)
{
    T bestMove, tmp;

    bestMove = *curMove;
    while (++curMove != lastMove)
    {
        if (bestMove < *curMove)
        {
            tmp = *curMove;
            *curMove = bestMove;
            bestMove = tmp;
        }
    }
    return bestMove;
}

// Assembly:
movq (%rdi), %rax
movq %rax, %rcx
shrq $0x20, %rcx
movq %rdi, %rdx
leaq 0x8(%rdx), %rdi
cmpq %rsi, %rdi
je 0x16781
cmpl %ecx, 0xc(%rdx)
movq %rdi, %rdx
jle 0x16765
movq (%rdi), %rcx
movq %rax, (%rdi)
movq %rcx, %rax
jmp 0x1675b
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/./move.h
// Function: void insertion_sort<MoveStack, MoveStack*>(MoveStack*, MoveStack*)
inline void insertion_sort(K firstMove, K lastMove)
{
    T value;
    K cur, p, d;

    if (firstMove != lastMove)
        for (cur = firstMove + 1; cur != lastMove; cur++)
        {
            p = d = cur;
            value = *p--;
            if (*p < value)
            {
                do *d = *p;
                while (--d != firstMove && *--p < value);
                *d = value;
            }
        }
}

// Assembly:
cmpq %rsi, %rdi
je 0x167db
pushq $0x8
popq %rax
movq %rdi, %r9
leaq 0x8(%r9), %rcx
cmpq %rsi, %rcx
je 0x167db
movq 0x8(%r9), %rdx
movq %rdx, %r8
shrq $0x20, %r8
movq %rax, %r10
cmpl %r8d, 0x4(%r9)
jge 0x167d2
movq -0x8(%rdi,%r10), %r9
movq %r9, (%rdi,%r10)
cmpq $0x8, %r10
je 0x167cc
leaq -0x8(%r10), %r9
cmpl %r8d, -0xc(%rdi,%r10)
movq %r9, %r10
jl 0x167aa
addq %rdi, %r9
jmp 0x167cf
movq %rdi, %r9
movq %rdx, (%r9)
addq $0x8, %rax
movq %rcx, %r9
jmp 0x1678d
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: CheckInfo::CheckInfo(Position const&)
CheckInfo::CheckInfo(const Position& pos) {

  Color us = pos.side_to_move();
  Color them = opposite_color(us);
  
  STARTNEW
  // FIXME: this cuts the possibility of detecting errors
  // but seems to be the easiest way to handle calls in qsearch and search
  if (pos.piece_count(them, KING) == 0 || pos.piece_count(us, KING) == 0) {
	  return;
  }
  ENDNEW
  
  NEW assert(pos.piece_count(them, KING));
  NEW assert(pos.piece_count(us, KING));
  NEW Square us_ksq = pos.king_square(us);
  ksq = pos.king_square(them);
  dcCandidates = pos.discovered_check_candidates(us);
  
  STARTNEW if (squares_touch[ksq][us_ksq]) {
	  checkSq[PAWN] 	= EmptyBoardBB;
	  checkSq[KNIGHT] 	= EmptyBoardBB;
	  checkSq[BISHOP] 	= EmptyBoardBB;
	  checkSq[ROOK] 	= EmptyBoardBB;
	  checkSq[QUEEN] 	= EmptyBoardBB;
	  checkSq[KING] 	= EmptyBoardBB;
  ENDNEW } else {
	  checkSq[PAWN] 	= pos.attacks_from<PAWN>(ksq, them);
	  checkSq[KNIGHT] 	= pos.attacks_from<KNIGHT>(ksq);
	  checkSq[BISHOP] 	= pos.attacks_from<BISHOP>(ksq);
	  checkSq[ROOK] 	= pos.attacks_from<ROOK>(ksq);
	  checkSq[QUEEN] 	= checkSq[BISHOP] | checkSq[ROOK];
	  checkSq[KING] 	= EmptyBoardBB;
  NEW }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl 0x1090(%rsi), %esi
movq %rsi, %r15
xorq $0x1, %r15
movq %r15, %rax
shlq $0x5, %rax
cmpl $0x0, 0x168(%r14,%rax)
je 0x1733b
leaq 0x150(%r14), %rax
movq %rsi, %rcx
shlq $0x5, %rcx
cmpl $0x0, 0x18(%rax,%rcx)
je 0x1733b
movq %rdi, %rbx
movq %rsi, %rax
shlq $0x9, %rax
movslq 0x310(%r14,%rax), %r12
movq %r15, %rax
shlq $0x9, %rax
movl 0x310(%r14,%rax), %eax
movl %eax, 0x48(%rdi)
movq %r14, %rdi
callq 0x1acd6
movq %rax, (%rbx)
movslq 0x48(%rbx), %rsi
movq %rsi, %rax
shlq $0x6, %rax
addq 0x1dcb8(%rip), %rax     # 0x34f88
cmpb $0x0, (%r12,%rax)
je 0x172e8
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
jmp 0x1733b
leal 0x1(,%r15,8), %eax
shlq $0x9, %rax
leaq 0xfa455(%rip), %rcx     # 0x111750
leaq (%rcx,%rsi,8), %rdx
movq (%rax,%rdx), %rax
movq %rax, 0x10(%rbx)
movq 0x400(%rcx,%rsi,8), %rax
movq %rax, 0x18(%rbx)
movq %r14, %rdi
callq 0xcf20
movq %rax, 0x20(%rbx)
movl 0x48(%rbx), %esi
movq %r14, %rdi
callq 0x12330
movq %rax, 0x28(%rbx)
orq 0x20(%rbx), %rax
movq %rax, 0x30(%rbx)
andq $0x0, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::Position(Position const&, int)
Position::Position(const Position& pos, int th) {

  memcpy(this, &pos, sizeof(Position));
  detach(); // Always detach() in copy c'tor to avoid surprises
  threadID = th;
  nodes = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movl $0x1940, %edx           # imm = 0x1940
callq 0x5310
movq 0x1938(%r14), %rsi
leaq 0x1878(%r14), %r15
movl $0x98, %edx
movq %r15, %rdi
callq 0x5310
movq %r15, 0x1938(%r14)
andq $0x0, 0x1910(%r14)
movl %ebx, 0x192c(%r14)
andq $0x0, 0x1930(%r14)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::clear()
void Position::clear() {

  st = &startState;
  memset(st, 0, sizeof(StateInfo));
  st->epSquare = SQ_NONE;
  startPosPlyCounter = 0;
  nodes = 0;

  memset(byColorBB,  0, sizeof(Bitboard) * 2);
  memset(byTypeBB,   0, sizeof(Bitboard) * 8);
  memset(pieceCount, 0, sizeof(int) * 2 * 8);
  memset(index,      0, sizeof(int) * 64);

  for (int i = 0; i < 64; i++)
      board[i] = PIECE_NONE;

  for (int i = 0; i < 8; i++)
      for (int j = 0; j < 16; j++)
          pieceList[0][i][j] = pieceList[1][i][j] = SQ_NONE;

  for (Square sq = SQ_A1; sq <= SQ_H8; sq++)
      castleRightsMask[sq] = ALL_CASTLES;

  sideToMove = WHITE;
  initialKFile = FILE_E;
  initialKRFile = FILE_H;
  initialQRFile = FILE_A;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
addq $0x1878, %rdi           # imm = 0x1878
movq %rdi, 0x1938(%rbx)
xorl %r15d, %r15d
movl $0xa0, %edx
xorl %esi, %esi
callq 0x5210
movl $0x40, 0x1898(%rbx)
andl $0x0, 0x1928(%rbx)
andq $0x0, 0x1930(%rbx)
leaq 0x100(%rbx), %r14
leaq 0x590(%rbx), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x5210
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x5210
cmpq $0x40, %r15
je 0x1782e
movl $0x10, (%rbx,%r15,4)
incq %r15
jmp 0x1781b
leaq 0x390(%rbx), %rax
xorl %ecx, %ecx
pushq $0x40
popq %rdx
cmpq $0x8, %rcx
je 0x17860
xorl %esi, %esi
cmpq $0x10, %rsi
je 0x17857
movl %edx, (%rax,%rsi,4)
movl %edx, -0x200(%rax,%rsi,4)
incq %rsi
jmp 0x17842
incq %rcx
addq $0x40, %rax
jmp 0x1783a
xorl %eax, %eax
cmpq $0x40, %rax
je 0x17878
movl $0xf, 0x1778(%rbx,%rax,4)
incq %rax
jmp 0x17862
andl $0x0, 0x1090(%rbx)
movabsq $0x700000004, %rax      # imm = 0x700000004
movq %rax, 0x1918(%rbx)
andl $0x0, 0x1920(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::find_checkers()
void Position::find_checkers() {
  Color us = side_to_move();
  OLD st->checkersBB = attackers_to(king_square(us)) & pieces_of_color(opposite_color(us));
  
  STARTNEW
  if (piece_count(us, KING)) {
	  Square ksq = king_square(us);
	  assert(piece_count(opposite_color(us), KING));
	  Square opp_ksq = king_square(opposite_color(us));
	  
	  // if both kings directly face each other there is no check
	  if (squares_touch[ksq][opp_ksq]) {
		  st->checkersBB = EmptyBoardBB;
		  return;
	  }
	  
	  Bitboard att_to =   (attacks_from<PAWN>(ksq, BLACK) & pieces(PAWN, WHITE))
                		| (attacks_from<PAWN>(ksq, WHITE) & pieces(PAWN, BLACK))
                		| (attacks_from<KNIGHT>(ksq)      & pieces(KNIGHT))
                		| (attacks_from<ROOK>(ksq)        & pieces(ROOK, QUEEN))
                		| (attacks_from<BISHOP>(ksq)      & pieces(BISHOP, QUEEN));
	  
	  st->checkersBB = att_to & pieces_of_color(opposite_color(us));
  } else {
	  st->checkersBB = EmptyBoardBB;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x1090(%rdi), %r15d
movq %r15, %rax
shlq $0x5, %rax
cmpl $0x0, 0x168(%rdi,%rax)
je 0x17acc
movq %r15, %rax
shlq $0x9, %rax
movslq 0x310(%rbx,%rax), %r14
xorl $0x1, %r15d
movq %r15, %rax
shlq $0x9, %rax
movslq 0x310(%rbx,%rax), %rax
movq %r14, %rcx
shlq $0x6, %rcx
addq 0x1d4c2(%rip), %rcx     # 0x34f88
cmpb $0x0, (%rax,%rcx)
je 0x17ad3
xorl %ecx, %ecx
jmp 0x17b5a
leaq 0xf9c76(%rip), %rax     # 0x111750
movq 0x110(%rbx), %r13
movq 0x140(%rbx), %rcx
andq 0x1200(%rax,%r14,8), %rcx
movq 0x148(%rbx), %r12
andq 0x200(%rax,%r14,8), %r12
orq %rcx, %r12
andq 0x108(%rbx), %r12
andq 0x400(%rax,%r14,8), %r13
movq %rbx, %rdi
movl %r14d, %esi
callq 0x12330
movq 0x128(%rbx), %rbp
orq 0x120(%rbx), %rbp
andq %rax, %rbp
orq %r13, %rbp
movq %rbx, %rdi
movl %r14d, %esi
callq 0xcf20
movq 0x128(%rbx), %rcx
orq 0x118(%rbx), %rcx
andq %rax, %rcx
orq %rbp, %rcx
orq %r12, %rcx
andq 0x140(%rbx,%r15,8), %rcx
movq 0x1938(%rbx), %rax
movq %rcx, 0x40(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::compute_key() const
Key Position::compute_key() const {

  Key result = zobCastle[st->castleRights];

  for (Square s = SQ_A1; s <= SQ_H8; s++)
      if (square_is_occupied(s))
          result ^= zobrist[color_of_piece_on(s)][type_of_piece_on(s)][s];

  if (ep_square() != SQ_NONE)
      result ^= zobEp[ep_square()];

  if (side_to_move() == BLACK)
      result ^= zobSideToMove;

  return result;
}

// Assembly:
movq 0x1938(%rdi), %rax
movslq 0x10(%rax), %rcx
leaq 0x39b60a(%rip), %rdx    # 0x3b3190
movq (%rdx,%rcx,8), %rcx
xorl %edx, %edx
leaq 0x3993fd(%rip), %rsi    # 0x3b0f90
movq %rdi, %r8
cmpq $0x200, %rdx            # imm = 0x200
je 0x17bcf
movl (%r8), %r9d
cmpq $0x10, %r9
je 0x17bc5
movl %r9d, %r10d
sarl $0x3, %r10d
andl $0x7, %r9d
shlq $0xc, %r10
shll $0x9, %r9d
orq %r10, %r9
addq %rdx, %r9
xorq (%rsi,%r9), %rcx
addq $0x8, %rdx
addq $0x4, %r8
jmp 0x17b96
movslq 0x20(%rax), %rax
cmpq $0x40, %rax
je 0x17be4
leaq 0x39b3b0(%rip), %rdx    # 0x3b2f90
xorq (%rdx,%rax,8), %rcx
cmpl $0x1, 0x1090(%rdi)
jne 0x17bf6
movq 0x39b61c(%rip), %rax    # 0x3b3210
jmp 0x17bf8
xorl %eax, %eax
xorq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::compute_pawn_key() const
Key Position::compute_pawn_key() const {

  Bitboard b;
  Key result = 0;

  for (Color c = WHITE; c <= BLACK; c++)
  {
      b = pieces(PAWN, c);
      while (b)
          result ^= zobrist[c][PAWN][pop_1st_bit(&b)];
  }
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r12d, %r12d
movq %rsp, %r14
leaq 0x399379(%rip), %r13    # 0x3b0f90
xorl %r15d, %r15d
cmpq $0x2, %r12
je 0x17c5f
movq 0x140(%rbx,%r12,8), %rax
andq 0x108(%rbx), %rax
movq %rax, (%rsp)
movq %r12, %rbp
shlq $0xc, %rbp
addq %r13, %rbp
testq %rax, %rax
je 0x17c5a
movq %r14, %rdi
callq 0x7b62
cltq
xorq 0x200(%rbp,%rax,8), %r15
movq (%rsp), %rax
jmp 0x17c3d
incq %r12
jmp 0x17c1a
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::compute_material_key() const
Key Position::compute_material_key() const {

  int count;
  Key result = 0;

  for (Color c = WHITE; c <= BLACK; c++)
      for (PieceType pt = PAWN; pt <= QUEEN; pt++)
      {
          count = piece_count(c, pt);
          for (int i = 0; i < count; i++)
              result ^= zobrist[c][pt][i];
      }
  return result;
}

// Assembly:
pushq %r14
pushq %rbx
addq $0x150, %rdi            # imm = 0x150
leaq 0x39950d(%rip), %rcx    # 0x3b1190
xorl %edx, %edx
movabsq $0x1, %rsi
xorl %r8d, %r8d
xorl %eax, %eax
cmpq $0x2, %r8
je 0x17ce2
movq %r8, %r9
shlq $0x5, %r9
addq %rdi, %r9
movq %rcx, %r10
movq %rsi, %r11
cmpq $0x6, %r11
je 0x17cd6
movl (%r9,%r11,4), %ebx
testl %ebx, %ebx
cmovlel %edx, %ebx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x17cca
xorq (%r10,%r14,8), %rax
incq %r14
jmp 0x17cbc
incq %r11
addq $0x200, %r10            # imm = 0x200
jmp 0x17caa
incq %r8
addq $0x1000, %rcx           # imm = 0x1000
jmp 0x17c94
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::compute_value() const
Score Position::compute_value() const {

  Bitboard b;
  Score result = SCORE_ZERO;

  for (Color c = WHITE; c <= BLACK; c++)
      for (PieceType pt = PAWN; pt <= KING; pt++)
      {
          b = pieces(pt, c);
          while (b)
              result += pst(c, pt, pop_1st_bit(&b));
      }

  result += (side_to_move() == WHITE ? TempoValue / 2 : -TempoValue / 2);
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x8(%rsp), %r14
xorl %ebp, %ebp
cmpq $0x2, %rax
je 0x17d73
leaq (,%rax,8), %rcx
movq %rcx, 0x10(%rsp)
pushq $0x1
popq %r15
cmpq $0x7, %r15
je 0x17d6e
movq %rax, %r12
movq 0x140(%rbx,%rax,8), %rax
andq 0x100(%rbx,%r15,8), %rax
movq %rax, 0x8(%rsp)
movq %r15, %r13
orq 0x10(%rsp), %r13
shlq $0x8, %r13
leaq 0x39b4d8(%rip), %rcx    # 0x3b3220
addq %rcx, %r13
testq %rax, %rax
je 0x17d66
movq %r14, %rdi
callq 0x7b62
cltq
addl (%r13,%rax,4), %ebp
movq 0x8(%rsp), %rax
jmp 0x17d4b
incq %r15
movq %r12, %rax
jmp 0x17d17
incq %rax
jmp 0x17d00
movl 0x39c567(%rip), %eax    # 0x3b42e0
movl %eax, %edi
negl %edi
cmpl $0x0, 0x1090(%rbx)
cmovel %eax, %edi
pushq $0x2
popq %rsi
callq 0x11d88
addl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::compute_non_pawn_material(Color) const
Value Position::compute_non_pawn_material(Color c) const {

  Value result = VALUE_ZERO;

  for (PieceType pt = KNIGHT; pt <= QUEEN; pt++)
      result += piece_count(c, pt) * PieceValueMidgame[pt];

  return result;
}

// Assembly:
movl %esi, %eax
shlq $0x5, %rax
leaq (%rax,%rdi), %rcx
addq $0x158, %rcx            # imm = 0x158
xorl %edx, %edx
leaq 0x39c466(%rip), %rsi    # 0x3b4220
xorl %eax, %eax
cmpq $0x4, %rdx
je 0x17dd1
movl 0x8(%rsi,%rdx,4), %edi
imull (%rcx,%rdx,4), %edi
addl %edi, %eax
incq %rdx
jmp 0x17dbc
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::neigh_is_ok()
bool Position::neigh_is_ok() {
	
	Square noSquares[64][9];
	Value neValue[64];
	
	write_neigh_arrays(noSquares, neValue);
	
	for (Square s = SQ_A1; s < SQ_NONE; ++s) {
		cout << s << endl;
		
		if (neValue[s] != neigh_expl_value(s)) {
			
#ifndef NDEBUG
			cout << "neValue - Square: " << s 
				 << ", neValue: " << neValue[s] 
				 << ", neigh_expl_value: " << neigh_expl_value(s) << endl;
#endif
			
			return false;
		}
		
		
		Bitboard b1 = EmptyBoardBB;
		Bitboard b2 = EmptyBoardBB;
		
		for (int k = 1; k <= noSquares[s][0]; ++k) {
			set_bit(&b1, noSquares[s][k]);
		}
		for (int k = 1; k <= neighOccSquares[s][0]; ++k) {
			set_bit(&b2, neighOccSquares[s][k]);
		}
		
		if (b1 != b2) {
			return false;
		}
	}
	
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa08, %rsp            # imm = 0xA08
movq %rdi, %rbx
leaq 0x100(%rsp), %rsi
movq %rsp, %rdx
callq 0x17dd2
leaq 0x690(%rbx), %r12
leaq 0x104(%rsp), %r13
leaq 0x694(%rbx), %rbp
leaq 0xf91e3(%rip), %r14     # 0x1111a0
xorl %ecx, %ecx
movq %rcx, %r15
cmpq $0x40, %rcx
je 0x18052
movq 0x1cfcd(%rip), %rdi     # 0x34fa0
movl %r15d, %esi
callq 0x5760
movq %rax, %rdi
callq 0x51d0
xorl %r8d, %r8d
movl (%rsp,%r15,4), %eax
cmpl 0xf90(%rbx,%r15,4), %eax
jne 0x18052
imulq $0x24, %r15, %rcx
movl 0x100(%rsp,%rcx), %edx
testl %edx, %edx
cmovlel %r8d, %edx
xorl %esi, %esi
xorl %eax, %eax
cmpq %rsi, %rdx
je 0x1801c
movslq (%r13,%rsi,4), %rdi
orq (%r14,%rdi,8), %rax
incq %rsi
jmp 0x18009
movl (%r12,%rcx), %ecx
testl %ecx, %ecx
cmovlel %r8d, %ecx
xorl %esi, %esi
xorl %edx, %edx
cmpq %rsi, %rcx
je 0x1803d
movslq (%rbp,%rsi,4), %rdi
orq (%r14,%rdi,8), %rdx
incq %rsi
jmp 0x1802a
leaq 0x1(%r15), %rcx
addq $0x24, %r13
addq $0x24, %rbp
cmpq %rdx, %rax
je 0x17fbf
cmpq $0x40, %r15
setae %al
addq $0xa08, %rsp            # imm = 0xA08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: (anonymous namespace)::PieceLetters::from_piece(Piece) const
char from_piece(Piece p) const {

      std::map<char, Piece>::const_iterator it;
      for (it = begin(); it != end(); ++it)
          if (it->second == p)
              return it->first;

      assert(false);
      return 0;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x39c023(%rip), %rax    # 0x3b4300
leaq 0x39c00c(%rip), %r14    # 0x3b42f0
cmpq %r14, %rax
je 0x182f8
cmpl %ebx, 0x24(%rax)
je 0x182fc
movq %rax, %rdi
callq 0x5430
jmp 0x182e4
xorl %eax, %eax
jmp 0x182ff
movb 0x20(%rax), %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::attackers_to(Square) const
Bitboard Position::attackers_to(Square s) const {

  return  (attacks_from<PAWN>(s, BLACK) & pieces(PAWN, WHITE))
        | (attacks_from<PAWN>(s, WHITE) & pieces(PAWN, BLACK))
        | (attacks_from<KNIGHT>(s)      & pieces(KNIGHT))
        | (attacks_from<ROOK>(s)        & pieces(ROOK, QUEEN))
        | (attacks_from<BISHOP>(s)      & pieces(BISHOP, QUEEN))
        | (attacks_from<KING>(s)        & pieces(KING));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movslq %esi, %rbx
leaq 0xf91b0(%rip), %r12     # 0x111750
movq 0x110(%rdi), %rbp
movq 0x140(%rdi), %rax
andq 0x1200(%r12,%rbx,8), %rax
movq 0x148(%rdi), %r13
andq 0x200(%r12,%rbx,8), %r13
orq %rax, %r13
andq 0x108(%rdi), %r13
andq 0x400(%r12,%rbx,8), %rbp
movl %ebx, %esi
callq 0x12330
movq %rax, %r15
movq 0x128(%r14), %rax
orq 0x120(%r14), %rax
andq %rax, %r15
orq %rbp, %r15
movq %r14, %rdi
movl %ebx, %esi
callq 0xcf20
movq 0x128(%r14), %rcx
orq 0x118(%r14), %rcx
movq 0x130(%r14), %rdx
andq %rcx, %rax
andq 0xc00(%r12,%rbx,8), %rdx
orq %r15, %rax
orq %rdx, %rax
orq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::attacks_from(Piece, Square) const
Bitboard Position::attacks_from(Piece p, Square s) const {

  assert(square_is_ok(s));

  switch (p)
  {
  case WB: case BB: return attacks_from<BISHOP>(s);
  case WR: case BR: return attacks_from<ROOK>(s);
  case WQ: case BQ: return attacks_from<QUEEN>(s);
  default: return StepAttacksBB[p][s];
  }
}

// Assembly:
cmpl $0xd, %esi
ja 0x18670
movl $0x808, %eax            # imm = 0x808
btl %esi, %eax
jb 0x18669
movl $0x1010, %eax           # imm = 0x1010
btl %esi, %eax
jb 0x18662
movl $0x2020, %eax           # imm = 0x2020
btl %esi, %eax
jae 0x18670
movl %edx, %esi
jmp 0x1230a
movl %edx, %esi
jmp 0x12330
movl %edx, %esi
jmp 0xcf20
movl %esi, %eax
movslq %edx, %rcx
shlq $0x9, %rax
addq 0x1c958(%rip), %rax     # 0x34fd8
movq (%rax,%rcx,8), %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::attacks_from(Piece, Square, unsigned long)
Bitboard Position::attacks_from(Piece p, Square s, Bitboard occ) {

  assert(square_is_ok(s));

  switch (p)
  {
  case WB: case BB: return bishop_attacks_bb(s, occ);
  case WR: case BR: return rook_attacks_bb(s, occ);
  case WQ: case BQ: return bishop_attacks_bb(s, occ) | rook_attacks_bb(s, occ);
  default: return StepAttacksBB[p][s];
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
cmpl $0xd, %edi
ja 0x186ea
movq %rdx, %rbx
movl $0x808, %eax            # imm = 0x808
btl %edi, %eax
jb 0x186dc
movl $0x1010, %eax           # imm = 0x1010
btl %edi, %eax
jb 0x186ce
movl $0x2020, %eax           # imm = 0x2020
btl %edi, %eax
jae 0x186ea
movl %ebp, %edi
movq %rbx, %rsi
callq 0x8208
movq %rax, %r14
movl %ebp, %edi
movq %rbx, %rsi
callq 0x8255
orq %r14, %rax
jmp 0x186fe
movl %ebp, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x8255
movl %ebp, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x8208
movl %edi, %eax
movslq %ebp, %rcx
shlq $0x9, %rax
addq 0x1c8de(%rip), %rax     # 0x34fd8
movq (%rax,%rcx,8), %rax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl %esi, %r12d
shrl $0x6, %r12d
andl $0x3f, %r12d
andl $0x3f, %ebp
movl (%rdi,%r12,4), %esi
movl %ebp, %edx
callq 0x18638
movq %rax, %rcx
movslq %ebx, %rsi
leaq 0xf8a64(%rip), %rdx     # 0x1111a0
movb $0x1, %al
testq %rcx, (%rdx,%rsi,8)
jne 0x187b6
movl %ebp, %eax
movq (%rdx,%rax,8), %r15
orq (%rdx,%r12,8), %r15
xorq 0x100(%r14), %r15
movl %ebx, %edi
movq %r15, %rsi
callq 0x8255
movq 0x128(%r14), %r13
orq 0x120(%r14), %r13
andq %rax, %r13
movl %ebx, %edi
movq %r15, %rsi
callq 0x8208
movq 0x128(%r14), %r15
orq 0x118(%r14), %r15
andq %rax, %r15
orq %r13, %r15
movl (%r14,%r12,4), %eax
sarl $0x3, %eax
andq 0x140(%r14,%rax,8), %r15
je 0x187b4
movq %r14, %rdi
movl %ebx, %esi
callq 0x1230a
notq %rax
testq %rax, %r15
setne %al
jmp 0x187b6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::pl_move_is_evasion(Move, unsigned long) const
bool Position::pl_move_is_evasion(Move m, Bitboard pinned) const
{
  assert(in_check());

  NEW assert(color_of_piece_on(move_from(m)) == side_to_move());
  
  Color us = side_to_move();
  Square from = move_from(m);
  Square to = move_to(m);

  // King moves and en-passant captures are verified in pl_move_is_legal()
  if (type_of_piece_on(from) == KING || move_is_ep(m))
      return pl_move_is_legal(m, pinned);

  Bitboard target = checkers();
  Square checksq = pop_1st_bit(&target);

  if (target) // double check ?
      return false;

  // Our move must be a blocking evasion or a capture of the checking piece
  NEW assert(piece_count(us, KING));
  target = squares_between(checksq, king_square(us)) | checkers();
  return bit_is_set(target, to) && pl_move_is_legal(m, pinned);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl %esi, %eax
andl $0xc000, %eax           # imm = 0xC000
cmpl $0x8000, %eax           # imm = 0x8000
je 0x18ac8
movl %ebp, %eax
shrl $0x4, %eax
andl $0xfc, %eax
movl (%r14,%rax), %eax
andl $0x7, %eax
cmpl $0x6, %eax
je 0x18ac8
movl 0x1090(%r14), %r12d
movq 0x1938(%r14), %rax
movq 0x40(%rax), %rax
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rdi
callq 0x7b62
cmpq $0x0, (%r15)
je 0x18ae1
xorl %eax, %eax
jmp 0x18b2f
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x187c6
movl %ebp, %ecx
andl $0x3f, %ecx
shlq $0x9, %r12
movslq 0x310(%r14,%r12), %rdx
cltq
shlq $0x9, %rax
addq 0x1c4a9(%rip), %rax     # 0x34fa8
movq 0x1938(%r14), %rsi
movq 0x40(%rsi), %rsi
orq (%rax,%rdx,8), %rsi
movq %rsi, 0x8(%rsp)
movl %ecx, %eax
leaq 0xf8684(%rip), %rcx     # 0x1111a0
testq %rsi, (%rcx,%rax,8)
je 0x18ac4
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x187c6
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::move_is_legal(Move) const
bool Position::move_is_legal(const Move m) const {
	
	NEW // don't test that since it might be a tested tt
	//NEW assert(color_of_piece_on(move_from(m)) == side_to_move());
	
  MoveStack mlist[MAX_MOVES];
  MoveStack *cur, *last = generate<MV_PSEUDO_LEGAL>(*this, mlist);

   for (cur = mlist; cur != last; cur++)
      if (cur->move == m)
          return pl_move_is_legal(m, pinned_pieces(sideToMove));

  return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
movl %esi, %ebx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rsi
callq 0x1540d
cmpq %rax, %r15
je 0x18b87
leaq 0x8(%r15), %rcx
cmpl %ebx, (%r15)
movq %rcx, %r15
jne 0x18b58
movl 0x1090(%r14), %esi
movq %r14, %rdi
callq 0x1ab9e
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x187c6
jmp 0x18b89
xorl %eax, %eax
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::do_setup_move(Move)
void Position::do_setup_move(Move m) {

  StateInfo newSt;

  do_move(m, newSt);

  // Reset "game ply" in case we made a non-reversible move.
  // "game ply" is used for repetition detection.
  if (st->rule50 == 0)
      st->gamePly = 0;

  // Update the number of plies played from the starting position
  startPosPlyCounter++;

  // Our StateInfo newSt is about going out of scope so copy
  // its content before it disappears.
  detach();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
callq 0x19114
movq 0x1938(%rbx), %rsi
cmpl $0x0, 0x14(%rsi)
jne 0x190e0
andl $0x0, 0x18(%rsi)
incl 0x1928(%rbx)
leaq 0x1878(%rbx), %r14
movl $0x98, %edx
movq %r14, %rdi
callq 0x5310
movq %r14, 0x1938(%rbx)
andq $0x0, 0x1910(%rbx)
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::do_null_move(StateInfo&)
void Position::do_null_move(StateInfo& backupSt) {

  assert(is_ok());
  assert(!in_check());

  // Back up the information necessary to undo the null move to the supplied
  // StateInfo object.
  // Note that differently from normal case here backupSt is actually used as
  // a backup storage not as a new state to be used.
  backupSt.key      = st->key;
  backupSt.epSquare = st->epSquare;
  backupSt.value    = st->value;
  backupSt.previous = st->previous;
  backupSt.pliesFromNull = st->pliesFromNull;
  st->previous = &backupSt;

  // Save the current key to the history[] array, in order to be able to
  // detect repetition draws.
  history[st->gamePly++] = st->key;

  // Update the necessary information
  if (st->epSquare != SQ_NONE)
      st->key ^= zobEp[st->epSquare];

  st->key ^= zobSideToMove;
  
  // TODO: PREFETCH
  prefetch((char*)TT.first_entry(st->key));

  sideToMove = opposite_color(sideToMove);
  st->epSquare = SQ_NONE;
  st->rule50++;
  st->pliesFromNull = 0;
  st->value += (sideToMove == WHITE) ?  TempoValue : -TempoValue;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x1938(%rdi), %rax
movq 0x38(%rax), %rcx
movq %rcx, 0x38(%rsi)
movq 0x20(%rax), %rdx
movq %rdx, 0x20(%rsi)
movq 0x98(%rax), %rdi
movq %rdi, 0x98(%rsi)
movl 0x1c(%rax), %edi
movl %edi, 0x1c(%rsi)
movq %rsi, 0x98(%rax)
movslq 0x18(%rax), %rsi
leal 0x1(%rsi), %edi
movl %edi, 0x18(%rax)
movq %rcx, 0x1098(%rbx,%rsi,8)
movq 0x38(%rax), %rcx
cmpl $0x40, %edx
je 0x1a4f7
movslq %edx, %rdx
leaq 0x398a9d(%rip), %rsi    # 0x3b2f90
xorq (%rsi,%rdx,8), %rcx
xorq 0x398d12(%rip), %rcx    # 0x3b3210
movq %rcx, 0x38(%rax)
leaq 0x3aa1d7(%rip), %rax    # 0x3c46e0
movl (%rax), %edi
decl %edi
andl %ecx, %edi
shlq $0x6, %rdi
addq 0x8(%rax), %rdi
callq 0x131e7
movl 0x1090(%rbx), %eax
movl %eax, %ecx
xorl $0x1, %ecx
movl %ecx, 0x1090(%rbx)
movq 0x1938(%rbx), %rcx
incl 0x14(%rcx)
movabsq $0x4000000000, %rdx     # imm = 0x4000000000
movq %rdx, 0x1c(%rcx)
movl 0x399d95(%rip), %edx    # 0x3b42e0
movl %edx, %esi
negl %esi
cmpl $0x1, %eax
cmovel %edx, %esi
addl %esi, 0x24(%rcx)
popq %rbx
retq