#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fatalx(char *, ...);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printmat(double *, int, int);
int /*<<< orphan*/ printnl();
double sqrt(double);
double conchiv(double *a, int m, int n) {
  double *rsum, *csum, ee, tot = 0, chsq = 0, y;
  int i, j, k;
  if ((rsum = (double *)calloc((m), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", m);
  if ((csum = (double *)calloc((n), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", n);
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      k = i * n + j;
      rsum[i] += a[k];
      csum[j] += a[k];
      tot += a[k];
    }
  }
  if (tot < 0.001)
    fatalx("(conchiv) no data\n");
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      k = i * n + j;
      ee = rsum[i] * csum[j] / tot;
      if (ee < 1.0e-12) {
        printf("bad conchi\n");
        printmat(a, m, n);
        fatalx("(conchiv) zero row or column sum\n");
      }
      y = a[k] - ee;
      printf("conchiv: %4d %4d ", i, j);
      printf("%9.3f ", a[k]);
      printf("%9.3f   ", ee);
      printf("%9.3f ", y);
      printf("%9.3f ", y / sqrt(ee));
      printnl();
      chsq += (y * y) / ee;
    }
  }
  free(rsum);
  free(csum);
  return chsq;
}


x86 assembly (clang, -O0):
<conchiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11be <conchiv+0x4e>
mov    -0xc(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x10(%rbp),%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11ea <conchiv+0x7a>
mov    -0x10(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1293 <conchiv+0x123>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1280 <conchiv+0x110>
mov    -0x44(%rbp),%eax
imul   -0x10(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1204 <conchiv+0x94>
jmp    1285 <conchiv+0x115>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11f1 <conchiv+0x81>
movsd  0xd65(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    12b4 <conchiv+0x144>
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1424 <conchiv+0x2b4>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1411 <conchiv+0x2a1>
mov    -0x44(%rbp),%eax
imul   -0x10(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xcf5(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1349 <conchiv+0x1d9>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <printmat@plt>
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd04(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xcf8(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xcde(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
lea    0xcb0(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1060 <printnl@plt>
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12ce <conchiv+0x15e>
jmp    1416 <conchiv+0x2a6>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12bb <conchiv+0x14b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x38(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conchiv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %edx,%r12d
mov    %rdi,0x18(%rsp)
mov    %esi,0x4(%rsp)
mov    %esi,%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    11c0 <conchiv+0x40>
lea    0xe63(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r12d,%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11e6 <conchiv+0x66>
lea    0xe3c(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r12d,%r13d
movslq %r12d,%r14
mov    0x4(%rsp),%eax
mov    %eax,%r15d
test   %eax,%eax
jle    1447 <conchiv+0x2c7>
lea    0x0(,%r14,8),%rax
xorpd  %xmm1,%xmm1
xor    %ecx,%ecx
mov    0x18(%rsp),%rdx
jmp    121c <conchiv+0x9c>
add    $0x1,%rcx
add    %rax,%rdx
cmp    %r15,%rcx
je     1260 <conchiv+0xe0>
test   %r12d,%r12d
jle    1210 <conchiv+0x90>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdx,%rsi,8),%xmm0
addsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rcx,8)
movsd  (%rdx,%rsi,8),%xmm0
addsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,(%rbx,%rsi,8)
addsd  (%rdx,%rsi,8),%xmm1
add    $0x1,%rsi
cmp    %rsi,%r13
jne    1230 <conchiv+0xb0>
jmp    1210 <conchiv+0x90>
movsd  0xd98(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     144b <conchiv+0x2cb>
cmpl   $0x0,0x4(%rsp)
jle    1470 <conchiv+0x2f0>
mov    %r15,0x48(%rsp)
shl    $0x3,%r14
mov    %r14,0x50(%rsp)
mov    0x18(%rsp),%rax
mov    %rax,0x28(%rsp)
xor    %esi,%esi
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12d,0x3c(%rsp)
movsd  %xmm1,0x20(%rsp)
jmp    12d3 <conchiv+0x153>
xchg   %ax,%ax
add    $0x1,%rsi
mov    0x28(%rsp),%rax
add    0x50(%rsp),%rax
mov    %rax,0x28(%rsp)
cmp    0x48(%rsp),%rsi
mov    0x3c(%rsp),%r12d
je     147a <conchiv+0x2fa>
test   %r12d,%r12d
jle    12b0 <conchiv+0x130>
xor    %r12d,%r12d
mov    %rsi,0x40(%rsp)
jmp    1361 <conchiv+0x1e1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm1,%xmm0
call   10a0 <sqrt@plt>
mov    %rbx,%r13
mov    %r15,%rbp
mov    %r14,%rbx
movsd  0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
lea    0xd75(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
xor    %eax,%eax
call   1070 <printnl@plt>
movsd  0x30(%rsp),%xmm0
mulsd  %xmm0,%xmm0
divsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x1,%r12
cmp    %r12,%r13
movsd  0x20(%rsp),%xmm1
mov    0x40(%rsp),%rsi
je     12b0 <conchiv+0x130>
mov    %rbp,%r15
movsd  0x0(%rbp,%rsi,8),%xmm2
mov    %rbx,%r14
mulsd  (%rbx,%r12,8),%xmm2
divsd  %xmm1,%xmm2
movsd  0xc89(%rip),%xmm0
ucomisd %xmm2,%xmm0
movsd  %xmm2,0x10(%rsp)
jbe    13c1 <conchiv+0x241>
lea    0xd06(%rip),%rdi
call   1050 <puts@plt>
mov    0x18(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    %r13d,%edx
call   1060 <printmat@plt>
lea    0xca5(%rip),%rdi
xor    %eax,%eax
call   1040 <fatalx@plt>
movsd  0x10(%rsp),%xmm2
mov    0x40(%rsp),%rsi
mov    %r13,%rbx
mov    0x28(%rsp),%rbp
movsd  0x0(%rbp,%r12,8),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0xc95(%rip),%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
movsd  0x0(%rbp,%r12,8),%xmm0
lea    0xc8f(%rip),%r13
mov    %r13,%rdi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xc85(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
mov    %r13,%rdi
movsd  0x30(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
movsd  0x10(%rsp),%xmm1
ucomisd 0xbdb(%rip),%xmm1
jb     12f0 <conchiv+0x170>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    12f9 <conchiv+0x179>
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
lea    0xbe9(%rip),%rdi
xor    %eax,%eax
call   1040 <fatalx@plt>
movsd  0x20(%rsp),%xmm1
cmpl   $0x0,0x4(%rsp)
jg     127d <conchiv+0xfd>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
@.str.1 = [19 x i8] c"(conchiv) no data\0A\00"
@.str.2 = [12 x i8] c"bad conchi\0A\00"
@.str.3 = [34 x i8] c"(conchiv) zero row or column sum\0A\00"
@.str.4 = [18 x i8] c"conchiv: %4d %4d \00"
@.str.5 = [7 x i8] c"%9.3f \00"
@.str.6 = [9 x i8] c"%9.3f \00"
define double @conchiv(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %11
%16 = load i32, i32* %5
%17 = call i64 @calloc(i32 %16, i32 8)
%18 = inttoptr i64 %17 to double*
store double* %18, double** %7
%19 = icmp eq double* %18, null
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %3
%24 = load i32, i32* %6
%25 = call i64 @calloc(i32 %24, i32 8)
%26 = inttoptr i64 %25 to double*
store double* %26, double** %8
%27 = icmp eq double* %26, null
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* %6
%30 = call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %23
store i32 0, i32* %13
br label %32
32: ; preds = %80, %31
%33 = load i32, i32* %13
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %83
36: ; preds = %32
store i32 0, i32* %14
br label %37
37: ; preds = %76, %36
%38 = load i32, i32* %14
%39 = load i32, i32* %6
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %79
41: ; preds = %37
%42 = load i32, i32* %13
%43 = load i32, i32* %6
%44 = mul nsw i32 %42, %43
%45 = load i32, i32* %14
%46 = add nsw i32 %44, %45
store i32 %46, i32* %15
%47 = load double*, double** %4
%48 = load i32, i32* %15
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %7
%53 = load i32, i32* %13
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = fadd double %56, %51
store double %57, double* %55
%58 = load double*, double** %4
%59 = load i32, i32* %15
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = load double*, double** %8
%64 = load i32, i32* %14
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = fadd double %67, %62
store double %68, double* %66
%69 = load double*, double** %4
%70 = load i32, i32* %15
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = load double, double* %10
%75 = fadd double %74, %73
store double %75, double* %10
br label %76
76: ; preds = %41
%77 = load i32, i32* %14
%78 = add nsw i32 %77, 1
store i32 %78, i32* %14
br label %37
79: ; preds = %37
br label %80
80: ; preds = %79
%81 = load i32, i32* %13
%82 = add nsw i32 %81, 1
store i32 %82, i32* %13
br label %32
83: ; preds = %32
%84 = load double, double* %10
%85 = fcmp olt double %84, 1.000000e-03
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %88
88: ; preds = %86, %83
store i32 0, i32* %13
br label %89
89: ; preds = %164, %88
%90 = load i32, i32* %13
%91 = load i32, i32* %5
%92 = icmp slt i32 %90, %91
br i1 %92, label %93, label %167
93: ; preds = %89
store i32 0, i32* %14
br label %94
94: ; preds = %160, %93
%95 = load i32, i32* %14
%96 = load i32, i32* %6
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %163
98: ; preds = %94
%99 = load i32, i32* %13
%100 = load i32, i32* %6
%101 = mul nsw i32 %99, %100
%102 = load i32, i32* %14
%103 = add nsw i32 %101, %102
store i32 %103, i32* %15
%104 = load double*, double** %7
%105 = load i32, i32* %13
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = load double*, double** %8
%110 = load i32, i32* %14
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load double, double* %112
%114 = fmul double %108, %113
%115 = load double, double* %10
%116 = fdiv double %114, %115
store double %116, double* %9
%117 = load double, double* %9
%118 = fcmp olt double %117, 0x3D719799812DEA11
br i1 %118, label %119, label %126
119: ; preds = %98
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%121 = load double*, double** %4
%122 = load i32, i32* %5
%123 = load i32, i32* %6
%124 = call i32 @printmat(double* %121, i32 %122, i32 %123)
%125 = call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %126
126: ; preds = %119, %98
%127 = load double*, double** %4
%128 = load i32, i32* %15
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %127, i64 %129
%131 = load double, double* %130
%132 = load double, double* %9
%133 = fsub double %131, %132
store double %133, double* %12
%134 = load i32, i32* %13
%135 = load i32, i32* %14
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %134, i32 %135)
%137 = load double*, double** %4
%138 = load i32, i32* %15
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %137, i64 %139
%141 = load double, double* %140
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %141)
%143 = load double, double* %9
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), double %143)
%145 = load double, double* %12
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %145)
%147 = load double, double* %12
%148 = load double, double* %9
%149 = call double @sqrt(double %148)
%150 = fdiv double %147, %149
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %150)
%152 = call i32 (...) @printnl()
%153 = load double, double* %12
%154 = load double, double* %12
%155 = fmul double %153, %154
%156 = load double, double* %9
%157 = fdiv double %155, %156
%158 = load double, double* %11
%159 = fadd double %158, %157
store double %159, double* %11
br label %160
160: ; preds = %126
%161 = load i32, i32* %14
%162 = add nsw i32 %161, 1
store i32 %162, i32* %14
br label %94
163: ; preds = %94
br label %164
164: ; preds = %163
%165 = load i32, i32* %13
%166 = add nsw i32 %165, 1
store i32 %166, i32* %13
br label %89
167: ; preds = %89
%168 = load double*, double** %7
%169 = call i32 @free(double* %168)
%170 = load double*, double** %8
%171 = call i32 @free(double* %170)
%172 = load double, double* %11
ret double %172
}

LLVM IR (-O2):
@.str = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
@.str.1 = [19 x i8] c"(conchiv) no data\0A\00"
@.str.3 = [34 x i8] c"(conchiv) zero row or column sum\0A\00"
@.str.4 = [18 x i8] c"conchiv: %4d %4d \00"
@.str.5 = [7 x i8] c"%9.3f \00"
@.str.6 = [9 x i8] c"%9.3f \00"
@str = [11 x i8] c"bad conchi\00"
define double @conchiv(double* %0, i32 %1, i32 %2) {
%4 = tail call i64 @calloc(i32 %1, i32 8)
%5 = inttoptr i64 %4 to double*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %9
9: ; preds = %7, %3
%10 = tail call i64 @calloc(i32 %2, i32 8)
%11 = inttoptr i64 %10 to double*
%12 = icmp eq i64 %10, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %15
15: ; preds = %13, %9
%16 = icmp sgt i32 %1, 0
br i1 %16, label %17, label %50
17: ; preds = %15
%18 = icmp sgt i32 %2, 0
%19 = sext i32 %2 to i64
%20 = zext i32 %1 to i64
%21 = zext i32 %2 to i64
br label %22
22: ; preds = %17, %44
%23 = phi i64 [ 0, %17 ], [ %46, %44 ]
%24 = phi double [ 0.000000e+00, %17 ], [ %45, %44 ]
br i1 %18, label %25, label %44
25: ; preds = %22
%26 = mul nsw i64 %23, %19
%27 = getelementptr inbounds double, double* %5, i64 %23
br label %28
28: ; preds = %25, %28
%29 = phi i64 [ 0, %25 ], [ %42, %28 ]
%30 = phi double [ %24, %25 ], [ %41, %28 ]
%31 = add nsw i64 %29, %26
%32 = getelementptr inbounds double, double* %0, i64 %31
%33 = load double, double* %32
%34 = load double, double* %27
%35 = fadd double %33, %34
store double %35, double* %27
%36 = load double, double* %32
%37 = getelementptr inbounds double, double* %11, i64 %29
%38 = load double, double* %37
%39 = fadd double %36, %38
store double %39, double* %37
%40 = load double, double* %32
%41 = fadd double %30, %40
%42 = add nuw nsw i64 %29, 1
%43 = icmp eq i64 %42, %21
br i1 %43, label %44, label %28
44: ; preds = %28, %22
%45 = phi double [ %24, %22 ], [ %41, %28 ]
%46 = add nuw nsw i64 %23, 1
%47 = icmp eq i64 %46, %20
br i1 %47, label %48, label %22
48: ; preds = %44
%49 = fcmp olt double %45, 1.000000e-03
br i1 %49, label %50, label %53
50: ; preds = %15, %48
%51 = phi double [ %45, %48 ], [ 0.000000e+00, %15 ]
%52 = tail call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %50, %48
%54 = phi double [ %51, %50 ], [ %45, %48 ]
br i1 %16, label %55, label %104
55: ; preds = %53
%56 = icmp sgt i32 %2, 0
%57 = sext i32 %2 to i64
%58 = zext i32 %1 to i64
%59 = zext i32 %2 to i64
br label %60
60: ; preds = %55, %100
%61 = phi i64 [ 0, %55 ], [ %102, %100 ]
%62 = phi double [ 0.000000e+00, %55 ], [ %101, %100 ]
br i1 %56, label %63, label %100
63: ; preds = %60
%64 = mul nsw i64 %61, %57
%65 = getelementptr inbounds double, double* %5, i64 %61
%66 = trunc i64 %61 to i32
br label %67
67: ; preds = %63, %81
%68 = phi i64 [ 0, %63 ], [ %98, %81 ]
%69 = phi double [ %62, %63 ], [ %97, %81 ]
%70 = add nsw i64 %68, %64
%71 = load double, double* %65
%72 = getelementptr inbounds double, double* %11, i64 %68
%73 = load double, double* %72
%74 = fmul double %71, %73
%75 = fdiv double %74, %54
%76 = fcmp olt double %75, 0x3D719799812DEA11
br i1 %76, label %77, label %81
77: ; preds = %67
%78 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%79 = tail call i32 @printmat(double* %0, i32 %1, i32 %2)
%80 = tail call i32 (i8*, ...) @fatalx(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %81
81: ; preds = %77, %67
%82 = getelementptr inbounds double, double* %0, i64 %70
%83 = load double, double* %82
%84 = fsub double %83, %75
%85 = trunc i64 %68 to i32
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %66, i32 %85)
%87 = load double, double* %82
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %87)
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), double %75)
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %84)
%91 = tail call double @sqrt(double %75)
%92 = fdiv double %84, %91
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %92)
%94 = tail call i32 (...) @printnl()
%95 = fmul double %84, %84
%96 = fdiv double %95, %75
%97 = fadd double %69, %96
%98 = add nuw nsw i64 %68, 1
%99 = icmp eq i64 %98, %59
br i1 %99, label %100, label %67
100: ; preds = %81, %60
%101 = phi double [ %62, %60 ], [ %97, %81 ]
%102 = add nuw nsw i64 %61, 1
%103 = icmp eq i64 %102, %58
br i1 %103, label %104, label %60
104: ; preds = %100, %53
%105 = phi double [ 0.000000e+00, %53 ], [ %101, %100 ]
%106 = tail call i32 @free(double* %5)
%107 = tail call i32 @free(double* %11)
ret double %105
}