// File: /workspace/github_cpp_makefile_star2_O1/ATOMIC-LICHESS[P]ATOMKRAFT/search.cpp
// Function: ThreadsManager::idle_loop(int, SplitPoint*)
void ThreadsManager::idle_loop(int threadID, SplitPoint* sp) {

  assert(threadID >= 0 && threadID < MAX_THREADS);

  int i;
  bool allFinished;

  while (true)
  {
      // Slave threads can exit as soon as AllThreadsShouldExit raises,
      // master should exit as last one.
      if (allThreadsShouldExit)
      {
          assert(!sp);
          threads[threadID].state = Thread::TERMINATED;
          return;
      }

      // If we are not thinking, wait for a condition to be signaled
      // instead of wasting CPU time polling for work.
      while (   threadID >= activeThreads
             || threads[threadID].state == Thread::INITIALIZING
             || (useSleepingThreads && threads[threadID].state == Thread::AVAILABLE))
      {
          assert(!sp || useSleepingThreads);
          assert(threadID != 0 || useSleepingThreads);

          if (threads[threadID].state == Thread::INITIALIZING)
              threads[threadID].state = Thread::AVAILABLE;

          // Grab the lock to avoid races with Thread::wake_up()
          lock_grab(&threads[threadID].sleepLock);

          // If we are master and all slaves have finished do not go to sleep
          for (i = 0; sp && i < activeThreads && !sp->is_slave[i]; i++) {}
          allFinished = (i == activeThreads);

          if (allFinished || allThreadsShouldExit)
          {
              lock_release(&threads[threadID].sleepLock);
              break;
          }

          // Do sleep here after retesting sleep conditions
          if (threadID >= activeThreads || threads[threadID].state == Thread::AVAILABLE)
              cond_wait(&threads[threadID].sleepCond, &threads[threadID].sleepLock);

          lock_release(&threads[threadID].sleepLock);
      }

      // If this thread has been assigned work, launch a search
      if (threads[threadID].state == Thread::WORKISWAITING)
      {
          assert(!allThreadsShouldExit);

          threads[threadID].state = Thread::SEARCHING;

          // Copy split point position and search stack and call search()
          // with SplitPoint template parameter set to true.
          SearchStack ss[PLY_MAX_PLUS_2];
          SplitPoint* tsp = threads[threadID].splitPoint;
          Position pos(*tsp->pos, threadID);

          memcpy(ss, tsp->ss - 1, 4 * sizeof(SearchStack));
          (ss+1)->sp = tsp;

          if (tsp->pvNode)
              search<PV, true, false>(pos, ss+1, tsp->alpha, tsp->beta, tsp->depth);
          else
              search<NonPV, true, false>(pos, ss+1, tsp->alpha, tsp->beta, tsp->depth);

          assert(threads[threadID].state == Thread::SEARCHING);

          threads[threadID].state = Thread::AVAILABLE;

          // Wake up master thread so to allow it to return from the idle loop in
          // case we are the last slave of the split point.
          if (   useSleepingThreads
              && threadID != tsp->master
              && threads[tsp->master].state == Thread::AVAILABLE)
              threads[tsp->master].wake_up();
      }

      // If this thread is the master of a split point and all slaves have
      // finished their work at this split point, return from the idle loop.
      for (i = 0; sp && i < activeThreads && !sp->is_slave[i]; i++) {}
      allFinished = (i == activeThreads);

      if (allFinished)
      {
          // Because sp->slaves[] is reset under lock protection,
          // be sure sp->lock has been released before to return.
          lock_grab(&(sp->lock));
          lock_release(&(sp->lock));

          // In helpful master concept a master can help only a sub-tree, and
          // because here is all finished is not possible master is booked.
          assert(threads[threadID].state == Thread::AVAILABLE);

          threads[threadID].state = Thread::SEARCHING;
          return;
      }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x39d8, %rsp           # imm = 0x39D8
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r15
leaq 0x40(%rdi), %rax
movq %rax, 0xa0(%rsp)
movslq %esi, %rax
imulq $0x560, %rax, %rax      # imm = 0x560
leaq (%rdi,%rax), %r13
addq $0xc8, %r13
leaq 0x40(%rdi,%rax), %r14
leaq 0x70(%rdi,%rax), %rcx
movq %rcx, 0x80(%rsp)
movq %rax, 0xb8(%rsp)
leaq 0x98(%rdi,%rax), %rax
movq %rax, 0xd8(%rsp)
movq %r14, 0xb0(%rsp)
movq %rdi, 0xa8(%rsp)
movl %esi, 0x6c(%rsp)
movq %r13, 0x90(%rsp)
cmpb $0x0, 0x38(%r15)
jne 0x25947
cmpl %r12d, 0x34(%r15)
jle 0x24b91
cmpl $0x0, (%r13)
je 0x24b91
cmpb $0x1, 0x30(%r15)
jne 0x24c37
movl (%r13), %eax
cmpl $0x2, %eax
jne 0x24c37
cmpl $0x0, 0x88(%r14)
jne 0x24ba6
movl $0x2, 0x88(%r14)
testq %rbx, %rbx
setne %bpl
movq 0x80(%rsp), %rdi
callq 0x55f0
movl 0x34(%r15), %ecx
movl %ecx, %eax
testl %ecx, %ecx
setg %dl
andb %bpl, %dl
xorl %ecx, %ecx
cmpb $0x1, %dl
jne 0x24be5
xorl %ecx, %ecx
cmpb $0x0, 0x75(%rbx,%rcx)
jne 0x24be5
incq %rcx
testq %rbx, %rbx
je 0x24be5
cmpq %rax, %rcx
jb 0x24bd1
cmpl %eax, %ecx
je 0x24c2a
movb 0x38(%r15), %cl
cmpb $0x1, %cl
je 0x24c2a
cmpl %r12d, %eax
jle 0x24c03
movl 0x88(%r14), %eax
cmpl $0x2, %eax
jne 0x24c18
movq 0xd8(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x5620
movq 0x80(%rsp), %rdi
callq 0x52e0
jmp 0x24b6c
movq 0x80(%rsp), %rdi
callq 0x52e0
movl 0x88(%r14), %eax
cmpl $0x4, %eax
jne 0x258ee
movl $0x1, 0x88(%r14)
movq 0x90(%r14), %rbp
movq 0x8(%rbp), %rsi
leaq 0x1820(%rsp), %rdi
movl %r12d, %edx
callq 0x1c732
movq 0x30(%rbp), %rsi
addq $-0x38, %rsi
movl $0xe0, %edx
leaq 0x1d0(%rsp), %rdi
callq 0x5320
movq %rbp, 0x238(%rsp)
movl 0x68(%rbp), %eax
movl %eax, 0x2c(%rsp)
movl 0x18(%rbp), %eax
movl %eax, 0x1c(%rsp)
movslq 0x10(%rbp), %rax
movq %rax, 0x48(%rsp)
movq %rbp, 0xd0(%rsp)
cmpb $0x1, 0x14(%rbp)
jne 0x251ee
movslq 0x314c(%rsp), %rdi
movl 0x1d0(%rsp), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x208(%rsp)
movl 0x28b0(%rsp), %edx
shlq $0x5, %rdx
leaq 0x1970(%rsp), %rsi
cmpl $0x0, 0x18(%rsi,%rdx)
je 0x258a3
movq %rdi, 0x40(%rsp)
imulq $0x560, %rdi, %rdx      # imm = 0x560
leaq 0x39bd8e(%rip), %rsi    # 0x3c0a90
addq %rsi, %rdx
addq $0x40, %rdx
movq %rdx, 0x60(%rsp)
cmpl %ecx, 0x28(%rdx)
jg 0x24d1b
movq 0x60(%rsp), %rcx
movl %eax, 0x28(%rcx)
movq 0x238(%rsp), %r15
movl $0xffff8acf, (%rsp)     # imm = 0xFFFF8ACF
leaq 0x3160(%rsp), %rdi
leaq 0x1820(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
movq 0x48(%rsp), %rcx
leaq 0x399cf5(%rip), %r8     # 0x3bea40
leaq 0x208(%rsp), %r9
callq 0x1b13c
movq $0x0, 0x39c8(%rsp)
movq 0x238(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x39d0(%rsp)
leaq 0xe0(%rsp), %rdi
movq %r14, %rsi
callq 0x1c598
movl $0x0, 0x218(%rsp)
leaq 0x38(%r15), %rdi
movq %rdi, 0x30(%rsp)
callq 0x55f0
movq %r15, 0x20(%rsp)
movl 0x6c(%r15), %eax
cmpl 0x1c(%rsp), %eax
jge 0x251af
movq 0x48(%rsp), %rcx
leal -0x2(%rcx), %eax
movl %eax, 0x54(%rsp)
cmpl $0x6, %ecx
setl %al
cmpl $0x10, %ecx
setl %dl
movl %ecx, %esi
shrl %esi
cmpl $0x7e, %ecx
movl $0x3f, %ecx
cmovgel %ecx, %esi
movl 0x1c(%rsp), %ecx
negl %ecx
movl %ecx, 0x3c(%rsp)
xorb %al, %dl
movb %dl, 0x58(%rsp)
movl $0xffff8acf, %r15d      # imm = 0xFFFF8ACF
shlq $0x6, %rsi
leaq 0x396934(%rip), %rax    # 0x3bb730
addq %rax, %rsi
movq %rsi, 0x88(%rsp)
movq 0x39d0(%rsp), %rdi
callq 0x1b630
testl %eax, %eax
je 0x251af
movl %eax, %r12d
movq 0x60(%rsp), %rdi
callq 0x28eb8
testb %al, %al
jne 0x251af
movl %r15d, 0x18(%rsp)
movq 0x20(%rsp), %rax
movl 0x70(%rax), %r15d
leal 0x1(%r15), %ecx
movq %rcx, 0x70(%rsp)
movl %ecx, 0x70(%rax)
movq 0x30(%rsp), %rdi
callq 0x52e0
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
leaq 0xe0(%rsp), %rdx
callq 0x1e9ca
testl $0x1f000, %r12d         # imm = 0x1F000
je 0x24e83
movl %r12d, %ecx
notl %ecx
testl $0xc000, %ecx           # imm = 0xC000
jmp 0x24e91
movl %r12d, %ecx
andl $0x3f, %ecx
cmpl $0x10, 0x1820(%rsp,%rcx,4)
setne %r14b
movzbl %r14b, %r13d
movzbl %al, %ebp
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
movl %ebp, %ecx
leaq 0x17(%rsp), %r8
callq 0x26bb1
movl %eax, %r8d
movl %r12d, 0x20c(%rsp)
andb 0x58(%rsp), %r13b
cmpb $0x1, %r13b
jne 0x24ed7
cmpb $0x0, 0x17(%rsp)
je 0x24fda
xorl %eax, %eax
movl %eax, 0x78(%rsp)
addl 0x54(%rsp), %r8d
movq %r8, %r13
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
leaq 0x130(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
movl %ebp, %r8d
callq 0x1ef5e
testl %r15d, %r15d
jle 0x24fcd
cmpl $0x6, 0x48(%rsp)
setl %al
movq 0x20(%rsp), %rcx
movl 0x68(%rcx), %r15d
orb %r14b, %al
movb $0x1, %al
movq %r13, %r8
jne 0x25033
movl %r12d, %ecx
notl %ecx
testl $0xc000, %ecx           # imm = 0xC000
je 0x25033
cmpb $0x0, 0x17(%rsp)
jne 0x25033
cmpl %r12d, 0x21c(%rsp)
je 0x25033
cmpl %r12d, 0x220(%rsp)
je 0x25033
movq 0x70(%rsp), %rcx
cmpl $0x3f, %ecx
movl $0x3f, %eax
cmovgel %eax, %ecx
movq 0x88(%rsp), %rax
movsbl 0x1000(%rcx,%rax), %eax
movl %eax, 0x224(%rsp)
testl %eax, %eax
je 0x25026
movl %r13d, %r8d
subl %eax, %r8d
movl %r15d, %edx
notl %edx
movl %r15d, %ecx
negl %ecx
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x26cac
movq %r13, %r8
negl %eax
movl %eax, 0x18(%rsp)
cmpl %eax, %r15d
setl %al
jmp 0x25028
movl 0x2c(%rsp), %r14d
negl %r14d
jmp 0x250d3
movl %r12d, %ecx
andl $0xc000, %ecx           # imm = 0xC000
movl 0x2c(%rsp), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
xorl %eax, %eax
cmpl $0x4000, %ecx           # imm = 0x4000
je 0x24ed9
cmpl $0x74cb, %esi           # imm = 0x74CB
ja 0x24ed9
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
movq %r8, %r13
callq 0x2073c
movq %r13, %r8
shrl $0x1f, %eax
jmp 0x24ed9
movb $0x1, %al
movl $0x0, 0x224(%rsp)
cmpb $0x0, 0x78(%rsp)
je 0x2508e
movl $0x6, 0x224(%rsp)
leal -0x12c(%r15), %ebp
leal -0x6(%r13), %r8d
movl $0x12b, %edx            # imm = 0x12B
subl %r15d, %edx
movl $0x12c, %ecx            # imm = 0x12C
subl %r15d, %ecx
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x26cac
movq %r13, %r8
negl %eax
movl %eax, 0x18(%rsp)
cmpl %eax, %ebp
setl %al
movl $0x0, 0x224(%rsp)
testb %al, %al
movl 0x18(%rsp), %r15d
je 0x250f8
movq 0x20(%rsp), %rax
movl 0x68(%rax), %ebp
movl %ebp, %edx
notl %edx
movl %ebp, %r14d
negl %r14d
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
movl %r14d, %ecx
callq 0x26cac
movl %eax, %r15d
negl %r15d
cmpl %r15d, %ebp
jge 0x250f8
cmpl %r15d, 0x1c(%rsp)
jle 0x250f8
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
movl 0x3c(%rsp), %edx
movl %r14d, %ecx
movl %r13d, %r8d
callq 0x261e2
movl %eax, %r15d
negl %r15d
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
callq 0x20056
movq 0x30(%rsp), %rdi
callq 0x55f0
movq 0x20(%rsp), %rax
movl 0x6c(%rax), %ebp
movl 0x68(%rax), %r14d
cmpl %ebp, %r15d
jle 0x2515c
movq 0x60(%rsp), %rdi
callq 0x28eb8
testb %al, %al
movq 0x90(%rsp), %r13
jne 0x251a0
movq 0x20(%rsp), %rax
movl %r15d, 0x6c(%rax)
cmpl %r14d, %r15d
jle 0x2519d
cmpl 0x1c(%rsp), %r15d
jge 0x25166
movq 0x20(%rsp), %rax
movl %r15d, 0x68(%rax)
movl %r15d, %r14d
jmp 0x2516f
movq 0x90(%rsp), %r13
jmp 0x251a0
movq 0x20(%rsp), %rax
movb $0x1, 0x74(%rax)
movl $0x752f, %eax           # imm = 0x752F
subl 0x208(%rsp), %eax
cmpl %eax, %r15d
jne 0x25188
movl %r12d, 0x210(%rsp)
movl %r12d, 0x218(%rsp)
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rax
movl %r12d, 0x10(%rax)
movl %r15d, %ebp
movl %r14d, 0x2c(%rsp)
cmpl 0x1c(%rsp), %ebp
jl 0x24e07
movq 0x40(%rsp), %rax
movq 0x20(%rsp), %rcx
movb $0x0, 0x75(%rcx,%rax)
movq 0x3150(%rsp), %rax
addq %rax, 0x60(%rcx)
movq 0x30(%rsp), %rdi
callq 0x52e0
movq 0xb0(%rsp), %r14
movq 0xa8(%rsp), %r15
movl 0x6c(%rsp), %r12d
jmp 0x258a3
movq 0x3158(%rsp), %rax
movb $0x1, 0x60(%rsp)
cmpq $0x0, 0x40(%rax)
jne 0x2521f
movl 0x28b0(%rsp), %eax
shlq $0x5, %rax
leaq 0x1970(%rsp), %rcx
cmpl $0x0, 0x18(%rcx,%rax)
sete 0x60(%rsp)
movslq 0x314c(%rsp), %rbp
movl 0x1d0(%rsp), %eax
incl %eax
movl %eax, 0x208(%rsp)
movl 0x28b0(%rsp), %eax
shlq $0x5, %rax
leaq 0x1970(%rsp), %rcx
cmpl $0x0, 0x18(%rcx,%rax)
je 0x258a3
movq 0x238(%rsp), %r12
movl 0x24(%r12), %eax
movl %eax, 0x54(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, (%rsp)
leaq 0x3160(%rsp), %rdi
leaq 0x1820(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
movq 0x48(%rsp), %r15
movl %r15d, %ecx
leaq 0x3997af(%rip), %r8     # 0x3bea40
leaq 0x208(%rsp), %r9
callq 0x1b13c
movq $0x0, 0x39c8(%rsp)
movq 0x238(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x39d0(%rsp)
leaq 0xe0(%rsp), %rdi
movq %r14, %rsi
callq 0x1c598
movl $0x0, 0x218(%rsp)
movl 0x22c(%rsp), %eax
addl 0x228(%rsp), %eax
movl %eax, 0x9c(%rsp)
leaq 0x38(%r12), %rdi
movq %rdi, 0x20(%rsp)
callq 0x55f0
movq %r12, 0x30(%rsp)
movl 0x6c(%r12), %eax
movl %eax, 0x18(%rsp)
movq %rbp, 0x88(%rsp)
imulq $0x560, %rbp, %rax      # imm = 0x560
leaq 0x39b76f(%rip), %rcx    # 0x3c0a90
addq %rcx, %rax
addq $0x40, %rax
movq %rax, 0x78(%rsp)
leal -0x2(%r15), %eax
movl %eax, 0x3c(%rsp)
movl %r15d, %eax
shrl $0x1f, %eax
addl %r15d, %eax
sarl %eax
cmpl $0x6, %r15d
setl %cl
cmpl $0x10, %r15d
setl %sil
movl %r15d, %edi
shrl %edi
cmpl $0x7e, %r15d
movl $0x3f, %edx
cmovgel %edx, %eax
movslq %eax, %r8
cmovgel %edx, %edi
xorb %cl, %sil
movb %sil, 0x2b(%rsp)
movl $0xffff8acf, %r15d      # imm = 0xFFFF8ACF
shlq $0x6, %rdi
leaq 0x3963b1(%rip), %rax    # 0x3bb730
addq %rax, %rdi
movq %rdi, 0xc0(%rsp)
shlq $0x6, %r8
addq %rax, %r8
movq %r8, 0xc8(%rsp)
movl %r15d, 0x40(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jge 0x2585e
movq 0x39d0(%rsp), %rdi
callq 0x1b630
testl %eax, %eax
je 0x2585e
movl %eax, %r12d
movq 0x78(%rsp), %rdi
callq 0x28eb8
testb %al, %al
jne 0x2585e
movq 0x30(%rsp), %rax
movl 0x70(%rax), %r15d
incl %r15d
movl %r15d, 0x70(%rax)
movq 0x20(%rsp), %rdi
callq 0x52e0
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
leaq 0xe0(%rsp), %rdx
callq 0x1e9ca
movl %r12d, %r14d
notl %r14d
testl $0x1f000, %r12d         # imm = 0x1F000
je 0x25420
testl $0xc000, %r14d          # imm = 0xC000
jmp 0x2542e
movl %r12d, %ecx
andl $0x3f, %ecx
cmpl $0x10, 0x1820(%rsp,%rcx,4)
setne %cl
movb %cl, 0x70(%rsp)
movzbl %cl, %r13d
movzbl %al, %ebp
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
movl %ebp, %ecx
leaq 0x17(%rsp), %r8
callq 0x28972
movl %r12d, 0x20c(%rsp)
orb 0x60(%rsp), %r13b
jne 0x255ef
testl $0xc000, %r14d          # imm = 0xC000
je 0x255ef
cmpb $0x0, 0x17(%rsp)
jne 0x255ef
movq %rax, %r13
movl $0x100, %eax            # imm = 0x100
cmpl $0x1f, 0x48(%rsp)
jg 0x2549f
leaq 0x399299(%rip), %rax    # 0x3be730
movq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl %eax, %r15d
jl 0x254fd
movl 0x54(%rsp), %edx
testl %edx, %edx
je 0x254cc
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
callq 0x28a6d
cmpl $0xffff8b35, 0x18(%rsp) # imm = 0xFFFF8B35
jl 0x254fd
testb %al, %al
je 0x254d6
jmp 0x254fd
cmpl $0xffff8b35, 0x18(%rsp) # imm = 0xFFFF8B35
jl 0x254fd
movq 0x20(%rsp), %rdi
callq 0x55f0
movq 0x39d0(%rsp), %rdi
callq 0x1b630
movl %eax, %r12d
testl %eax, %eax
jne 0x253c4
jmp 0x2585e
addl 0x3c(%rsp), %r13d
cmpl $0x3f, %r15d
movl $0x3f, %eax
cmovll %r15d, %eax
movslq %eax, %rcx
movq 0xc8(%rsp), %rax
movsbl (%rcx,%rax), %edx
movq %r13, 0x58(%rsp)
movl %r13d, %eax
subl %edx, %eax
movl $0xea62, %r13d          # imm = 0xEA62
cmpl $0xd, %eax
jg 0x25550
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
shlq $0x8, %rdx
leaq 0x3981e7(%rip), %rsi    # 0x3bd730
addq %rsi, %rdx
movl (%rdx,%rcx,4), %r13d
addl 0x9c(%rsp), %r13d
movl %r12d, %ecx
shrl $0x4, %ecx
andl $0xfc, %ecx
movl 0x1820(%rsp,%rcx), %ecx
movl %r12d, %edx
andl $0x3f, %edx
shlq $0x8, %rcx
leaq 0x3994c4(%rip), %rsi    # 0x3bea40
addq %rsi, %rcx
addl 0x1000(%rcx,%rdx,4), %r13d
cmpl 0x1c(%rsp), %r13d
jge 0x255b0
movq 0x20(%rsp), %rdi
callq 0x55f0
movq 0x30(%rsp), %rax
cmpl 0x6c(%rax), %r13d
jle 0x255e3
movl %r13d, 0x6c(%rax)
xorl %ecx, %ecx
movl %r13d, 0x18(%rsp)
jmp 0x255e5
movb $0x1, %cl
cmpl $0xffff8b35, 0x18(%rsp) # imm = 0xFFFF8B35
jl 0x255e5
cmpl $0x3, %eax
jg 0x255e5
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
callq 0x2073c
testl %eax, %eax
js 0x255d9
movb $0x1, %cl
jmp 0x255e5
movq 0x20(%rsp), %rdi
callq 0x55f0
xorl %ecx, %ecx
testb %cl, %cl
je 0x2539e
jmp 0x255f8
addl 0x3c(%rsp), %eax
movq %rax, 0x58(%rsp)
movb 0x2b(%rsp), %al
andb 0x70(%rsp), %al
cmpb $0x1, %al
jne 0x2560f
cmpb $0x0, 0x17(%rsp)
je 0x256dd
xorl %eax, %eax
movl %eax, 0x18(%rsp)
cmpl $0x6, 0x48(%rsp)
setl %r13b
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
leaq 0x130(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
movl %ebp, %r8d
callq 0x1ef5e
movq 0x30(%rsp), %rax
movl 0x68(%rax), %ebp
orb 0x70(%rsp), %r13b
movb $0x1, %al
je 0x2565c
movl 0x40(%rsp), %r15d
jmp 0x25735
testl $0xc000, %r14d          # imm = 0xC000
je 0x25652
cmpb $0x0, 0x17(%rsp)
jne 0x25652
cmpl %r12d, 0x21c(%rsp)
je 0x25652
cmpl %r12d, 0x220(%rsp)
je 0x25652
cmpl $0x3f, %r15d
movl $0x3f, %eax
cmovgel %eax, %r15d
movslq %r15d, %rax
movq 0xc0(%rsp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, 0x224(%rsp)
testl %eax, %eax
je 0x25723
movq 0x58(%rsp), %rcx
movl %ecx, %r8d
subl %eax, %r8d
movl %ebp, %edx
notl %edx
movl %ebp, %ecx
negl %ecx
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x26cac
movl %eax, %r15d
negl %r15d
cmpl %r15d, %ebp
setl %al
jmp 0x2572a
movl %r12d, %ecx
andl $0xc000, %ecx           # imm = 0xC000
movl 0x2c(%rsp), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
xorl %eax, %eax
cmpl $0x4000, %ecx           # imm = 0x4000
je 0x25611
cmpl $0x74cb, %esi           # imm = 0x74CB
ja 0x25611
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
callq 0x2073c
shrl $0x1f, %eax
jmp 0x25611
movb $0x1, %al
movl 0x40(%rsp), %r15d
movl $0x0, 0x224(%rsp)
cmpb $0x0, 0x18(%rsp)
je 0x25791
movl $0x6, 0x224(%rsp)
leal -0x12c(%rbp), %r14d
movq 0x58(%rsp), %rax
leal -0x6(%rax), %r8d
movl $0x12b, %edx            # imm = 0x12B
subl %ebp, %edx
movl $0x12c, %ecx            # imm = 0x12C
subl %ebp, %ecx
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x26cac
movl %eax, %r15d
negl %r15d
cmpl %r15d, %r14d
setl %al
movl $0x0, 0x224(%rsp)
testb %al, %al
movq 0x30(%rsp), %r14
je 0x257c4
movl 0x68(%r14), %ecx
movl %ecx, %edx
notl %edx
negl %ecx
leaq 0x1820(%rsp), %rdi
leaq 0x240(%rsp), %rsi
movq 0x58(%rsp), %r8
callq 0x26cac
movl %eax, %r15d
negl %r15d
leaq 0x1820(%rsp), %rdi
movl %r12d, %esi
callq 0x20056
movq 0x20(%rsp), %rdi
callq 0x55f0
movl 0x6c(%r14), %ecx
movl 0x68(%r14), %eax
movl %eax, 0x2c(%rsp)
movl %ecx, 0x18(%rsp)
cmpl %ecx, %r15d
jle 0x25399
movq 0x78(%rsp), %rdi
callq 0x28eb8
testb %al, %al
jne 0x25399
movq 0x30(%rsp), %rax
movl %r15d, 0x6c(%rax)
movl %r15d, 0x18(%rsp)
cmpl 0x2c(%rsp), %r15d
jle 0x25399
movq 0x30(%rsp), %rcx
movb $0x1, 0x74(%rcx)
movl $0x752f, %eax           # imm = 0x752F
subl 0x208(%rsp), %eax
cmpl %eax, %r15d
jne 0x25844
movl %r12d, 0x210(%rsp)
movl %r12d, 0x218(%rsp)
movq 0x30(%rcx), %rax
movl %r12d, 0x10(%rax)
movl %r15d, 0x18(%rsp)
jmp 0x25399
movq 0x88(%rsp), %rax
movq 0x30(%rsp), %rcx
movb $0x0, 0x75(%rcx,%rax)
movq 0x3150(%rsp), %rax
addq %rax, 0x60(%rcx)
movq 0x20(%rsp), %rdi
callq 0x52e0
movq 0xb0(%rsp), %r14
movq 0xa8(%rsp), %r15
movl 0x6c(%rsp), %r12d
movq 0x90(%rsp), %r13
movl $0x2, 0x88(%r14)
cmpb $0x1, 0x30(%r15)
jne 0x258ee
movq 0xd0(%rsp), %rax
movslq 0x20(%rax), %rax
cmpl %r12d, %eax
je 0x258ee
imulq $0x560, %rax, %rdi      # imm = 0x560
movq 0xa0(%rsp), %rax
movl 0x88(%rax,%rdi), %eax
cmpl $0x2, %eax
jne 0x258ee
addq 0xa0(%rsp), %rdi
callq 0x28e8a
testq %rbx, %rbx
setne %cl
movl 0x34(%r15), %edx
movl %edx, %eax
testl %edx, %edx
setg %dl
andb %cl, %dl
xorl %ecx, %ecx
cmpb $0x1, %dl
jne 0x2591e
xorl %ecx, %ecx
cmpb $0x0, 0x75(%rbx,%rcx)
jne 0x2591e
incq %rcx
testq %rbx, %rbx
je 0x2591e
cmpq %rax, %rcx
jb 0x2590a
cmpl %eax, %ecx
jne 0x24b61
addq $0x38, %rbx
movq %rbx, %rdi
callq 0x55f0
movq %rbx, %rdi
callq 0x52e0
movl $0x1, 0x88(%r14)
jmp 0x2595b
movq 0xb8(%rsp), %rax
movl $0x5, 0xc8(%r15,%rax)
addq $0x39d8, %rsp           # imm = 0x39D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq