#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*/ Forward_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 so3CoefLoc(int, int, int, int);
int /*<<< orphan*/ stdout;
int totalCoeffs_so3(int);
int main(int argc, char **argv) {
  int i, bw, n, n3;
  int l, m1, m2, dummy, format;
  double *rsignal, *isignal;
  double *rcoeffs, *icoeffs;
  double *workspace1, *workspace2;
  double tstart, tstop, runtime;
  FILE *fp;
  if (argc != 5) {
    fprintf(stdout, "Usage: test_soft_for bw sampleFile ");
    fprintf(stdout, "coefFile order_flag\n");
    exit(0);
  }
  bw = atoi(argv[1]);
  n = 2 * bw;
  n3 = n * n * n;
  format = atoi(argv[4]);
  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) * (26 * 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 < n3; i++) {
    fscanf(fp, "%lf", rsignal + i);
    fscanf(fp, "%lf", isignal + i);
  }
  fclose(fp);
  tstart = csecond();
  Forward_SO3_Naive(bw, rsignal, isignal, rcoeffs, icoeffs, workspace1,
                    workspace2);
  tstop = csecond();
  runtime = tstop - tstart;
  fprintf(stdout, "runtime: %.5f seconds\n", runtime);
  if (format == 0) {
    fp = fopen(argv[3], "w");
    for (i = 0; i < totalCoeffs_so3(bw); i++)
      fprintf(fp, "%.16f\n%.16f\n", rcoeffs[i], icoeffs[i]);
    fclose(fp);
  } else {
    fp = fopen(argv[3], "w");
    for (l = 0; l < bw; l++)
      for (m1 = -l; m1 < l + 1; m1++)
        for (m2 = -l; m2 < l + 1; m2++) {
          dummy = so3CoefLoc(m1, m2, l, bw);
          fprintf(fp, "l = %d m1 = %d m2 = %d\t%.15f\t%.15f\n", l, m1, m2,
                  rcoeffs[dummy], icoeffs[dummy]);
        }
    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    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     122a <main+0x5a>
mov    0x2de6(%rip),%rax
movslq (%rax),%rdi
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dce(%rip),%rax
movslq (%rax),%rdi
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <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)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x34(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%edi
call   10f0 <totalCoeffs_so3@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%edi
call   10f0 <totalCoeffs_so3@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x5,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x60(%rbp)
imul   $0x1a,-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   1080 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     132f <main+0x15f>
cmpq   $0x0,-0x48(%rbp)
je     132f <main+0x15f>
cmpq   $0x0,-0x50(%rbp)
je     132f <main+0x15f>
cmpq   $0x0,-0x58(%rbp)
je     132f <main+0x15f>
cmpq   $0x0,-0x60(%rbp)
je     132f <main+0x15f>
cmpq   $0x0,-0x68(%rbp)
jne    1345 <main+0x175>
lea    0xd03(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd00(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13c5 <main+0x1f5>
mov    -0x88(%rbp),%rdi
mov    -0x40(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xcc6(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x48(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xca4(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1367 <main+0x197>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x0,%al
call   1050 <csecond@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x60(%rbp),%r9
mov    -0x68(%rbp),%rax
mov    %rax,(%rsp)
call   10a0 <Forward_SO3_Naive@plt>
mov    $0x0,%al
call   1050 <csecond@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    0x2bbd(%rip),%rax
movslq (%rax),%rdi
movsd  -0x80(%rbp),%xmm0
lea    0xc28(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    14d4 <main+0x304>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xc1f(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x18(%rbp),%edi
call   10f0 <totalCoeffs_so3@plt>
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
cmp    %ecx,%eax
jge    14c3 <main+0x2f3>
mov    -0x88(%rbp),%rdi
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xbc5(%rip),%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1465 <main+0x295>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
jmp    15c1 <main+0x3f1>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xb8e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15b5 <main+0x3e5>
xor    %eax,%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    15a2 <main+0x3d2>
xor    %eax,%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    158f <main+0x3bf>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1090 <so3CoefLoc@plt>
mov    %eax,-0x30(%rbp)
mov    -0x88(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rsi
movsd  (%rax,%rsi,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x30(%rbp),%rsi
movsd  (%rax,%rsi,8),%xmm1
lea    0xb06(%rip),%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1523 <main+0x353>
jmp    1594 <main+0x3c4>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    150a <main+0x33a>
jmp    15a7 <main+0x3d7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14f6 <main+0x326>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@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>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
cmp    $0x5,%edi
jne    152d <main+0x34d>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
lea    0x0(%rbp,%rbp,1),%eax
mov    %eax,%r13d
imul   %r13d,%r13d
imul   %eax,%r13d
mov    0x20(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,0x14(%rsp)
lea    0x0(,%r13,8),%ebx
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %ebp,%edi
call   1100 <totalCoeffs_so3@plt>
lea    0x0(,%rax,8),%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %ebp,%edi
call   1100 <totalCoeffs_so3@plt>
lea    0x0(,%rax,8),%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %r13d,%edi
shl    $0x5,%edi
call   1080 <malloc@plt>
mov    %rax,0x40(%rsp)
lea    0x1a(%rbp,%rbp,1),%edi
mov    %rbp,0x50(%rsp)
imul   %ebp,%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %r15,0x38(%rsp)
test   %r15,%r15
je     156d <main+0x38d>
cmpq   $0x0,0x18(%rsp)
je     156d <main+0x38d>
test   %r12,%r12
je     156d <main+0x38d>
test   %rbx,%rbx
je     156d <main+0x38d>
cmpq   $0x0,0x40(%rsp)
je     156d <main+0x38d>
test   %rax,%rax
je     156d <main+0x38d>
mov    %rax,0x60(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r12,0x30(%rsp)
mov    0x10(%r14),%rdi
lea    0xd6a(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r12
test   %r13d,%r13d
jle    133a <main+0x15a>
mov    %r13d,%ebx
lea    0xd55(%rip),%r15
mov    0x38(%rsp),%r13
mov    0x18(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1060 <fscanf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1060 <fscanf@plt>
add    $0x8,%rbp
add    $0x8,%r13
add    $0xffffffffffffffff,%rbx
jne    1310 <main+0x130>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
call   1050 <csecond@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,(%rsp)
mov    0x50(%rsp),%r15
mov    %r15d,%edi
mov    0x38(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    0x30(%rsp),%rcx
mov    0x20(%rsp),%r8
mov    0x40(%rsp),%r9
call   10a0 <Forward_SO3_Naive@plt>
xor    %eax,%eax
call   1050 <csecond@plt>
subsd  0x28(%rsp),%xmm0
mov    0x2c4e(%rip),%rax
movslq (%rax),%rdi
lea    0xcbe(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    0x18(%r14),%rdi
lea    0xcc3(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,0x48(%rsp)
cmpl   $0x0,0x14(%rsp)
je     147e <main+0x29e>
test   %r15d,%r15d
jle    14d6 <main+0x2f6>
xor    %r15d,%r15d
movl   $0x1,0x14(%rsp)
movl   $0x1,0x28(%rsp)
mov    0x20(%rsp),%r14
mov    0x48(%rsp),%rbp
nopl   0x0(%rax)
mov    %r15d,%r12d
neg    %r12d
mov    %r12d,0x5c(%rsp)
nopl   0x0(%rax,%rax,1)
mov    0x14(%rsp),%ebx
mov    0x5c(%rsp),%r13d
nopl   0x0(%rax)
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r15d,%edx
mov    0x50(%rsp),%rcx
call   1090 <so3CoefLoc@plt>
cltq
mov    0x30(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  (%r14,%rax,8),%xmm1
mov    %rbp,%rdi
lea    0xc41(%rip),%rsi
mov    %r15d,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    $0x2,%al
call   1070 <fprintf@plt>
add    $0x1,%r13d
add    $0xffffffff,%ebx
jne    1410 <main+0x230>
add    $0x1,%r12d
cmp    0x28(%rsp),%r12d
jne    1400 <main+0x220>
add    $0x1,%r15d
addl   $0x1,0x28(%rsp)
addl   $0x2,0x14(%rsp)
cmp    0x50(%rsp),%r15d
jne    13f0 <main+0x210>
jmp    14d6 <main+0x2f6>
mov    %r15d,%edi
call   1100 <totalCoeffs_so3@plt>
test   %eax,%eax
jle    14d6 <main+0x2f6>
xor    %ebx,%ebx
lea    0xbe0(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x30(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
mov    0x20(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm1
mov    0x48(%rsp),%rdi
mov    %r14,%rsi
mov    $0x2,%al
call   1070 <fprintf@plt>
add    $0x1,%rbx
mov    %r15d,%edi
call   1100 <totalCoeffs_so3@plt>
cltq
cmp    %rax,%rbx
jl     14a0 <main+0x2c0>
mov    0x48(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aac(%rip),%rbx
movslq (%rbx),%rcx
lea    0xac2(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
movslq (%rbx),%rcx
lea    0xacd(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xac5(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [36 x i8] c"Usage: test_soft_for bw sampleFile \00"
@.str.1 = [21 x i8] c"coefFile order_flag\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"
@.str.8 = [36 x i8] c"l = %d m1 = %d m2 = %d\09%.15f\09%.15f\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 i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 5
br i1 %26, label %27, label %37
27: ; preds = %2
%28 = load i32, i32* @stdout
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* @stdout
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i32*
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @exit(i32 0)
unreachable
37: ; preds = %2
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %7
%42 = load i32, i32* %7
%43 = mul nsw i32 2, %42
store i32 %43, i32* %8
%44 = load i32, i32* %8
%45 = load i32, i32* %8
%46 = mul nsw i32 %44, %45
%47 = load i32, i32* %8
%48 = mul nsw i32 %46, %47
store i32 %48, i32* %9
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 4
%51 = load i8*, i8** %50
%52 = call i32 @atoi(i8* %51)
store i32 %52, i32* %14
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = mul i64 8, %54
%56 = trunc i64 %55 to i32
%57 = call i64 @malloc(i32 %56)
%58 = inttoptr i64 %57 to double*
store double* %58, double** %15
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = mul i64 8, %60
%62 = trunc i64 %61 to i32
%63 = call i64 @malloc(i32 %62)
%64 = inttoptr i64 %63 to double*
store double* %64, double** %16
%65 = load i32, i32* %7
%66 = call i32 @totalCoeffs_so3(i32 %65)
%67 = sext i32 %66 to i64
%68 = mul i64 8, %67
%69 = trunc i64 %68 to i32
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to double*
store double* %71, double** %17
%72 = load i32, i32* %7
%73 = call i32 @totalCoeffs_so3(i32 %72)
%74 = sext i32 %73 to i64
%75 = mul i64 8, %74
%76 = trunc i64 %75 to i32
%77 = call i64 @malloc(i32 %76)
%78 = inttoptr i64 %77 to double*
store double* %78, double** %18
%79 = load i32, i32* %9
%80 = sext i32 %79 to i64
%81 = mul i64 32, %80
%82 = trunc i64 %81 to i32
%83 = call i64 @malloc(i32 %82)
%84 = inttoptr i64 %83 to double*
store double* %84, double** %19
%85 = load i32, i32* %7
%86 = mul nsw i32 26, %85
%87 = load i32, i32* %7
%88 = mul nsw i32 2, %87
%89 = load i32, i32* %7
%90 = mul nsw i32 %88, %89
%91 = add nsw i32 %86, %90
%92 = sext i32 %91 to i64
%93 = mul i64 8, %92
%94 = trunc i64 %93 to i32
%95 = call i64 @malloc(i32 %94)
%96 = inttoptr i64 %95 to double*
store double* %96, double** %20
%97 = load double*, double** %15
%98 = icmp eq double* %97, null
br i1 %98, label %114, label %99
99: ; preds = %37
%100 = load double*, double** %16
%101 = icmp eq double* %100, null
br i1 %101, label %114, label %102
102: ; preds = %99
%103 = load double*, double** %17
%104 = icmp eq double* %103, null
br i1 %104, label %114, label %105
105: ; preds = %102
%106 = load double*, double** %18
%107 = icmp eq double* %106, null
br i1 %107, label %114, label %108
108: ; preds = %105
%109 = load double*, double** %19
%110 = icmp eq double* %109, null
br i1 %110, label %114, label %111
111: ; preds = %108
%112 = load double*, double** %20
%113 = icmp eq double* %112, null
br i1 %113, label %114, label %117
114: ; preds = %111, %108, %105, %102, %99, %37
%115 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%116 = call i32 @exit(i32 1)
unreachable
117: ; preds = %111
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 2
%120 = load i8*, i8** %119
%121 = call i32* @fopen(i8* %120, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %121, i32** %24
store i32 0, i32* %6
br label %122
122: ; preds = %139, %117
%123 = load i32, i32* %6
%124 = load i32, i32* %9
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %142
126: ; preds = %122
%127 = load i32*, i32** %24
%128 = load double*, double** %15
%129 = load i32, i32* %6
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
%132 = call i32 @fscanf(i32* %127, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %131)
%133 = load i32*, i32** %24
%134 = load double*, double** %16
%135 = load i32, i32* %6
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %134, i64 %136
%138 = call i32 @fscanf(i32* %133, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %137)
br label %139
139: ; preds = %126
%140 = load i32, i32* %6
%141 = add nsw i32 %140, 1
store i32 %141, i32* %6
br label %122
142: ; preds = %122
%143 = load i32*, i32** %24
%144 = call i32 @fclose(i32* %143)
%145 = call double (...) @csecond()
store double %145, double* %21
%146 = load i32, i32* %7
%147 = load double*, double** %15
%148 = load double*, double** %16
%149 = load double*, double** %17
%150 = load double*, double** %18
%151 = load double*, double** %19
%152 = load double*, double** %20
%153 = call i32 @Forward_SO3_Naive(i32 %146, double* %147, double* %148, double* %149, double* %150, double* %151, double* %152)
%154 = call double (...) @csecond()
store double %154, double* %22
%155 = load double, double* %22
%156 = load double, double* %21
%157 = fsub double %155, %156
store double %157, double* %23
%158 = load i32, i32* @stdout
%159 = sext i32 %158 to i64
%160 = inttoptr i64 %159 to i32*
%161 = load double, double* %23
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double %161)
%163 = load i32, i32* %14
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %194
165: ; preds = %142
%166 = load i8**, i8*** %5
%167 = getelementptr inbounds i8*, i8** %166, i64 3
%168 = load i8*, i8** %167
%169 = call i32* @fopen(i8* %168, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %169, i32** %24
store i32 0, i32* %6
br label %170
170: ; preds = %188, %165
%171 = load i32, i32* %6
%172 = load i32, i32* %7
%173 = call i32 @totalCoeffs_so3(i32 %172)
%174 = icmp slt i32 %171, %173
br i1 %174, label %175, label %191
175: ; preds = %170
%176 = load i32*, i32** %24
%177 = load double*, double** %17
%178 = load i32, i32* %6
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %177, i64 %179
%181 = load double, double* %180
%182 = load double*, double** %18
%183 = load i32, i32* %6
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds double, double* %182, i64 %184
%186 = load double, double* %185
%187 = call i32 (i32*, i8*, ...) @fprintf(i32* %176, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %181, double %186)
br label %188
188: ; preds = %175
%189 = load i32, i32* %6
%190 = add nsw i32 %189, 1
store i32 %190, i32* %6
br label %170
191: ; preds = %170
%192 = load i32*, i32** %24
%193 = call i32 @fclose(i32* %192)
br label %254
194: ; preds = %142
%195 = load i8**, i8*** %5
%196 = getelementptr inbounds i8*, i8** %195, i64 3
%197 = load i8*, i8** %196
%198 = call i32* @fopen(i8* %197, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %198, i32** %24
store i32 0, i32* %10
br label %199
199: ; preds = %248, %194
%200 = load i32, i32* %10
%201 = load i32, i32* %7
%202 = icmp slt i32 %200, %201
br i1 %202, label %203, label %251
203: ; preds = %199
%204 = load i32, i32* %10
%205 = sub nsw i32 0, %204
store i32 %205, i32* %11
br label %206
206: ; preds = %244, %203
%207 = load i32, i32* %11
%208 = load i32, i32* %10
%209 = add nsw i32 %208, 1
%210 = icmp slt i32 %207, %209
br i1 %210, label %211, label %247
211: ; preds = %206
%212 = load i32, i32* %10
%213 = sub nsw i32 0, %212
store i32 %213, i32* %12
br label %214
214: ; preds = %240, %211
%215 = load i32, i32* %12
%216 = load i32, i32* %10
%217 = add nsw i32 %216, 1
%218 = icmp slt i32 %215, %217
br i1 %218, label %219, label %243
219: ; preds = %214
%220 = load i32, i32* %11
%221 = load i32, i32* %12
%222 = load i32, i32* %10
%223 = load i32, i32* %7
%224 = call i32 @so3CoefLoc(i32 %220, i32 %221, i32 %222, i32 %223)
store i32 %224, i32* %13
%225 = load i32*, i32** %24
%226 = load i32, i32* %10
%227 = load i32, i32* %11
%228 = load i32, i32* %12
%229 = load double*, double** %17
%230 = load i32, i32* %13
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds double, double* %229, i64 %231
%233 = load double, double* %232
%234 = load double*, double** %18
%235 = load i32, i32* %13
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds double, double* %234, i64 %236
%238 = load double, double* %237
%239 = call i32 (i32*, i8*, ...) @fprintf(i32* %225, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %226, i32 %227, i32 %228, double %233, double %238)
br label %240
240: ; preds = %219
%241 = load i32, i32* %12
%242 = add nsw i32 %241, 1
store i32 %242, i32* %12
br label %214
243: ; preds = %214
br label %244
244: ; preds = %243
%245 = load i32, i32* %11
%246 = add nsw i32 %245, 1
store i32 %246, i32* %11
br label %206
247: ; preds = %206
br label %248
248: ; preds = %247
%249 = load i32, i32* %10
%250 = add nsw i32 %249, 1
store i32 %250, i32* %10
br label %199
251: ; preds = %199
%252 = load i32*, i32** %24
%253 = call i32 @fclose(i32* %252)
br label %254
254: ; preds = %251, %191
%255 = load double*, double** %20
%256 = call i32 @free(double* %255)
%257 = load double*, double** %19
%258 = call i32 @free(double* %257)
%259 = load double*, double** %18
%260 = call i32 @free(double* %259)
%261 = load double*, double** %17
%262 = call i32 @free(double* %261)
%263 = load double*, double** %16
%264 = call i32 @free(double* %263)
%265 = load double*, double** %15
%266 = call i32 @free(double* %265)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [36 x i8] c"Usage: test_soft_for bw sampleFile \00"
@.str.1 = [21 x i8] c"coefFile order_flag\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"
@.str.8 = [36 x i8] c"l = %d m1 = %d m2 = %d\09%.15f\09%.15f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 5
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 ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 35, 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 ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 20, 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 = getelementptr inbounds i8*, i8** %1, i64 4
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = shl i32 %20, 3
%25 = tail call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
%27 = tail call i64 @malloc(i32 %24)
%28 = inttoptr i64 %27 to double*
%29 = tail call i32 @totalCoeffs_so3(i32 %17)
%30 = shl i32 %29, 3
%31 = tail call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to double*
%33 = tail call i32 @totalCoeffs_so3(i32 %17)
%34 = shl i32 %33, 3
%35 = tail call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to double*
%37 = shl i32 %20, 5
%38 = tail call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to double*
%40 = add i32 %18, 26
%41 = shl i32 %17, 3
%42 = mul i32 %41, %40
%43 = tail call i64 @malloc(i32 %42)
%44 = inttoptr i64 %43 to double*
%45 = icmp eq i64 %25, 0
%46 = icmp eq i64 %27, 0
%47 = select i1 %45, i1 true, i1 %46
%48 = icmp eq i64 %31, 0
%49 = select i1 %47, i1 true, i1 %48
%50 = icmp eq i64 %35, 0
%51 = select i1 %49, i1 true, i1 %50
%52 = icmp eq i64 %38, 0
%53 = select i1 %51, i1 true, i1 %52
%54 = icmp eq i64 %43, 0
%55 = select i1 %53, i1 true, i1 %54
br i1 %55, label %56, label %59
56: ; preds = %14
%57 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%58 = tail call i32 @exit(i32 1)
unreachable
59: ; preds = %14
%60 = getelementptr inbounds i8*, i8** %1, i64 2
%61 = load i8*, i8** %60
%62 = tail call i32* @fopen(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%63 = icmp sgt i32 %20, 0
br i1 %63, label %64, label %74
64: ; preds = %59
%65 = zext i32 %20 to i64
br label %66
66: ; preds = %64, %66
%67 = phi i64 [ 0, %64 ], [ %72, %66 ]
%68 = getelementptr inbounds double, double* %26, i64 %67
%69 = tail call i32 @fscanf(i32* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %68)
%70 = getelementptr inbounds double, double* %28, i64 %67
%71 = tail call i32 @fscanf(i32* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %70)
%72 = add nuw nsw i64 %67, 1
%73 = icmp eq i64 %72, %65
br i1 %73, label %74, label %66
74: ; preds = %66, %59
%75 = tail call i32 @fclose(i32* %62)
%76 = tail call double (...) @csecond()
%77 = tail call i32 @Forward_SO3_Naive(i32 %17, double* %26, double* %28, double* %32, double* %36, double* %39, double* %44)
%78 = tail call double (...) @csecond()
%79 = fsub double %78, %76
%80 = load i32, i32* @stdout
%81 = sext i32 %80 to i64
%82 = inttoptr i64 %81 to i32*
%83 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double %79)
%84 = icmp eq i32 %23, 0
%85 = getelementptr inbounds i8*, i8** %1, i64 3
%86 = load i8*, i8** %85
%87 = tail call i32* @fopen(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br i1 %84, label %88, label %102
88: ; preds = %74
%89 = tail call i32 @totalCoeffs_so3(i32 %17)
%90 = icmp sgt i32 %89, 0
br i1 %90, label %91, label %128
91: ; preds = %88, %91
%92 = phi i64 [ %98, %91 ], [ 0, %88 ]
%93 = getelementptr inbounds double, double* %32, i64 %92
%94 = load double, double* %93
%95 = getelementptr inbounds double, double* %36, i64 %92
%96 = load double, double* %95
%97 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %94, double %96)
%98 = add nuw nsw i64 %92, 1
%99 = tail call i32 @totalCoeffs_so3(i32 %17)
%100 = sext i32 %99 to i64
%101 = icmp slt i64 %98, %100
br i1 %101, label %91, label %128
102: ; preds = %74
%103 = icmp sgt i32 %17, 0
br i1 %103, label %104, label %128
104: ; preds = %102, %124
%105 = phi i32 [ %126, %124 ], [ 1, %102 ]
%106 = phi i32 [ %125, %124 ], [ 0, %102 ]
%107 = sub nsw i32 0, %106
br label %108
108: ; preds = %121, %104
%109 = phi i32 [ %107, %104 ], [ %122, %121 ]
br label %110
110: ; preds = %108, %110
%111 = phi i32 [ %119, %110 ], [ %107, %108 ]
%112 = tail call i32 @so3CoefLoc(i32 %109, i32 %111, i32 %106, i32 %17)
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %32, i64 %113
%115 = load double, double* %114
%116 = getelementptr inbounds double, double* %36, i64 %113
%117 = load double, double* %116
%118 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %106, i32 %109, i32 %111, double %115, double %117)
%119 = add i32 %111, 1
%120 = icmp eq i32 %119, %105
br i1 %120, label %121, label %110
121: ; preds = %110
%122 = add i32 %109, 1
%123 = icmp eq i32 %122, %105
br i1 %123, label %124, label %108
124: ; preds = %121
%125 = add nuw nsw i32 %106, 1
%126 = add nuw i32 %105, 1
%127 = icmp eq i32 %125, %17
br i1 %127, label %128, label %104
128: ; preds = %124, %91, %102, %88
%129 = tail call i32 @fclose(i32* %87)
%130 = tail call i32 @free(double* %44)
%131 = tail call i32 @free(double* %39)
%132 = tail call i32 @free(double* %36)
%133 = tail call i32 @free(double* %32)
%134 = tail call i32 @free(double* %28)
%135 = tail call i32 @free(double* %26)
ret i32 0
}