// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: qsort_double_sample
void
qsort_double_sample(const double * const array0, const u64 nr, const u64 res, FILE * const out)
{
  const u64 datasize = nr * sizeof(double);
  double * const array = (typeof(array))malloc(datasize);
  debug_assert(array);
  memcpy(array, array0, datasize);
  qsort_double(array, nr);

  const u64 srate = res ? res : 64;
  const double srate_d = (double)srate;
  const u64 sized = (double)nr;
  const u64 xstep = ({u64 step = nr / srate; step ? step : 1; });
  const double ystep = ({ double step = fabs((array[nr - 1] - array[0]) / srate_d); step ? step : 1.0; });
  u64 i = 0;
  fprintf(out, "%lu %06.2lf %020.9lf\n", i, ((double)(i + 1lu)) * 100.0 / sized, array[i]);
  for (u64 j = 1; j < nr; j++) {
    if (((j - i) >= xstep) || (array[j] - array[i]) >= ystep) {
      i = j;
      fprintf(out, "%lu %06.2lf %020.9lf\n", i, ((double)(i + 1lu)) * 100.0 / sized, array[i]);
    }
  }
  if (i != (nr - 1)) {
    i = nr - 1;
    fprintf(out, "%lu %06.2lf %020.9lf\n", i, ((double)(i + 1lu)) * 100.0 / sized, array[i]);
  }
  free(array);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, -0x38(%rbp)
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
leaq (,%rsi,8), %r13
movq %r13, %rdi
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
jne 0x848d
callq 0x6e43
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6340
movq %rbx, %rdi
movq %r15, %rsi
callq 0x829f
testq %r12, %r12
pushq $0x40
popq %rcx
cmovneq %r12, %rcx
vcvtusi2sd %rcx, %xmm0, %xmm0
vcvtusi2sd %r15, %xmm1, %xmm1
vmovsd %xmm1, -0x40(%rbp)
vcvttsd2usi %xmm1, %rsi
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r13
xorl %r14d, %r14d
cmpq %r15, %rcx
pushq $0x1
popq %r12
cmovaq %r12, %r13
leaq -0x1(%r15), %rax
movq %rax, -0x48(%rbp)
vmovsd -0x8(%rbx,%r15,8), %xmm2
vmovsd (%rbx), %xmm1
vsubsd %xmm1, %xmm2, %xmm2
vdivsd %xmm0, %xmm2, %xmm0
vandpd 0x9b6b(%rip){1to2}, %xmm0, %xmm2 # 0x12070
vxorpd %xmm3, %xmm3, %xmm3
vcmpneqsd %xmm3, %xmm0, %k1
vmovsd 0x9b60(%rip), %xmm0     # 0x12078
vmovsd %xmm2, %xmm0, %xmm0 {%k1}
vmovapd %xmm0, -0x60(%rbp)
vcvtusi2sd %rsi, %xmm4, %xmm0
vmovsd 0x9b37(%rip), %xmm2     # 0x12068
vmovsd %xmm0, -0x30(%rbp)
vdivsd %xmm0, %xmm2, %xmm0
leaq 0x9d2e(%rip), %rsi      # 0x1226f
movq -0x38(%rbp), %rdi
xorl %edx, %edx
movb $0x2, %al
callq 0x6300
movq %r14, %rax
negq %rax
movq -0x38(%rbp), %rdi
vmovapd -0x60(%rbp), %xmm2
cmpq %r15, %r12
jae 0x85b8
leaq (%rax,%r12), %rcx
vmovsd (%rbx,%r12,8), %xmm1
cmpq %r13, %rcx
jae 0x8582
vsubsd (%rbx,%r14,8), %xmm1, %xmm0
vucomisd %xmm2, %xmm0
jae 0x8582
incq %r12
jmp 0x855d
leaq 0x1(%r12), %rax
movq %rax, -0x50(%rbp)
vcvtusi2sd %rax, %xmm4, %xmm0
vmulsd 0x9acf(%rip), %xmm0, %xmm0 # 0x12068
vdivsd -0x30(%rbp), %xmm0, %xmm0
leaq 0x9cca(%rip), %rsi      # 0x1226f
movq %r12, %rdx
movb $0x2, %al
callq 0x6300
movq %r12, %r14
movq -0x50(%rbp), %r12
jmp 0x854e
movq -0x48(%rbp), %rdx
cmpq %rdx, %r14
je 0x85e8
vmovsd -0x40(%rbp), %xmm0
vmulsd 0x9a9a(%rip), %xmm0, %xmm0 # 0x12068
vdivsd -0x30(%rbp), %xmm0, %xmm0
vmovsd -0x8(%rbx,%r15,8), %xmm1
leaq 0x9c8e(%rip), %rsi      # 0x1226f
movb $0x2, %al
callq 0x6300
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6060