// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/position.cpp
// Function: Position::do_move(Move, StateInfo&, CheckInfo const&, bool)
void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveIsCheck) {

  assert(is_ok());
  assert(move_is_ok(m));
  assert(&newSt != st);

  nodes++;
  Key key = st->key;

  // Copy some fields of old state to our new StateInfo object except the
  // ones which are recalculated from scratch anyway, then switch our state
  // pointer to point to the new, ready to be updated, state.
  struct ReducedStateInfo {
    Key pawnKey, materialKey;
    int castleRights, rule50, gamePly, pliesFromNull;
    Square epSquare;
    Score value;
    Value npMaterial[2];
  };

  memcpy(&newSt, st, sizeof(ReducedStateInfo));

  newSt.previous = st;
  st = &newSt;

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

  // Update side to move
  key ^= zobSideToMove;

  // Increment the 50 moves rule draw counter. Resetting it to zero in the
  // case of non-reversible moves is taken care of later.
  st->rule50++;
  st->pliesFromNull++;

  if (move_is_castle(m))
  {
      st->key = key;
      do_castle_move(m);
      return;
  }

  Color us = side_to_move();
  Color them = opposite_color(us);
  Square from = move_from(m);
  Square to = move_to(m);
  bool ep = move_is_ep(m);
  bool pm = move_is_promotion(m);

  Piece piece = piece_on(from);
  PieceType pt = type_of_piece(piece);
  PieceType capture = ep ? PAWN : type_of_piece_on(to);

  assert(color_of_piece_on(from) == us);
  assert(color_of_piece_on(to) == them || square_is_empty(to));
  assert(!(ep || pm) || piece == make_piece(us, PAWN));
  assert(!pm || relative_rank(us, to) == RANK_8);
  
  if (capture)
      do_capture_move(key, capture, them, to, from, ep);

  // Update hash key
  key ^= zobrist[us][pt][from] ^ zobrist[us][pt][to];

  // Reset en passant square
  if (st->epSquare != SQ_NONE)
  {
      key ^= zobEp[st->epSquare];
      st->epSquare = SQ_NONE;
  }

  // Update castle rights, try to shortcut a common case
  int cm = castleRightsMask[from] & castleRightsMask[to];
  NEW if (capture) cm &= expl_castleRightsMask[to];	// 
  if (cm != ALL_CASTLES && ((cm & st->castleRights) != st->castleRights))
  {
      key ^= zobCastle[st->castleRights];
      OLD st->castleRights &= castleRightsMask[from];
      OLD st->castleRights &= castleRightsMask[to];
      NEW st->castleRights &= cm;
      key ^= zobCastle[st->castleRights];
  }
  
  // TODO: PREFETCH
  // Prefetch TT access as soon as we know key is updated
  prefetch((char*)TT.first_entry(key));

  // Move the piece
  Bitboard move_bb = make_move_bb(from, to);
  do_move_bb(&(byColorBB[us]), move_bb);
  do_move_bb(&(byTypeBB[pt]), move_bb);
  do_move_bb(&(byTypeBB[0]), move_bb); // HACK: byTypeBB[0] == occupied squares

  board[to] = board[from];
  board[from] = PIECE_NONE;

  // Update piece lists, note that index[from] is not updated and
  // becomes stale. This works as long as index[] is accessed just
  // by known occupied squares.
  index[to] = index[from];
  pieceList[us][pt][index[to]] = to;

  // If the moving piece was a pawn do some special extra work
  if (pt == PAWN)
  {
      // Reset rule 50 draw counter
      st->rule50 = 0;

      // Update pawn hash key and prefetch in L1/L2 cache
      OLD st->pawnKey ^= zobrist[us][PAWN][from] ^ zobrist[us][PAWN][to];
      STARTNEW
      if (capture) {
    	  st->pawnKey ^= zobrist[us][PAWN][from];
      } else {
    	  st->pawnKey ^= zobrist[us][PAWN][from] ^ zobrist[us][PAWN][to];
      }
      ENDNEW

      // Set en passant square, only if moved pawn can be captured
      if ((to ^ from) == 16)
      {
          if (attacks_from<PAWN>(from + (us == WHITE ? DELTA_N : DELTA_S), us) & pieces(PAWN, them))
          {
              st->epSquare = Square((int(from) + int(to)) / 2);
              key ^= zobEp[st->epSquare];
          }
      }

      if (pm) // promotion ?
      //NEW if (pm && !capture)	// if capture the following code is unnecessary
      {
    	  NEW assert(!capture); // if capture the following code is unnecessary
    	  
          PieceType promotion = move_promotion_piece(m);

          assert(promotion >= KNIGHT && promotion <= QUEEN);

          // Insert promoted piece instead of pawn
          clear_bit(&(byTypeBB[PAWN]), to);
          set_bit(&(byTypeBB[promotion]), to);
          board[to] = make_piece(us, promotion);

          // Update piece counts
          pieceCount[us][promotion]++;
          pieceCount[us][PAWN]--;

          // Update material key
          st->materialKey ^= zobrist[us][PAWN][pieceCount[us][PAWN]];
          st->materialKey ^= zobrist[us][promotion][pieceCount[us][promotion]-1];

          // Update piece lists, move the last pawn at index[to] position
          // and shrink the list. Add a new promotion piece to the list.
          Square lastPawnSquare = pieceList[us][PAWN][pieceCount[us][PAWN]];
          index[lastPawnSquare] = index[to];
          pieceList[us][PAWN][index[lastPawnSquare]] = lastPawnSquare;
          pieceList[us][PAWN][pieceCount[us][PAWN]] = SQ_NONE;
          index[to] = pieceCount[us][promotion] - 1;
          pieceList[us][promotion][index[to]] = to;

          // Partially revert hash keys update
          key ^= zobrist[us][PAWN][to] ^ zobrist[us][promotion][to];
          st->pawnKey ^= zobrist[us][PAWN][to];

          // Partially revert and update incremental scores
          st->value -= pst(us, PAWN, to);
          st->value += pst(us, promotion, to);

          // Update material
          st->npMaterial[us] += PieceValueMidgame[promotion];
      }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %r14d
movq %rdi, %rbx
incq 0x1930(%rdi)
movq 0x1938(%rdi), %rax
movq 0x38(%rax), %rdi
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rdx)
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
movq 0x1938(%rbx), %rax
movq %rax, 0x98(%rdx)
movq %rdx, 0x1938(%rbx)
movq 0x39bd91(%rip), %rax    # 0x3bb210
xorq %rdi, %rax
movq %rax, 0x18(%rsp)
movq 0x14(%rdx), %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %esi
movslq %esi, %rsi
movq %rdi, 0x1098(%rbx,%rsi,8)
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x14(%rdx)
incl 0x1c(%rdx)
movl $0xc000, %esi           # imm = 0xC000
movl %r14d, %r12d
andl %esi, %r12d
cmpl %esi, %r12d
jne 0x1f4e0
movq %rax, 0x38(%rdx)
movq %rbx, %rdi
movl %r14d, %esi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fd88
movl %r8d, 0x3c(%rsp)
movq %rcx, 0x78(%rsp)
movl 0x1090(%rbx), %esi
movq %rsi, %rcx
movq %rsi, 0x10(%rsp)
xorq $0x1, %rcx
movl %r14d, %r13d
shrl $0x6, %r13d
andl $0x3f, %r13d
movl %r14d, %r15d
andl $0x3f, %r15d
movl (%rbx,%r13,4), %esi
movq %rsi, 0x80(%rsp)
andl $0x7, %esi
movl $0x1, %r8d
cmpl $0x8000, %r12d          # imm = 0x8000
movq %rsi, 0x28(%rsp)
movq %rcx, 0x58(%rsp)
je 0x1f544
movl (%rbx,%r15,4), %r8d
andl $0x7, %r8d
je 0x1fbc4
xorl %eax, %eax
cmpl $0x8000, %r12d          # imm = 0x8000
sete %al
movl %eax, (%rsp)
leaq 0x18(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
movl %r8d, 0x24(%rsp)
movl %r8d, %edx
movl %r15d, %r8d
movl %r13d, %r9d
callq 0x20158
movq 0x28(%rsp), %rsi
movq (%rbp), %rax
movq 0x1938(%rbx), %rdx
movl $0x0, 0xc(%rsp)
movq 0x10(%rsp), %rdi
shlq $0xc, %rdi
leaq 0x3999f7(%rip), %rcx    # 0x3b8f90
movq %rdi, 0x30(%rsp)
addq %rcx, %rdi
movl %esi, %ecx
shll $0x9, %ecx
addq %rdi, %rcx
movq (%rcx,%r15,8), %rbp
xorq (%rcx,%r13,8), %rbp
xorq %rax, %rbp
movq %rbp, 0x18(%rsp)
movslq 0x20(%rdx), %rax
cmpq $0x40, %rax
je 0x1f5da
leaq 0x39b9c6(%rip), %rcx    # 0x3baf90
xorq (%rcx,%rax,8), %rbp
movq %rbp, 0x18(%rsp)
movl $0x40, 0x20(%rdx)
movl 0x1778(%rbx,%r15,4), %eax
andl 0x1778(%rbx,%r13,4), %eax
cmpb $0x0, 0xc(%rsp)
jne 0x1f5fc
leaq 0x13b48(%rip), %rcx     # 0x33140
andl (%rcx,%r15,4), %eax
cmpl $0xf, %eax
movq %rdi, 0x48(%rsp)
je 0x1f62c
movslq 0x10(%rdx), %rcx
andl %ecx, %eax
cmpl %ecx, %eax
je 0x1f62c
leaq 0x39bb79(%rip), %rsi    # 0x3bb190
movq (%rsi,%rcx,8), %rcx
movl %eax, 0x10(%rdx)
cltq
xorq (%rsi,%rax,8), %rcx
xorq %rcx, %rbp
movq %rbp, 0x18(%rsp)
leaq 0x3ad0ad(%rip), %rax    # 0x3cc6e0
movl (%rax), %edi
decl %edi
andl %ebp, %edi
shlq $0x6, %rdi
addq 0x8(%rax), %rdi
callq 0x17542
leaq 0xf9b53(%rip), %r9      # 0x1191a0
movq (%r9,%r15,8), %rax
orq (%r9,%r13,8), %rax
movq 0x10(%rsp), %rsi
xorq %rax, 0x140(%rbx,%rsi,8)
movq 0x28(%rsp), %rdi
xorq %rax, 0x100(%rbx,%rdi,8)
xorq %rax, 0x100(%rbx)
leal (,%r13,4), %eax
movl (%rbx,%rax), %ecx
leal (,%r15,4), %edx
movl %ecx, (%rbx,%rdx)
movl $0x10, (%rbx,%rax)
movslq 0x590(%rbx,%rax), %rax
movl %eax, 0x590(%rbx,%rdx)
leaq 0x190(%rbx), %rcx
movq %rcx, 0x50(%rsp)
shlq $0x9, %rsi
movq %rsi, 0x40(%rsp)
leaq (%rbx,%rsi), %rcx
addq $0x190, %rcx            # imm = 0x190
movl %edi, %edx
shll $0x6, %edx
addq %rcx, %rdx
movl %r15d, (%rdx,%rax,4)
cmpl $0x1, %edi
jne 0x1f91a
movq 0x1938(%rbx), %rax
movl $0x0, 0x14(%rax)
movq 0x48(%rsp), %r8
movq 0x200(%r8,%r13,8), %rcx
cmpb $0x0, 0xc(%rsp)
movq 0x58(%rsp), %rdi
je 0x1f70b
movq 0x200(%r8,%r15,8), %rdx
xorq (%rax), %rdx
jmp 0x1f70e
movq (%rax), %rdx
xorq %rcx, %rdx
movq %rdx, (%rax)
movl %r13d, %ecx
xorl %r15d, %ecx
cmpl $0x10, %ecx
jne 0x1f776
xorl %ecx, %ecx
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
sete %cl
shll $0x4, %ecx
addl %r13d, %ecx
leal 0x1(,%rdx,8), %edx
shlq $0x9, %rdx
addq 0x1d894(%rip), %rdx     # 0x3cfd8
movq 0x108(%rbx), %rsi
andq -0x40(%rdx,%rcx,8), %rsi
testq %rsi, 0x140(%rbx,%rdi,8)
je 0x1f776
leal (%r15,%r13), %ecx
shrb %cl
movzbl %cl, %ecx
movl %ecx, 0x20(%rax)
leaq 0x39b823(%rip), %rdx    # 0x3baf90
xorq (%rdx,%rcx,8), %rbp
movq %rbp, 0x18(%rsp)
cmpl $0x4000, %r12d          # imm = 0x4000
jne 0x1f91a
shrl $0xc, %r14d
andl $0x3, %r14d
leal 0x2(%r14), %r8d
leal (,%r15,8), %edx
movq %rdx, 0x70(%rsp)
leaq 0xf9c0d(%rip), %rcx     # 0x1193b0
movq (%rcx,%rdx), %rcx
andq %rcx, 0x108(%rbx)
movq (%r9,%rdx), %rcx
orq %rcx, 0x100(%rbx,%r8,8)
movq 0x10(%rsp), %r9
leal (%r14,%r9,8), %ecx
addl $0x2, %ecx
leal (,%r15,4), %edx
movq %rdx, 0x68(%rsp)
movl %ecx, (%rbx,%rdx)
shlq $0x5, %r9
leaq (%rbx,%r9), %r10
leal 0x8(,%r14,4), %edx
movq %rdx, 0x60(%rsp)
movslq 0x150(%rdx,%r10), %r11
leal 0x1(%r11), %r14d
movl %r14d, 0x150(%rdx,%r10)
movslq 0x154(%rbx,%r9), %r14
leaq -0x1(%r14), %rsi
movl %esi, 0x154(%rbx,%r9)
movl %r8d, %esi
shll $0x9, %esi
leaq 0x399770(%rip), %rdi    # 0x3b8f90
addq %rsi, %rdi
addq 0x30(%rsp), %rdi
movq 0x8(%rax), %rsi
movq 0x48(%rsp), %rdx
xorq 0x1f8(%rdx,%r14,8), %rsi
movq %rsi, 0x8(%rax)
xorq (%rdi,%r11,8), %rsi
movq %rsi, 0x8(%rax)
movq 0x50(%rsp), %rsi
movq 0x40(%rsp), %r11
addq %r11, %rsi
movslq 0x3c(%rsi,%r14,4), %r11
movl %r12d, 0x30(%rsp)
movq %rax, %r12
movq 0x68(%rsp), %rax
movslq 0x590(%rbx,%rax), %r14
movl %r14d, 0x590(%rbx,%r11,4)
movl %r11d, 0x40(%rsi,%r14,4)
movslq 0x154(%rbx,%r9), %r9
movl $0x40, 0x40(%rsi,%r9,4)
movq 0x60(%rsp), %r11
movslq 0x150(%r11,%r10), %r9
leaq -0x1(%r9), %r10
movl %r10d, 0x590(%rbx,%rax)
shll $0x6, %r8d
addq %rsi, %r8
movl %r15d, -0x4(%r8,%r9,4)
movq 0x70(%rsp), %r8
movq 0x200(%rdx,%r8), %rsi
xorq (%r8,%rdi), %rbp
xorq %rsi, %rbp
movq %rbp, 0x18(%rsp)
xorq %rsi, (%r12)
movq 0x10(%rsp), %r9
leal 0x1(,%r9,8), %esi
shlq $0x8, %rsi
leaq 0x39b93c(%rip), %rdi    # 0x3bb220
addq %rdi, %rsi
movl 0x24(%r12), %r8d
subl (%rax,%rsi), %r8d
shlq $0x8, %rcx
addq %rdi, %rcx
movl %r8d, 0x24(%r12)
addl (%rax,%rcx), %r8d
movl %r8d, 0x24(%r12)
leaq 0x39c914(%rip), %rcx    # 0x3bc220
movl (%r11,%rcx), %ecx
addl %ecx, 0x28(%r12,%r9,4)
movl 0x30(%rsp), %r12d
cmpb $0x0, 0xc(%rsp)
jne 0x1f941
leaq 0x18(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movl %r15d, %ecx
movq 0x28(%rsp), %r8
callq 0x20396
movq (%r14), %rbp
movslq 0x192c(%rbx), %rax
movq 0x1938(%rbx), %rcx
movq (%rcx), %rcx
imulq $0x560, %rax, %rax      # imm = 0x560
leaq 0x3a2130(%rip), %r14    # 0x3c1a90
andl $0x3fff, %ecx           # imm = 0x3FFF
leaq (%rcx,%rcx,8), %rdi
shll $0x3, %edi
addq 0x60(%r14,%rax), %rdi
callq 0x17542
movslq 0x192c(%rbx), %rax
movq 0x1938(%rbx), %rcx
movq 0x8(%rcx), %rcx
imulq $0x560, %rax, %rax      # imm = 0x560
andl $0x1fff, %ecx           # imm = 0x1FFF
leaq (%rcx,%rcx,2), %rdi
shll $0x4, %edi
addq 0x48(%r14,%rax), %rdi
callq 0x17542
movq 0x80(%rsp), %rcx
shlq $0x8, %rcx
leaq 0x39b866(%rip), %rax    # 0x3bb220
addq %rcx, %rax
movl (%rax,%r15,4), %ecx
subl (%rax,%r13,4), %ecx
movq 0x1938(%rbx), %rdx
addl %ecx, 0x24(%rdx)
movl 0x24(%rsp), %eax
movl %eax, 0x30(%rdx)
movq 0x28(%rsp), %rdi
movl %edi, 0x34(%rdx)
movq %rbp, 0x38(%rdx)
movq $0x0, 0x40(%rdx)
movl 0x58(%rsp), %eax
movq %rax, %rcx
shlq $0x5, %rcx
cmpl $0x0, 0x168(%rbx,%rcx)
sete %cl
movl 0x3c(%rsp), %esi
xorb $0x1, %sil
orb %cl, %sil
jne 0x1fd52
cmpl $0x4000, %r12d          # imm = 0x4000
setne %cl
shlq $0x9, %rax
movq 0x50(%rsp), %rsi
movslq 0x180(%rsi,%rax), %r14
testb %cl, 0xc(%rsp)
je 0x1fa87
cmpl $0x6, %edi
jne 0x1fa63
movl %r13d, %eax
shll $0x6, %eax
addq 0x1d534(%rip), %rax     # 0x3cf78
cmpb $0x0, (%r14,%rax)
je 0x1fa63
movl %r15d, %eax
shll $0x6, %eax
addq 0x1d520(%rip), %rax     # 0x3cf78
cmpb $0x0, (%r14,%rax)
je 0x1fcbb
leaq 0xf9736(%rip), %rsi     # 0x1191a0
movq (%rsi,%r15,8), %rax
movq 0x78(%rsp), %r14
testq %rax, 0x8(%r14,%rdi,8)
je 0x1fbd7
movq %rax, 0x40(%rdx)
jmp 0x1fbd9
movq 0x40(%rsp), %rcx
movslq 0x180(%rsi,%rcx), %rax
shlq $0x6, %rax
addq 0x1d4d9(%rip), %rax     # 0x3cf78
cmpb $0x0, (%r14,%rax)
jne 0x1fd52
leaq 0xf9c9f(%rip), %rcx     # 0x119750
movq 0x140(%rbx), %rax
andq 0x1200(%rcx,%r14,8), %rax
movq 0x148(%rbx), %rsi
andq 0x200(%rcx,%r14,8), %rsi
orq %rax, %rsi
andq 0x108(%rbx), %rsi
movq 0x100(%rbx), %rax
movq 0x110(%rbx), %rdi
andq 0x400(%rcx,%r14,8), %rdi
leaq 0x26caa(%rip), %rcx     # 0x467a0
movq (%rcx,%r14,8), %rcx
andq %rax, %rcx
leaq 0xfabc(%rip), %r8       # 0x2f5c0
movq (%r8,%r14,8), %r9
movl %r9d, %r8d
imull %ecx, %r8d
shrq $0x20, %rcx
shrq $0x20, %r9
imull %ecx, %r9d
xorl %r8d, %r9d
leaq 0xfd9b(%rip), %rcx      # 0x2f8c0
movb (%rcx,%r14,4), %cl
shrl %cl, %r9d
orq %rsi, %rdi
leaq 0x26e6a(%rip), %rcx     # 0x469a0
addl (%rcx,%r14,4), %r9d
leaq 0x26f5f(%rip), %rcx     # 0x46aa0
movq 0x128(%rbx), %rsi
movq 0x120(%rbx), %r8
orq %rsi, %r8
andq (%rcx,%r9,8), %r8
orq %rdi, %r8
leaq 0xeef40(%rip), %rcx     # 0x10eaa0
andq (%rcx,%r14,8), %rax
leaq 0xf855(%rip), %rcx      # 0x2f3c0
movq (%rcx,%r14,8), %rdi
movl %edi, %ecx
imull %eax, %ecx
shrq $0x20, %rax
shrq $0x20, %rdi
imull %eax, %edi
xorl %ecx, %edi
leaq 0xfc38(%rip), %rax      # 0x2f7c0
movb (%rax,%r14,4), %cl
shrl %cl, %edi
leaq 0xef10b(%rip), %rax     # 0x10eca0
addl (%rax,%r14,4), %edi
leaq 0xef200(%rip), %rax     # 0x10eda0
orq 0x118(%rbx), %rsi
andq (%rax,%rdi,8), %rsi
orq %r8, %rsi
movq 0x10(%rsp), %rax
andq 0x140(%rbx,%rax,8), %rsi
movq %rsi, 0x40(%rdx)
jmp 0x1fd52
movl $0x0, 0x24(%rsp)
movb $0x1, %cl
movl %ecx, 0xc(%rsp)
jmp 0x1f589
xorl %eax, %eax
movq (%r14), %rcx
testq %rcx, %rcx
je 0x1fd52
testq %rcx, (%rsi,%r13,8)
je 0x1fd52
cmpl $0x4, %edi
je 0x1fc3a
movl 0x48(%r14), %esi
movq %rdi, %r15
movq %rbx, %rdi
callq 0x211ea
movq 0x128(%rbx), %rcx
orq 0x120(%rbx), %rcx
movq 0x10(%rsp), %rdx
andq 0x140(%rbx,%rdx,8), %rax
andq %rcx, %rax
movq 0x1938(%rbx), %rdx
orq 0x40(%rdx), %rax
movq %rax, 0x40(%rdx)
cmpl $0x3, %r15d
je 0x1fd52
movslq 0x48(%r14), %rsi
leaq 0xeee5b(%rip), %rcx     # 0x10eaa0
movq (%rcx,%rsi,8), %rcx
andq 0x100(%rbx), %rcx
leaq 0xf769(%rip), %rdi      # 0x2f3c0
movq (%rdi,%rsi,8), %rdi
movl %edi, %r8d
imull %ecx, %r8d
shrq $0x20, %rcx
shrq $0x20, %rdi
imull %ecx, %edi
xorl %r8d, %edi
leaq 0xfb49(%rip), %rcx      # 0x2f7c0
movb (%rcx,%rsi,4), %cl
shrl %cl, %edi
leaq 0xef01d(%rip), %rcx     # 0x10eca0
addl (%rcx,%rsi,4), %edi
movq 0x128(%rbx), %rcx
orq 0x118(%rbx), %rcx
leaq 0xef105(%rip), %rsi     # 0x10eda0
movq 0x10(%rsp), %r8
movq 0x140(%rbx,%r8,8), %r8
andq (%rsi,%rdi,8), %r8
andq %rcx, %r8
orq %rax, %r8
movq %r8, 0x40(%rdx)
jmp 0x1fd52
leaq 0xf9a8e(%rip), %rax     # 0x119750
movq 0x110(%rbx), %r12
movq 0x140(%rbx), %rcx
andq 0x1200(%rax,%r14,8), %rcx
movq 0x148(%rbx), %r15
andq 0x200(%rax,%r14,8), %r15
orq %rcx, %r15
andq 0x108(%rbx), %r15
andq 0x400(%rax,%r14,8), %r12
movq %rbx, %rdi
movl %r14d, %esi
callq 0x211ea
movq 0x128(%rbx), %r13
orq 0x120(%rbx), %r13
andq %rax, %r13
orq %r12, %r13
movq %rbx, %rdi
movl %r14d, %esi
callq 0xe44e
movq 0x128(%rbx), %rcx
orq 0x118(%rbx), %rcx
andq %rax, %rcx
orq %r13, %rcx
orq %r15, %rcx
movq 0x10(%rsp), %rax
andq 0x140(%rbx,%rax,8), %rcx
movq 0x1938(%rbx), %rdx
movq %rcx, 0x40(%rdx)
movl 0x1090(%rbx), %eax
movl %eax, %ecx
xorl $0x1, %ecx
movl %ecx, 0x1090(%rbx)
movl 0x39c577(%rip), %ecx    # 0x3bc2e0
movl %ecx, %esi
negl %esi
cmpl $0x1, %eax
cmovel %ecx, %esi
addl %esi, 0x24(%rdx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq