// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/bzip2-1.0.6/blocksort.c
// Function: mainSimpleSort
static
void mainSimpleSort ( UInt32* ptr,
                      UChar*  block,
                      UInt16* quadrant,
                      Int32   nblock,
                      Int32   lo, 
                      Int32   hi, 
                      Int32   d,
                      Int32*  budget )
{
   Int32 i, j, h, bigN, hp;
   UInt32 v;

   bigN = hi - lo + 1;
   if (bigN < 2) return;

   hp = 0;
   while (incs[hp] < bigN) hp++;
   hp--;

   for (; hp >= 0; hp--) {
      h = incs[hp];

      i = lo + h;
      while (True) {

         /*-- copy 1 --*/
         if (i > hi) break;
         v = ptr[i];
         j = i;
         while ( mainGtU ( 
                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
                 ) ) {
            ptr[j] = ptr[j-h];
            j = j - h;
            if (j <= (lo + h - 1)) break;
         }
         ptr[j] = v;
         i++;

         /*-- copy 2 --*/
         if (i > hi) break;
         v = ptr[i];
         j = i;
         while ( mainGtU ( 
                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
                 ) ) {
            ptr[j] = ptr[j-h];
            j = j - h;
            if (j <= (lo + h - 1)) break;
         }
         ptr[j] = v;
         i++;

         /*-- copy 3 --*/
         if (i > hi) break;
         v = ptr[i];
         j = i;
         while ( mainGtU ( 
                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
                 ) ) {
            ptr[j] = ptr[j-h];
            j = j - h;
            if (j <= (lo + h - 1)) break;
         }
         ptr[j] = v;
         i++;

         if (*budget < 0) return;
      }
   }
}

// Assembly:
subq $0x48, %rsp
movq 0x58(%rsp), %rax
movl 0x50(%rsp), %eax
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movl %ecx, 0x2c(%rsp)
movl %r8d, 0x28(%rsp)
movl %r9d, 0x24(%rsp)
movl 0x24(%rsp), %eax
subl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
cmpl $0x2, 0x14(%rsp)
jge 0x1553d5
jmp 0x1556a0
movl $0x0, 0x10(%rsp)
movslq 0x10(%rsp), %rcx
leaq 0x60e97(%rip), %rax     # 0x1b6280
movl (%rax,%rcx,4), %eax
cmpl 0x14(%rsp), %eax
jge 0x1553ff
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x1553dd
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
jl 0x1556a0
movslq 0x10(%rsp), %rcx
leaq 0x60e5f(%rip), %rax     # 0x1b6280
movl (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movl 0x28(%rsp), %eax
addl 0x18(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jle 0x155443
jmp 0x15568e
movq 0x40(%rsp), %rax
movslq 0x20(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0xc(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edi
addl 0x50(%rsp), %edi
movl 0xc(%rsp), %esi
addl 0x50(%rsp), %esi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movl 0x2c(%rsp), %r8d
movq 0x58(%rsp), %r9
callq 0x155720
cmpb $0x0, %al
je 0x1554db
movq 0x40(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x40(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
subl 0x18(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x28(%rsp), %ecx
addl 0x18(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x1554d9
jmp 0x1554db
jmp 0x15545c
movl 0xc(%rsp), %edx
movq 0x40(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jle 0x155506
jmp 0x15568e
movq 0x40(%rsp), %rax
movslq 0x20(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0xc(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edi
addl 0x50(%rsp), %edi
movl 0xc(%rsp), %esi
addl 0x50(%rsp), %esi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movl 0x2c(%rsp), %r8d
movq 0x58(%rsp), %r9
callq 0x155720
cmpb $0x0, %al
je 0x15559e
movq 0x40(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x40(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
subl 0x18(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x28(%rsp), %ecx
addl 0x18(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x15559c
jmp 0x15559e
jmp 0x15551f
movl 0xc(%rsp), %edx
movq 0x40(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jle 0x1555c9
jmp 0x15568e
movq 0x40(%rsp), %rax
movslq 0x20(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0xc(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edi
addl 0x50(%rsp), %edi
movl 0xc(%rsp), %esi
addl 0x50(%rsp), %esi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movl 0x2c(%rsp), %r8d
movq 0x58(%rsp), %r9
callq 0x155720
cmpb $0x0, %al
je 0x155661
movq 0x40(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x40(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
subl 0x18(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x28(%rsp), %ecx
addl 0x18(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x15565f
jmp 0x155661
jmp 0x1555e2
movl 0xc(%rsp), %edx
movq 0x40(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x58(%rsp), %rax
cmpl $0x0, (%rax)
jge 0x155689
jmp 0x1556a0
jmp 0x155434
jmp 0x155690
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x15540a
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)