// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rcx, -0x30(%rbp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
leaq (,%rsi,8), %r12
movq %r12, %rdi
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
je 0x8f7a
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x6340
leaq -0x1f8(%rip), %rcx      # 0x8bfe
movl $0x8, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x60d0
testq %r14, %r14
movl $0x40, %ecx
cmovneq %r14, %rcx
vcvtusi2sd %r15, %xmm0, %xmm0
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r13
vmovsd %xmm0, -0x68(%rbp)
vcvttsd2usi %xmm0, %rax
xorl %r14d, %r14d
movq %rcx, -0x50(%rbp)
cmpq %r15, %rcx
movl $0x1, %r12d
cmovaq %r12, %r13
vmovsd -0x8(%rbx,%r15,8), %xmm0
vmovsd %xmm0, -0x60(%rbp)
vmovsd (%rbx), %xmm1
leaq -0x1(%r15), %rcx
movq %rcx, -0x70(%rbp)
vcvtusi2sd %rax, %xmm2, %xmm0
vmovsd 0xc200(%rip), %xmm2     # 0x15068
vmovsd %xmm0, -0x38(%rbp)
vdivsd %xmm0, %xmm2, %xmm0
leaq 0xc3e7(%rip), %rsi      # 0x1525f
movq -0x30(%rbp), %rdi
xorl %edx, %edx
vmovsd %xmm1, -0x58(%rbp)
movb $0x2, %al
callq 0x6300
cmpq $0x2, %r15
jb 0x8f30
vcvtusi2sdq -0x50(%rbp), %xmm3, %xmm0
vmovsd -0x60(%rbp), %xmm1
vsubsd -0x58(%rbp), %xmm1, %xmm1
vdivsd %xmm0, %xmm1, %xmm0
vandpd 0xc1bd(%rip){1to2}, %xmm0, %xmm1 # 0x15070
vxorpd %xmm2, %xmm2, %xmm2
vcmpneqsd %xmm2, %xmm0, %k1
vmovsd 0xc1b2(%rip), %xmm0     # 0x15078
vmovsd %xmm1, %xmm0, %xmm0 {%k1}
vmovapd %xmm0, -0x50(%rbp)
xorl %r14d, %r14d
movq %r12, %rax
subq %r14, %rax
cmpq %r13, %rax
jae 0x8ef2
vmovsd (%rbx,%r12,8), %xmm0
vsubsd (%rbx,%r14,8), %xmm0, %xmm0
vucomisd -0x50(%rbp), %xmm0
jb 0x8f28
leaq 0x1(%r12), %rax
vcvtusi2sd %rax, %xmm3, %xmm0
vmulsd 0xc163(%rip), %xmm0, %xmm0 # 0x15068
vdivsd -0x38(%rbp), %xmm0, %xmm0
vmovsd (%rbx,%r12,8), %xmm1
movq -0x30(%rbp), %rdi
leaq 0xc344(%rip), %rsi      # 0x1525f
movq %r12, %rdx
movb $0x2, %al
callq 0x6300
movq %r12, %r14
incq %r12
cmpq %r12, %r15
jne 0x8ed4
movq -0x70(%rbp), %rdx
cmpq %rdx, %r14
je 0x8f64
vmovsd -0x68(%rbp), %xmm0
vmulsd 0xc122(%rip), %xmm0, %xmm0 # 0x15068
vdivsd -0x38(%rbp), %xmm0, %xmm0
vmovsd -0x8(%rbx,%r15,8), %xmm1
leaq 0xc306(%rip), %rsi      # 0x1525f
movq -0x30(%rbp), %rdi
movb $0x2, %al
callq 0x6300
movq %rbx, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6060
callq 0x66ef
jmp 0x8de1