// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/bzip2-1.0.6/blocksort.c
// Function: mainSort
static
void mainSort ( UInt32* ptr, 
                UChar*  block,
                UInt16* quadrant, 
                UInt32* ftab,
                Int32   nblock,
                Int32   verb,
                Int32*  budget )
{
   Int32  i, j, k, ss, sb;
   Int32  runningOrder[256];
   Bool   bigDone[256];
   Int32  copyStart[256];
   Int32  copyEnd  [256];
   UChar  c1;
   Int32  numQSorted;
   UInt16 s;
   if (verb >= 4) VPrintf0 ( "        main sort initialise ...\n" );

   /*-- set up the 2-byte frequency table --*/
   for (i = 65536; i >= 0; i--) ftab[i] = 0;

   j = block[0] << 8;
   i = nblock-1;
   for (; i >= 3; i -= 4) {
      quadrant[i] = 0;
      j = (j >> 8) | ( ((UInt16)block[i]) << 8);
      ftab[j]++;
      quadrant[i-1] = 0;
      j = (j >> 8) | ( ((UInt16)block[i-1]) << 8);
      ftab[j]++;
      quadrant[i-2] = 0;
      j = (j >> 8) | ( ((UInt16)block[i-2]) << 8);
      ftab[j]++;
      quadrant[i-3] = 0;
      j = (j >> 8) | ( ((UInt16)block[i-3]) << 8);
      ftab[j]++;
   }
   for (; i >= 0; i--) {
      quadrant[i] = 0;
      j = (j >> 8) | ( ((UInt16)block[i]) << 8);
      ftab[j]++;
   }

   /*-- (emphasises close relationship of block & quadrant) --*/
   for (i = 0; i < BZ_N_OVERSHOOT; i++) {
      block   [nblock+i] = block[i];
      quadrant[nblock+i] = 0;
   }

   if (verb >= 4) VPrintf0 ( "        bucket sorting ...\n" );

   /*-- Complete the initial radix sort --*/
   for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1];

   s = block[0] << 8;
   i = nblock-1;
   for (; i >= 3; i -= 4) {
      s = (s >> 8) | (block[i] << 8);
      j = ftab[s] -1;
      ftab[s] = j;
      ptr[j] = i;
      s = (s >> 8) | (block[i-1] << 8);
      j = ftab[s] -1;
      ftab[s] = j;
      ptr[j] = i-1;
      s = (s >> 8) | (block[i-2] << 8);
      j = ftab[s] -1;
      ftab[s] = j;
      ptr[j] = i-2;
      s = (s >> 8) | (block[i-3] << 8);
      j = ftab[s] -1;
      ftab[s] = j;
      ptr[j] = i-3;
   }
   for (; i >= 0; i--) {
      s = (s >> 8) | (block[i] << 8);
      j = ftab[s] -1;
      ftab[s] = j;
      ptr[j] = i;
   }

   /*--
      Now ftab contains the first loc of every small bucket.
      Calculate the running order, from smallest to largest
      big bucket.
   --*/
   for (i = 0; i <= 255; i++) {
      bigDone     [i] = False;
      runningOrder[i] = i;
   }

   {
      Int32 vv;
      Int32 h = 1;
      do h = 3 * h + 1; while (h <= 256);
      do {
         h = h / 3;
         for (i = h; i <= 255; i++) {
            vv = runningOrder[i];
            j = i;
            while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) {
               runningOrder[j] = runningOrder[j-h];
               j = j - h;
               if (j <= (h - 1)) goto zero;
            }
            zero:
            runningOrder[j] = vv;
         }
      } while (h != 1);
   }

   /*--
      The main sorting loop.
   --*/

   numQSorted = 0;

   for (i = 0; i <= 255; i++) {

      /*--
         Process big buckets, starting with the least full.
         Basically this is a 3-step process in which we call
         mainQSort3 to sort the small buckets [ss, j], but
         also make a big effort to avoid the calls if we can.
      --*/
      ss = runningOrder[i];

      /*--
         Step 1:
         Complete the big bucket [ss] by quicksorting
         any unsorted small buckets [ss, j], for j != ss.  
         Hopefully previous pointer-scanning phases have already
         completed many of the small buckets [ss, j], so
         we don't have to sort them at all.
      --*/
      for (j = 0; j <= 255; j++) {
         if (j != ss) {
            sb = (ss << 8) + j;
            if ( ! (ftab[sb] & SETMASK) ) {
               Int32 lo = ftab[sb]   & CLEARMASK;
               Int32 hi = (ftab[sb+1] & CLEARMASK) - 1;
               if (hi > lo) {
                  if (verb >= 4)
                     VPrintf4 ( "        qsort [0x%x, 0x%x]   "
                                "done %d   this %d\n",
                                ss, j, numQSorted, hi - lo + 1 );
                  mainQSort3 ( 
                     ptr, block, quadrant, nblock, 
                     lo, hi, BZ_N_RADIX, budget 
                  );   
                  numQSorted += (hi - lo + 1);
                  if (*budget < 0) return;
               }
            }
            ftab[sb] |= SETMASK;
         }
      }

      AssertH ( !bigDone[ss], 1006 );

      /*--
         Step 2:
         Now scan this big bucket [ss] so as to synthesise the
         sorted order for small buckets [t, ss] for all t,
         including, magically, the bucket [ss,ss] too.
         This will avoid doing Real Work in subsequent Step 1's.
      --*/
      {
         for (j = 0; j <= 255; j++) {
            copyStart[j] =  ftab[(j << 8) + ss]     & CLEARMASK;
            copyEnd  [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1;
         }
         for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) {
            k = ptr[j]-1; if (k < 0) k += nblock;
            c1 = block[k];
            if (!bigDone[c1])
               ptr[ copyStart[c1]++ ] = k;
         }
         for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) {
            k = ptr[j]-1; if (k < 0) k += nblock;
            c1 = block[k];
            if (!bigDone[c1]) 
               ptr[ copyEnd[c1]-- ] = k;
         }
      }

      AssertH ( (copyStart[ss]-1 == copyEnd[ss])
                || 
                /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1.
                   Necessity for this case is demonstrated by compressing 
                   a sequence of approximately 48.5 million of character 
                   251; 1.0.0/1.0.1 will then die here. */
                (copyStart[ss] == 0 && copyEnd[ss] == nblock-1),
                1007 )

      for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK;

      /*--
         Step 3:
         The [ss] big bucket is now done.  Record this fact,
         and update the quadrant descriptors.  Remember to
         update quadrants in the overshoot area too, if
         necessary.  The "if (i < 255)" test merely skips
         this updating for the last bucket processed, since
         updating for the last bucket is pointless.

         The quadrant array provides a way to incrementally
         cache sort orderings, as they appear, so as to 
         make subsequent comparisons in fullGtU() complete
         faster.  For repetitive blocks this makes a big
         difference (but not big enough to be able to avoid
         the fallback sorting mechanism, exponential radix sort).

         The precise meaning is: at all times:

            for 0 <= i < nblock and 0 <= j <= nblock

            if block[i] != block[j], 

               then the relative values of quadrant[i] and 
                    quadrant[j] are meaningless.

               else {
                  if quadrant[i] < quadrant[j]
                     then the string starting at i lexicographically
                     precedes the string starting at j

                  else if quadrant[i] > quadrant[j]
                     then the string starting at j lexicographically
                     precedes the string starting at i

                  else
                     the relative ordering of the strings starting
                     at i and j has not yet been determined.
               }
      --*/
      bigDone[ss] = True;

      if (i < 255) {
         Int32 bbStart  = ftab[ss << 8] & CLEARMASK;
         Int32 bbSize   = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart;
         Int32 shifts   = 0;

         while ((bbSize >> shifts) > 65534) shifts++;

         for (j = bbSize-1; j >= 0; j--) {
            Int32 a2update     = ptr[bbStart + j];
            UInt16 qVal        = (UInt16)(j >> shifts);
            quadrant[a2update] = qVal;
            if (a2update < BZ_N_OVERSHOOT)
               quadrant[a2update + nblock] = qVal;
         }
         AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 );
      }

   }

   if (verb >= 4)
      VPrintf3 ( "        %d pointers, %d sorted, %d scanned\n",
                 nblock, numQSorted, nblock - numQSorted );
}

// Assembly:
subq $0xd88, %rsp            # imm = 0xD88
movq 0xd90(%rsp), %rax
movq %rdi, 0xd80(%rsp)
movq %rsi, 0xd78(%rsp)
movq %rdx, 0xd70(%rsp)
movq %rcx, 0xd68(%rsp)
movl %r8d, 0xd64(%rsp)
movl %r9d, 0xd60(%rsp)
cmpl $0x4, 0xd60(%rsp)
jl 0x153191
movq 0x60e58(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x3bc50(%rip), %rsi     # 0x18edda
movb $0x0, %al
callq 0xb890
movl $0x10000, 0xd5c(%rsp) # imm = 0x10000
cmpl $0x0, 0xd5c(%rsp)
jl 0x1531d0
movq 0xd68(%rsp), %rax
movslq 0xd5c(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl 0xd5c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x15319c
movq 0xd78(%rsp), %rax
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, 0xd58(%rsp)
movl 0xd64(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xd5c(%rsp)
cmpl $0x3, 0xd5c(%rsp)
jl 0x1533a8
movq 0xd70(%rsp), %rax
movslq 0xd5c(%rsp), %rcx
movw $0x0, (%rax,%rcx,2)
movl 0xd58(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movslq 0xd5c(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
movzwl %cx, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, 0xd58(%rsp)
movq 0xd68(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0xd70(%rsp), %rax
movl 0xd5c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw $0x0, (%rax,%rcx,2)
movl 0xd58(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movl 0xd5c(%rsp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
movzwl %cx, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, 0xd58(%rsp)
movq 0xd68(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0xd70(%rsp), %rax
movl 0xd5c(%rsp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movw $0x0, (%rax,%rcx,2)
movl 0xd58(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movl 0xd5c(%rsp), %edx
subl $0x2, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
movzwl %cx, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, 0xd58(%rsp)
movq 0xd68(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0xd70(%rsp), %rax
movl 0xd5c(%rsp), %ecx
subl $0x3, %ecx
movslq %ecx, %rcx
movw $0x0, (%rax,%rcx,2)
movl 0xd58(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movl 0xd5c(%rsp), %edx
subl $0x3, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
movzwl %cx, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, 0xd58(%rsp)
movq 0xd68(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %eax
subl $0x4, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x1531f6
jmp 0x1533aa
cmpl $0x0, 0xd5c(%rsp)
jl 0x153423
movq 0xd70(%rsp), %rax
movslq 0xd5c(%rsp), %rcx
movw $0x0, (%rax,%rcx,2)
movl 0xd58(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movslq 0xd5c(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
movzwl %cx, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, 0xd58(%rsp)
movq 0xd68(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x1533aa
movl $0x0, 0xd5c(%rsp)
cmpl $0x22, 0xd5c(%rsp)
jge 0x153499
movq 0xd78(%rsp), %rax
movslq 0xd5c(%rsp), %rcx
movb (%rax,%rcx), %dl
movq 0xd78(%rsp), %rax
movl 0xd64(%rsp), %ecx
addl 0xd5c(%rsp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq 0xd70(%rsp), %rax
movl 0xd64(%rsp), %ecx
addl 0xd5c(%rsp), %ecx
movslq %ecx, %rcx
movw $0x0, (%rax,%rcx,2)
movl 0xd5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x15342e
cmpl $0x4, 0xd60(%rsp)
jl 0x1534bb
movq 0x60b2e(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x3b8b9(%rip), %rsi     # 0x18ed6d
movb $0x0, %al
callq 0xb890
movl $0x1, 0xd5c(%rsp)
cmpl $0x10000, 0xd5c(%rsp) # imm = 0x10000
jg 0x153514
movq 0xd68(%rsp), %rax
movl 0xd5c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0xd68(%rsp), %rax
movslq 0xd5c(%rsp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x1534c6
movq 0xd78(%rsp), %rax
movzbl (%rax), %eax
shll $0x8, %eax
movw %ax, 0x36(%rsp)
movl 0xd64(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xd5c(%rsp)
cmpl $0x3, 0xd5c(%rsp)
jl 0x153738
movzwl 0x36(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movslq 0xd5c(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movw %ax, 0x36(%rsp)
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %edx
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %edx
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movzwl 0x36(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movl 0xd5c(%rsp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movw %ax, 0x36(%rsp)
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %edx
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %edx
subl $0x1, %edx
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movzwl 0x36(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movl 0xd5c(%rsp), %edx
subl $0x2, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movw %ax, 0x36(%rsp)
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %edx
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %edx
subl $0x2, %edx
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movzwl 0x36(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movl 0xd5c(%rsp), %edx
subl $0x3, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movw %ax, 0x36(%rsp)
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %edx
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %edx
subl $0x3, %edx
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %eax
subl $0x4, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x153538
jmp 0x15373a
cmpl $0x0, 0xd5c(%rsp)
jl 0x1537cf
movzwl 0x36(%rsp), %eax
sarl $0x8, %eax
movq 0xd78(%rsp), %rcx
movslq 0xd5c(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movw %ax, 0x36(%rsp)
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %edx
movq 0xd68(%rsp), %rax
movzwl 0x36(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %edx
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0xd5c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x15373a
movl $0x0, 0xd5c(%rsp)
cmpl $0xff, 0xd5c(%rsp)
jg 0x153820
movslq 0xd5c(%rsp), %rax
movb $0x0, 0x840(%rsp,%rax)
movl 0xd5c(%rsp), %ecx
movslq 0xd5c(%rsp), %rax
movl %ecx, 0x940(%rsp,%rax,4)
movl 0xd5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x1537da
movl $0x1, 0x2c(%rsp)
imull $0x3, 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
cmpl $0x100, 0x2c(%rsp)      # imm = 0x100
jle 0x153828
jmp 0x153840
movl 0x2c(%rsp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0xd5c(%rsp)
cmpl $0xff, 0xd5c(%rsp)
jg 0x153986
movslq 0xd5c(%rsp), %rax
movl 0x940(%rsp,%rax,4), %eax
movl %eax, 0x30(%rsp)
movl 0xd5c(%rsp), %eax
movl %eax, 0xd58(%rsp)
movq 0xd68(%rsp), %rax
movl 0xd58(%rsp), %ecx
subl 0x2c(%rsp), %ecx
movslq %ecx, %rcx
movl 0x940(%rsp,%rcx,4), %ecx
addl $0x1, %ecx
shll $0x8, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq 0xd68(%rsp), %rcx
movl 0xd58(%rsp), %edx
subl 0x2c(%rsp), %edx
movslq %edx, %rdx
movl 0x940(%rsp,%rdx,4), %edx
shll $0x8, %edx
movslq %edx, %rdx
subl (%rcx,%rdx,4), %eax
movq 0xd68(%rsp), %rcx
movl 0x30(%rsp), %edx
addl $0x1, %edx
shll $0x8, %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movq 0xd68(%rsp), %rdx
movl 0x30(%rsp), %esi
shll $0x8, %esi
movslq %esi, %rsi
subl (%rdx,%rsi,4), %ecx
cmpl %ecx, %eax
jbe 0x15395b
movl 0xd58(%rsp), %eax
subl 0x2c(%rsp), %eax
cltq
movl 0x940(%rsp,%rax,4), %ecx
movslq 0xd58(%rsp), %rax
movl %ecx, 0x940(%rsp,%rax,4)
movl 0xd58(%rsp), %eax
subl 0x2c(%rsp), %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %eax
movl 0x2c(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x153956
jmp 0x15395d
jmp 0x15388d
jmp 0x15395d
movl 0x30(%rsp), %ecx
movslq 0xd58(%rsp), %rax
movl %ecx, 0x940(%rsp,%rax,4)
movl 0xd5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x15385b
jmp 0x153988
cmpl $0x1, 0x2c(%rsp)
jne 0x153840
movl $0x0, 0x38(%rsp)
movl $0x0, 0xd5c(%rsp)
cmpl $0xff, 0xd5c(%rsp)
jg 0x153ffe
movslq 0xd5c(%rsp), %rax
movl 0x940(%rsp,%rax,4), %eax
movl %eax, 0xd50(%rsp)
movl $0x0, 0xd58(%rsp)
cmpl $0xff, 0xd58(%rsp)
jg 0x153b66
movl 0xd58(%rsp), %eax
cmpl 0xd50(%rsp), %eax
je 0x153b4e
movl 0xd50(%rsp), %eax
shll $0x8, %eax
addl 0xd58(%rsp), %eax
movl %eax, 0xd4c(%rsp)
movq 0xd68(%rsp), %rax
movslq 0xd4c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
jne 0x153b32
movq 0xd68(%rsp), %rax
movslq 0xd4c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xffdfffff, %eax       # imm = 0xFFDFFFFF
movl %eax, 0x28(%rsp)
movq 0xd68(%rsp), %rax
movl 0xd4c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
andl $0xffdfffff, %eax       # imm = 0xFFDFFFFF
subl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x28(%rsp), %eax
jle 0x153b30
cmpl $0x4, 0xd60(%rsp)
jl 0x153ac7
movq 0x60543(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movl 0xd50(%rsp), %edx
movl 0xd58(%rsp), %ecx
movl 0x38(%rsp), %r8d
movl 0x24(%rsp), %r9d
subl 0x28(%rsp), %r9d
addl $0x1, %r9d
leaq 0x3b33c(%rip), %rsi     # 0x18edfc
movb $0x0, %al
callq 0xb890
movq 0xd80(%rsp), %rdi
movq 0xd78(%rsp), %rsi
movq 0xd70(%rsp), %rdx
movl 0xd64(%rsp), %ecx
movl 0x28(%rsp), %r8d
movl 0x24(%rsp), %r9d
movq 0xd90(%rsp), %rax
movl $0x2, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1549d0
movl 0x24(%rsp), %eax
subl 0x28(%rsp), %eax
addl $0x1, %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
movq 0xd90(%rsp), %rax
cmpl $0x0, (%rax)
jge 0x153b2e
jmp 0x154038
jmp 0x153b30
jmp 0x153b32
movq 0xd68(%rsp), %rax
movslq 0xd4c(%rsp), %rcx
movl (%rax,%rcx,4), %edx
orl $0x200000, %edx         # imm = 0x200000
movl %edx, (%rax,%rcx,4)
jmp 0x153b50
movl 0xd58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd58(%rsp)
jmp 0x1539d8
movslq 0xd50(%rsp), %rax
cmpb $0x0, 0x840(%rsp,%rax)
je 0x153b82
movl $0x3ee, %edi            # imm = 0x3EE
callq 0xc7b30
movl $0x0, 0xd58(%rsp)
cmpl $0xff, 0xd58(%rsp)
jg 0x153c1f
movq 0xd68(%rsp), %rax
movl 0xd58(%rsp), %ecx
shll $0x8, %ecx
addl 0xd50(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
andl $0xffdfffff, %ecx       # imm = 0xFFDFFFFF
movslq 0xd58(%rsp), %rax
movl %ecx, 0x440(%rsp,%rax,4)
movq 0xd68(%rsp), %rax
movl 0xd58(%rsp), %ecx
shll $0x8, %ecx
addl 0xd50(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
andl $0xffdfffff, %ecx       # imm = 0xFFDFFFFF
subl $0x1, %ecx
movslq 0xd58(%rsp), %rax
movl %ecx, 0x40(%rsp,%rax,4)
movl 0xd58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd58(%rsp)
jmp 0x153b8d
movq 0xd68(%rsp), %rax
movl 0xd50(%rsp), %ecx
shll $0x8, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
andl $0xffdfffff, %eax       # imm = 0xFFDFFFFF
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %eax
movslq 0xd50(%rsp), %rcx
cmpl 0x440(%rsp,%rcx,4), %eax
jge 0x153d08
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd54(%rsp)
cmpl $0x0, 0xd54(%rsp)
jge 0x153c9b
movl 0xd64(%rsp), %eax
addl 0xd54(%rsp), %eax
movl %eax, 0xd54(%rsp)
movq 0xd78(%rsp), %rax
movslq 0xd54(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0x3f(%rsp)
movzbl 0x3f(%rsp), %eax
cmpb $0x0, 0x840(%rsp,%rax)
jne 0x153cf0
movl 0xd54(%rsp), %edx
movq 0xd80(%rsp), %rax
movzbl 0x3f(%rsp), %ecx
movl %ecx, %esi
movl 0x440(%rsp,%rsi,4), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x440(%rsp,%rsi,4)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x153cf2
movl 0xd58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd58(%rsp)
jmp 0x153c43
movq 0xd68(%rsp), %rax
movl 0xd50(%rsp), %ecx
addl $0x1, %ecx
shll $0x8, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
andl $0xffdfffff, %eax       # imm = 0xFFDFFFFF
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
movl 0xd58(%rsp), %eax
movslq 0xd50(%rsp), %rcx
cmpl 0x40(%rsp,%rcx,4), %eax
jle 0x153dee
movq 0xd80(%rsp), %rax
movslq 0xd58(%rsp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, 0xd54(%rsp)
cmpl $0x0, 0xd54(%rsp)
jge 0x153d87
movl 0xd64(%rsp), %eax
addl 0xd54(%rsp), %eax
movl %eax, 0xd54(%rsp)
movq 0xd78(%rsp), %rax
movslq 0xd54(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0x3f(%rsp)
movzbl 0x3f(%rsp), %eax
cmpb $0x0, 0x840(%rsp,%rax)
jne 0x153dd6
movl 0xd54(%rsp), %edx
movq 0xd80(%rsp), %rax
movzbl 0x3f(%rsp), %ecx
movl %ecx, %esi
movl 0x40(%rsp,%rsi,4), %ecx
movl %ecx, %edi
addl $-0x1, %edi
movl %edi, 0x40(%rsp,%rsi,4)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x153dd8
movl 0xd58(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xd58(%rsp)
jmp 0x153d32
movslq 0xd50(%rsp), %rax
movl 0x440(%rsp,%rax,4), %eax
subl $0x1, %eax
movslq 0xd50(%rsp), %rcx
cmpl 0x40(%rsp,%rcx,4), %eax
je 0x153e44
movslq 0xd50(%rsp), %rax
cmpl $0x0, 0x440(%rsp,%rax,4)
jne 0x153e3a
movslq 0xd50(%rsp), %rax
movl 0x40(%rsp,%rax,4), %eax
movl 0xd64(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x153e44
movl $0x3ef, %edi            # imm = 0x3EF
callq 0xc7b30
movl $0x0, 0xd58(%rsp)
cmpl $0xff, 0xd58(%rsp)
jg 0x153e97
movq 0xd68(%rsp), %rax
movl 0xd58(%rsp), %ecx
shll $0x8, %ecx
addl 0xd50(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
orl $0x200000, %edx         # imm = 0x200000
movl %edx, (%rax,%rcx,4)
movl 0xd58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd58(%rsp)
jmp 0x153e4f
movslq 0xd50(%rsp), %rax
movb $0x1, 0x840(%rsp,%rax)
cmpl $0xff, 0xd5c(%rsp)
jge 0x153fe6
movq 0xd68(%rsp), %rax
movl 0xd50(%rsp), %ecx
shll $0x8, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
andl $0xffdfffff, %eax       # imm = 0xFFDFFFFF
movl %eax, 0x20(%rsp)
movq 0xd68(%rsp), %rax
movl 0xd50(%rsp), %ecx
addl $0x1, %ecx
shll $0x8, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
andl $0xffdfffff, %eax       # imm = 0xFFDFFFFF
subl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
movl 0x1c(%rsp), %eax
movl 0x18(%rsp), %ecx
sarl %cl, %eax
cmpl $0xfffe, %eax           # imm = 0xFFFE
jle 0x153f27
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x153f09
movl 0x1c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xd58(%rsp)
cmpl $0x0, 0xd58(%rsp)
jl 0x153fc6
movq 0xd80(%rsp), %rax
movl 0x20(%rsp), %ecx
addl 0xd58(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
movl 0xd58(%rsp), %eax
movl 0x18(%rsp), %ecx
sarl %cl, %eax
movw %ax, 0x12(%rsp)
movw 0x12(%rsp), %dx
movq 0xd70(%rsp), %rax
movslq 0x14(%rsp), %rcx
movw %dx, (%rax,%rcx,2)
cmpl $0x22, 0x14(%rsp)
jge 0x153fae
movw 0x12(%rsp), %dx
movq 0xd70(%rsp), %rax
movl 0x14(%rsp), %ecx
addl 0xd64(%rsp), %ecx
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x153fb0
movl 0xd58(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xd58(%rsp)
jmp 0x153f35
movl 0x1c(%rsp), %eax
subl $0x1, %eax
movl 0x18(%rsp), %ecx
sarl %cl, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jle 0x153fe4
movl $0x3ea, %edi            # imm = 0x3EA
callq 0xc7b30
jmp 0x153fe6
jmp 0x153fe8
movl 0xd5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd5c(%rsp)
jmp 0x1539a6
cmpl $0x4, 0xd60(%rsp)
jl 0x154038
movq 0x5ffc9(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
movl 0xd64(%rsp), %edx
movl 0x38(%rsp), %ecx
movl 0xd64(%rsp), %r8d
subl 0x38(%rsp), %r8d
leaq 0x3adfb(%rip), %rsi     # 0x18ee2c
movb $0x0, %al
callq 0xb890
addq $0xd88, %rsp            # imm = 0xD88
retq