#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 */
double CSPL_Regression_LinearRsq(double *, double *, long, double, double);
unsigned long CSPL_Stats_combination(long, int);
double CSPL_Stats_median_quickselect(double *, long);
scalar_t__ calloc(unsigned long, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ stderr;
double CSPL_Regression_TheilSen(double *x, double *y, long n, double *slope,
                                double *intercept) {
  double *slopes;
  double *intercepts;
  double dx;
  unsigned long i, j, k;
  unsigned long combs;
  double rsq;
  combs = CSPL_Stats_combination(n, 2);
  if (combs == 0) {
    fprintf(stderr, "CSPL_Regression_TheilSen: Data has one or zero length, no "
                    "calcualtion posssible\n");
    return (-1);
  }
  slopes = (double *)calloc(combs, sizeof(double));
  intercepts = (double *)calloc(combs, sizeof(double));
  k = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      dx = (x[j] - x[i]);
      slopes[k] = ((y[j] - y[i]) / dx);
      k++;
    }
  }
  *slope = CSPL_Stats_median_quickselect(slopes, combs);
  for (i = 0; i < n; i++) {
    intercepts[i] = y[i] - *slope * x[i];
  }
  *intercept = CSPL_Stats_median_quickselect(intercepts, n);
  rsq = CSPL_Regression_LinearRsq(x, y, n, *slope, *intercept);
  free(slopes);
  free(intercepts);
  return (rsq);
}


x86 assembly (clang, -O0):
<CSPL_Regression_TheilSen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1080 <CSPL_Stats_combination@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    11c0 <CSPL_Regression_TheilSen+0x60>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1060 <fprintf@plt>
movsd  0xe4a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1377 <CSPL_Regression_TheilSen+0x217>
mov    -0x68(%rbp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x68(%rbp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1296 <CSPL_Regression_TheilSen+0x136>
movq   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    1280 <CSPL_Regression_TheilSen+0x120>
mov    -0x10(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x50(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x50(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    120a <CSPL_Regression_TheilSen+0xaa>
jmp    1285 <CSPL_Regression_TheilSen+0x125>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    11f4 <CSPL_Regression_TheilSen+0x94>
mov    -0x38(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1040 <CSPL_Stats_median_quickselect@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1320 <CSPL_Regression_TheilSen+0x1c0>
mov    -0x18(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    12b3 <CSPL_Regression_TheilSen+0x153>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <CSPL_Stats_median_quickselect@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm1
call   1070 <CSPL_Regression_LinearRsq@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSPL_Regression_TheilSen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%rbp
mov    %rcx,(%rsp)
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%rbx
mov    %rdx,%rdi
mov    $0x2,%esi
call   1080 <CSPL_Stats_combination@plt>
test   %rax,%rax
je     1449 <CSPL_Regression_TheilSen+0x2e9>
mov    %rbp,0x20(%rsp)
mov    %rax,%r14
mov    %rax,%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
test   %r15,%r15
je     1468 <CSPL_Regression_TheilSen+0x308>
mov    %r14,0x18(%rsp)
mov    %rax,0x10(%rsp)
xor    %eax,%eax
xor    %ecx,%ecx
mov    %r15,0x8(%rsp)
jmp    11ed <CSPL_Regression_TheilSen+0x8d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
cmp    %r15,%rax
je     1314 <CSPL_Regression_TheilSen+0x1b4>
test   %rax,%rax
je     11e0 <CSPL_Regression_TheilSen+0x80>
cmp    $0x1,%rax
je     12d0 <CSPL_Regression_TheilSen+0x170>
lea    0x0(,%rax,8),%r8
add    %rbp,%r8
lea    (%rbx,%rax,8),%rdi
lea    0x8(%rbx,%rax,8),%r9
lea    0x0(%r13,%rax,8),%r11
lea    0x8(,%rax,8),%r10
add    %r13,%r10
lea    0x0(,%rcx,8),%rsi
add    %rbp,%rsi
lea    (%r8,%rcx,8),%rdx
cmp    %r9,%rsi
setb   %r12b
cmp    %rdx,%rdi
setb   %r14b
cmp    %rdi,%rsi
setb   %r15b
cmp    %rbx,%rdx
seta   %r9b
cmp    %r10,%rsi
setb   %dil
cmp    %rdx,%r11
setb   %r10b
cmp    %r11,%rsi
setb   %r8b
cmp    %r13,%rdx
seta   %r11b
test   %r14b,%r12b
jne    12d4 <CSPL_Regression_TheilSen+0x174>
and    %r9b,%r15b
jne    12d4 <CSPL_Regression_TheilSen+0x174>
and    %r10b,%dil
mov    0x8(%rsp),%r15
jne    12d0 <CSPL_Regression_TheilSen+0x170>
and    %r11b,%r8b
jne    12d0 <CSPL_Regression_TheilSen+0x170>
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
add    %rdx,%rcx
movsd  (%rbx,%rax,8),%xmm0
unpcklpd %xmm0,%xmm0
movsd  0x0(%r13,%rax,8),%xmm1
unpcklpd %xmm1,%xmm1
xor    %edi,%edi
movupd (%rbx,%rdi,8),%xmm2
subpd  %xmm0,%xmm2
movupd 0x0(%r13,%rdi,8),%xmm3
subpd  %xmm1,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,(%rsi,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%rdx
jne    12a0 <CSPL_Regression_TheilSen+0x140>
jmp    130a <CSPL_Regression_TheilSen+0x1aa>
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
jmp    12e0 <CSPL_Regression_TheilSen+0x180>
xor    %edx,%edx
mov    0x8(%rsp),%r15
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rdx,8),%xmm0
subsd  (%rbx,%rax,8),%xmm0
movsd  0x0(%r13,%rdx,8),%xmm1
subsd  0x0(%r13,%rax,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%rbp,%rcx,8)
add    $0x1,%rcx
add    $0x1,%rdx
cmp    %rdx,%rax
jne    12e0 <CSPL_Regression_TheilSen+0x180>
jmp    11e0 <CSPL_Regression_TheilSen+0x80>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
call   1040 <CSPL_Stats_median_quickselect@plt>
mov    (%rsp),%rcx
movsd  %xmm0,(%rcx)
test   %r15,%r15
mov    0x10(%rsp),%rdi
je     1481 <CSPL_Regression_TheilSen+0x321>
mulsd  (%rbx),%xmm0
movsd  0x0(%r13),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi)
cmp    $0x1,%r15
je     1481 <CSPL_Regression_TheilSen+0x321>
lea    -0x1(%r15),%rdx
mov    $0x1,%eax
cmp    $0x4,%rdx
jb     14e3 <CSPL_Regression_TheilSen+0x383>
mov    %rdx,0x18(%rsp)
lea    0x8(%rdi),%rsi
lea    (%rdi,%r15,8),%r9
lea    0x8(%r13),%r10
lea    0x0(,%r15,8),%rdx
add    %r13,%rdx
lea    0x8(%rbx),%r8
lea    (%rbx,%r15,8),%r12
cmp    %rcx,%rdi
setb   %r11b
cmp    %rcx,%r9
seta   %r14b
cmp    %rdx,%rsi
setb   %dl
cmp    %r9,%r10
setb   %r10b
cmp    %r12,%rsi
setb   %cl
cmp    %r9,%r8
setb   %r8b
test   %r14b,%r11b
jne    14da <CSPL_Regression_TheilSen+0x37a>
and    %r10b,%dl
jne    14da <CSPL_Regression_TheilSen+0x37a>
and    %r8b,%cl
mov    (%rsp),%rcx
mov    0x10(%rsp),%rdi
jne    14e3 <CSPL_Regression_TheilSen+0x383>
mov    0x18(%rsp),%r8
mov    %r8,%rdx
and    $0xfffffffffffffffc,%rdx
lea    0x1(%rdx),%rax
movsd  (%rcx),%xmm0
unpcklpd %xmm0,%xmm0
xorpd  0xc0a(%rip),%xmm0
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movupd 0x8(%r13,%rsi,8),%xmm1
movupd 0x18(%r13,%rsi,8),%xmm2
movupd 0x8(%rbx,%rsi,8),%xmm3
movupd 0x18(%rbx,%rsi,8),%xmm4
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm3,0x8(%rdi,%rsi,8)
movupd %xmm4,0x18(%rdi,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%rdx
jne    1400 <CSPL_Regression_TheilSen+0x2a0>
cmp    %rdx,%r8
je     1481 <CSPL_Regression_TheilSen+0x321>
jmp    14e3 <CSPL_Regression_TheilSen+0x383>
mov    0x2b90(%rip),%rax
mov    (%rax),%edi
lea    0xbbf(%rip),%rsi
call   1060 <fprintf@plt>
movsd  0xbaa(%rip),%xmm0
jmp    14cb <CSPL_Regression_TheilSen+0x36b>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rax,%r14
call   1040 <CSPL_Stats_median_quickselect@plt>
mov    %r14,%rdi
mov    (%rsp),%rcx
movsd  %xmm0,(%rcx)
mov    %r15,%rsi
mov    %rcx,%r14
mov    %rdi,%r12
call   1040 <CSPL_Stats_median_quickselect@plt>
movapd %xmm0,%xmm1
mov    0x20(%rsp),%rax
movsd  %xmm0,(%rax)
movsd  (%r14),%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1070 <CSPL_Regression_LinearRsq@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rsp),%rcx
mov    0x10(%rsp),%rdi
mov    %rax,%rdx
not    %rdx
test   $0x1,%r15b
jne    150c <CSPL_Regression_TheilSen+0x3ac>
movsd  (%rcx),%xmm0
mulsd  (%rbx,%rax,8),%xmm0
movsd  0x0(%r13,%rax,8),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
add    $0x1,%rax
add    %r15,%rdx
je     1481 <CSPL_Regression_TheilSen+0x321>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rcx),%xmm0
movsd  0x0(%r13,%rax,8),%xmm1
mulsd  (%rbx,%rax,8),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
movsd  (%rcx),%xmm0
movsd  0x8(%r13,%rax,8),%xmm1
mulsd  0x8(%rbx,%rax,8),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rdi,%rax,8)
add    $0x2,%rax
cmp    %rax,%r15
jne    1520 <CSPL_Regression_TheilSen+0x3c0>
jmp    1481 <CSPL_Regression_TheilSen+0x321>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [81 x i8] c"CSPL_Regression_TheilSen: Data has one or zero length, no calcualtion posssible\0A\00"
define double @CSPL_Regression_TheilSen(double* %0, double* %1, i64 %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca i64
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store i64 %2, i64* %9
store double* %3, double** %10
store double* %4, double** %11
%20 = load i64, i64* %9
%21 = call i64 @CSPL_Stats_combination(i64 %20, i32 2)
store i64 %21, i64* %18
%22 = load i64, i64* %18
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %5
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
store double -1.000000e+00, double* %6
br label %122
27: ; preds = %5
%28 = load i64, i64* %18
%29 = call i64 @calloc(i64 %28, i32 8)
%30 = inttoptr i64 %29 to double*
store double* %30, double** %12
%31 = load i64, i64* %18
%32 = call i64 @calloc(i64 %31, i32 8)
%33 = inttoptr i64 %32 to double*
store double* %33, double** %13
store i64 0, i64* %17
store i64 0, i64* %15
br label %34
34: ; preds = %73, %27
%35 = load i64, i64* %15
%36 = load i64, i64* %9
%37 = icmp ult i64 %35, %36
br i1 %37, label %38, label %76
38: ; preds = %34
store i64 0, i64* %16
br label %39
39: ; preds = %69, %38
%40 = load i64, i64* %16
%41 = load i64, i64* %15
%42 = icmp ult i64 %40, %41
br i1 %42, label %43, label %72
43: ; preds = %39
%44 = load double*, double** %7
%45 = load i64, i64* %16
%46 = getelementptr inbounds double, double* %44, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %7
%49 = load i64, i64* %15
%50 = getelementptr inbounds double, double* %48, i64 %49
%51 = load double, double* %50
%52 = fsub double %47, %51
store double %52, double* %14
%53 = load double*, double** %8
%54 = load i64, i64* %16
%55 = getelementptr inbounds double, double* %53, i64 %54
%56 = load double, double* %55
%57 = load double*, double** %8
%58 = load i64, i64* %15
%59 = getelementptr inbounds double, double* %57, i64 %58
%60 = load double, double* %59
%61 = fsub double %56, %60
%62 = load double, double* %14
%63 = fdiv double %61, %62
%64 = load double*, double** %12
%65 = load i64, i64* %17
%66 = getelementptr inbounds double, double* %64, i64 %65
store double %63, double* %66
%67 = load i64, i64* %17
%68 = add i64 %67, 1
store i64 %68, i64* %17
br label %69
69: ; preds = %43
%70 = load i64, i64* %16
%71 = add i64 %70, 1
store i64 %71, i64* %16
br label %39
72: ; preds = %39
br label %73
73: ; preds = %72
%74 = load i64, i64* %15
%75 = add i64 %74, 1
store i64 %75, i64* %15
br label %34
76: ; preds = %34
%77 = load double*, double** %12
%78 = load i64, i64* %18
%79 = call double @CSPL_Stats_median_quickselect(double* %77, i64 %78)
%80 = load double*, double** %10
store double %79, double* %80
store i64 0, i64* %15
br label %81
81: ; preds = %101, %76
%82 = load i64, i64* %15
%83 = load i64, i64* %9
%84 = icmp ult i64 %82, %83
br i1 %84, label %85, label %104
85: ; preds = %81
%86 = load double*, double** %8
%87 = load i64, i64* %15
%88 = getelementptr inbounds double, double* %86, i64 %87
%89 = load double, double* %88
%90 = load double*, double** %10
%91 = load double, double* %90
%92 = load double*, double** %7
%93 = load i64, i64* %15
%94 = getelementptr inbounds double, double* %92, i64 %93
%95 = load double, double* %94
%96 = fneg double %91
%97 = call double @llvm.fmuladd.f64(double %96, double %95, double %89)
%98 = load double*, double** %13
%99 = load i64, i64* %15
%100 = getelementptr inbounds double, double* %98, i64 %99
store double %97, double* %100
br label %101
101: ; preds = %85
%102 = load i64, i64* %15
%103 = add i64 %102, 1
store i64 %103, i64* %15
br label %81
104: ; preds = %81
%105 = load double*, double** %13
%106 = load i64, i64* %9
%107 = call double @CSPL_Stats_median_quickselect(double* %105, i64 %106)
%108 = load double*, double** %11
store double %107, double* %108
%109 = load double*, double** %7
%110 = load double*, double** %8
%111 = load i64, i64* %9
%112 = load double*, double** %10
%113 = load double, double* %112
%114 = load double*, double** %11
%115 = load double, double* %114
%116 = call double @CSPL_Regression_LinearRsq(double* %109, double* %110, i64 %111, double %113, double %115)
store double %116, double* %19
%117 = load double*, double** %12
%118 = call i32 @free(double* %117)
%119 = load double*, double** %13
%120 = call i32 @free(double* %119)
%121 = load double, double* %19
store double %121, double* %6
br label %122
122: ; preds = %104, %24
%123 = load double, double* %6
ret double %123
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [81 x i8] c"CSPL_Regression_TheilSen: Data has one or zero length, no calcualtion posssible\0A\00"
define double @CSPL_Regression_TheilSen(double* %0, double* %1, i64 %2, double* nocapture %3, double* nocapture writeonly %4) {
%6 = tail call i64 @CSPL_Stats_combination(i64 %2, i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
br label %211
11: ; preds = %5
%12 = tail call i64 @calloc(i64 %6, i32 8)
%13 = inttoptr i64 %12 to double*
%14 = tail call i64 @calloc(i64 %6, i32 8)
%15 = inttoptr i64 %14 to double*
%16 = icmp eq i64 %2, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = tail call double @CSPL_Stats_median_quickselect(double* %13, i64 %6)
store double %18, double* %3
br label %205
19: ; preds = %11, %97
%20 = phi i64 [ %99, %97 ], [ 0, %11 ]
%21 = phi i64 [ %98, %97 ], [ 0, %11 ]
%22 = getelementptr double, double* %13, i64 %20
%23 = getelementptr double, double* %0, i64 %20
%24 = add i64 %20, 1
%25 = getelementptr double, double* %0, i64 %24
%26 = getelementptr double, double* %1, i64 %20
%27 = getelementptr double, double* %1, i64 %24
%28 = icmp eq i64 %20, 0
br i1 %28, label %97, label %29
29: ; preds = %19
%30 = getelementptr inbounds double, double* %0, i64 %20
%31 = getelementptr inbounds double, double* %1, i64 %20
%32 = icmp eq i64 %20, 1
br i1 %32, label %78, label %33
33: ; preds = %29
%34 = getelementptr double, double* %13, i64 %21
%35 = getelementptr double, double* %22, i64 %21
%36 = icmp ult double* %34, %25
%37 = icmp ult double* %23, %35
%38 = and i1 %36, %37
%39 = icmp ult double* %34, %23
%40 = icmp ugt double* %35, %0
%41 = and i1 %39, %40
%42 = or i1 %38, %41
%43 = icmp ult double* %34, %27
%44 = icmp ult double* %26, %35
%45 = and i1 %43, %44
%46 = or i1 %42, %45
%47 = icmp ult double* %34, %26
%48 = icmp ugt double* %35, %1
%49 = and i1 %47, %48
%50 = or i1 %46, %49
br i1 %50, label %78, label %51
51: ; preds = %33
%52 = and i64 %20, -2
%53 = add i64 %21, %52
%54 = load double, double* %30
%55 = insertelement <2 x double> poison, double %54, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%57 = load double, double* %31
%58 = insertelement <2 x double> poison, double %57, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
br label %60
60: ; preds = %60, %51
%61 = phi i64 [ 0, %51 ], [ %74, %60 ]
%62 = add i64 %21, %61
%63 = getelementptr inbounds double, double* %0, i64 %61
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = fsub <2 x double> %65, %56
%67 = getelementptr inbounds double, double* %1, i64 %61
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = fsub <2 x double> %69, %59
%71 = fdiv <2 x double> %70, %66
%72 = getelementptr inbounds double, double* %13, i64 %62
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> %71, <2 x double>* %73
%74 = add nuw i64 %61, 2
%75 = icmp eq i64 %74, %52
br i1 %75, label %76, label %60
76: ; preds = %60
%77 = icmp eq i64 %20, %52
br i1 %77, label %97, label %78
78: ; preds = %33, %29, %76
%79 = phi i64 [ %21, %33 ], [ %21, %29 ], [ %53, %76 ]
%80 = phi i64 [ 0, %33 ], [ 0, %29 ], [ %52, %76 ]
br label %81
81: ; preds = %78, %81
%82 = phi i64 [ %94, %81 ], [ %79, %78 ]
%83 = phi i64 [ %95, %81 ], [ %80, %78 ]
%84 = getelementptr inbounds double, double* %0, i64 %83
%85 = load double, double* %84
%86 = load double, double* %30
%87 = fsub double %85, %86
%88 = getelementptr inbounds double, double* %1, i64 %83
%89 = load double, double* %88
%90 = load double, double* %31
%91 = fsub double %89, %90
%92 = fdiv double %91, %87
%93 = getelementptr inbounds double, double* %13, i64 %82
store double %92, double* %93
%94 = add i64 %82, 1
%95 = add nuw i64 %83, 1
%96 = icmp eq i64 %95, %20
br i1 %96, label %97, label %81
97: ; preds = %81, %76, %19
%98 = phi i64 [ %21, %19 ], [ %53, %76 ], [ %94, %81 ]
%99 = add nuw i64 %20, 1
%100 = icmp eq i64 %99, %2
br i1 %100, label %101, label %19
101: ; preds = %97
%102 = tail call double @CSPL_Stats_median_quickselect(double* %13, i64 %6)
store double %102, double* %3
br i1 %16, label %205, label %103
103: ; preds = %101
%104 = load double, double* %1
%105 = load double, double* %0
%106 = fneg double %102
%107 = tail call double @llvm.fmuladd.f64(double %106, double %105, double %104)
store double %107, double* %15
%108 = icmp eq i64 %2, 1
br i1 %108, label %205, label %109
109: ; preds = %103
%110 = add i64 %2, -1
%111 = icmp ult i64 %110, 4
br i1 %111, label %165, label %112
112: ; preds = %109
%113 = getelementptr double, double* %15, i64 1
%114 = getelementptr double, double* %15, i64 %2
%115 = getelementptr double, double* %1, i64 1
%116 = getelementptr double, double* %1, i64 %2
%117 = getelementptr double, double* %0, i64 1
%118 = getelementptr double, double* %0, i64 %2
%119 = icmp ult double* %15, %3
%120 = icmp ugt double* %114, %3
%121 = and i1 %119, %120
%122 = icmp ult double* %113, %116
%123 = icmp ult double* %115, %114
%124 = and i1 %122, %123
%125 = or i1 %121, %124
%126 = icmp ult double* %113, %118
%127 = icmp ult double* %117, %114
%128 = and i1 %126, %127
%129 = or i1 %125, %128
br i1 %129, label %165, label %130
130: ; preds = %112
%131 = and i64 %110, -4
%132 = or i64 %131, 1
%133 = load double, double* %3
%134 = insertelement <2 x double> poison, double %133, i64 0
%135 = shufflevector <2 x double> %134, <2 x double> poison, <2 x i32> zeroinitializer
%136 = insertelement <2 x double> poison, double %133, i64 0
%137 = shufflevector <2 x double> %136, <2 x double> poison, <2 x i32> zeroinitializer
%138 = fneg <2 x double> %135
%139 = fneg <2 x double> %137
br label %140
140: ; preds = %140, %130
%141 = phi i64 [ 0, %130 ], [ %161, %140 ]
%142 = or i64 %141, 1
%143 = getelementptr inbounds double, double* %1, i64 %142
%144 = bitcast double* %143 to <2 x double>*
%145 = load <2 x double>, <2 x double>* %144
%146 = getelementptr inbounds double, double* %143, i64 2
%147 = bitcast double* %146 to <2 x double>*
%148 = load <2 x double>, <2 x double>* %147
%149 = getelementptr inbounds double, double* %0, i64 %142
%150 = bitcast double* %149 to <2 x double>*
%151 = load <2 x double>, <2 x double>* %150
%152 = getelementptr inbounds double, double* %149, i64 2
%153 = bitcast double* %152 to <2 x double>*
%154 = load <2 x double>, <2 x double>* %153
%155 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %138, <2 x double> %151, <2 x double> %145)
%156 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %139, <2 x double> %154, <2 x double> %148)
%157 = getelementptr inbounds double, double* %15, i64 %142
%158 = bitcast double* %157 to <2 x double>*
store <2 x double> %155, <2 x double>* %158
%159 = getelementptr inbounds double, double* %157, i64 2
%160 = bitcast double* %159 to <2 x double>*
store <2 x double> %156, <2 x double>* %160
%161 = add nuw i64 %141, 4
%162 = icmp eq i64 %161, %131
br i1 %162, label %163, label %140
163: ; preds = %140
%164 = icmp eq i64 %110, %131
br i1 %164, label %205, label %165
165: ; preds = %112, %109, %163
%166 = phi i64 [ 1, %112 ], [ 1, %109 ], [ %132, %163 ]
%167 = xor i64 %166, -1
%168 = and i64 %2, 1
%169 = icmp eq i64 %168, 0
br i1 %169, label %170, label %180
170: ; preds = %165
%171 = load double, double* %3
%172 = getelementptr inbounds double, double* %1, i64 %166
%173 = load double, double* %172
%174 = getelementptr inbounds double, double* %0, i64 %166
%175 = load double, double* %174
%176 = fneg double %171
%177 = tail call double @llvm.fmuladd.f64(double %176, double %175, double %173)
%178 = getelementptr inbounds double, double* %15, i64 %166
store double %177, double* %178
%179 = add nuw i64 %166, 1
br label %180
180: ; preds = %170, %165
%181 = phi i64 [ %166, %165 ], [ %179, %170 ]
%182 = sub i64 0, %2
%183 = icmp eq i64 %167, %182
br i1 %183, label %205, label %184
184: ; preds = %180, %184
%185 = phi i64 [ %203, %184 ], [ %181, %180 ]
%186 = load double, double* %3
%187 = getelementptr inbounds double, double* %1, i64 %185
%188 = load double, double* %187
%189 = getelementptr inbounds double, double* %0, i64 %185
%190 = load double, double* %189
%191 = fneg double %186
%192 = tail call double @llvm.fmuladd.f64(double %191, double %190, double %188)
%193 = getelementptr inbounds double, double* %15, i64 %185
store double %192, double* %193
%194 = add nuw i64 %185, 1
%195 = load double, double* %3
%196 = getelementptr inbounds double, double* %1, i64 %194
%197 = load double, double* %196
%198 = getelementptr inbounds double, double* %0, i64 %194
%199 = load double, double* %198
%200 = fneg double %195
%201 = tail call double @llvm.fmuladd.f64(double %200, double %199, double %197)
%202 = getelementptr inbounds double, double* %15, i64 %194
store double %201, double* %202
%203 = add nuw i64 %185, 2
%204 = icmp eq i64 %203, %2
br i1 %204, label %205, label %184
205: ; preds = %180, %184, %103, %163, %17, %101
%206 = tail call double @CSPL_Stats_median_quickselect(double* %15, i64 %2)
store double %206, double* %4
%207 = load double, double* %3
%208 = tail call double @CSPL_Regression_LinearRsq(double* %0, double* %1, i64 %2, double %207, double %206)
%209 = tail call i32 @free(double* %13)
%210 = tail call i32 @free(double* %15)
br label %211
211: ; preds = %205, %8
%212 = phi double [ -1.000000e+00, %8 ], [ %208, %205 ]
ret double %212
}