#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ heapsort2_d(int, double *, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(double *, double *, int);
int /*<<< orphan*/ stderr;
double doubleweightedmedian(int ndat, double *dat, double *weight) {
  int i;
  double sw, mw;
  double *a, *w, med;
  if (ndat == 1)
    return dat[0];
  if ((a = (double *)malloc(sizeof(double) * ndat)) == NULL) {
    fprintf(stderr, "Cannot allocate a in doubleweightedmedian, ndat=%d\n",
            ndat);
    exit(-1);
  }
  if ((w = (double *)malloc(sizeof(double) * ndat)) == NULL) {
    fprintf(stderr, "Cannot allocate w in doubleweightedmedian, ndat=%d\n",
            ndat);
    exit(-1);
  }
  memcpy(a, dat, sizeof(double) * ndat);
  memcpy(w, weight, sizeof(double) * ndat);
  heapsort2_d(ndat, a, w);
  sw = 0;
  for (i = 0; i < ndat; i++)
    sw += w[i];
  mw = 0.5 * sw;
  sw = 0;
  med = 0;
  for (i = 0; i < ndat; i++) {
    sw += w[i];
    if (sw > mw) {
      med = a[i];
      break;
    } else if (sw == mw) {
      med = 0.5 * (a[i] + a[i + 1]);
      break;
    }
  }
  free(a);
  free(w);
  return med;
}


x86 assembly (clang, -O0):
<doubleweightedmedian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    118f <doubleweightedmedian+0x2f>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137d <doubleweightedmedian+0x21d>
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    11ce <doubleweightedmedian+0x6e>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe49(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    120d <doubleweightedmedian+0xad>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe3e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0xc(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
call   1040 <heapsort2_d@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    128b <doubleweightedmedian+0x12b>
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    125a <doubleweightedmedian+0xfa>
movsd  0xd6d(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1361 <doubleweightedmedian+0x201>
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    12fe <doubleweightedmedian+0x19e>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1361 <doubleweightedmedian+0x201>
movsd  -0x30(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jne    1349 <doubleweightedmedian+0x1e9>
jp     1349 <doubleweightedmedian+0x1e9>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xcc5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1361 <doubleweightedmedian+0x201>
jmp    134e <doubleweightedmedian+0x1ee>
jmp    1353 <doubleweightedmedian+0x1f3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12b4 <doubleweightedmedian+0x154>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleweightedmedian>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
cmp    $0x1,%edi
jne    117e <doubleweightedmedian+0x1e>
movsd  0x0(%r13),%xmm0
jmp    12c6 <doubleweightedmedian+0x166>
mov    %rdx,%r12
mov    %edi,%r15d
lea    0x0(,%r15,8),%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     12f4 <doubleweightedmedian+0x194>
mov    %rax,%r14
mov    %ebp,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1306 <doubleweightedmedian+0x1a6>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   1060 <memcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1060 <memcpy@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <heapsort2_d@plt>
test   %r15d,%r15d
jle    12a8 <doubleweightedmedian+0x148>
mov    %r15d,%eax
lea    -0x1(%rax),%rdx
mov    %eax,%ecx
and    $0x7,%ecx
cmp    $0x7,%rdx
jae    11fd <doubleweightedmedian+0x9d>
xorpd  %xmm0,%xmm0
xor    %edx,%edx
jmp    1248 <doubleweightedmedian+0xe8>
mov    %eax,%esi
and    $0xfffffff8,%esi
xorpd  %xmm0,%xmm0
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
addsd  (%rbx,%rdx,8),%xmm0
addsd  0x8(%rbx,%rdx,8),%xmm0
addsd  0x10(%rbx,%rdx,8),%xmm0
addsd  0x18(%rbx,%rdx,8),%xmm0
addsd  0x20(%rbx,%rdx,8),%xmm0
addsd  0x28(%rbx,%rdx,8),%xmm0
addsd  0x30(%rbx,%rdx,8),%xmm0
addsd  0x38(%rbx,%rdx,8),%xmm0
add    $0x8,%rdx
cmp    %rdx,%rsi
jne    1210 <doubleweightedmedian+0xb0>
test   %rcx,%rcx
je     126e <doubleweightedmedian+0x10e>
lea    (%rbx,%rdx,8),%rdx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addsd  (%rdx,%rsi,8),%xmm0
add    $0x1,%rsi
cmp    %rsi,%rcx
jne    1260 <doubleweightedmedian+0x100>
test   %r15d,%r15d
jle    12a8 <doubleweightedmedian+0x148>
mulsd  0xd85(%rip),%xmm0
xorpd  %xmm1,%xmm1
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addsd  (%rbx,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
ja     12d5 <doubleweightedmedian+0x175>
jne    129f <doubleweightedmedian+0x13f>
jnp    12dd <doubleweightedmedian+0x17d>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1290 <doubleweightedmedian+0x130>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movsd  (%r14,%rcx,8),%xmm0
jmp    12ac <doubleweightedmedian+0x14c>
movsd  (%r14,%rcx,8),%xmm0
addsd  0x8(%r14,%rcx,8),%xmm0
mulsd  0xd0e(%rip),%xmm0
jmp    12ac <doubleweightedmedian+0x14c>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xd04(%rip),%rsi
jmp    1316 <doubleweightedmedian+0x1b6>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
lea    0xd26(%rip),%rsi
mov    %r15d,%edx
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [52 x i8] c"Cannot allocate a in doubleweightedmedian, ndat=%d\0A\00"
@.str.1 = [52 x i8] c"Cannot allocate w in doubleweightedmedian, ndat=%d\0A\00"
define double @doubleweightedmedian(i32 %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load double*, double** %6
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
store double %19, double* %4
br label %133
20: ; preds = %3
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = mul i64 8, %22
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
store double* %26, double** %11
%27 = icmp eq double* %26, null
br i1 %27, label %28, label %33
28: ; preds = %20
%29 = load i32, i32* @stderr
%30 = load i32, i32* %5
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = call i32 @exit(i32 -1)
unreachable
33: ; preds = %20
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = mul i64 8, %35
%37 = trunc i64 %36 to i32
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to double*
store double* %39, double** %12
%40 = icmp eq double* %39, null
br i1 %40, label %41, label %46
41: ; preds = %33
%42 = load i32, i32* @stderr
%43 = load i32, i32* %5
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 %43)
%45 = call i32 @exit(i32 -1)
unreachable
46: ; preds = %33
%47 = load double*, double** %11
%48 = load double*, double** %6
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = mul i64 8, %50
%52 = trunc i64 %51 to i32
%53 = call i32 @memcpy(double* %47, double* %48, i32 %52)
%54 = load double*, double** %12
%55 = load double*, double** %7
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = mul i64 8, %57
%59 = trunc i64 %58 to i32
%60 = call i32 @memcpy(double* %54, double* %55, i32 %59)
%61 = load i32, i32* %5
%62 = load double*, double** %11
%63 = load double*, double** %12
%64 = call i32 @heapsort2_d(i32 %61, double* %62, double* %63)
store double 0.000000e+00, double* %9
store i32 0, i32* %8
br label %65
65: ; preds = %77, %46
%66 = load i32, i32* %8
%67 = load i32, i32* %5
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %80
69: ; preds = %65
%70 = load double*, double** %12
%71 = load i32, i32* %8
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = load double, double* %9
%76 = fadd double %75, %74
store double %76, double* %9
br label %77
77: ; preds = %69
%78 = load i32, i32* %8
%79 = add nsw i32 %78, 1
store i32 %79, i32* %8
br label %65
80: ; preds = %65
%81 = load double, double* %9
%82 = fmul double 5.000000e-01, %81
store double %82, double* %10
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %13
store i32 0, i32* %8
br label %83
83: ; preds = %124, %80
%84 = load i32, i32* %8
%85 = load i32, i32* %5
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %127
87: ; preds = %83
%88 = load double*, double** %12
%89 = load i32, i32* %8
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %88, i64 %90
%92 = load double, double* %91
%93 = load double, double* %9
%94 = fadd double %93, %92
store double %94, double* %9
%95 = load double, double* %9
%96 = load double, double* %10
%97 = fcmp ogt double %95, %96
br i1 %97, label %98, label %104
98: ; preds = %87
%99 = load double*, double** %11
%100 = load i32, i32* %8
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
store double %103, double* %13
br label %127
104: ; preds = %87
%105 = load double, double* %9
%106 = load double, double* %10
%107 = fcmp oeq double %105, %106
br i1 %107, label %108, label %122
108: ; preds = %104
%109 = load double*, double** %11
%110 = load i32, i32* %8
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load double, double* %112
%114 = load double*, double** %11
%115 = load i32, i32* %8
%116 = add nsw i32 %115, 1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %114, i64 %117
%119 = load double, double* %118
%120 = fadd double %113, %119
%121 = fmul double 5.000000e-01, %120
store double %121, double* %13
br label %127
122: ; preds = %104
br label %123
123: ; preds = %122
br label %124
124: ; preds = %123
%125 = load i32, i32* %8
%126 = add nsw i32 %125, 1
store i32 %126, i32* %8
br label %83
127: ; preds = %108, %98, %83
%128 = load double*, double** %11
%129 = call i32 @free(double* %128)
%130 = load double*, double** %12
%131 = call i32 @free(double* %130)
%132 = load double, double* %13
store double %132, double* %4
br label %133
133: ; preds = %127, %16
%134 = load double, double* %4
ret double %134
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [52 x i8] c"Cannot allocate a in doubleweightedmedian, ndat=%d\0A\00"
@.str.1 = [52 x i8] c"Cannot allocate w in doubleweightedmedian, ndat=%d\0A\00"
define double @doubleweightedmedian(i32 %0, double* %1, double* %2) {
%4 = icmp eq i32 %0, 1
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = load double, double* %1
br label %124
7: ; preds = %3
%8 = shl i32 %0, 3
%9 = tail call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to double*
%11 = icmp eq i64 %9, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %0)
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %7
%17 = tail call i64 @malloc(i32 %8)
%18 = inttoptr i64 %17 to double*
%19 = icmp eq i64 %17, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%23 = tail call i32 @exit(i32 -1)
unreachable
24: ; preds = %16
%25 = tail call i32 @memcpy(double* %10, double* %1, i32 %8)
%26 = tail call i32 @memcpy(double* %18, double* %2, i32 %8)
%27 = tail call i32 @heapsort2_d(i32 %0, double* %10, double* %18)
%28 = icmp sgt i32 %0, 0
br i1 %28, label %29, label %120
29: ; preds = %24
%30 = zext i32 %0 to i64
%31 = add nsw i64 %30, -1
%32 = and i64 %30, 7
%33 = icmp ult i64 %31, 7
br i1 %33, label %74, label %34
34: ; preds = %29
%35 = and i64 %30, 4294967288
br label %36
36: ; preds = %36, %34
%37 = phi i64 [ 0, %34 ], [ %71, %36 ]
%38 = phi double [ 0.000000e+00, %34 ], [ %70, %36 ]
%39 = phi i64 [ 0, %34 ], [ %72, %36 ]
%40 = getelementptr inbounds double, double* %18, i64 %37
%41 = load double, double* %40
%42 = fadd double %38, %41
%43 = or i64 %37, 1
%44 = getelementptr inbounds double, double* %18, i64 %43
%45 = load double, double* %44
%46 = fadd double %42, %45
%47 = or i64 %37, 2
%48 = getelementptr inbounds double, double* %18, i64 %47
%49 = load double, double* %48
%50 = fadd double %46, %49
%51 = or i64 %37, 3
%52 = getelementptr inbounds double, double* %18, i64 %51
%53 = load double, double* %52
%54 = fadd double %50, %53
%55 = or i64 %37, 4
%56 = getelementptr inbounds double, double* %18, i64 %55
%57 = load double, double* %56
%58 = fadd double %54, %57
%59 = or i64 %37, 5
%60 = getelementptr inbounds double, double* %18, i64 %59
%61 = load double, double* %60
%62 = fadd double %58, %61
%63 = or i64 %37, 6
%64 = getelementptr inbounds double, double* %18, i64 %63
%65 = load double, double* %64
%66 = fadd double %62, %65
%67 = or i64 %37, 7
%68 = getelementptr inbounds double, double* %18, i64 %67
%69 = load double, double* %68
%70 = fadd double %66, %69
%71 = add nuw nsw i64 %37, 8
%72 = add i64 %39, 8
%73 = icmp eq i64 %72, %35
br i1 %73, label %74, label %36
74: ; preds = %36, %29
%75 = phi double [ undef, %29 ], [ %70, %36 ]
%76 = phi i64 [ 0, %29 ], [ %71, %36 ]
%77 = phi double [ 0.000000e+00, %29 ], [ %70, %36 ]
%78 = icmp eq i64 %32, 0
br i1 %78, label %89, label %79
79: ; preds = %74, %79
%80 = phi i64 [ %86, %79 ], [ %76, %74 ]
%81 = phi double [ %85, %79 ], [ %77, %74 ]
%82 = phi i64 [ %87, %79 ], [ 0, %74 ]
%83 = getelementptr inbounds double, double* %18, i64 %80
%84 = load double, double* %83
%85 = fadd double %81, %84
%86 = add nuw nsw i64 %80, 1
%87 = add i64 %82, 1
%88 = icmp eq i64 %87, %32
br i1 %88, label %89, label %79
89: ; preds = %79, %74
%90 = phi double [ %75, %74 ], [ %85, %79 ]
%91 = fmul double %90, 5.000000e-01
br i1 %28, label %92, label %120
92: ; preds = %89
%93 = zext i32 %0 to i64
br label %94
94: ; preds = %92, %117
%95 = phi i64 [ 0, %92 ], [ %118, %117 ]
%96 = phi double [ 0.000000e+00, %92 ], [ %99, %117 ]
%97 = getelementptr inbounds double, double* %18, i64 %95
%98 = load double, double* %97
%99 = fadd double %96, %98
%100 = fcmp ogt double %99, %91
br i1 %100, label %101, label %105
101: ; preds = %94
%102 = and i64 %95, 4294967295
%103 = getelementptr inbounds double, double* %10, i64 %102
%104 = load double, double* %103
br label %120
105: ; preds = %94
%106 = fcmp oeq double %99, %91
br i1 %106, label %107, label %117
107: ; preds = %105
%108 = and i64 %95, 4294967295
%109 = getelementptr inbounds double, double* %10, i64 %108
%110 = load double, double* %109
%111 = add nuw i64 %95, 1
%112 = and i64 %111, 4294967295
%113 = getelementptr inbounds double, double* %10, i64 %112
%114 = load double, double* %113
%115 = fadd double %110, %114
%116 = fmul double %115, 5.000000e-01
br label %120
117: ; preds = %105
%118 = add nuw nsw i64 %95, 1
%119 = icmp eq i64 %118, %93
br i1 %119, label %120, label %94
120: ; preds = %117, %24, %89, %107, %101
%121 = phi double [ %104, %101 ], [ %116, %107 ], [ 0.000000e+00, %89 ], [ 0.000000e+00, %24 ], [ 0.000000e+00, %117 ]
%122 = tail call i32 @free(double* %10)
%123 = tail call i32 @free(double* %18)
br label %124
124: ; preds = %120, %5
%125 = phi double [ %6, %5 ], [ %121, %120 ]
ret double %125
}