#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_sym(int, double *, double *, double *,
                                         double *, double *, double *,
                                         int /*<<< orphan*/);
int atoi(char *);
scalar_t__ calloc(int, int);
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;
  double *rsignal, *isignal;
  double *rcoeffs, *icoeffs;
  double *workspace1, *workspace2;
  double tstart, tstop, runtime;
  int format;
  FILE *fp;
  if (argc < 5) {
    fprintf(stdout, "Usage: test_soft_sym_for bw sample_file ");
    fprintf(stdout, "coef_file ");
    fprintf(stdout, "order_flag\n");
    exit(0);
  }
  bw = atoi(argv[1]);
  n = 2 * bw;
  n3 = n * n * n;
  format = atoi(argv[4]);
  rsignal = (double *)calloc(n3, sizeof(double));
  isignal = (double *)calloc(n3, sizeof(double));
  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_sym(bw, rsignal, isignal, rcoeffs, icoeffs, workspace1,
                        workspace2, 0);
  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)
jge    1252 <main+0x72>
mov    0x2dd6(%rip),%rax
movslq (%rax),%rdi
lea    0xdec(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2dbe(%rip),%rax
movslq (%rax),%rdi
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2da6(%rip),%rax
movslq (%rax),%rdi
lea    0xdf0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <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   10e0 <atoi@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x20(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%edi
call   1100 <totalCoeffs_so3@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%edi
call   1100 <totalCoeffs_so3@plt>
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x5,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x58(%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   10a0 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1353 <main+0x173>
cmpq   $0x0,-0x40(%rbp)
je     1353 <main+0x173>
cmpq   $0x0,-0x48(%rbp)
je     1353 <main+0x173>
cmpq   $0x0,-0x50(%rbp)
je     1353 <main+0x173>
cmpq   $0x0,-0x58(%rbp)
je     1353 <main+0x173>
cmpq   $0x0,-0x60(%rbp)
jne    1369 <main+0x189>
lea    0xce6(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xce3(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13e9 <main+0x209>
mov    -0x88(%rbp),%rdi
mov    -0x38(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xca9(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x40(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xc87(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    138b <main+0x1ab>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x0,%al
call   1050 <csecond@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0x60(%rbp),%rax
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1090 <Forward_SO3_Naive_sym@plt>
mov    $0x0,%al
call   1050 <csecond@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    0x2b8e(%rip),%rax
movslq (%rax),%rdi
movsd  -0x78(%rbp),%xmm0
lea    0xc00(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
cmpl   $0x0,-0x7c(%rbp)
jne    1503 <main+0x323>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xbf7(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x18(%rbp),%edi
call   1100 <totalCoeffs_so3@plt>
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
cmp    %ecx,%eax
jge    14f2 <main+0x312>
mov    -0x88(%rbp),%rdi
mov    -0x48(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xb9d(%rip),%rsi
mov    $0x2,%al
call   1080 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1494 <main+0x2b4>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
jmp    15f0 <main+0x410>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xb66(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15e4 <main+0x404>
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    15d1 <main+0x3f1>
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    15be <main+0x3de>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   10b0 <so3CoefLoc@plt>
mov    %eax,-0x30(%rbp)
mov    -0x88(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x48(%rbp),%rax
movslq -0x30(%rbp),%rsi
movsd  (%rax,%rsi,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rsi
movsd  (%rax,%rsi,8),%xmm1
lea    0xade(%rip),%rsi
mov    $0x2,%al
call   1080 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1552 <main+0x372>
jmp    15c3 <main+0x3e3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1539 <main+0x359>
jmp    15d6 <main+0x3f6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1525 <main+0x345>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@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>
mov    -0x38(%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    $0x58,%rsp
cmp    $0x4,%edi
jle    153d <main+0x34d>
mov    %rsi,%r12
mov    0x8(%rsi),%rdi
call   10e0 <atoi@plt>
mov    %eax,%ebp
lea    0x0(%rbp,%rbp,1),%eax
mov    %eax,%r15d
imul   %eax,%r15d
imul   %eax,%r15d
mov    0x20(%r12),%rdi
call   10e0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    %r15d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,%r13
mov    %r15d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,0x8(%rsp)
mov    %ebp,%edi
call   1110 <totalCoeffs_so3@plt>
lea    0x0(,%rax,8),%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1110 <totalCoeffs_so3@plt>
lea    0x0(,%rax,8),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %r15d,%edi
shl    $0x5,%edi
call   10a0 <malloc@plt>
mov    %rax,0x30(%rsp)
lea    0x1a(%rbp,%rbp,1),%edi
mov    %rbp,0x40(%rsp)
imul   %ebp,%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %r13,0x28(%rsp)
test   %r13,%r13
je     1596 <main+0x3a6>
cmpq   $0x0,0x8(%rsp)
je     1596 <main+0x3a6>
test   %r14,%r14
je     1596 <main+0x3a6>
test   %rbx,%rbx
je     1596 <main+0x3a6>
cmpq   $0x0,0x30(%rsp)
je     1596 <main+0x3a6>
test   %rax,%rax
je     1596 <main+0x3a6>
mov    %rax,0x50(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r14,0x20(%rsp)
mov    0x10(%r12),%rdi
lea    0xd5b(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r13
test   %r15d,%r15d
jle    135a <main+0x16a>
mov    %r15d,%r14d
lea    0xd46(%rip),%r15
mov    0x28(%rsp),%rbp
mov    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1060 <fscanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
add    $0x8,%rbx
add    $0x8,%rbp
add    $0xffffffffffffffff,%r14
jne    1330 <main+0x140>
mov    %r13,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
call   1050 <csecond@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x40(%rsp),%r15
mov    %r15d,%edi
mov    0x28(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    0x20(%rsp),%rcx
mov    0x10(%rsp),%r8
mov    0x30(%rsp),%r9
push   $0x0
push   0x58(%rsp)
call   1090 <Forward_SO3_Naive_sym@plt>
add    $0x10,%rsp
xor    %eax,%eax
call   1050 <csecond@plt>
subsd  0x18(%rsp),%xmm0
mov    0x2c2d(%rip),%rax
movslq (%rax),%rdi
lea    0xca4(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    0x18(%r12),%rdi
lea    0xca8(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,0x38(%rsp)
cmpl   $0x0,0x4(%rsp)
je     149b <main+0x2ab>
test   %r15d,%r15d
jle    14e6 <main+0x2f6>
xor    %ebx,%ebx
movl   $0x1,0x4(%rsp)
movl   $0x1,0x18(%rsp)
mov    0x10(%rsp),%r15
mov    0x38(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %ebx,%r12d
neg    %r12d
mov    %r12d,0x4c(%rsp)
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%r14d
mov    0x4c(%rsp),%r13d
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %r13d,%esi
mov    %ebx,%edx
mov    0x40(%rsp),%rcx
call   10b0 <so3CoefLoc@plt>
cltq
mov    0x20(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  (%r15,%rax,8),%xmm1
mov    %rbp,%rdi
lea    0xc29(%rip),%rsi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    $0x2,%al
call   1080 <fprintf@plt>
add    $0x1,%r13d
add    $0xffffffff,%r14d
jne    1430 <main+0x240>
add    $0x1,%r12d
cmp    0x18(%rsp),%r12d
jne    1420 <main+0x230>
add    $0x1,%ebx
addl   $0x1,0x18(%rsp)
addl   $0x2,0x4(%rsp)
cmp    0x40(%rsp),%ebx
jne    1410 <main+0x220>
jmp    14e6 <main+0x2f6>
mov    %r15d,%edi
call   1110 <totalCoeffs_so3@plt>
test   %eax,%eax
jle    14e6 <main+0x2f6>
xor    %ebx,%ebx
lea    0xbca(%rip),%r14
mov    0x20(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
mov    0x10(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm1
mov    0x38(%rsp),%rdi
mov    %r14,%rsi
mov    $0x2,%al
call   1080 <fprintf@plt>
add    $0x1,%rbx
mov    %r15d,%edi
call   1110 <totalCoeffs_so3@plt>
cltq
cmp    %rax,%rbx
jl     14b0 <main+0x2c0>
mov    0x38(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%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    0x2a9c(%rip),%rbx
movslq (%rbx),%rcx
lea    0xab2(%rip),%rdi
mov    $0x28,%esi
mov    $0x1,%edx
call   1100 <fwrite@plt>
movslq (%rbx),%rcx
lea    0xac2(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1100 <fwrite@plt>
movslq (%rbx),%rcx
lea    0xab4(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
call   1100 <fwrite@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
lea    0xaa3(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

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

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