#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ calloc(size_t, int);
float fabs(float);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ loadLowerMatrix(float *, size_t, char const *);
int /*<<< orphan*/ loadTorgeirUpperMatrix(float *, size_t, char const *);
float meanf(float *, size_t);
int /*<<< orphan*/ printf(char *);
float sqrt(float);
float stdf(float *, size_t);
void computeCLR(const char *nvalf, size_t ngenes, const char *nclrf,
                int inputftype) {
  int i, j;
  float *v = (float *)calloc(ngenes * (ngenes - 1) / 2, sizeof(float));
  if (inputftype == 0)
    loadTorgeirUpperMatrix(v, ngenes, nvalf);
  if (inputftype == 1)
    loadLowerMatrix(v, ngenes, nvalf);
  float *m = (float *)calloc(ngenes, sizeof(float));
  float *s = (float *)calloc(ngenes, sizeof(float));
  for (i = 0; i < ngenes; i++) {
    float *tv = (float *)calloc(ngenes, sizeof(float));
    for (j = 0; j < i; j++)
      tv[j] = fabs(v[i * (i - 1) / 2 + j]);
    tv[i] = 0;
    for (j = i + 1; j < ngenes; j++)
      tv[j] = fabs(v[j * (j - 1) / 2 + i]);
    m[i] = meanf(tv, ngenes);
    s[i] = stdf(tv, ngenes);
    free(tv);
  }
  FILE *fo;
  fo = fopen(nclrf, "w");
  for (i = 0; i < ngenes; i++) {
    for (j = 0; j < i; j++) {
      float c = fabs(v[i * (i - 1) / 2 + j]);
      float zi = (c - m[i]) / s[i];
      float zj = (c - m[j]) / s[j];
      if (zi < 0)
        zi = 0;
      if (zj < 0)
        zj = 0;
      float z = sqrt(zi * zi + zj * zj);
      fprintf(fo, "%f", z);
      if (j < i)
        fprintf(fo, " ");
    }
    if (i > 0)
      fprintf(fo, "\n");
  }
  fclose(fo);
  free(m);
  free(s);
  free(v);
  printf("Done computing CLR matrix!\n");
}


x86 assembly (clang, -O0):
<computeCLR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
imul   %rax,%rdi
shr    $0x1,%rdi
mov    $0x4,%esi
call   1090 <calloc@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1217 <computeCLR+0x57>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   10d0 <loadTorgeirUpperMatrix@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1232 <computeCLR+0x72>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <loadLowerMatrix@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1090 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1090 <calloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x20(%rbp)
movslq -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    139c <computeCLR+0x1dc>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1090 <calloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12dd <computeCLR+0x11d>
mov    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
call   10a0 <fabs@plt>
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1284 <computeCLR+0xc4>
mov    -0x48(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1351 <computeCLR+0x191>
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
call   10a0 <fabs@plt>
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12f6 <computeCLR+0x136>
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <meanf@plt>
mov    -0x38(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <stdf@plt>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    125d <computeCLR+0x9d>
mov    -0x18(%rbp),%rdi
lea    0xc59(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x20(%rbp)
movslq -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1522 <computeCLR+0x362>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    14f3 <computeCLR+0x333>
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x78(%rbp),%rax
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
call   10a0 <fabs@plt>
movss  %xmm0,-0x54(%rbp)
movss  -0x54(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x20(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
divss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x54(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
divss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x5c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x58(%rbp),%xmm0
jbe    146c <computeCLR+0x2ac>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x5c(%rbp),%xmm0
jbe    1481 <computeCLR+0x2c1>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x58(%rbp),%xmm0
movss  -0x58(%rbp),%xmm2
movss  -0x5c(%rbp),%xmm1
mulss  -0x5c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   10e0 <sqrt@plt>
movss  %xmm0,-0x60(%rbp)
mov    -0x50(%rbp),%rdi
movss  -0x60(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb47(%rip),%rsi
mov    $0x1,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    14e0 <computeCLR+0x320>
mov    -0x50(%rbp),%rdi
lea    0xb2c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    14e5 <computeCLR+0x325>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13cc <computeCLR+0x20c>
cmpl   $0x0,-0x20(%rbp)
jle    150f <computeCLR+0x34f>
mov    -0x50(%rbp),%rdi
lea    0xb19(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1514 <computeCLR+0x354>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13b7 <computeCLR+0x1f7>
mov    -0x50(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xaba(%rip),%rdi
call   1070 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeCLR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %ecx,%ebp
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%r14
lea    -0x1(%rsi),%rdi
imul   %rsi,%rdi
shr    %rdi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%r15
cmp    $0x1,%ebp
mov    %rbx,0x8(%rsp)
je     1214 <computeCLR+0x54>
test   %ebp,%ebp
jne    1222 <computeCLR+0x62>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10d0 <loadTorgeirUpperMatrix@plt>
mov    0x8(%rsp),%rbx
jmp    1222 <computeCLR+0x62>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <loadLowerMatrix@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%r12
mov    0x8(%rsp),%rdi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    0x8(%rsp),%rdi
mov    %rax,%rbx
test   %rdi,%rdi
je     15dd <computeCLR+0x41d>
mov    %r13,0x18(%rsp)
lea    0x30(%r15),%rax
mov    %rax,0x20(%rsp)
lea    0x4(%r15),%rax
mov    %rax,0x28(%rsp)
movq   $0xfffffffffffffff8,0x10(%rsp)
ff ff
xor    %r13d,%r13d
jmp    12c0 <computeCLR+0x100>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1050 <meanf@plt>
movss  %xmm0,(%r12,%r13,4)
mov    %rbp,%rdi
mov    0x8(%rsp),%rsi
call   1080 <stdf@plt>
movss  %xmm0,(%rbx,%r13,4)
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
addq   $0x1,0x10(%rsp)
mov    %r14,%r13
cmp    %rdi,%r14
je     1488 <computeCLR+0x2c8>
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%rbp
test   %r13,%r13
movaps 0xd29(%rip),%xmm2
je     1430 <computeCLR+0x270>
lea    -0x1(%r13),%eax
imul   %r13d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
cmp    $0x8,%r13
jb     1318 <computeCLR+0x158>
lea    (%r15,%r13,4),%rcx
lea    (%rcx,%rax,4),%rcx
cmp    %rcx,%rbp
jae    137b <computeCLR+0x1bb>
lea    0x0(,%r13,4),%rcx
add    %rbp,%rcx
lea    (%r15,%rax,4),%rdx
cmp    %rcx,%rdx
jae    137b <computeCLR+0x1bb>
xor    %ecx,%ecx
mov    %rcx,%rdx
or     $0x1,%rdx
test   $0x1,%r13b
je     133d <computeCLR+0x17d>
lea    (%rcx,%rax,1),%rsi
movss  (%r15,%rsi,4),%xmm0
andps  %xmm2,%xmm0
movss  %xmm0,0x0(%rbp,%rcx,4)
mov    %rdx,%rcx
cmp    %rdx,%r13
je     1430 <computeCLR+0x270>
mov    0x28(%rsp),%rdx
lea    (%rdx,%rax,4),%rax
nop
movss  -0x4(%rax,%rcx,4),%xmm0
andps  %xmm2,%xmm0
movss  %xmm0,0x0(%rbp,%rcx,4)
movss  (%rax,%rcx,4),%xmm0
andps  %xmm2,%xmm0
movss  %xmm0,0x4(%rbp,%rcx,4)
add    $0x2,%rcx
cmp    %rcx,%r13
jne    1350 <computeCLR+0x190>
jmp    1430 <computeCLR+0x270>
lea    -0x8(%r13),%rcx
mov    %rcx,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
cmp    $0x8,%rcx
jae    1394 <computeCLR+0x1d4>
xor    %esi,%esi
jmp    13ed <computeCLR+0x22d>
mov    0x10(%rsp),%rcx
shr    $0x3,%rcx
add    $0x1,%rcx
and    $0xfffffffffffffffe,%rcx
mov    0x20(%rsp),%rsi
lea    (%rsi,%rax,4),%rdi
xor    %esi,%esi
movups -0x30(%rdi,%rsi,4),%xmm0
movups -0x20(%rdi,%rsi,4),%xmm1
andps  %xmm2,%xmm0
andps  %xmm2,%xmm1
movups %xmm0,0x0(%rbp,%rsi,4)
movups %xmm1,0x10(%rbp,%rsi,4)
movups -0x10(%rdi,%rsi,4),%xmm0
movups (%rdi,%rsi,4),%xmm1
andps  %xmm2,%xmm0
andps  %xmm2,%xmm1
movups %xmm0,0x20(%rbp,%rsi,4)
movups %xmm1,0x30(%rbp,%rsi,4)
add    $0x10,%rsi
add    $0xfffffffffffffffe,%rcx
jne    13b0 <computeCLR+0x1f0>
mov    %r13,%rcx
and    $0xfffffffffffffff8,%rcx
test   $0x1,%dl
je     1418 <computeCLR+0x258>
lea    (%rsi,%rax,1),%rdx
movups (%r15,%rdx,4),%xmm0
movups 0x10(%r15,%rdx,4),%xmm1
andps  %xmm2,%xmm0
andps  %xmm2,%xmm1
movups %xmm0,0x0(%rbp,%rsi,4)
movups %xmm1,0x10(%rbp,%rsi,4)
cmp    %rcx,%r13
jne    131a <computeCLR+0x15a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movl   $0x0,0x0(%rbp,%r13,4)
lea    0x1(%r13),%r14
mov    0x8(%rsp),%rsi
cmp    %rsi,%r14
jae    1280 <computeCLR+0xc0>
mov    %r13,%rax
xchg   %ax,%ax
lea    0x1(%rax),%rcx
mov    %eax,%edx
imul   %ecx,%edx
mov    %edx,%edi
shr    $0x1f,%edi
add    %edx,%edi
sar    %edi
add    %r13d,%edi
movslq %edi,%rdx
movss  (%r15,%rdx,4),%xmm0
andps  %xmm2,%xmm0
movss  %xmm0,0x4(%rbp,%rax,4)
add    $0x2,%rax
cmp    %rsi,%rax
mov    %rcx,%rax
jb     1450 <computeCLR+0x290>
jmp    1280 <computeCLR+0xc0>
lea    0xb91(%rip),%rsi
mov    0x18(%rsp),%rdi
call   10c0 <fopen@plt>
mov    0x8(%rsp),%rcx
mov    %rax,%rbp
test   %rcx,%rcx
je     15ef <computeCLR+0x42f>
xor    %r14d,%r14d
movdqa 0xb4b(%rip),%xmm1
mov    %r15,0x30(%rsp)
jmp    14cd <computeCLR+0x30d>
nopl   0x0(%rax)
add    $0x1,%r14
cmp    %rcx,%r14
je     15ef <computeCLR+0x42f>
test   %r14,%r14
je     14c0 <computeCLR+0x300>
lea    -0x1(%r14),%eax
imul   %r14d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
lea    (%r15,%rax,4),%r13
xor    %r15d,%r15d
jmp    1531 <computeCLR+0x371>
nop
call   10e0 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
lea    0xb1f(%rip),%rsi
mov    $0x1,%al
call   10b0 <fprintf@plt>
mov    $0x20,%edi
mov    %rbp,%rsi
call   1090 <fputc@plt>
add    $0x1,%r15
cmp    %r15,%r14
mov    0x8(%rsp),%rcx
movdqa 0xad5(%rip),%xmm1
je     15b0 <computeCLR+0x3f0>
movd   0x0(%r13,%r15,4),%xmm0
pand   %xmm1,%xmm0
pshufd $0x0,%xmm0,%xmm1
movss  (%r12,%r14,4),%xmm0
movss  (%r12,%r15,4),%xmm2
unpcklps %xmm0,%xmm2
subps  %xmm2,%xmm1
movss  (%rbx,%r14,4),%xmm0
movss  (%rbx,%r15,4),%xmm2
unpcklps %xmm0,%xmm2
divps  %xmm2,%xmm1
movaps %xmm1,%xmm0
cmpltps 0xaa0(%rip),%xmm0
01
unpcklps %xmm0,%xmm0
movmskpd %xmm0,%eax
xorps  %xmm2,%xmm2
xorps  %xmm0,%xmm0
test   $0x2,%al
jne    1588 <computeCLR+0x3c8>
movaps %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm0
xorps  %xmm3,%xmm3
test   $0x1,%al
jne    1592 <computeCLR+0x3d2>
movaps %xmm1,%xmm3
mulss  %xmm3,%xmm3
mulss  %xmm0,%xmm0
addss  %xmm3,%xmm0
ucomiss %xmm2,%xmm0
jb     14f0 <computeCLR+0x330>
sqrtss %xmm0,%xmm0
jmp    14f5 <computeCLR+0x335>
test   %r14,%r14
mov    0x30(%rsp),%r15
je     14c0 <computeCLR+0x300>
mov    $0xa,%edi
mov    %rbp,%rsi
call   1090 <fputc@plt>
movdqa 0xa2d(%rip),%xmm1
mov    0x8(%rsp),%rcx
jmp    14c0 <computeCLR+0x300>
lea    0xa3c(%rip),%rsi
mov    %r13,%rdi
call   10c0 <fopen@plt>
mov    %rax,%rbp
mov    %rbp,%rdi
call   1070 <fclose@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xa0f(%rip),%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <puts@plt>

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

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