#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*/ ave_dmatrix(double **, long, int, double *);
int /*<<< orphan*/ cov_matrix(double **, double **, long, int, double **);
double ddiff(double, double);
double **dmatrix(int, int, int, int);
double dot(double *, double *);
int /*<<< orphan*/ free_dmatrix(double **, int, int, int, int);
int /*<<< orphan*/ identity_matrix(double **, int);
int /*<<< orphan*/ jacobi(double **, int, double *, double **);
int /*<<< orphan*/ nrerror(char *);
void ls_plane(double **bxyz, long n, double *pnormal, double *ppos,
              double *odist, double *adist) {
  double D[4];
  double **cov_mtx, **identityV, **V;
  long i, j, nml = 0;
  if (n < 3)
    nrerror("too few atoms for least-squares fitting");
  cov_mtx = dmatrix(1, 3, 1, 3);
  V = dmatrix(1, 3, 1, 3);
  identityV = dmatrix(1, 3, 1, 3);
  cov_matrix(bxyz, bxyz, n, 3, cov_mtx);
  jacobi(cov_mtx, 3, D, V);
  identity_matrix(identityV, 3);
  for (i = 1; i <= 3 && !nml; i++)
    for (j = 1; j <= 3 && !nml; j++)
      if (ddiff(V[i][j], identityV[i][j]) > 1.0e-7)
        nml = 1;
  if (nml)
    for (i = 1; i <= 3; i++)
      pnormal[i] = V[i][1];
  else {
    pnormal[1] = 0.0;
    pnormal[2] = 0.0;
    pnormal[3] = 1.0;
  }
  ave_dmatrix(bxyz, n, 3, ppos);
  if (pnormal[3] < 0)
    for (i = 1; i <= 3; i++)
      pnormal[i] = -pnormal[i];
  *odist = dot(ppos, pnormal);
  for (i = 1; i <= n; i++)
    adist[i] = dot(bxyz[i], pnormal) - *odist;
  free_dmatrix(cov_mtx, 1, 3, 1, 3);
  free_dmatrix(V, 1, 3, 1, 3);
  free_dmatrix(identityV, 1, 3, 1, 3);
}


x86 assembly (clang, -O0):
<ls_plane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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)
movq   $0x0,-0x80(%rbp)
cmpq   $0x3,-0x10(%rbp)
jge    11d2 <ls_plane+0x42>
lea    0xe43(%rip),%rdi
call   1050 <nrerror@plt>
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1070 <dmatrix@plt>
mov    %rax,-0x58(%rbp)
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1070 <dmatrix@plt>
mov    %rax,-0x68(%rbp)
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1070 <dmatrix@plt>
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x58(%rbp),%r8
mov    $0x3,%ecx
call   1060 <cov_matrix@plt>
mov    -0x58(%rbp),%rdi
lea    -0x50(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    $0x3,%esi
call   1040 <jacobi@plt>
mov    -0x60(%rbp),%rdi
mov    $0x3,%esi
call   1090 <identity_matrix@plt>
movq   $0x1,-0x70(%rbp)
xor    %eax,%eax
cmpq   $0x3,-0x70(%rbp)
mov    %al,-0x81(%rbp)
jg     1280 <ls_plane+0xf0>
cmpq   $0x0,-0x80(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    1293 <ls_plane+0x103>
jmp    1346 <ls_plane+0x1b6>
movq   $0x1,-0x78(%rbp)
xor    %eax,%eax
cmpq   $0x3,-0x78(%rbp)
mov    %al,-0x82(%rbp)
jg     12be <ls_plane+0x12e>
cmpq   $0x0,-0x80(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x82(%rbp)
mov    -0x82(%rbp),%al
test   $0x1,%al
jne    12d1 <ls_plane+0x141>
jmp    1330 <ls_plane+0x1a0>
mov    -0x68(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   10a0 <ddiff@plt>
movsd  0xd00(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    131a <ls_plane+0x18a>
movq   $0x1,-0x80(%rbp)
jmp    131f <ls_plane+0x18f>
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    129b <ls_plane+0x10b>
jmp    1335 <ls_plane+0x1a5>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    125d <ls_plane+0xcd>
cmpq   $0x0,-0x80(%rbp)
je     1398 <ls_plane+0x208>
movq   $0x1,-0x70(%rbp)
cmpq   $0x3,-0x70(%rbp)
jg     1393 <ls_plane+0x203>
mov    -0x68(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x70(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1359 <ls_plane+0x1c9>
jmp    13c1 <ls_plane+0x231>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
movsd  0xc44(%rip),%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    $0x3,%edx
call   10b0 <ave_dmatrix@plt>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd 0x18(%rax),%xmm0
jbe    1443 <ls_plane+0x2b3>
movq   $0x1,-0x70(%rbp)
cmpq   $0x3,-0x70(%rbp)
jg     143e <ls_plane+0x2ae>
mov    -0x18(%rbp),%rax
mov    -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x70(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    13f1 <ls_plane+0x261>
jmp    1443 <ls_plane+0x2b3>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <dot@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movq   $0x1,-0x70(%rbp)
mov    -0x70(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     14a9 <ls_plane+0x319>
mov    -0x8(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <dot@plt>
mov    -0x28(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x70(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1460 <ls_plane+0x2d0>
mov    -0x58(%rbp),%rdi
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
mov    %r8d,%edx
call   1080 <free_dmatrix@plt>
mov    -0x68(%rbp),%rdi
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
mov    %r8d,%edx
call   1080 <free_dmatrix@plt>
mov    -0x60(%rbp),%rdi
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
mov    %r8d,%edx
call   1080 <free_dmatrix@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_plane>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x28(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,%r12
mov    %rdi,%r15
mov    %rsi,0x18(%rsp)
cmp    $0x2,%rsi
jg     11ca <ls_plane+0x3a>
lea    0xe5b(%rip),%rdi
call   1050 <nrerror@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1070 <dmatrix@plt>
mov    %rax,%rbx
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1070 <dmatrix@plt>
mov    %rax,%rbp
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1070 <dmatrix@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %r15,(%rsp)
mov    %r15,%rsi
mov    0x18(%rsp),%rdx
mov    $0x3,%ecx
mov    %rbx,%r8
call   1060 <cov_matrix@plt>
lea    0x30(%rsp),%rdx
mov    %rbx,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %rbp,%rcx
call   1040 <jacobi@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1090 <identity_matrix@plt>
mov    $0x1,%r15d
nopw   0x0(%rax,%rax,1)
mov    $0x1,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%rbp,%r15,8),%rax
movsd  (%rax,%r13,8),%xmm0
mov    (%r14,%r15,8),%rax
movsd  (%rax,%r13,8),%xmm1
call   10a0 <ddiff@plt>
cmp    $0x2,%r13
ja     12ae <ls_plane+0x11e>
add    $0x1,%r13
ucomisd 0xd54(%rip),%xmm0
jbe    1280 <ls_plane+0xf0>
cmp    $0x2,%r15
ja     12c2 <ls_plane+0x132>
add    $0x1,%r15
ucomisd 0xd40(%rip),%xmm0
jbe    1270 <ls_plane+0xe0>
ucomisd 0xd36(%rip),%xmm0
ja     12e8 <ls_plane+0x158>
xorpd  %xmm0,%xmm0
movupd %xmm0,0x8(%r12)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x18(%r12)
jmp    1318 <ls_plane+0x188>
mov    0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%r12)
mov    0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x10(%r12)
mov    0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x18(%r12)
mov    0x10(%rsp),%r13
mov    (%rsp),%rdi
mov    0x8(%rsp),%r15
mov    0x18(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x3,%edx
mov    %r15,%rcx
call   10b0 <ave_dmatrix@plt>
movsd  0x18(%r12),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1371 <ls_plane+0x1e1>
movupd 0x8(%r12),%xmm1
movapd 0xcb5(%rip),%xmm2
xorpd  %xmm2,%xmm1
movupd %xmm1,0x8(%r12)
xorpd  %xmm2,%xmm0
movlpd %xmm0,0x18(%r12)
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <dot@plt>
movsd  %xmm0,0x0(%r13)
test   %rbx,%rbx
mov    (%rsp),%rdx
jle    13bb <ls_plane+0x22b>
mov    %rbx,%r15
xor    %ebx,%ebx
mov    0x8(%rdx,%rbx,8),%rdi
mov    %r12,%rsi
call   1030 <dot@plt>
mov    0x28(%rsp),%rsi
mov    (%rsp),%rdx
subsd  0x0(%r13),%xmm0
movsd  %xmm0,0x8(%rsi,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1390 <ls_plane+0x200>
mov    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   1080 <free_dmatrix@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   1080 <free_dmatrix@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   1080 <free_dmatrix@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"too few atoms for least-squares fitting\00"
define void @ls_plane(double** %0, i64 %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca double**
%8 = alloca i64
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca [4 x double]
%14 = alloca double**
%15 = alloca double**
%16 = alloca double**
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
store double** %0, double*** %7
store i64 %1, i64* %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store i64 0, i64* %19
%20 = load i64, i64* %8
%21 = icmp slt i64 %20, 3
br i1 %21, label %22, label %24
22: ; preds = %6
%23 = call i32 @nrerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %6
%25 = call double** @dmatrix(i32 1, i32 3, i32 1, i32 3)
store double** %25, double*** %14
%26 = call double** @dmatrix(i32 1, i32 3, i32 1, i32 3)
store double** %26, double*** %16
%27 = call double** @dmatrix(i32 1, i32 3, i32 1, i32 3)
store double** %27, double*** %15
%28 = load double**, double*** %7
%29 = load double**, double*** %7
%30 = load i64, i64* %8
%31 = load double**, double*** %14
%32 = call i32 @cov_matrix(double** %28, double** %29, i64 %30, i32 3, double** %31)
%33 = load double**, double*** %14
%34 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%35 = load double**, double*** %16
%36 = call i32 @jacobi(double** %33, i32 3, double* %34, double** %35)
%37 = load double**, double*** %15
%38 = call i32 @identity_matrix(double** %37, i32 3)
store i64 1, i64* %17
br label %39
39: ; preds = %81, %24
%40 = load i64, i64* %17
%41 = icmp sle i64 %40, 3
br i1 %41, label %42, label %46
42: ; preds = %39
%43 = load i64, i64* %19
%44 = icmp ne i64 %43, 0
%45 = xor i1 %44, true
br label %46
46: ; preds = %42, %39
%47 = phi i1 [ false, %39 ], [ %45, %42 ]
br i1 %47, label %48, label %84
48: ; preds = %46
store i64 1, i64* %18
br label %49
49: ; preds = %77, %48
%50 = load i64, i64* %18
%51 = icmp sle i64 %50, 3
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = load i64, i64* %19
%54 = icmp ne i64 %53, 0
%55 = xor i1 %54, true
br label %56
56: ; preds = %52, %49
%57 = phi i1 [ false, %49 ], [ %55, %52 ]
br i1 %57, label %58, label %80
58: ; preds = %56
%59 = load double**, double*** %16
%60 = load i64, i64* %17
%61 = getelementptr inbounds double*, double** %59, i64 %60
%62 = load double*, double** %61
%63 = load i64, i64* %18
%64 = getelementptr inbounds double, double* %62, i64 %63
%65 = load double, double* %64
%66 = load double**, double*** %15
%67 = load i64, i64* %17
%68 = getelementptr inbounds double*, double** %66, i64 %67
%69 = load double*, double** %68
%70 = load i64, i64* %18
%71 = getelementptr inbounds double, double* %69, i64 %70
%72 = load double, double* %71
%73 = call double @ddiff(double %65, double %72)
%74 = fcmp ogt double %73, 0x3E7AD7F29ABCAF48
br i1 %74, label %75, label %76
75: ; preds = %58
store i64 1, i64* %19
br label %76
76: ; preds = %75, %58
br label %77
77: ; preds = %76
%78 = load i64, i64* %18
%79 = add nsw i64 %78, 1
store i64 %79, i64* %18
br label %49
80: ; preds = %56
br label %81
81: ; preds = %80
%82 = load i64, i64* %17
%83 = add nsw i64 %82, 1
store i64 %83, i64* %17
br label %39
84: ; preds = %46
%85 = load i64, i64* %19
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %105
87: ; preds = %84
store i64 1, i64* %17
br label %88
88: ; preds = %101, %87
%89 = load i64, i64* %17
%90 = icmp sle i64 %89, 3
br i1 %90, label %91, label %104
91: ; preds = %88
%92 = load double**, double*** %16
%93 = load i64, i64* %17
%94 = getelementptr inbounds double*, double** %92, i64 %93
%95 = load double*, double** %94
%96 = getelementptr inbounds double, double* %95, i64 1
%97 = load double, double* %96
%98 = load double*, double** %9
%99 = load i64, i64* %17
%100 = getelementptr inbounds double, double* %98, i64 %99
store double %97, double* %100
br label %101
101: ; preds = %91
%102 = load i64, i64* %17
%103 = add nsw i64 %102, 1
store i64 %103, i64* %17
br label %88
104: ; preds = %88
br label %112
105: ; preds = %84
%106 = load double*, double** %9
%107 = getelementptr inbounds double, double* %106, i64 1
store double 0.000000e+00, double* %107
%108 = load double*, double** %9
%109 = getelementptr inbounds double, double* %108, i64 2
store double 0.000000e+00, double* %109
%110 = load double*, double** %9
%111 = getelementptr inbounds double, double* %110, i64 3
store double 1.000000e+00, double* %111
br label %112
112: ; preds = %105, %104
%113 = load double**, double*** %7
%114 = load i64, i64* %8
%115 = load double*, double** %10
%116 = call i32 @ave_dmatrix(double** %113, i64 %114, i32 3, double* %115)
%117 = load double*, double** %9
%118 = getelementptr inbounds double, double* %117, i64 3
%119 = load double, double* %118
%120 = fcmp olt double %119, 0.000000e+00
br i1 %120, label %121, label %138
121: ; preds = %112
store i64 1, i64* %17
br label %122
122: ; preds = %134, %121
%123 = load i64, i64* %17
%124 = icmp sle i64 %123, 3
br i1 %124, label %125, label %137
125: ; preds = %122
%126 = load double*, double** %9
%127 = load i64, i64* %17
%128 = getelementptr inbounds double, double* %126, i64 %127
%129 = load double, double* %128
%130 = fneg double %129
%131 = load double*, double** %9
%132 = load i64, i64* %17
%133 = getelementptr inbounds double, double* %131, i64 %132
store double %130, double* %133
br label %134
134: ; preds = %125
%135 = load i64, i64* %17
%136 = add nsw i64 %135, 1
store i64 %136, i64* %17
br label %122
137: ; preds = %122
br label %138
138: ; preds = %137, %112
%139 = load double*, double** %10
%140 = load double*, double** %9
%141 = call double @dot(double* %139, double* %140)
%142 = load double*, double** %11
store double %141, double* %142
store i64 1, i64* %17
br label %143
143: ; preds = %160, %138
%144 = load i64, i64* %17
%145 = load i64, i64* %8
%146 = icmp sle i64 %144, %145
br i1 %146, label %147, label %163
147: ; preds = %143
%148 = load double**, double*** %7
%149 = load i64, i64* %17
%150 = getelementptr inbounds double*, double** %148, i64 %149
%151 = load double*, double** %150
%152 = load double*, double** %9
%153 = call double @dot(double* %151, double* %152)
%154 = load double*, double** %11
%155 = load double, double* %154
%156 = fsub double %153, %155
%157 = load double*, double** %12
%158 = load i64, i64* %17
%159 = getelementptr inbounds double, double* %157, i64 %158
store double %156, double* %159
br label %160
160: ; preds = %147
%161 = load i64, i64* %17
%162 = add nsw i64 %161, 1
store i64 %162, i64* %17
br label %143
163: ; preds = %143
%164 = load double**, double*** %14
%165 = call i32 @free_dmatrix(double** %164, i32 1, i32 3, i32 1, i32 3)
%166 = load double**, double*** %16
%167 = call i32 @free_dmatrix(double** %166, i32 1, i32 3, i32 1, i32 3)
%168 = load double**, double*** %15
%169 = call i32 @free_dmatrix(double** %168, i32 1, i32 3, i32 1, i32 3)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"too few atoms for least-squares fitting\00"
define void @ls_plane(double** %0, i64 %1, double* %2, double* %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = alloca [4 x double]
%8 = bitcast [4 x double]* %7 to i8*
%9 = icmp slt i64 %1, 3
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @nrerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = tail call double** @dmatrix(i32 1, i32 3, i32 1, i32 3)
%14 = tail call double** @dmatrix(i32 1, i32 3, i32 1, i32 3)
%15 = tail call double** @dmatrix(i32 1, i32 3, i32 1, i32 3)
%16 = tail call i32 @cov_matrix(double** %0, double** %0, i64 %1, i32 3, double** %13)
%17 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%18 = call i32 @jacobi(double** %13, i32 3, double* %17, double** %14)
%19 = call i32 @identity_matrix(double** %15, i32 3)
br label %20
20: ; preds = %12, %37
%21 = phi i64 [ 1, %12 ], [ %38, %37 ]
%22 = getelementptr inbounds double*, double** %14, i64 %21
%23 = getelementptr inbounds double*, double** %15, i64 %21
br label %24
24: ; preds = %20, %24
%25 = phi i64 [ 1, %20 ], [ %34, %24 ]
%26 = load double*, double** %22
%27 = getelementptr inbounds double, double* %26, i64 %25
%28 = load double, double* %27
%29 = load double*, double** %23
%30 = getelementptr inbounds double, double* %29, i64 %25
%31 = load double, double* %30
%32 = call double @ddiff(double %28, double %31)
%33 = fcmp ule double %32, 0x3E7AD7F29ABCAF48
%34 = add nuw nsw i64 %25, 1
%35 = icmp ult i64 %25, 3
%36 = select i1 %35, i1 %33, i1 false
br i1 %36, label %24, label %37
37: ; preds = %24
%38 = add nuw nsw i64 %21, 1
%39 = icmp ult i64 %21, 3
%40 = select i1 %39, i1 %33, i1 false
br i1 %40, label %20, label %41
41: ; preds = %37
br i1 %33, label %58, label %42
42: ; preds = %41
%43 = getelementptr inbounds double*, double** %14, i64 1
%44 = load double*, double** %43
%45 = getelementptr inbounds double, double* %44, i64 1
%46 = load double, double* %45
%47 = getelementptr inbounds double, double* %2, i64 1
store double %46, double* %47
%48 = getelementptr inbounds double*, double** %14, i64 2
%49 = load double*, double** %48
%50 = getelementptr inbounds double, double* %49, i64 1
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %2, i64 2
store double %51, double* %52
%53 = getelementptr inbounds double*, double** %14, i64 3
%54 = load double*, double** %53
%55 = getelementptr inbounds double, double* %54, i64 1
%56 = load double, double* %55
%57 = getelementptr inbounds double, double* %2, i64 3
store double %56, double* %57
br label %62
58: ; preds = %41
%59 = getelementptr inbounds double, double* %2, i64 1
%60 = getelementptr inbounds double, double* %2, i64 3
%61 = bitcast double* %59 to i8*
store double 1.000000e+00, double* %60
br label %62
62: ; preds = %42, %58
%63 = call i32 @ave_dmatrix(double** %0, i64 %1, i32 3, double* %3)
%64 = getelementptr inbounds double, double* %2, i64 3
%65 = load double, double* %64
%66 = fcmp olt double %65, 0.000000e+00
br i1 %66, label %67, label %74
67: ; preds = %62
%68 = getelementptr inbounds double, double* %2, i64 1
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = fneg <2 x double> %70
%72 = bitcast double* %68 to <2 x double>*
store <2 x double> %71, <2 x double>* %72
%73 = fneg double %65
store double %73, double* %64
br label %74
74: ; preds = %67, %62
%75 = call double @dot(double* %3, double* %2)
store double %75, double* %4
%76 = icmp slt i64 %1, 1
br i1 %76, label %87, label %77
77: ; preds = %74, %77
%78 = phi i64 [ %85, %77 ], [ 1, %74 ]
%79 = getelementptr inbounds double*, double** %0, i64 %78
%80 = load double*, double** %79
%81 = call double @dot(double* %80, double* %2)
%82 = load double, double* %4
%83 = fsub double %81, %82
%84 = getelementptr inbounds double, double* %5, i64 %78
store double %83, double* %84
%85 = add nuw i64 %78, 1
%86 = icmp eq i64 %78, %1
br i1 %86, label %87, label %77
87: ; preds = %77, %74
%88 = call i32 @free_dmatrix(double** %13, i32 1, i32 3, i32 1, i32 3)
%89 = call i32 @free_dmatrix(double** %14, i32 1, i32 3, i32 1, i32 3)
%90 = call i32 @free_dmatrix(double** %15, i32 1, i32 3, i32 1, i32 3)
ret void
}