// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/ltablib.c
// Function: auxsort
static void auxsort (lua_State *L, int l, int u) {
  while (l < u) {  /* for tail recursion */
    int i, j;
    /* sort elements a[l], a[(l+u)/2] and a[u] */
    lua_rawgeti(L, 1, l);
    lua_rawgeti(L, 1, u);
    if (sort_comp(L, -1, -2))  /* a[u] < a[l]? */
      set2(L, l, u);  /* swap a[l] - a[u] */
    else
      lua_pop(L, 2);
    if (u-l == 1) break;  /* only 2 elements */
    i = (l+u)/2;
    lua_rawgeti(L, 1, i);
    lua_rawgeti(L, 1, l);
    if (sort_comp(L, -2, -1))  /* a[i]<a[l]? */
      set2(L, i, l);
    else {
      lua_pop(L, 1);  /* remove a[l] */
      lua_rawgeti(L, 1, u);
      if (sort_comp(L, -1, -2))  /* a[u]<a[i]? */
        set2(L, i, u);
      else
        lua_pop(L, 2);
    }
    if (u-l == 2) break;  /* only 3 elements */
    lua_rawgeti(L, 1, i);  /* Pivot */
    lua_pushvalue(L, -1);
    lua_rawgeti(L, 1, u-1);
    set2(L, i, u-1);
    /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */
    i = l; j = u-1;
    for (;;) {  /* invariant: a[l..i] <= P <= a[j..u] */
      /* repeat ++i until a[i] >= P */
      while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
        if (i>=u) luaL_error(L, "invalid order function for sorting");
        lua_pop(L, 1);  /* remove a[i] */
      }
      /* repeat --j until a[j] <= P */
      while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
        if (j<=l) luaL_error(L, "invalid order function for sorting");
        lua_pop(L, 1);  /* remove a[j] */
      }
      if (j<i) {
        lua_pop(L, 3);  /* pop pivot, a[i], a[j] */
        break;
      }
      set2(L, i, j);
    }
    lua_rawgeti(L, 1, u-1);
    lua_rawgeti(L, 1, i);
    set2(L, u-1, i);  /* swap pivot (a[u-1]) with a[i] */
    /* a[l..i-1] <= a[i] == P <= a[i+1..u] */
    /* adjust so that smaller half is in [j..i] and larger one in [l..u] */
    if (i-l < u-i) {
      j=l; i=i-1; l=i+2;
    }
    else {
      j=i+1; i=u; u=j-2;
    }
    auxsort(L, j, i);  /* call recursively the smaller one */
  }  /* repeat the routine for the larger one */
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movl %edx, 0x8(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x26331
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq 0x26340
cmpl $0x0, %eax
je 0x26042
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0x26410
jmp 0x26051
movq 0x10(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x8e50
movl 0x8(%rsp), %eax
subl 0xc(%rsp), %eax
cmpl $0x1, %eax
jne 0x26063
jmp 0x26331
movl 0xc(%rsp), %eax
addl 0x8(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x4(%rsp)
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x26340
cmpl $0x0, %eax
je 0x260ca
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
movl 0xc(%rsp), %edx
callq 0x26410
jmp 0x2612a
movq 0x10(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x8e50
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq 0x26340
cmpl $0x0, %eax
je 0x26119
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0x26410
jmp 0x26128
movq 0x10(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x8e50
jmp 0x2612a
movl 0x8(%rsp), %eax
subl 0xc(%rsp), %eax
cmpl $0x2, %eax
jne 0x2613c
jmp 0x26331
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x92e0
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %edx
subl $0x1, %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
movl 0x8(%rsp), %edx
subl $0x1, %edx
callq 0x26410
movl 0xc(%rsp), %eax
movl %eax, 0x4(%rsp)
movl 0x8(%rsp), %eax
subl $0x1, %eax
movl %eax, (%rsp)
jmp 0x2619d
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %edx
addl $0x1, %edx
movl %edx, 0x4(%rsp)
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq 0x26340
cmpl $0x0, %eax
je 0x261fe
movl 0x4(%rsp), %eax
cmpl 0x8(%rsp), %eax
jl 0x261ed
movq 0x10(%rsp), %rdi
leaq 0x10d2e(%rip), %rsi     # 0x36f14
movb $0x0, %al
callq 0xc520
movq 0x10(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x8e50
jmp 0x2619d
jmp 0x26200
movq 0x10(%rsp), %rdi
movl (%rsp), %edx
addl $-0x1, %edx
movl %edx, (%rsp)
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x26340
cmpl $0x0, %eax
je 0x2625e
movl (%rsp), %eax
cmpl 0xc(%rsp), %eax
jg 0x2624d
movq 0x10(%rsp), %rdi
leaq 0x10cce(%rip), %rsi     # 0x36f14
movb $0x0, %al
callq 0xc520
movq 0x10(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x8e50
jmp 0x26200
movl (%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x26278
movq 0x10(%rsp), %rdi
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x8e50
jmp 0x2628e
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
movl (%rsp), %edx
callq 0x26410
jmp 0x2619b
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %edx
subl $0x1, %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %edx
movl $0x1, %esi
callq 0xa660
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %esi
subl $0x1, %esi
movl 0x4(%rsp), %edx
callq 0x26410
movl 0x4(%rsp), %eax
subl 0xc(%rsp), %eax
movl 0x8(%rsp), %ecx
subl 0x4(%rsp), %ecx
cmpl %ecx, %eax
jge 0x262ff
movl 0xc(%rsp), %eax
movl %eax, (%rsp)
movl 0x4(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
addl $0x2, %eax
movl %eax, 0xc(%rsp)
jmp 0x2631b
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%rsp)
movl (%rsp), %eax
subl $0x2, %eax
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movl (%rsp), %esi
movl 0x4(%rsp), %edx
callq 0x25fd0
jmp 0x25fe1
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)