#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ quicksort_double_(double *, int *);
void get_binned_data_double_(double x[], int *n, int *nbins, int *bins_used,
                             double center[], double density[]) {
  double *buffer;
  double lower, upper, dx;
  int i, m, j, i1;
  if (*n < 2) {
    center[0] = x[0];
    *bins_used = 1;
    density[0] = 1.;
    return;
  }
  buffer = (double *)malloc((*n) * sizeof(double));
  for (i = 0; i < *n; i++)
    buffer[i] = x[i];
  quicksort_double_(buffer, n);
  m = (*n - 1) / (*nbins) + 1;
  lower = buffer[0] - 1.e-30;
  upper = lower;
  dx = (buffer[*n - 1] - buffer[0]) / (*nbins) / 2.;
  i = 0;
  j = -1;
  i1 = i;
  while (i < *n) {
    j++;
    center[j] = 0;
    while (upper < lower + dx || i1 - i < m) {
      center[j] = center[j] + buffer[i1];
      if (i1 == (*n) - 1) {
        upper = buffer[i1] + 1.e-30;
        i1++;
        break;
      } else {
        upper = (buffer[i1] + buffer[i1 + 1]) / 2.;
        i1++;
      }
    }
    center[j] = center[j] / (i1 - i);
    density[j] = (i1 - i) / (upper - lower);
    lower = upper;
    i = i1;
  }
  free(buffer);
  *bins_used = j + 1;
  if (density[0] > density[1])
    density[0] = density[1];
  if (density[j] > density[j - 1])
    density[j] = density[j - 1];
}


x86 assembly (clang, -O0):
<get_binned_data_double_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
jge    118c <get_binned_data_double_+0x5c>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xe8d(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    145d <get_binned_data_double_+0x32d>
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11e0 <get_binned_data_double_+0xb0>
mov    -0x8(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11a9 <get_binned_data_double_+0x79>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <quicksort_double_@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    -0x18(%rbp),%rcx
cltd
idivl  (%rcx)
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdf5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  0xda9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0xffffffff,-0x5c(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    13dc <get_binned_data_double_+0x2ac>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x61(%rbp)
ja     12c9 <get_binned_data_double_+0x199>
mov    -0x60(%rbp),%eax
sub    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
setl   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    12d9 <get_binned_data_double_+0x1a9>
jmp    137a <get_binned_data_double_+0x24a>
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x60(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    133c <get_binned_data_double_+0x20c>
mov    -0x38(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  0xce4(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    137a <get_binned_data_double_+0x24a>
mov    -0x38(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xc9d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    129c <get_binned_data_double_+0x16c>
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%eax
sub    -0x54(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
sub    -0x54(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0x54(%rbp)
jmp    1274 <get_binned_data_double_+0x144>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    1419 <get_binned_data_double_+0x2e9>
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    145d <get_binned_data_double_+0x32d>
mov    -0x30(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_binned_data_double_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8,%r13
mov    %rdi,%r14
mov    (%rsi),%edi
cmp    $0x1,%edi
jg     116e <get_binned_data_double_+0x3e>
movsd  (%r14),%xmm0
movsd  %xmm0,0x0(%r13)
movl   $0x1,(%rcx)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r15)
jmp    14b4 <get_binned_data_double_+0x384>
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rcx,(%rsp)
shl    $0x3,%edi
call   1040 <malloc@plt>
mov    %rax,%r12
mov    0x0(%rbp),%eax
test   %eax,%eax
jle    131b <get_binned_data_double_+0x1eb>
cmp    $0x4,%eax
jb     11ad <get_binned_data_double_+0x7d>
lea    (%r14,%rax,8),%rcx
cmp    %rcx,%r12
jae    1234 <get_binned_data_double_+0x104>
lea    (%r12,%rax,8),%rcx
cmp    %r14,%rcx
jbe    1234 <get_binned_data_double_+0x104>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %rax,%rdx
mov    %rax,%rsi
and    $0x3,%rsi
je     11e6 <get_binned_data_double_+0xb6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    11d0 <get_binned_data_double_+0xa0>
cmp    $0x3,%rdx
jb     131b <get_binned_data_double_+0x1eb>
movsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r12,%rcx,8)
movsd  0x10(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x10(%r12,%rcx,8)
movsd  0x18(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x18(%r12,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    11f0 <get_binned_data_double_+0xc0>
jmp    131b <get_binned_data_double_+0x1eb>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
mov    %rbx,%r8
cmp    $0xc,%rdi
jae    125a <get_binned_data_double_+0x12a>
xor    %edi,%edi
jmp    12cc <get_binned_data_double_+0x19c>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
movups (%r14,%rdi,8),%xmm0
movups 0x10(%r14,%rdi,8),%xmm1
movups %xmm0,(%r12,%rdi,8)
movups %xmm1,0x10(%r12,%rdi,8)
movups 0x20(%r14,%rdi,8),%xmm0
movups 0x30(%r14,%rdi,8),%xmm1
movups %xmm0,0x20(%r12,%rdi,8)
movups %xmm1,0x30(%r12,%rdi,8)
movups 0x40(%r14,%rdi,8),%xmm0
movups 0x50(%r14,%rdi,8),%xmm1
movups %xmm0,0x40(%r12,%rdi,8)
movups %xmm1,0x50(%r12,%rdi,8)
movupd 0x60(%r14,%rdi,8),%xmm0
movupd 0x70(%r14,%rdi,8),%xmm1
movupd %xmm0,0x60(%r12,%rdi,8)
movupd %xmm1,0x70(%r12,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1260 <get_binned_data_double_+0x130>
test   %rdx,%rdx
je     130f <get_binned_data_double_+0x1df>
lea    (%r12,%rdi,8),%rsi
add    $0x10,%rsi
lea    (%r14,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rdx
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movupd -0x10(%rdi,%rbx,1),%xmm0
movupd (%rdi,%rbx,1),%xmm1
movupd %xmm0,-0x10(%rsi,%rbx,1)
movupd %xmm1,(%rsi,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%rdx
jne    12f0 <get_binned_data_double_+0x1c0>
cmp    %rax,%rcx
mov    %r8,%rbx
jne    11af <get_binned_data_double_+0x7f>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <quicksort_double_@plt>
movslq 0x0(%rbp),%r9
lea    -0x1(%r9),%r8
mov    (%rbx),%ecx
mov    %r8d,%eax
cltd
idiv   %ecx
test   %r9,%r9
jle    146c <get_binned_data_double_+0x33c>
movsd  (%r12),%xmm1
movsd  -0x8(%r12,%r9,8),%xmm0
cvtsi2sd %ecx,%xmm2
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mulsd  0xca0(%rip),%xmm0
addsd  0xca0(%rip),%xmm1
movslq %eax,%r10
add    $0x1,%r8
xor    %edi,%edi
mov    $0xffffffffffffffff,%rbp
movsd  0xc90(%rip),%xmm2
movsd  0xc78(%rip),%xmm3
jmp    13ce <get_binned_data_double_+0x29e>
nopw   0x0(%rax,%rax,1)
addsd  %xmm2,%xmm5
mov    %r9d,%ecx
mov    %ecx,%edx
sub    %edi,%edx
xorps  %xmm6,%xmm6
cvtsi2sd %edx,%xmm6
divsd  %xmm6,%xmm4
movsd  %xmm4,0x0(%r13,%rbp,8)
movapd %xmm5,%xmm4
subsd  %xmm1,%xmm4
divsd  %xmm4,%xmm6
movsd  %xmm6,(%r15,%rbp,8)
mov    %ecx,%edi
movapd %xmm5,%xmm1
cmp    %r9d,%ecx
jge    1471 <get_binned_data_double_+0x341>
movq   $0x0,0x8(%r13,%rbp,8)
add    $0x1,%rbp
movapd %xmm0,%xmm6
addsd  %xmm1,%xmm6
ucomisd %xmm1,%xmm6
ja     13f7 <get_binned_data_double_+0x2c7>
xorpd  %xmm4,%xmm4
movapd %xmm1,%xmm5
mov    %edi,%ecx
test   %eax,%eax
js     1397 <get_binned_data_double_+0x267>
movslq %edi,%rdx
lea    (%r12,%rdx,8),%rcx
movsd  (%r12,%rdx,8),%xmm7
mov    %r8,%rsi
sub    %rdx,%rsi
xorpd  %xmm4,%xmm4
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm4,%xmm5
movapd %xmm7,%xmm4
addsd  %xmm5,%xmm4
movsd  %xmm4,0x0(%r13,%rbp,8)
movsd  -0x8(%rcx,%rdx,8),%xmm5
cmp    %rdx,%rsi
je     1390 <get_binned_data_double_+0x260>
mov    %rdx,%rbx
movsd  (%rcx,%rdx,8),%xmm7
addsd  %xmm7,%xmm5
mulsd  %xmm3,%xmm5
add    $0x1,%rdx
ucomisd %xmm5,%xmm6
ja     1420 <get_binned_data_double_+0x2f0>
cmp    %r10,%rbx
jle    1420 <get_binned_data_double_+0x2f0>
lea    (%rdi,%rdx,1),%ecx
add    $0xffffffff,%ecx
jmp    1397 <get_binned_data_double_+0x267>
mov    $0xffffffff,%ebp
mov    %r12,%rdi
call   1030 <free@plt>
lea    0x1(%rbp),%eax
mov    (%rsp),%rcx
mov    %eax,(%rcx)
movsd  (%r15),%xmm1
movsd  0x8(%r15),%xmm0
ucomisd %xmm0,%xmm1
jbe    1498 <get_binned_data_double_+0x368>
movsd  %xmm0,(%r15)
movslq %ebp,%rax
movsd  -0x8(%r15,%rax,8),%xmm0
movsd  (%r15,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    14b4 <get_binned_data_double_+0x384>
movsd  %xmm0,(%r15,%rax,8)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_binned_data_double_(double* %0, i32* %1, i32* %2, i32* %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store double* %0, double** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store double* %4, double** %11
store double* %5, double** %12
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
%23 = icmp slt i32 %22, 2
br i1 %23, label %24, label %33
24: ; preds = %6
%25 = load double*, double** %7
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = load double*, double** %11
%29 = getelementptr inbounds double, double* %28, i64 0
store double %27, double* %29
%30 = load i32*, i32** %10
store i32 1, i32* %30
%31 = load double*, double** %12
%32 = getelementptr inbounds double, double* %31, i64 0
store double 1.000000e+00, double* %32
br label %237
33: ; preds = %6
%34 = load i32*, i32** %8
%35 = load i32, i32* %34
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 8
%38 = trunc i64 %37 to i32
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double*
store double* %40, double** %13
store i32 0, i32* %17
br label %41
41: ; preds = %56, %33
%42 = load i32, i32* %17
%43 = load i32*, i32** %8
%44 = load i32, i32* %43
%45 = icmp slt i32 %42, %44
br i1 %45, label %46, label %59
46: ; preds = %41
%47 = load double*, double** %7
%48 = load i32, i32* %17
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %13
%53 = load i32, i32* %17
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
store double %51, double* %55
br label %56
56: ; preds = %46
%57 = load i32, i32* %17
%58 = add nsw i32 %57, 1
store i32 %58, i32* %17
br label %41
59: ; preds = %41
%60 = load double*, double** %13
%61 = load i32*, i32** %8
%62 = call i32 @quicksort_double_(double* %60, i32* %61)
%63 = load i32*, i32** %8
%64 = load i32, i32* %63
%65 = sub nsw i32 %64, 1
%66 = load i32*, i32** %9
%67 = load i32, i32* %66
%68 = sdiv i32 %65, %67
%69 = add nsw i32 %68, 1
store i32 %69, i32* %18
%70 = load double*, double** %13
%71 = getelementptr inbounds double, double* %70, i64 0
%72 = load double, double* %71
%73 = fsub double %72, 1.000000e-30
store double %73, double* %14
%74 = load double, double* %14
store double %74, double* %15
%75 = load double*, double** %13
%76 = load i32*, i32** %8
%77 = load i32, i32* %76
%78 = sub nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %75, i64 %79
%81 = load double, double* %80
%82 = load double*, double** %13
%83 = getelementptr inbounds double, double* %82, i64 0
%84 = load double, double* %83
%85 = fsub double %81, %84
%86 = load i32*, i32** %9
%87 = load i32, i32* %86
%88 = sitofp i32 %87 to double
%89 = fdiv double %85, %88
%90 = fdiv double %89, 2.000000e+00
store double %90, double* %16
store i32 0, i32* %17
store i32 -1, i32* %19
%91 = load i32, i32* %17
store i32 %91, i32* %20
br label %92
92: ; preds = %165, %59
%93 = load i32, i32* %17
%94 = load i32*, i32** %8
%95 = load i32, i32* %94
%96 = icmp slt i32 %93, %95
br i1 %96, label %97, label %194
97: ; preds = %92
%98 = load i32, i32* %19
%99 = add nsw i32 %98, 1
store i32 %99, i32* %19
%100 = load double*, double** %11
%101 = load i32, i32* %19
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %100, i64 %102
store double 0.000000e+00, double* %103
br label %104
104: ; preds = %164, %97
%105 = load double, double* %15
%106 = load double, double* %14
%107 = load double, double* %16
%108 = fadd double %106, %107
%109 = fcmp olt double %105, %108
br i1 %109, label %116, label %110
110: ; preds = %104
%111 = load i32, i32* %20
%112 = load i32, i32* %17
%113 = sub nsw i32 %111, %112
%114 = load i32, i32* %18
%115 = icmp slt i32 %113, %114
br label %116
116: ; preds = %110, %104
%117 = phi i1 [ true, %104 ], [ %115, %110 ]
br i1 %117, label %118, label %165
118: ; preds = %116
%119 = load double*, double** %11
%120 = load i32, i32* %19
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %119, i64 %121
%123 = load double, double* %122
%124 = load double*, double** %13
%125 = load i32, i32* %20
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %124, i64 %126
%128 = load double, double* %127
%129 = fadd double %123, %128
%130 = load double*, double** %11
%131 = load i32, i32* %19
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %130, i64 %132
store double %129, double* %133
%134 = load i32, i32* %20
%135 = load i32*, i32** %8
%136 = load i32, i32* %135
%137 = sub nsw i32 %136, 1
%138 = icmp eq i32 %134, %137
br i1 %138, label %139, label %148
139: ; preds = %118
%140 = load double*, double** %13
%141 = load i32, i32* %20
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
%144 = load double, double* %143
%145 = fadd double %144, 1.000000e-30
store double %145, double* %15
%146 = load i32, i32* %20
%147 = add nsw i32 %146, 1
store i32 %147, i32* %20
br label %165
148: ; preds = %118
%149 = load double*, double** %13
%150 = load i32, i32* %20
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %149, i64 %151
%153 = load double, double* %152
%154 = load double*, double** %13
%155 = load i32, i32* %20
%156 = add nsw i32 %155, 1
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds double, double* %154, i64 %157
%159 = load double, double* %158
%160 = fadd double %153, %159
%161 = fdiv double %160, 2.000000e+00
store double %161, double* %15
%162 = load i32, i32* %20
%163 = add nsw i32 %162, 1
store i32 %163, i32* %20
br label %164
164: ; preds = %148
br label %104
165: ; preds = %139, %116
%166 = load double*, double** %11
%167 = load i32, i32* %19
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %166, i64 %168
%170 = load double, double* %169
%171 = load i32, i32* %20
%172 = load i32, i32* %17
%173 = sub nsw i32 %171, %172
%174 = sitofp i32 %173 to double
%175 = fdiv double %170, %174
%176 = load double*, double** %11
%177 = load i32, i32* %19
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double, double* %176, i64 %178
store double %175, double* %179
%180 = load i32, i32* %20
%181 = load i32, i32* %17
%182 = sub nsw i32 %180, %181
%183 = sitofp i32 %182 to double
%184 = load double, double* %15
%185 = load double, double* %14
%186 = fsub double %184, %185
%187 = fdiv double %183, %186
%188 = load double*, double** %12
%189 = load i32, i32* %19
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds double, double* %188, i64 %190
store double %187, double* %191
%192 = load double, double* %15
store double %192, double* %14
%193 = load i32, i32* %20
store i32 %193, i32* %17
br label %92
194: ; preds = %92
%195 = load double*, double** %13
%196 = call i32 @free(double* %195)
%197 = load i32, i32* %19
%198 = add nsw i32 %197, 1
%199 = load i32*, i32** %10
store i32 %198, i32* %199
%200 = load double*, double** %12
%201 = getelementptr inbounds double, double* %200, i64 0
%202 = load double, double* %201
%203 = load double*, double** %12
%204 = getelementptr inbounds double, double* %203, i64 1
%205 = load double, double* %204
%206 = fcmp ogt double %202, %205
br i1 %206, label %207, label %213
207: ; preds = %194
%208 = load double*, double** %12
%209 = getelementptr inbounds double, double* %208, i64 1
%210 = load double, double* %209
%211 = load double*, double** %12
%212 = getelementptr inbounds double, double* %211, i64 0
store double %210, double* %212
br label %213
213: ; preds = %207, %194
%214 = load double*, double** %12
%215 = load i32, i32* %19
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %214, i64 %216
%218 = load double, double* %217
%219 = load double*, double** %12
%220 = load i32, i32* %19
%221 = sub nsw i32 %220, 1
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %219, i64 %222
%224 = load double, double* %223
%225 = fcmp ogt double %218, %224
br i1 %225, label %226, label %237
226: ; preds = %213
%227 = load double*, double** %12
%228 = load i32, i32* %19
%229 = sub nsw i32 %228, 1
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds double, double* %227, i64 %230
%232 = load double, double* %231
%233 = load double*, double** %12
%234 = load i32, i32* %19
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %233, i64 %235
store double %232, double* %236
br label %237
237: ; preds = %24, %226, %213
ret void
}

LLVM IR (-O2):
define void @get_binned_data_double_(double* nocapture %0, i32* %1, i32* nocapture %2, i32* nocapture writeonly %3, double* nocapture %4, double* nocapture %5) {
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = load double, double* %0
store double %10, double* %4
store i32 1, i32* %3
store double 1.000000e+00, double* %5
br label %230
11: ; preds = %6
%12 = shl i32 %7, 3
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to double*
%15 = inttoptr i64 %13 to i8*
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %144
18: ; preds = %11
%19 = zext i32 %16 to i64
%20 = icmp ult i32 %16, 4
br i1 %20, label %107, label %21
21: ; preds = %18
%22 = getelementptr double, double* %14, i64 %19
%23 = getelementptr double, double* %0, i64 %19
%24 = bitcast double* %23 to i8*
%25 = icmp ult i8* %15, %24
%26 = icmp ugt double* %22, %0
%27 = and i1 %25, %26
br i1 %27, label %107, label %28
28: ; preds = %21
%29 = and i64 %19, 4294967292
%30 = add nsw i64 %29, -4
%31 = lshr exact i64 %30, 2
%32 = add nuw nsw i64 %31, 1
%33 = and i64 %32, 3
%34 = icmp ult i64 %30, 12
br i1 %34, label %86, label %35
35: ; preds = %28
%36 = and i64 %32, 9223372036854775804
br label %37
37: ; preds = %37, %35
%38 = phi i64 [ 0, %35 ], [ %83, %37 ]
%39 = phi i64 [ 0, %35 ], [ %84, %37 ]
%40 = getelementptr inbounds double, double* %0, i64 %38
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr inbounds double, double* %40, i64 2
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = getelementptr inbounds double, double* %14, i64 %38
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> %42, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %45, <2 x double>* %49
%50 = or i64 %38, 4
%51 = getelementptr inbounds double, double* %0, i64 %50
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %51, i64 2
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %14, i64 %50
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %53, <2 x double>* %58
%59 = getelementptr inbounds double, double* %57, i64 2
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %56, <2 x double>* %60
%61 = or i64 %38, 8
%62 = getelementptr inbounds double, double* %0, i64 %61
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = getelementptr inbounds double, double* %62, i64 2
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = getelementptr inbounds double, double* %14, i64 %61
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %64, <2 x double>* %69
%70 = getelementptr inbounds double, double* %68, i64 2
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %67, <2 x double>* %71
%72 = or i64 %38, 12
%73 = getelementptr inbounds double, double* %0, i64 %72
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = getelementptr inbounds double, double* %73, i64 2
%77 = bitcast double* %76 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = getelementptr inbounds double, double* %14, i64 %72
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> %75, <2 x double>* %80
%81 = getelementptr inbounds double, double* %79, i64 2
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> %78, <2 x double>* %82
%83 = add nuw i64 %38, 16
%84 = add nuw i64 %39, 4
%85 = icmp eq i64 %84, %36
br i1 %85, label %86, label %37
86: ; preds = %37, %28
%87 = phi i64 [ 0, %28 ], [ %83, %37 ]
%88 = icmp eq i64 %33, 0
br i1 %88, label %105, label %89
89: ; preds = %86, %89
%90 = phi i64 [ %102, %89 ], [ %87, %86 ]
%91 = phi i64 [ %103, %89 ], [ 0, %86 ]
%92 = getelementptr inbounds double, double* %0, i64 %90
%93 = bitcast double* %92 to <2 x double>*
%94 = load <2 x double>, <2 x double>* %93
%95 = getelementptr inbounds double, double* %92, i64 2
%96 = bitcast double* %95 to <2 x double>*
%97 = load <2 x double>, <2 x double>* %96
%98 = getelementptr inbounds double, double* %14, i64 %90
%99 = bitcast double* %98 to <2 x double>*
store <2 x double> %94, <2 x double>* %99
%100 = getelementptr inbounds double, double* %98, i64 2
%101 = bitcast double* %100 to <2 x double>*
store <2 x double> %97, <2 x double>* %101
%102 = add nuw i64 %90, 4
%103 = add i64 %91, 1
%104 = icmp eq i64 %103, %33
br i1 %104, label %105, label %89
105: ; preds = %89, %86
%106 = icmp eq i64 %29, %19
br i1 %106, label %144, label %107
107: ; preds = %21, %18, %105
%108 = phi i64 [ 0, %21 ], [ 0, %18 ], [ %29, %105 ]
%109 = xor i64 %108, -1
%110 = add nsw i64 %109, %19
%111 = and i64 %19, 3
%112 = icmp eq i64 %111, 0
br i1 %112, label %122, label %113
113: ; preds = %107, %113
%114 = phi i64 [ %119, %113 ], [ %108, %107 ]
%115 = phi i64 [ %120, %113 ], [ 0, %107 ]
%116 = getelementptr inbounds double, double* %0, i64 %114
%117 = load double, double* %116
%118 = getelementptr inbounds double, double* %14, i64 %114
store double %117, double* %118
%119 = add nuw nsw i64 %114, 1
%120 = add i64 %115, 1
%121 = icmp eq i64 %120, %111
br i1 %121, label %122, label %113
122: ; preds = %113, %107
%123 = phi i64 [ %108, %107 ], [ %119, %113 ]
%124 = icmp ult i64 %110, 3
br i1 %124, label %144, label %125
125: ; preds = %122, %125
%126 = phi i64 [ %142, %125 ], [ %123, %122 ]
%127 = getelementptr inbounds double, double* %0, i64 %126
%128 = load double, double* %127
%129 = getelementptr inbounds double, double* %14, i64 %126
store double %128, double* %129
%130 = add nuw nsw i64 %126, 1
%131 = getelementptr inbounds double, double* %0, i64 %130
%132 = load double, double* %131
%133 = getelementptr inbounds double, double* %14, i64 %130
store double %132, double* %133
%134 = add nuw nsw i64 %126, 2
%135 = getelementptr inbounds double, double* %0, i64 %134
%136 = load double, double* %135
%137 = getelementptr inbounds double, double* %14, i64 %134
store double %136, double* %137
%138 = add nuw nsw i64 %126, 3
%139 = getelementptr inbounds double, double* %0, i64 %138
%140 = load double, double* %139
%141 = getelementptr inbounds double, double* %14, i64 %138
store double %140, double* %141
%142 = add nuw nsw i64 %126, 4
%143 = icmp eq i64 %142, %19
br i1 %143, label %144, label %125
144: ; preds = %122, %125, %105, %11
%145 = tail call i32 @quicksort_double_(double* %14, i32* %1)
%146 = load i32, i32* %1
%147 = add nsw i32 %146, -1
%148 = load i32, i32* %2
%149 = sdiv i32 %147, %148
%150 = load double, double* %14
%151 = sext i32 %147 to i64
%152 = getelementptr inbounds double, double* %14, i64 %151
%153 = load double, double* %152
%154 = fsub double %153, %150
%155 = sitofp i32 %148 to double
%156 = fdiv double %154, %155
%157 = fmul double %156, 5.000000e-01
%158 = icmp sgt i32 %146, 0
br i1 %158, label %159, label %211
159: ; preds = %144
%160 = fadd double %150, -1.000000e-30
%161 = icmp slt i32 %149, 0
%162 = sext i32 %149 to i64
br label %163
163: ; preds = %159, %198
%164 = phi i64 [ -1, %159 ], [ %167, %198 ]
%165 = phi i32 [ 0, %159 ], [ %201, %198 ]
%166 = phi double [ %160, %159 ], [ %200, %198 ]
%167 = add nsw i64 %164, 1
%168 = getelementptr inbounds double, double* %4, i64 %167
store double 0.000000e+00, double* %168
%169 = fadd double %157, %166
%170 = fcmp uge double %166, %169
%171 = select i1 %170, i1 %161, i1 false
br i1 %171, label %198, label %172
172: ; preds = %163
%173 = sext i32 %165 to i64
%174 = getelementptr inbounds double, double* %14, i64 %173
%175 = load double, double* %174
br label %176
176: ; preds = %172, %186
%177 = phi double [ %175, %172 ], [ %189, %186 ]
%178 = phi double [ 0.000000e+00, %172 ], [ %181, %186 ]
%179 = phi i64 [ %173, %172 ], [ %187, %186 ]
%180 = getelementptr inbounds double, double* %14, i64 %179
%181 = fadd double %178, %177
store double %181, double* %168
%182 = icmp eq i64 %179, %151
%183 = load double, double* %180
br i1 %182, label %184, label %186
184: ; preds = %176
%185 = fadd double %183, 1.000000e-30
br label %198
186: ; preds = %176
%187 = add nsw i64 %179, 1
%188 = getelementptr inbounds double, double* %14, i64 %187
%189 = load double, double* %188
%190 = fadd double %183, %189
%191 = fmul double %190, 5.000000e-01
%192 = fcmp uge double %191, %169
%193 = sub nsw i64 %187, %173
%194 = icmp sgt i64 %193, %162
%195 = select i1 %192, i1 %194, i1 false
br i1 %195, label %196, label %176
196: ; preds = %186
%197 = trunc i64 %187 to i32
br label %198
198: ; preds = %196, %163, %184
%199 = phi double [ %181, %184 ], [ 0.000000e+00, %163 ], [ %181, %196 ]
%200 = phi double [ %185, %184 ], [ %166, %163 ], [ %191, %196 ]
%201 = phi i32 [ %146, %184 ], [ %165, %163 ], [ %197, %196 ]
%202 = sub nsw i32 %201, %165
%203 = sitofp i32 %202 to double
%204 = fdiv double %199, %203
store double %204, double* %168
%205 = fsub double %200, %166
%206 = fdiv double %203, %205
%207 = getelementptr inbounds double, double* %5, i64 %167
store double %206, double* %207
%208 = icmp slt i32 %201, %146
br i1 %208, label %163, label %209
209: ; preds = %198
%210 = trunc i64 %167 to i32
br label %211
211: ; preds = %209, %144
%212 = phi i32 [ -1, %144 ], [ %210, %209 ]
%213 = tail call i32 @free(double* %14)
%214 = add nsw i32 %212, 1
store i32 %214, i32* %3
%215 = load double, double* %5
%216 = getelementptr inbounds double, double* %5, i64 1
%217 = load double, double* %216
%218 = fcmp ogt double %215, %217
br i1 %218, label %219, label %220
219: ; preds = %211
store double %217, double* %5
br label %220
220: ; preds = %219, %211
%221 = sext i32 %212 to i64
%222 = getelementptr inbounds double, double* %5, i64 %221
%223 = load double, double* %222
%224 = add nsw i32 %212, -1
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds double, double* %5, i64 %225
%227 = load double, double* %226
%228 = fcmp ogt double %223, %227
br i1 %228, label %229, label %230
229: ; preds = %220
store double %227, double* %222
br label %230
230: ; preds = %220, %229, %9
ret void
}