#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 */
int /*<<< orphan*/ Inverse_SO3_Naive(int, double *, double *, double *,
                                     double *, double *, double *);
int atoi(char *);
double csecond();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stdout;
int totalCoeffs_so3(int);
int main(int argc, char **argv) {
  int i, bw, n, n3;
  double *rsignal, *isignal;
  double *rcoeffs, *icoeffs;
  double *workspace1, *workspace2;
  double tstart, tstop, runtime;
  FILE *fp;
  if (argc != 4) {
    fprintf(stdout, "Usage: test_soft_inv bw coefFile ");
    fprintf(stdout, "sampleFile\n");
    exit(0);
  }
  bw = atoi(argv[1]);
  n = 2 * bw;
  n3 = n * n * n;
  rsignal = (double *)malloc(sizeof(double) * n3);
  isignal = (double *)malloc(sizeof(double) * n3);
  rcoeffs = (double *)malloc(sizeof(double) * totalCoeffs_so3(bw));
  icoeffs = (double *)malloc(sizeof(double) * totalCoeffs_so3(bw));
  workspace1 = (double *)malloc(sizeof(double) * 4 * n3);
  workspace2 = (double *)malloc(sizeof(double) * (24 * bw + 2 * bw * bw));
  if ((rsignal == NULL) || (isignal == NULL) || (rcoeffs == NULL) ||
      (icoeffs == NULL) || (workspace1 == NULL) || (workspace2 == NULL)) {
    perror("Error in allocating memory");
    exit(1);
  }
  fp = fopen(argv[2], "r");
  for (i = 0; i < totalCoeffs_so3(bw); i++) {
    fscanf(fp, "%lf", rcoeffs + i);
    fscanf(fp, "%lf", icoeffs + i);
  }
  fclose(fp);
  tstart = csecond();
  Inverse_SO3_Naive(bw, rcoeffs, icoeffs, rsignal, isignal, workspace1,
                    workspace2);
  tstop = csecond();
  runtime = tstop - tstart;
  fprintf(stdout, "runtime: %.5f seconds\n", runtime);
  fp = fopen(argv[3], "w");
  for (i = 0; i < n3; i++)
    fprintf(fp, "%.16f\n%.16f\n", rsignal[i], isignal[i]);
  fclose(fp);
  free(workspace2);
  free(workspace1);
  free(icoeffs);
  free(rcoeffs);
  free(isignal);
  free(rsignal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     121a <main+0x5a>
mov    0x2df6(%rip),%rax
movslq (%rax),%rdi
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dde(%rip),%rax
movslq (%rax),%rdi
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x1c(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
call   10e0 <totalCoeffs_so3@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%edi
call   10e0 <totalCoeffs_so3@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x5,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
imul   $0x18,-0x18(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x18(%rbp),%ecx
add    %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     130f <main+0x14f>
cmpq   $0x0,-0x30(%rbp)
je     130f <main+0x14f>
cmpq   $0x0,-0x38(%rbp)
je     130f <main+0x14f>
cmpq   $0x0,-0x40(%rbp)
je     130f <main+0x14f>
cmpq   $0x0,-0x48(%rbp)
je     130f <main+0x14f>
cmpq   $0x0,-0x50(%rbp)
jne    1325 <main+0x165>
lea    0xd18(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd15(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x18(%rbp),%edi
call   10e0 <totalCoeffs_so3@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
cmp    %ecx,%eax
jge    13ab <main+0x1eb>
mov    -0x70(%rbp),%rdi
mov    -0x38(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xcd2(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x40(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xcb3(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1344 <main+0x184>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x0,%al
call   1050 <csecond@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    -0x50(%rbp),%rax
mov    %rax,(%rsp)
call   1080 <Inverse_SO3_Naive@plt>
mov    $0x0,%al
call   1050 <csecond@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x2bda(%rip),%rax
movslq (%rax),%rdi
movsd  -0x68(%rbp),%xmm0
lea    0xc3a(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xc3b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1481 <main+0x2c1>
mov    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xbfc(%rip),%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    143b <main+0x27b>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x4,%edi
jne    1444 <main+0x274>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebp
lea    0x0(%rbp,%rbp,1),%eax
mov    %eax,%ebx
imul   %ebx,%ebx
imul   %eax,%ebx
lea    0x0(,%rbx,8),%r12d
mov    %r12d,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %r12d,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    %ebp,%edi
call   10f0 <totalCoeffs_so3@plt>
lea    0x0(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %ebp,%edi
call   10f0 <totalCoeffs_so3@plt>
lea    0x0(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,0x48(%rsp)
mov    %ebx,%edi
shl    $0x5,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
lea    0x18(%rbp,%rbp,1),%edi
imul   %ebp,%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    %r14,0x50(%rsp)
test   %r14,%r14
je     1484 <main+0x2b4>
test   %r12,%r12
je     1484 <main+0x2b4>
cmpq   $0x0,0x18(%rsp)
je     1484 <main+0x2b4>
cmpq   $0x0,0x10(%rsp)
je     1484 <main+0x2b4>
test   %rbx,%rbx
je     1484 <main+0x2b4>
test   %rax,%rax
je     1484 <main+0x2b4>
mov    %rax,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    %r12,0x40(%rsp)
mov    %r15,0x38(%rsp)
mov    0x10(%r15),%rdi
lea    0xd79(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
mov    %ebp,%edi
call   10f0 <totalCoeffs_so3@plt>
test   %eax,%eax
jle    1336 <main+0x166>
xor    %ebx,%ebx
lea    0xd5f(%rip),%r12
mov    0x18(%rsp),%r13
mov    0x10(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1060 <fscanf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1060 <fscanf@plt>
add    $0x1,%rbx
mov    %ebp,%edi
call   10f0 <totalCoeffs_so3@plt>
cltq
add    $0x8,%r14
add    $0x8,%r13
cmp    %rax,%rbx
jl     1300 <main+0x130>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
call   1050 <csecond@plt>
movsd  %xmm0,0x30(%rsp)
mov    0x20(%rsp),%rax
mov    %rax,(%rsp)
mov    %ebp,%edi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    0x50(%rsp),%r12
mov    %r12,%rcx
mov    0x40(%rsp),%r13
mov    %r13,%r8
mov    0x28(%rsp),%r9
call   1080 <Inverse_SO3_Naive@plt>
xor    %eax,%eax
call   1050 <csecond@plt>
subsd  0x30(%rsp),%xmm0
mov    0x2c52(%rip),%rax
movslq (%rax),%rdi
lea    0xcb7(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    0x38(%rsp),%rax
mov    0x18(%rax),%rdi
lea    0xcb7(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
mov    0x48(%rsp),%rax
test   %eax,%eax
jle    13f3 <main+0x223>
mov    %eax,%ebx
xor    %ebp,%ebp
lea    0xc9d(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%rbp,8),%xmm0
movsd  0x0(%r13,%rbp,8),%xmm1
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    13d0 <main+0x200>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b95(%rip),%rbx
movslq (%rbx),%rcx
lea    0xbab(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
call   10e0 <fwrite@plt>
movslq (%rbx),%rcx
lea    0xbb4(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
call   10e0 <fwrite@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    0xba3(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [34 x i8] c"Usage: test_soft_inv bw coefFile \00"
@.str.1 = [12 x i8] c"sampleFile\0A\00"
@.str.2 = [27 x i8] c"Error in allocating memory\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [23 x i8] c"runtime: %.5f seconds\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [13 x i8] c"%.16f\0A%.16f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 4
br i1 %21, label %22, label %32
22: ; preds = %2
%23 = load i32, i32* @stdout
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* @stdout
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @exit(i32 0)
unreachable
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %7
%37 = load i32, i32* %7
%38 = mul nsw i32 2, %37
store i32 %38, i32* %8
%39 = load i32, i32* %8
%40 = load i32, i32* %8
%41 = mul nsw i32 %39, %40
%42 = load i32, i32* %8
%43 = mul nsw i32 %41, %42
store i32 %43, i32* %9
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = mul i64 8, %45
%47 = trunc i64 %46 to i32
%48 = call i64 @malloc(i32 %47)
%49 = inttoptr i64 %48 to double*
store double* %49, double** %10
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = mul i64 8, %51
%53 = trunc i64 %52 to i32
%54 = call i64 @malloc(i32 %53)
%55 = inttoptr i64 %54 to double*
store double* %55, double** %11
%56 = load i32, i32* %7
%57 = call i32 @totalCoeffs_so3(i32 %56)
%58 = sext i32 %57 to i64
%59 = mul i64 8, %58
%60 = trunc i64 %59 to i32
%61 = call i64 @malloc(i32 %60)
%62 = inttoptr i64 %61 to double*
store double* %62, double** %12
%63 = load i32, i32* %7
%64 = call i32 @totalCoeffs_so3(i32 %63)
%65 = sext i32 %64 to i64
%66 = mul i64 8, %65
%67 = trunc i64 %66 to i32
%68 = call i64 @malloc(i32 %67)
%69 = inttoptr i64 %68 to double*
store double* %69, double** %13
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = mul i64 32, %71
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to double*
store double* %75, double** %14
%76 = load i32, i32* %7
%77 = mul nsw i32 24, %76
%78 = load i32, i32* %7
%79 = mul nsw i32 2, %78
%80 = load i32, i32* %7
%81 = mul nsw i32 %79, %80
%82 = add nsw i32 %77, %81
%83 = sext i32 %82 to i64
%84 = mul i64 8, %83
%85 = trunc i64 %84 to i32
%86 = call i64 @malloc(i32 %85)
%87 = inttoptr i64 %86 to double*
store double* %87, double** %15
%88 = load double*, double** %10
%89 = icmp eq double* %88, null
br i1 %89, label %105, label %90
90: ; preds = %32
%91 = load double*, double** %11
%92 = icmp eq double* %91, null
br i1 %92, label %105, label %93
93: ; preds = %90
%94 = load double*, double** %12
%95 = icmp eq double* %94, null
br i1 %95, label %105, label %96
96: ; preds = %93
%97 = load double*, double** %13
%98 = icmp eq double* %97, null
br i1 %98, label %105, label %99
99: ; preds = %96
%100 = load double*, double** %14
%101 = icmp eq double* %100, null
br i1 %101, label %105, label %102
102: ; preds = %99
%103 = load double*, double** %15
%104 = icmp eq double* %103, null
br i1 %104, label %105, label %108
105: ; preds = %102, %99, %96, %93, %90, %32
%106 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%107 = call i32 @exit(i32 1)
unreachable
108: ; preds = %102
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 2
%111 = load i8*, i8** %110
%112 = call i32* @fopen(i8* %111, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %112, i32** %19
store i32 0, i32* %6
br label %113
113: ; preds = %131, %108
%114 = load i32, i32* %6
%115 = load i32, i32* %7
%116 = call i32 @totalCoeffs_so3(i32 %115)
%117 = icmp slt i32 %114, %116
br i1 %117, label %118, label %134
118: ; preds = %113
%119 = load i32*, i32** %19
%120 = load double*, double** %12
%121 = load i32, i32* %6
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double, double* %120, i64 %122
%124 = call i32 @fscanf(i32* %119, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %123)
%125 = load i32*, i32** %19
%126 = load double*, double** %13
%127 = load i32, i32* %6
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %126, i64 %128
%130 = call i32 @fscanf(i32* %125, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %129)
br label %131
131: ; preds = %118
%132 = load i32, i32* %6
%133 = add nsw i32 %132, 1
store i32 %133, i32* %6
br label %113
134: ; preds = %113
%135 = load i32*, i32** %19
%136 = call i32 @fclose(i32* %135)
%137 = call double (...) @csecond()
store double %137, double* %16
%138 = load i32, i32* %7
%139 = load double*, double** %12
%140 = load double*, double** %13
%141 = load double*, double** %10
%142 = load double*, double** %11
%143 = load double*, double** %14
%144 = load double*, double** %15
%145 = call i32 @Inverse_SO3_Naive(i32 %138, double* %139, double* %140, double* %141, double* %142, double* %143, double* %144)
%146 = call double (...) @csecond()
store double %146, double* %17
%147 = load double, double* %17
%148 = load double, double* %16
%149 = fsub double %147, %148
store double %149, double* %18
%150 = load i32, i32* @stdout
%151 = sext i32 %150 to i64
%152 = inttoptr i64 %151 to i32*
%153 = load double, double* %18
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double %153)
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 3
%157 = load i8*, i8** %156
%158 = call i32* @fopen(i8* %157, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %158, i32** %19
store i32 0, i32* %6
br label %159
159: ; preds = %176, %134
%160 = load i32, i32* %6
%161 = load i32, i32* %9
%162 = icmp slt i32 %160, %161
br i1 %162, label %163, label %179
163: ; preds = %159
%164 = load i32*, i32** %19
%165 = load double*, double** %10
%166 = load i32, i32* %6
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %165, i64 %167
%169 = load double, double* %168
%170 = load double*, double** %11
%171 = load i32, i32* %6
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %170, i64 %172
%174 = load double, double* %173
%175 = call i32 (i32*, i8*, ...) @fprintf(i32* %164, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %169, double %174)
br label %176
176: ; preds = %163
%177 = load i32, i32* %6
%178 = add nsw i32 %177, 1
store i32 %178, i32* %6
br label %159
179: ; preds = %159
%180 = load i32*, i32** %19
%181 = call i32 @fclose(i32* %180)
%182 = load double*, double** %15
%183 = call i32 @free(double* %182)
%184 = load double*, double** %14
%185 = call i32 @free(double* %184)
%186 = load double*, double** %13
%187 = call i32 @free(double* %186)
%188 = load double*, double** %12
%189 = call i32 @free(double* %188)
%190 = load double*, double** %11
%191 = call i32 @free(double* %190)
%192 = load double*, double** %10
%193 = call i32 @free(double* %192)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [34 x i8] c"Usage: test_soft_inv bw coefFile \00"
@.str.1 = [12 x i8] c"sampleFile\0A\00"
@.str.2 = [27 x i8] c"Error in allocating memory\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [23 x i8] c"runtime: %.5f seconds\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [13 x i8] c"%.16f\0A%.16f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i64 33, i64 1, i32* %7)
%9 = load i32, i32* @stdout
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 11, i64 1, i32* %11)
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = shl nsw i32 %17, 1
%19 = mul nsw i32 %18, %18
%20 = mul nsw i32 %19, %18
%21 = shl i32 %20, 3
%22 = tail call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to double*
%24 = tail call i64 @malloc(i32 %21)
%25 = inttoptr i64 %24 to double*
%26 = tail call i32 @totalCoeffs_so3(i32 %17)
%27 = shl i32 %26, 3
%28 = tail call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
%30 = tail call i32 @totalCoeffs_so3(i32 %17)
%31 = shl i32 %30, 3
%32 = tail call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to double*
%34 = shl i32 %20, 5
%35 = tail call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to double*
%37 = add i32 %18, 24
%38 = shl i32 %17, 3
%39 = mul i32 %38, %37
%40 = tail call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to double*
%42 = icmp eq i64 %22, 0
%43 = icmp eq i64 %24, 0
%44 = select i1 %42, i1 true, i1 %43
%45 = icmp eq i64 %28, 0
%46 = select i1 %44, i1 true, i1 %45
%47 = icmp eq i64 %32, 0
%48 = select i1 %46, i1 true, i1 %47
%49 = icmp eq i64 %35, 0
%50 = select i1 %48, i1 true, i1 %49
%51 = icmp eq i64 %40, 0
%52 = select i1 %50, i1 true, i1 %51
br i1 %52, label %53, label %56
53: ; preds = %14
%54 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%55 = tail call i32 @exit(i32 1)
unreachable
56: ; preds = %14
%57 = getelementptr inbounds i8*, i8** %1, i64 2
%58 = load i8*, i8** %57
%59 = tail call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%60 = tail call i32 @totalCoeffs_so3(i32 %17)
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %72
62: ; preds = %56, %62
%63 = phi i64 [ %68, %62 ], [ 0, %56 ]
%64 = getelementptr inbounds double, double* %29, i64 %63
%65 = tail call i32 @fscanf(i32* %59, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %64)
%66 = getelementptr inbounds double, double* %33, i64 %63
%67 = tail call i32 @fscanf(i32* %59, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %66)
%68 = add nuw nsw i64 %63, 1
%69 = tail call i32 @totalCoeffs_so3(i32 %17)
%70 = sext i32 %69 to i64
%71 = icmp slt i64 %68, %70
br i1 %71, label %62, label %72
72: ; preds = %62, %56
%73 = tail call i32 @fclose(i32* %59)
%74 = tail call double (...) @csecond()
%75 = tail call i32 @Inverse_SO3_Naive(i32 %17, double* %29, double* %33, double* %23, double* %25, double* %36, double* %41)
%76 = tail call double (...) @csecond()
%77 = fsub double %76, %74
%78 = load i32, i32* @stdout
%79 = sext i32 %78 to i64
%80 = inttoptr i64 %79 to i32*
%81 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double %77)
%82 = getelementptr inbounds i8*, i8** %1, i64 3
%83 = load i8*, i8** %82
%84 = tail call i32* @fopen(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%85 = icmp sgt i32 %20, 0
br i1 %85, label %86, label %97
86: ; preds = %72
%87 = zext i32 %20 to i64
br label %88
88: ; preds = %86, %88
%89 = phi i64 [ 0, %86 ], [ %95, %88 ]
%90 = getelementptr inbounds double, double* %23, i64 %89
%91 = load double, double* %90
%92 = getelementptr inbounds double, double* %25, i64 %89
%93 = load double, double* %92
%94 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %91, double %93)
%95 = add nuw nsw i64 %89, 1
%96 = icmp eq i64 %95, %87
br i1 %96, label %97, label %88
97: ; preds = %88, %72
%98 = tail call i32 @fclose(i32* %84)
%99 = tail call i32 @free(double* %41)
%100 = tail call i32 @free(double* %36)
%101 = tail call i32 @free(double* %33)
%102 = tail call i32 @free(double* %29)
%103 = tail call i32 @free(double* %25)
%104 = tail call i32 @free(double* %23)
ret i32 0
}