// File: /workspace/github_c_makefile_star2_O0/millimat[P]Soft-Heap/sorts.c
// Function: mergesort
static void mergesort(int *A, int *aux1, int *aux2, int l, int r) {
  if(l >= r) return;
  
  // Recursively sort two halves
  int q = (l+r)/2;
  mergesort(A, aux1, aux2, l, q);
  mergesort(A, aux1, aux2, q+1, r);
  
  // Copy the two sorted halves into aux arrays
  int nlo = q - l + 1, nhi = r - q;
  memcpy(aux1, A + l, nlo * sizeof(int));
  memcpy(aux2, A + q + 1, nhi * sizeof(int));

  // Merge the arrays by filling A[l..r] with the lower current elem
  // of the smallest two unconsidered elements in aux1 and aux2
  int i = 0, j = 0, pos = l;
  while(i < nlo && j < nhi) {
    if(aux1[i] <= aux2[j]) A[pos++] = aux1[i++];
    else A[pos++] = aux2[j++];
  }
  
  // fill the remainder of A[l..r] with whichever subarray isn't done
  while(i < nlo) A[pos++] = aux1[i++];
  while(j < nhi) A[pos++] = aux2[j++];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x1a08
jmp 0x1bba
movl -0x1c(%rbp), %eax
addl -0x20(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0x24(%rbp), %r8d
callq 0x19e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl -0x20(%rbp), %r8d
callq 0x19e0
movl -0x24(%rbp), %eax
subl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
movslq -0x28(%rbp), %rdx
shlq $0x2, %rdx
callq 0x10b0
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
addq $0x4, %rsi
movslq -0x2c(%rbp), %rdx
shlq $0x2, %rdx
callq 0x10b0
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl -0x28(%rbp), %ecx
movb %al, -0x39(%rbp)
jge 0x1ad2
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x1adb
jmp 0x1b4e
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jg 0x1b1f
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1b49
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1ab9
jmp 0x1b50
movl -0x30(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x1b84
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1b50
jmp 0x1b86
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x1bba
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1b86
addq $0x40, %rsp
popq %rbp
retq