#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 array_get_threshold_double_(double *x, int *n, double *perc,
                                 double *threshold) {
  double *buffer;
  double r;
  int i;
  buffer = (double *)malloc((*n) * sizeof(double));
  for (i = 0; i < *n; i++)
    buffer[i] = x[i];
  quicksort_double_(buffer, n);
  i = (int)((1. - (*perc)) * (*n) + 0.5);
  if (i >= *n)
    i = *n - 1;
  if (i < 0)
    i = 0;
  if (buffer[i + 1] > buffer[i]) {
    r = (*perc) + (1. * i) / (*n);
    *threshold = buffer[i - 1] + (buffer[i] - buffer[i - 1]) * (1. - r);
  } else
    *threshold = buffer[i - 1];
  free(buffer);
}


x86 assembly (clang, -O0):
<array_get_threshold_double_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    119c <array_get_threshold_double_+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1165 <array_get_threshold_double_+0x35>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <quicksort_double_@plt>
mov    -0x18(%rbp),%rax
movsd  0xe53(%rip),%xmm0
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe33(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jl     11f3 <array_get_threshold_double_+0xc3>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1204 <array_get_threshold_double_+0xd4>
movl   $0x0,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    12aa <array_get_threshold_double_+0x17a>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm2
movsd  0xdca(%rip),%xmm1
mulsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0xd78(%rip),%xmm2
subsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    12c4 <array_get_threshold_double_+0x194>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_get_threshold_double_>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
mov    (%rsi),%edi
shl    $0x3,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    (%r15),%eax
test   %eax,%eax
jle    12d4 <array_get_threshold_double_+0x1a4>
cmp    $0x4,%eax
jb     1183 <array_get_threshold_double_+0x53>
lea    (%rbx,%rax,8),%rcx
cmp    %rcx,%r13
jae    1201 <array_get_threshold_double_+0xd1>
lea    0x0(,%rax,8),%rcx
add    %r13,%rcx
cmp    %rbx,%rcx
jbe    1201 <array_get_threshold_double_+0xd1>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %rax,%rdx
mov    %rax,%rsi
and    $0x3,%rsi
je     11b6 <array_get_threshold_double_+0x86>
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x0(%r13,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    11a0 <array_get_threshold_double_+0x70>
cmp    $0x3,%rdx
jb     12d4 <array_get_threshold_double_+0x1a4>
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x0(%r13,%rcx,8)
movsd  0x8(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r13,%rcx,8)
movsd  0x10(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x10(%r13,%rcx,8)
movsd  0x18(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x18(%r13,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    11c0 <array_get_threshold_double_+0x90>
jmp    12d4 <array_get_threshold_double_+0x1a4>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0xc,%rdx
jae    1226 <array_get_threshold_double_+0xf6>
xor    %edi,%edi
jmp    1291 <array_get_threshold_double_+0x161>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
movups (%rbx,%rdi,8),%xmm0
movups 0x10(%rbx,%rdi,8),%xmm1
movups %xmm0,0x0(%r13,%rdi,8)
movups %xmm1,0x10(%r13,%rdi,8)
movups 0x20(%rbx,%rdi,8),%xmm0
movups 0x30(%rbx,%rdi,8),%xmm1
movups %xmm0,0x20(%r13,%rdi,8)
movups %xmm1,0x30(%r13,%rdi,8)
movups 0x40(%rbx,%rdi,8),%xmm0
movups 0x50(%rbx,%rdi,8),%xmm1
movups %xmm0,0x40(%r13,%rdi,8)
movups %xmm1,0x50(%r13,%rdi,8)
movups 0x60(%rbx,%rdi,8),%xmm0
movups 0x70(%rbx,%rdi,8),%xmm1
movups %xmm0,0x60(%r13,%rdi,8)
movups %xmm1,0x70(%r13,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1230 <array_get_threshold_double_+0x100>
test   %r8,%r8
je     12cb <array_get_threshold_double_+0x19b>
lea    0x10(,%rdi,8),%rsi
add    %r13,%rsi
lea    (%rbx,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%r8
xor    %edx,%edx
nop
movups -0x10(%rdi,%rdx,1),%xmm0
movups (%rdi,%rdx,1),%xmm1
movups %xmm0,-0x10(%rsi,%rdx,1)
movups %xmm1,(%rsi,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%r8
jne    12b0 <array_get_threshold_double_+0x180>
cmp    %rax,%rcx
jne    1185 <array_get_threshold_double_+0x55>
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <quicksort_double_@plt>
movsd  (%r12),%xmm1
movsd  0xd13(%rip),%xmm0
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
mov    (%r15),%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm3
addsd  0xd00(%rip),%xmm3
cvttsd2si %xmm3,%ecx
lea    -0x1(%rax),%edx
cmp    %ecx,%eax
cmovg  %ecx,%edx
xor    %eax,%eax
test   %edx,%edx
cmovns %edx,%eax
movsd  0x0(%r13,%rax,8),%xmm3
movsd  0x8(%r13,%rax,8),%xmm4
ucomisd %xmm3,%xmm4
jbe    1359 <array_get_threshold_double_+0x229>
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
divsd  %xmm2,%xmm4
addsd  %xmm4,%xmm1
cltq
movsd  -0x8(%r13,%rax,8),%xmm2
subsd  %xmm2,%xmm3
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
jmp    1362 <array_get_threshold_double_+0x232>
cltq
movsd  -0x8(%r13,%rax,8),%xmm0
movsd  %xmm0,(%r14)
mov    %r13,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @array_get_threshold_double_(double* %0, i32* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca i32
store double* %0, double** %5
store i32* %1, i32** %6
store double* %2, double** %7
store double* %3, double** %8
%12 = load i32*, i32** %6
%13 = load i32, i32* %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to double*
store double* %18, double** %9
store i32 0, i32* %11
br label %19
19: ; preds = %34, %4
%20 = load i32, i32* %11
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %37
24: ; preds = %19
%25 = load double*, double** %5
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %25, i64 %27
%29 = load double, double* %28
%30 = load double*, double** %9
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double %29, double* %33
br label %34
34: ; preds = %24
%35 = load i32, i32* %11
%36 = add nsw i32 %35, 1
store i32 %36, i32* %11
br label %19
37: ; preds = %19
%38 = load double*, double** %9
%39 = load i32*, i32** %6
%40 = call i32 @quicksort_double_(double* %38, i32* %39)
%41 = load double*, double** %7
%42 = load double, double* %41
%43 = fsub double 1.000000e+00, %42
%44 = load i32*, i32** %6
%45 = load i32, i32* %44
%46 = sitofp i32 %45 to double
%47 = call double @llvm.fmuladd.f64(double %43, double %46, double 5.000000e-01)
%48 = fptosi double %47 to i32
store i32 %48, i32* %11
%49 = load i32, i32* %11
%50 = load i32*, i32** %6
%51 = load i32, i32* %50
%52 = icmp sge i32 %49, %51
br i1 %52, label %53, label %57
53: ; preds = %37
%54 = load i32*, i32** %6
%55 = load i32, i32* %54
%56 = sub nsw i32 %55, 1
store i32 %56, i32* %11
br label %57
57: ; preds = %53, %37
%58 = load i32, i32* %11
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %57
store i32 0, i32* %11
br label %61
61: ; preds = %60, %57
%62 = load double*, double** %9
%63 = load i32, i32* %11
%64 = add nsw i32 %63, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %62, i64 %65
%67 = load double, double* %66
%68 = load double*, double** %9
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
%72 = load double, double* %71
%73 = fcmp ogt double %67, %72
br i1 %73, label %74, label %107
74: ; preds = %61
%75 = load double*, double** %7
%76 = load double, double* %75
%77 = load i32, i32* %11
%78 = sitofp i32 %77 to double
%79 = fmul double 1.000000e+00, %78
%80 = load i32*, i32** %6
%81 = load i32, i32* %80
%82 = sitofp i32 %81 to double
%83 = fdiv double %79, %82
%84 = fadd double %76, %83
store double %84, double* %10
%85 = load double*, double** %9
%86 = load i32, i32* %11
%87 = sub nsw i32 %86, 1
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %85, i64 %88
%90 = load double, double* %89
%91 = load double*, double** %9
%92 = load i32, i32* %11
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %91, i64 %93
%95 = load double, double* %94
%96 = load double*, double** %9
%97 = load i32, i32* %11
%98 = sub nsw i32 %97, 1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %96, i64 %99
%101 = load double, double* %100
%102 = fsub double %95, %101
%103 = load double, double* %10
%104 = fsub double 1.000000e+00, %103
%105 = call double @llvm.fmuladd.f64(double %102, double %104, double %90)
%106 = load double*, double** %8
store double %105, double* %106
br label %115
107: ; preds = %61
%108 = load double*, double** %9
%109 = load i32, i32* %11
%110 = sub nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %108, i64 %111
%113 = load double, double* %112
%114 = load double*, double** %8
store double %113, double* %114
br label %115
115: ; preds = %107, %74
%116 = load double*, double** %9
%117 = call i32 @free(double* %116)
ret void
}

LLVM IR (-O2):
define void @array_get_threshold_double_(double* nocapture %0, i32* %1, double* nocapture %2, double* nocapture writeonly %3) {
%5 = load i32, i32* %1
%6 = shl i32 %5, 3
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to double*
%9 = inttoptr i64 %7 to i8*
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %138
12: ; preds = %4
%13 = zext i32 %10 to i64
%14 = icmp ult i32 %10, 4
br i1 %14, label %101, label %15
15: ; preds = %12
%16 = getelementptr double, double* %8, i64 %13
%17 = getelementptr double, double* %0, i64 %13
%18 = bitcast double* %17 to i8*
%19 = icmp ult i8* %9, %18
%20 = icmp ugt double* %16, %0
%21 = and i1 %19, %20
br i1 %21, label %101, label %22
22: ; preds = %15
%23 = and i64 %13, 4294967292
%24 = add nsw i64 %23, -4
%25 = lshr exact i64 %24, 2
%26 = add nuw nsw i64 %25, 1
%27 = and i64 %26, 3
%28 = icmp ult i64 %24, 12
br i1 %28, label %80, label %29
29: ; preds = %22
%30 = and i64 %26, 9223372036854775804
br label %31
31: ; preds = %31, %29
%32 = phi i64 [ 0, %29 ], [ %77, %31 ]
%33 = phi i64 [ 0, %29 ], [ %78, %31 ]
%34 = getelementptr inbounds double, double* %0, i64 %32
%35 = bitcast double* %34 to <2 x double>*
%36 = load <2 x double>, <2 x double>* %35
%37 = getelementptr inbounds double, double* %34, i64 2
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %8, i64 %32
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> %36, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %39, <2 x double>* %43
%44 = or i64 %32, 4
%45 = getelementptr inbounds double, double* %0, i64 %44
%46 = bitcast double* %45 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = getelementptr inbounds double, double* %45, i64 2
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = getelementptr inbounds double, double* %8, i64 %44
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %47, <2 x double>* %52
%53 = getelementptr inbounds double, double* %51, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %50, <2 x double>* %54
%55 = or i64 %32, 8
%56 = getelementptr inbounds double, double* %0, i64 %55
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = getelementptr inbounds double, double* %56, i64 2
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = getelementptr inbounds double, double* %8, i64 %55
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %58, <2 x double>* %63
%64 = getelementptr inbounds double, double* %62, i64 2
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %61, <2 x double>* %65
%66 = or i64 %32, 12
%67 = getelementptr inbounds double, double* %0, i64 %66
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = getelementptr inbounds double, double* %67, i64 2
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = getelementptr inbounds double, double* %8, i64 %66
%74 = bitcast double* %73 to <2 x double>*
store <2 x double> %69, <2 x double>* %74
%75 = getelementptr inbounds double, double* %73, i64 2
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> %72, <2 x double>* %76
%77 = add nuw i64 %32, 16
%78 = add nuw i64 %33, 4
%79 = icmp eq i64 %78, %30
br i1 %79, label %80, label %31
80: ; preds = %31, %22
%81 = phi i64 [ 0, %22 ], [ %77, %31 ]
%82 = icmp eq i64 %27, 0
br i1 %82, label %99, label %83
83: ; preds = %80, %83
%84 = phi i64 [ %96, %83 ], [ %81, %80 ]
%85 = phi i64 [ %97, %83 ], [ 0, %80 ]
%86 = getelementptr inbounds double, double* %0, i64 %84
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = getelementptr inbounds double, double* %86, i64 2
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = getelementptr inbounds double, double* %8, i64 %84
%93 = bitcast double* %92 to <2 x double>*
store <2 x double> %88, <2 x double>* %93
%94 = getelementptr inbounds double, double* %92, i64 2
%95 = bitcast double* %94 to <2 x double>*
store <2 x double> %91, <2 x double>* %95
%96 = add nuw i64 %84, 4
%97 = add i64 %85, 1
%98 = icmp eq i64 %97, %27
br i1 %98, label %99, label %83
99: ; preds = %83, %80
%100 = icmp eq i64 %23, %13
br i1 %100, label %138, label %101
101: ; preds = %15, %12, %99
%102 = phi i64 [ 0, %15 ], [ 0, %12 ], [ %23, %99 ]
%103 = xor i64 %102, -1
%104 = add nsw i64 %103, %13
%105 = and i64 %13, 3
%106 = icmp eq i64 %105, 0
br i1 %106, label %116, label %107
107: ; preds = %101, %107
%108 = phi i64 [ %113, %107 ], [ %102, %101 ]
%109 = phi i64 [ %114, %107 ], [ 0, %101 ]
%110 = getelementptr inbounds double, double* %0, i64 %108
%111 = load double, double* %110
%112 = getelementptr inbounds double, double* %8, i64 %108
store double %111, double* %112
%113 = add nuw nsw i64 %108, 1
%114 = add i64 %109, 1
%115 = icmp eq i64 %114, %105
br i1 %115, label %116, label %107
116: ; preds = %107, %101
%117 = phi i64 [ %102, %101 ], [ %113, %107 ]
%118 = icmp ult i64 %104, 3
br i1 %118, label %138, label %119
119: ; preds = %116, %119
%120 = phi i64 [ %136, %119 ], [ %117, %116 ]
%121 = getelementptr inbounds double, double* %0, i64 %120
%122 = load double, double* %121
%123 = getelementptr inbounds double, double* %8, i64 %120
store double %122, double* %123
%124 = add nuw nsw i64 %120, 1
%125 = getelementptr inbounds double, double* %0, i64 %124
%126 = load double, double* %125
%127 = getelementptr inbounds double, double* %8, i64 %124
store double %126, double* %127
%128 = add nuw nsw i64 %120, 2
%129 = getelementptr inbounds double, double* %0, i64 %128
%130 = load double, double* %129
%131 = getelementptr inbounds double, double* %8, i64 %128
store double %130, double* %131
%132 = add nuw nsw i64 %120, 3
%133 = getelementptr inbounds double, double* %0, i64 %132
%134 = load double, double* %133
%135 = getelementptr inbounds double, double* %8, i64 %132
store double %134, double* %135
%136 = add nuw nsw i64 %120, 4
%137 = icmp eq i64 %136, %13
br i1 %137, label %138, label %119
138: ; preds = %116, %119, %99, %4
%139 = tail call i32 @quicksort_double_(double* %8, i32* %1)
%140 = load double, double* %2
%141 = fsub double 1.000000e+00, %140
%142 = load i32, i32* %1
%143 = sitofp i32 %142 to double
%144 = tail call double @llvm.fmuladd.f64(double %141, double %143, double 5.000000e-01)
%145 = fptosi double %144 to i32
%146 = icmp sgt i32 %142, %145
%147 = add nsw i32 %142, -1
%148 = select i1 %146, i32 %145, i32 %147
%149 = icmp sgt i32 %148, 0
%150 = select i1 %149, i32 %148, i32 0
%151 = add nuw nsw i32 %150, 1
%152 = zext i32 %151 to i64
%153 = getelementptr inbounds double, double* %8, i64 %152
%154 = load double, double* %153
%155 = zext i32 %150 to i64
%156 = getelementptr inbounds double, double* %8, i64 %155
%157 = load double, double* %156
%158 = fcmp ogt double %154, %157
br i1 %158, label %159, label %170
159: ; preds = %138
%160 = sitofp i32 %150 to double
%161 = fdiv double %160, %143
%162 = fadd double %140, %161
%163 = add nsw i32 %150, -1
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %8, i64 %164
%166 = load double, double* %165
%167 = fsub double %157, %166
%168 = fsub double 1.000000e+00, %162
%169 = tail call double @llvm.fmuladd.f64(double %167, double %168, double %166)
br label %175
170: ; preds = %138
%171 = add nsw i32 %150, -1
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %8, i64 %172
%174 = load double, double* %173
br label %175
175: ; preds = %170, %159
%176 = phi double [ %174, %170 ], [ %169, %159 ]
store double %176, double* %3
%177 = tail call i32 @free(double* %8)
ret void
}