#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_sym(int, double *, double *, double *,
                                         double *, double *, double *, int);
int M_PI;
int atoi(char *);
double csecond();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int floor(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ so3CombineCoef(int, int, int, double *, double *, double *,
                                  double *, double *, double *);
int /*<<< orphan*/ *stderr;
int main(int argc, char **argv) {
  FILE *fp;
  int i;
  int bw, degLim;
  double tstart, tstop;
  double *rdata, *idata;
  double *workspace1, *workspace2;
  double *sigCoefR, *sigCoefI;
  double *patCoefR, *patCoefI;
  double *so3CoefR, *so3CoefI;
  int tmp, maxloc, ii, jj, kk;
  double maxval;
  if (argc < 5) {
    printf("test_soft_sym_correlate sigCoef patCoef bw degLim [result]\n");
    exit(0);
  }
  bw = atoi(argv[3]);
  degLim = atoi(argv[4]);
  rdata = (double *)malloc(sizeof(double) * (8 * bw * bw * bw));
  idata = (double *)malloc(sizeof(double) * (8 * bw * bw * bw));
  workspace1 = (double *)malloc(sizeof(double) * (16 * bw * bw * bw));
  workspace2 = (double *)malloc(sizeof(double) * (24 * bw + 2 * bw * bw));
  sigCoefR = (double *)malloc(sizeof(double) * bw * bw);
  sigCoefI = (double *)malloc(sizeof(double) * bw * bw);
  patCoefR = (double *)malloc(sizeof(double) * bw * bw);
  patCoefI = (double *)malloc(sizeof(double) * bw * bw);
  so3CoefR = (double *)malloc(sizeof(double) * ((4 * bw * bw * bw - bw) / 3));
  so3CoefI = (double *)malloc(sizeof(double) * ((4 * bw * bw * bw - bw) / 3));
  if ((rdata == NULL) || (idata == NULL) || (workspace1 == NULL) ||
      (workspace2 == NULL) || (sigCoefR == NULL) || (sigCoefI == NULL) ||
      (patCoefR == NULL) || (patCoefI == NULL) || (so3CoefR == NULL) ||
      (so3CoefI == NULL)) {
    perror("Error in allocating memory");
    exit(1);
  }
  fp = fopen(argv[1], "r");
  for (i = 0; i < bw * bw; i++) {
    fscanf(fp, "%lf", sigCoefR + i);
    fscanf(fp, "%lf", sigCoefI + i);
  }
  fclose(fp);
  fp = fopen(argv[2], "r");
  for (i = 0; i < bw * bw; i++) {
    fscanf(fp, "%lf", patCoefR + i);
    fscanf(fp, "%lf", patCoefI + i);
  }
  fclose(fp);
  printf("about to combine coefficients\n");
  tstart = csecond();
  so3CombineCoef(bw, bw, degLim, sigCoefR, sigCoefI, patCoefR, patCoefI,
                 so3CoefR, so3CoefI);
  tstop = csecond();
  fprintf(stderr, "combine time \t = %.4e\n", tstop - tstart);
  printf("about to inverse so(3) transform\n");
  tstart = csecond();
  Inverse_SO3_Naive_sym(bw, so3CoefR, so3CoefI, rdata, idata, workspace1,
                        workspace2, 1);
  tstop = csecond();
  printf("finished inverse so(3) transform\n");
  fprintf(stderr, "inverse so(3) time \t = %.4e\n", tstop - tstart);
  maxval = 0.0;
  maxloc = 0;
  for (i = 0; i < 8 * bw * bw * bw; i++) {
    if (rdata[i] >= maxval) {
      maxval = rdata[i];
      maxloc = i;
    }
  }
  ii = floor(maxloc / (4. * bw * bw));
  tmp = maxloc - (ii * 4. * bw * bw);
  jj = floor(tmp / (2. * bw));
  tmp = maxloc - (ii * 4 * bw * bw) - jj * (2 * bw);
  kk = tmp;
  printf("ii = %d\tjj = %d\tkk = %d\n", ii, jj, kk);
  printf("alpha = %f\nbeta = %f\ngamma = %f\n", M_PI * jj / ((double)bw),
         M_PI * (2 * ii + 1) / (4. * bw), M_PI * kk / ((double)bw));
  if (argc == 6) {
    printf("about to save data\n");
    fp = fopen(argv[5], "w");
    for (i = 0; i < 8 * bw * bw * bw; i++)
      fprintf(fp, "%.16f\n", rdata[i]);
    fclose(fp);
  }
  free(so3CoefI);
  free(so3CoefR);
  free(patCoefI);
  free(patCoefR);
  free(sigCoefI);
  free(sigCoefR);
  free(workspace2);
  free(workspace1);
  free(idata);
  free(rdata);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1218 <main+0x38>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x3,%eax
imul   -0x20(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x3,%eax
imul   -0x20(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x4,%eax
imul   -0x20(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
imul   $0x18,-0x20(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x20(%rbp),%ecx
add    %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x68(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x70(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
imul   -0x20(%rbp),%eax
imul   -0x20(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
imul   -0x20(%rbp),%eax
imul   -0x20(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x48(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x50(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x58(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x60(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x68(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x70(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x78(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x80(%rbp)
je     13ea <main+0x20a>
cmpq   $0x0,-0x88(%rbp)
jne    1400 <main+0x220>
lea    0xc5b(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc58(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    147d <main+0x29d>
mov    -0x18(%rbp),%rdi
mov    -0x60(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xc1e(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x68(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xbff(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    141f <main+0x23f>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xbd2(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1503 <main+0x323>
mov    -0x18(%rbp),%rdi
mov    -0x70(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xb98(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x78(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xb79(%rip),%rsi
call   1080 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14a5 <main+0x2c5>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xb5a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1060 <csecond@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x70(%rbp),%r9
mov    -0x78(%rbp),%r11
mov    -0x80(%rbp),%r10
mov    -0x88(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <so3CombineCoef@plt>
mov    $0x0,%al
call   1060 <csecond@plt>
movsd  %xmm0,-0x38(%rbp)
mov    0x2a68(%rip),%rax
mov    (%rax),%rdi
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
lea    0xb08(%rip),%rsi
call   1090 <fprintf@plt>
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1060 <csecond@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    -0x58(%rbp),%rax
mov    %rax,(%rsp)
movl   $0x1,0x8(%rsp)
call   10b0 <Inverse_SO3_Naive_sym@plt>
mov    $0x0,%al
call   1060 <csecond@plt>
movsd  %xmm0,-0x38(%rbp)
lea    0xae0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x29e5(%rip),%rax
mov    (%rax),%rdi
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
lea    0xae0(%rip),%rsi
call   1090 <fprintf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movl   $0x0,-0x90(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x3,%ecx
imul   -0x20(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    168d <main+0x4ad>
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jb     167a <main+0x49a>
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x1c(%rbp),%eax
mov    %eax,-0x90(%rbp)
jmp    167f <main+0x49f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1628 <main+0x448>
cvtsi2sdl -0x90(%rbp),%xmm0
ff
cvtsi2sdl -0x20(%rbp),%xmm2
movsd  0x95e(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1100 <floor@plt>
mov    %eax,-0x94(%rbp)
cvtsi2sdl -0x90(%rbp),%xmm1
ff
cvtsi2sdl -0x94(%rbp),%xmm0
ff
movsd  0x926(%rip),%xmm2
mulsd  %xmm2,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8c(%rbp)
cvtsi2sdl -0x8c(%rbp),%xmm0
ff
cvtsi2sdl -0x20(%rbp),%xmm2
movsd  0x8de(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1100 <floor@plt>
mov    %eax,-0x98(%rbp)
mov    -0x90(%rbp),%eax
mov    -0x94(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x20(%rbp),%ecx
imul   -0x20(%rbp),%ecx
sub    %ecx,%eax
mov    -0x98(%rbp),%ecx
mov    -0x20(%rbp),%edx
shl    $0x1,%edx
imul   %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x94(%rbp),%esi
mov    -0x98(%rbp),%edx
mov    -0x9c(%rbp),%ecx
lea    0x96e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2844(%rip),%rax
mov    (%rax),%eax
imul   -0x98(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x2827(%rip),%rax
mov    (%rax),%eax
mov    -0x94(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x20(%rbp),%xmm3
movsd  0x81d(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mov    0x27f6(%rip),%rax
mov    (%rax),%eax
imul   -0x9c(%rbp),%eax
cvtsi2sd %eax,%xmm2
cvtsi2sdl -0x20(%rbp),%xmm3
divsd  %xmm3,%xmm2
lea    0x90e(%rip),%rdi
mov    $0x3,%al
call   1070 <printf@plt>
cmpl   $0x6,-0x8(%rbp)
jne    189a <main+0x6ba>
lea    0x917(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0x915(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x3,%ecx
imul   -0x20(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1891 <main+0x6b1>
mov    -0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0x8d6(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    184d <main+0x66d>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@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    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %edi,0x4c(%rsp)
cmp    $0x4,%edi
jle    1816 <main+0x626>
mov    %rsi,%rbx
mov    0x18(%rsi),%rdi
call   10f0 <atoi@plt>
mov    %eax,%r12d
mov    %rbx,0x40(%rsp)
mov    0x20(%rbx),%rdi
call   10f0 <atoi@plt>
mov    %eax,0x10(%rsp)
lea    0x0(,%r12,8),%r14d
mov    %r14d,%ebp
imul   %r12d,%ebp
mov    %ebp,%eax
imul   %r12d,%eax
mov    %rax,0x50(%rsp)
lea    0x0(,%rax,8),%ebx
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,0x78(%rsp)
mov    %r12d,%ebx
imul   %r12d,%ebx
mov    %ebx,0x4(%rsp)
imul   %r12d,%ebx
mov    %ebx,%edi
shl    $0x7,%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
lea    (%r12,%r12,1),%edi
add    $0x18,%edi
imul   %r14d,%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x20(%rsp)
shl    $0x2,%ebx
mov    %r12,0x18(%rsp)
sub    %r12d,%ebx
movslq %ebx,%rax
imul   $0x55555556,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
shr    $0x20,%rbx
add    %eax,%ebx
shl    $0x3,%ebx
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    0x78(%rsp),%rcx
mov    %r15,0x80(%rsp)
test   %r15,%r15
je     1829 <main+0x639>
test   %rcx,%rcx
je     1829 <main+0x639>
test   %r13,%r13
je     1829 <main+0x639>
test   %r14,%r14
je     1829 <main+0x639>
cmpq   $0x0,0x38(%rsp)
je     1829 <main+0x639>
cmpq   $0x0,0x30(%rsp)
je     1829 <main+0x639>
cmpq   $0x0,0x28(%rsp)
je     1829 <main+0x639>
cmpq   $0x0,0x20(%rsp)
je     1829 <main+0x639>
test   %rbp,%rbp
je     1829 <main+0x639>
test   %rax,%rax
je     1829 <main+0x639>
mov    %rax,0x58(%rsp)
mov    %rbp,0x60(%rsp)
mov    %r14,0x68(%rsp)
mov    %r13,0x70(%rsp)
mov    0x40(%rsp),%rax
mov    0x8(%rax),%rdi
lea    0xc99(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%rbp
mov    0x4(%rsp),%eax
mov    %eax,%r13d
test   %eax,%eax
je     13ea <main+0x1fa>
lea    0xc81(%rip),%r12
mov    %r13,%r15
mov    0x38(%rsp),%rbx
mov    0x30(%rsp),%r14
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1090 <fscanf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1090 <fscanf@plt>
add    $0x8,%r14
add    $0x8,%rbx
add    $0xffffffffffffffff,%r15
jne    13c0 <main+0x1d0>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    0x40(%rsp),%rax
mov    0x10(%rax),%rdi
lea    0xc29(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r14
cmpl   $0x0,0x4(%rsp)
je     145a <main+0x26a>
lea    0xc15(%rip),%r12
mov    0x28(%rsp),%rbx
mov    0x20(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1090 <fscanf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   1090 <fscanf@plt>
add    $0x8,%rbp
add    $0x8,%rbx
add    $0xffffffffffffffff,%r13
jne    1430 <main+0x240>
mov    0x18(%rsp),%rbx
lea    (%rbx,%rbx,1),%r15d
mov    %r14,%rdi
call   1060 <fclose@plt>
lea    0xc36(%rip),%rdi
call   1050 <puts@plt>
xor    %r12d,%r12d
xor    %eax,%eax
call   1070 <csecond@plt>
movsd  %xmm0,0x8(%rsp)
sub    $0x8,%rsp
mov    %ebx,%edi
mov    %ebx,%esi
mov    0x18(%rsp),%edx
mov    0x40(%rsp),%rcx
mov    0x38(%rsp),%r8
mov    0x30(%rsp),%r9
mov    0x60(%rsp),%r13
push   %r13
mov    0x70(%rsp),%rbp
push   %rbp
push   0x38(%rsp)
call   1040 <so3CombineCoef@plt>
add    $0x20,%rsp
xor    %eax,%eax
call   1070 <csecond@plt>
mov    0x2b0e(%rip),%r14
mov    (%r14),%rdi
subsd  0x8(%rsp),%xmm0
lea    0xb57(%rip),%rsi
call   10a0 <fprintf@plt>
lea    0xbe0(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1070 <csecond@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    0x80(%rsp),%rbp
mov    %rbp,%rcx
mov    0x78(%rsp),%r13
mov    %r13,%r8
mov    0x70(%rsp),%r9
push   $0x1
push   0x70(%rsp)
call   10c0 <Inverse_SO3_Naive_sym@plt>
add    $0x10,%rsp
xor    %eax,%eax
call   1070 <csecond@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xbac(%rip),%rdi
call   1050 <puts@plt>
mov    (%r14),%rdi
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
lea    0xaf2(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x50(%rsp),%rax
test   %eax,%eax
jle    1632 <main+0x442>
mov    %eax,%eax
xor    %ecx,%ecx
xorpd  %xmm0,%xmm0
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%rbp,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
cmovae %ecx,%r12d
movsd  0x8(%rbp,%rcx,8),%xmm2
movapd %xmm0,%xmm3
cmpnlesd %xmm1,%xmm3
movapd %xmm3,%xmm4
andnpd %xmm1,%xmm4
andpd  %xmm0,%xmm3
orpd   %xmm4,%xmm3
lea    0x1(%rcx),%edx
ucomisd %xmm3,%xmm2
cmovb  %r12d,%edx
movapd %xmm3,%xmm0
cmpnlesd %xmm2,%xmm0
movapd %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
movsd  0x10(%rbp,%rcx,8),%xmm1
lea    0x2(%rcx),%esi
ucomisd %xmm0,%xmm1
cmovb  %edx,%esi
movapd %xmm0,%xmm2
cmpnlesd %xmm1,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movsd  0x18(%rbp,%rcx,8),%xmm1
lea    0x3(%rcx),%r12d
ucomisd %xmm2,%xmm1
cmovb  %esi,%r12d
movapd %xmm2,%xmm0
cmpnlesd %xmm1,%xmm0
movapd %xmm0,%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm1,%xmm0
orpd   %xmm3,%xmm0
add    $0x4,%rcx
cmp    %rax,%rcx
jne    1580 <main+0x390>
xorps  %xmm2,%xmm2
cvtsi2sd %r12d,%xmm2
movsd  %xmm2,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sdl 0x18(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x9a9(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm0
movapd %xmm2,%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1110 <floor@plt>
mov    %eax,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x980(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1110 <floor@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%eax
imul   %r14d,%eax
shl    $0x2,%eax
imul   %ebx,%r15d
sub    %r15d,%r12d
sub    %eax,%r12d
lea    0x992(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x28ff(%rip),%rax
mov    (%rax),%eax
imul   %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0x18(%rsp),%xmm3
divsd  %xmm3,%xmm0
lea    (%r14,%r14,1),%ecx
add    $0x1,%ecx
imul   %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
divsd  0x10(%rsp),%xmm1
imul   %eax,%r12d
xorps  %xmm2,%xmm2
cvtsi2sd %r12d,%xmm2
divsd  %xmm3,%xmm2
lea    0x951(%rip),%rdi
mov    $0x3,%al
call   1080 <printf@plt>
cmpl   $0x6,0x4c(%rsp)
jne    17a2 <main+0x5b2>
lea    0x9c6(%rip),%rdi
call   1050 <puts@plt>
mov    0x40(%rsp),%rax
mov    0x28(%rax),%rdi
lea    0x948(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r15
mov    0x50(%rsp),%rax
test   %eax,%eax
jle    179a <main+0x5aa>
mov    %eax,%r12d
xor    %ebx,%ebx
lea    0x92d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x0(%rbp,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
call   10a0 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1780 <main+0x590>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    0x58(%rsp),%rdi
call   1030 <free@plt>
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x8fe(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1100 <exit@plt>
lea    0x7e0(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"test_soft_sym_correlate sigCoef patCoef bw degLim [result]\0A\00"
@.str.1 = [27 x i8] c"Error in allocating memory\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [31 x i8] c"about to combine coefficients\0A\00"
@stderr = global i32* null
@.str.5 = [23 x i8] c"combine time \09 = %.4e\0A\00"
@.str.6 = [34 x i8] c"about to inverse so(3) transform\0A\00"
@.str.7 = [34 x i8] c"finished inverse so(3) transform\0A\00"
@.str.8 = [29 x i8] c"inverse so(3) time \09 = %.4e\0A\00"
@.str.9 = [25 x i8] c"ii = %d\09jj = %d\09kk = %d\0A\00"
@.str.10 = [33 x i8] c"alpha = %f\0Abeta = %f\0Agamma = %f\0A\00"
@M_PI = global i32 0
@.str.11 = [20 x i8] c"about to save data\0A\00"
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [7 x i8] c"%.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 double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 5
br i1 %29, label %30, label %33
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @exit(i32 0)
unreachable
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %8
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %9
%42 = load i32, i32* %8
%43 = mul nsw i32 8, %42
%44 = load i32, i32* %8
%45 = mul nsw i32 %43, %44
%46 = load i32, i32* %8
%47 = mul nsw i32 %45, %46
%48 = sext i32 %47 to i64
%49 = mul i64 8, %48
%50 = trunc i64 %49 to i32
%51 = call i64 @malloc(i32 %50)
%52 = inttoptr i64 %51 to double*
store double* %52, double** %12
%53 = load i32, i32* %8
%54 = mul nsw i32 8, %53
%55 = load i32, i32* %8
%56 = mul nsw i32 %54, %55
%57 = load i32, i32* %8
%58 = mul nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = mul i64 8, %59
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to double*
store double* %63, double** %13
%64 = load i32, i32* %8
%65 = mul nsw i32 16, %64
%66 = load i32, i32* %8
%67 = mul nsw i32 %65, %66
%68 = load i32, i32* %8
%69 = mul nsw i32 %67, %68
%70 = sext i32 %69 to i64
%71 = mul i64 8, %70
%72 = trunc i64 %71 to i32
%73 = call i64 @malloc(i32 %72)
%74 = inttoptr i64 %73 to double*
store double* %74, double** %14
%75 = load i32, i32* %8
%76 = mul nsw i32 24, %75
%77 = load i32, i32* %8
%78 = mul nsw i32 2, %77
%79 = load i32, i32* %8
%80 = mul nsw i32 %78, %79
%81 = add nsw i32 %76, %80
%82 = sext i32 %81 to i64
%83 = mul i64 8, %82
%84 = trunc i64 %83 to i32
%85 = call i64 @malloc(i32 %84)
%86 = inttoptr i64 %85 to double*
store double* %86, double** %15
%87 = load i32, i32* %8
%88 = sext i32 %87 to i64
%89 = mul i64 8, %88
%90 = load i32, i32* %8
%91 = sext i32 %90 to i64
%92 = mul i64 %89, %91
%93 = trunc i64 %92 to i32
%94 = call i64 @malloc(i32 %93)
%95 = inttoptr i64 %94 to double*
store double* %95, double** %16
%96 = load i32, i32* %8
%97 = sext i32 %96 to i64
%98 = mul i64 8, %97
%99 = load i32, i32* %8
%100 = sext i32 %99 to i64
%101 = mul i64 %98, %100
%102 = trunc i64 %101 to i32
%103 = call i64 @malloc(i32 %102)
%104 = inttoptr i64 %103 to double*
store double* %104, double** %17
%105 = load i32, i32* %8
%106 = sext i32 %105 to i64
%107 = mul i64 8, %106
%108 = load i32, i32* %8
%109 = sext i32 %108 to i64
%110 = mul i64 %107, %109
%111 = trunc i64 %110 to i32
%112 = call i64 @malloc(i32 %111)
%113 = inttoptr i64 %112 to double*
store double* %113, double** %18
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = mul i64 8, %115
%117 = load i32, i32* %8
%118 = sext i32 %117 to i64
%119 = mul i64 %116, %118
%120 = trunc i64 %119 to i32
%121 = call i64 @malloc(i32 %120)
%122 = inttoptr i64 %121 to double*
store double* %122, double** %19
%123 = load i32, i32* %8
%124 = mul nsw i32 4, %123
%125 = load i32, i32* %8
%126 = mul nsw i32 %124, %125
%127 = load i32, i32* %8
%128 = mul nsw i32 %126, %127
%129 = load i32, i32* %8
%130 = sub nsw i32 %128, %129
%131 = sdiv i32 %130, 3
%132 = sext i32 %131 to i64
%133 = mul i64 8, %132
%134 = trunc i64 %133 to i32
%135 = call i64 @malloc(i32 %134)
%136 = inttoptr i64 %135 to double*
store double* %136, double** %20
%137 = load i32, i32* %8
%138 = mul nsw i32 4, %137
%139 = load i32, i32* %8
%140 = mul nsw i32 %138, %139
%141 = load i32, i32* %8
%142 = mul nsw i32 %140, %141
%143 = load i32, i32* %8
%144 = sub nsw i32 %142, %143
%145 = sdiv i32 %144, 3
%146 = sext i32 %145 to i64
%147 = mul i64 8, %146
%148 = trunc i64 %147 to i32
%149 = call i64 @malloc(i32 %148)
%150 = inttoptr i64 %149 to double*
store double* %150, double** %21
%151 = load double*, double** %12
%152 = icmp eq double* %151, null
br i1 %152, label %180, label %153
153: ; preds = %33
%154 = load double*, double** %13
%155 = icmp eq double* %154, null
br i1 %155, label %180, label %156
156: ; preds = %153
%157 = load double*, double** %14
%158 = icmp eq double* %157, null
br i1 %158, label %180, label %159
159: ; preds = %156
%160 = load double*, double** %15
%161 = icmp eq double* %160, null
br i1 %161, label %180, label %162
162: ; preds = %159
%163 = load double*, double** %16
%164 = icmp eq double* %163, null
br i1 %164, label %180, label %165
165: ; preds = %162
%166 = load double*, double** %17
%167 = icmp eq double* %166, null
br i1 %167, label %180, label %168
168: ; preds = %165
%169 = load double*, double** %18
%170 = icmp eq double* %169, null
br i1 %170, label %180, label %171
171: ; preds = %168
%172 = load double*, double** %19
%173 = icmp eq double* %172, null
br i1 %173, label %180, label %174
174: ; preds = %171
%175 = load double*, double** %20
%176 = icmp eq double* %175, null
br i1 %176, label %180, label %177
177: ; preds = %174
%178 = load double*, double** %21
%179 = icmp eq double* %178, null
br i1 %179, label %180, label %183
180: ; preds = %177, %174, %171, %168, %165, %162, %159, %156, %153, %33
%181 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%182 = call i32 @exit(i32 1)
unreachable
183: ; preds = %177
%184 = load i8**, i8*** %5
%185 = getelementptr inbounds i8*, i8** %184, i64 1
%186 = load i8*, i8** %185
%187 = call i32* @fopen(i8* %186, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %187, i32** %6
store i32 0, i32* %7
br label %188
188: ; preds = %207, %183
%189 = load i32, i32* %7
%190 = load i32, i32* %8
%191 = load i32, i32* %8
%192 = mul nsw i32 %190, %191
%193 = icmp slt i32 %189, %192
br i1 %193, label %194, label %210
194: ; preds = %188
%195 = load i32*, i32** %6
%196 = load double*, double** %16
%197 = load i32, i32* %7
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %196, i64 %198
%200 = call i32 @fscanf(i32* %195, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %199)
%201 = load i32*, i32** %6
%202 = load double*, double** %17
%203 = load i32, i32* %7
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds double, double* %202, i64 %204
%206 = call i32 @fscanf(i32* %201, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %205)
br label %207
207: ; preds = %194
%208 = load i32, i32* %7
%209 = add nsw i32 %208, 1
store i32 %209, i32* %7
br label %188
210: ; preds = %188
%211 = load i32*, i32** %6
%212 = call i32 @fclose(i32* %211)
%213 = load i8**, i8*** %5
%214 = getelementptr inbounds i8*, i8** %213, i64 2
%215 = load i8*, i8** %214
%216 = call i32* @fopen(i8* %215, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %216, i32** %6
store i32 0, i32* %7
br label %217
217: ; preds = %236, %210
%218 = load i32, i32* %7
%219 = load i32, i32* %8
%220 = load i32, i32* %8
%221 = mul nsw i32 %219, %220
%222 = icmp slt i32 %218, %221
br i1 %222, label %223, label %239
223: ; preds = %217
%224 = load i32*, i32** %6
%225 = load double*, double** %18
%226 = load i32, i32* %7
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds double, double* %225, i64 %227
%229 = call i32 @fscanf(i32* %224, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %228)
%230 = load i32*, i32** %6
%231 = load double*, double** %19
%232 = load i32, i32* %7
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds double, double* %231, i64 %233
%235 = call i32 @fscanf(i32* %230, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %234)
br label %236
236: ; preds = %223
%237 = load i32, i32* %7
%238 = add nsw i32 %237, 1
store i32 %238, i32* %7
br label %217
239: ; preds = %217
%240 = load i32*, i32** %6
%241 = call i32 @fclose(i32* %240)
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%243 = call double (...) @csecond()
store double %243, double* %10
%244 = load i32, i32* %8
%245 = load i32, i32* %8
%246 = load i32, i32* %9
%247 = load double*, double** %16
%248 = load double*, double** %17
%249 = load double*, double** %18
%250 = load double*, double** %19
%251 = load double*, double** %20
%252 = load double*, double** %21
%253 = call i32 @so3CombineCoef(i32 %244, i32 %245, i32 %246, double* %247, double* %248, double* %249, double* %250, double* %251, double* %252)
%254 = call double (...) @csecond()
store double %254, double* %11
%255 = load i32*, i32** @stderr
%256 = load double, double* %11
%257 = load double, double* %10
%258 = fsub double %256, %257
%259 = call i32 @fprintf(i32* %255, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double %258)
%260 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%261 = call double (...) @csecond()
store double %261, double* %10
%262 = load i32, i32* %8
%263 = load double*, double** %20
%264 = load double*, double** %21
%265 = load double*, double** %12
%266 = load double*, double** %13
%267 = load double*, double** %14
%268 = load double*, double** %15
%269 = call i32 @Inverse_SO3_Naive_sym(i32 %262, double* %263, double* %264, double* %265, double* %266, double* %267, double* %268, i32 1)
%270 = call double (...) @csecond()
store double %270, double* %11
%271 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%272 = load i32*, i32** @stderr
%273 = load double, double* %11
%274 = load double, double* %10
%275 = fsub double %273, %274
%276 = call i32 @fprintf(i32* %272, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), double %275)
store double 0.000000e+00, double* %27
store i32 0, i32* %23
store i32 0, i32* %7
br label %277
277: ; preds = %302, %239
%278 = load i32, i32* %7
%279 = load i32, i32* %8
%280 = mul nsw i32 8, %279
%281 = load i32, i32* %8
%282 = mul nsw i32 %280, %281
%283 = load i32, i32* %8
%284 = mul nsw i32 %282, %283
%285 = icmp slt i32 %278, %284
br i1 %285, label %286, label %305
286: ; preds = %277
%287 = load double*, double** %12
%288 = load i32, i32* %7
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds double, double* %287, i64 %289
%291 = load double, double* %290
%292 = load double, double* %27
%293 = fcmp oge double %291, %292
br i1 %293, label %294, label %301
294: ; preds = %286
%295 = load double*, double** %12
%296 = load i32, i32* %7
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds double, double* %295, i64 %297
%299 = load double, double* %298
store double %299, double* %27
%300 = load i32, i32* %7
store i32 %300, i32* %23
br label %301
301: ; preds = %294, %286
br label %302
302: ; preds = %301
%303 = load i32, i32* %7
%304 = add nsw i32 %303, 1
store i32 %304, i32* %7
br label %277
305: ; preds = %277
%306 = load i32, i32* %23
%307 = sitofp i32 %306 to double
%308 = load i32, i32* %8
%309 = sitofp i32 %308 to double
%310 = fmul double 4.000000e+00, %309
%311 = load i32, i32* %8
%312 = sitofp i32 %311 to double
%313 = fmul double %310, %312
%314 = fdiv double %307, %313
%315 = fptosi double %314 to i32
%316 = call i32 @floor(i32 %315)
store i32 %316, i32* %24
%317 = load i32, i32* %23
%318 = sitofp i32 %317 to double
%319 = load i32, i32* %24
%320 = sitofp i32 %319 to double
%321 = fmul double %320, 4.000000e+00
%322 = load i32, i32* %8
%323 = sitofp i32 %322 to double
%324 = fmul double %321, %323
%325 = load i32, i32* %8
%326 = sitofp i32 %325 to double
%327 = fneg double %324
%328 = call double @llvm.fmuladd.f64(double %327, double %326, double %318)
%329 = fptosi double %328 to i32
store i32 %329, i32* %22
%330 = load i32, i32* %22
%331 = sitofp i32 %330 to double
%332 = load i32, i32* %8
%333 = sitofp i32 %332 to double
%334 = fmul double 2.000000e+00, %333
%335 = fdiv double %331, %334
%336 = fptosi double %335 to i32
%337 = call i32 @floor(i32 %336)
store i32 %337, i32* %25
%338 = load i32, i32* %23
%339 = load i32, i32* %24
%340 = mul nsw i32 %339, 4
%341 = load i32, i32* %8
%342 = mul nsw i32 %340, %341
%343 = load i32, i32* %8
%344 = mul nsw i32 %342, %343
%345 = sub nsw i32 %338, %344
%346 = load i32, i32* %25
%347 = load i32, i32* %8
%348 = mul nsw i32 2, %347
%349 = mul nsw i32 %346, %348
%350 = sub nsw i32 %345, %349
store i32 %350, i32* %22
%351 = load i32, i32* %22
store i32 %351, i32* %26
%352 = load i32, i32* %24
%353 = load i32, i32* %25
%354 = load i32, i32* %26
%355 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %352, i32 %353, i32 %354)
%356 = load i32, i32* @M_PI
%357 = load i32, i32* %25
%358 = mul nsw i32 %356, %357
%359 = sitofp i32 %358 to double
%360 = load i32, i32* %8
%361 = sitofp i32 %360 to double
%362 = fdiv double %359, %361
%363 = load i32, i32* @M_PI
%364 = load i32, i32* %24
%365 = mul nsw i32 2, %364
%366 = add nsw i32 %365, 1
%367 = mul nsw i32 %363, %366
%368 = sitofp i32 %367 to double
%369 = load i32, i32* %8
%370 = sitofp i32 %369 to double
%371 = fmul double 4.000000e+00, %370
%372 = fdiv double %368, %371
%373 = load i32, i32* @M_PI
%374 = load i32, i32* %26
%375 = mul nsw i32 %373, %374
%376 = sitofp i32 %375 to double
%377 = load i32, i32* %8
%378 = sitofp i32 %377 to double
%379 = fdiv double %376, %378
%380 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), double %362, double %372, double %379)
%381 = load i32, i32* %4
%382 = icmp eq i32 %381, 6
br i1 %382, label %383, label %412
383: ; preds = %305
%384 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%385 = load i8**, i8*** %5
%386 = getelementptr inbounds i8*, i8** %385, i64 5
%387 = load i8*, i8** %386
%388 = call i32* @fopen(i8* %387, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %388, i32** %6
store i32 0, i32* %7
br label %389
389: ; preds = %406, %383
%390 = load i32, i32* %7
%391 = load i32, i32* %8
%392 = mul nsw i32 8, %391
%393 = load i32, i32* %8
%394 = mul nsw i32 %392, %393
%395 = load i32, i32* %8
%396 = mul nsw i32 %394, %395
%397 = icmp slt i32 %390, %396
br i1 %397, label %398, label %409
398: ; preds = %389
%399 = load i32*, i32** %6
%400 = load double*, double** %12
%401 = load i32, i32* %7
%402 = sext i32 %401 to i64
%403 = getelementptr inbounds double, double* %400, i64 %402
%404 = load double, double* %403
%405 = call i32 @fprintf(i32* %399, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), double %404)
br label %406
406: ; preds = %398
%407 = load i32, i32* %7
%408 = add nsw i32 %407, 1
store i32 %408, i32* %7
br label %389
409: ; preds = %389
%410 = load i32*, i32** %6
%411 = call i32 @fclose(i32* %410)
br label %412
412: ; preds = %409, %305
%413 = load double*, double** %21
%414 = call i32 @free(double* %413)
%415 = load double*, double** %20
%416 = call i32 @free(double* %415)
%417 = load double*, double** %19
%418 = call i32 @free(double* %417)
%419 = load double*, double** %18
%420 = call i32 @free(double* %419)
%421 = load double*, double** %17
%422 = call i32 @free(double* %421)
%423 = load double*, double** %16
%424 = call i32 @free(double* %423)
%425 = load double*, double** %15
%426 = call i32 @free(double* %425)
%427 = load double*, double** %14
%428 = call i32 @free(double* %427)
%429 = load double*, double** %13
%430 = call i32 @free(double* %429)
%431 = load double*, double** %12
%432 = call i32 @free(double* %431)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"Error in allocating memory\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [4 x i8] c"%lf\00"
@stderr = global i32* null
@.str.5 = [23 x i8] c"combine time \09 = %.4e\0A\00"
@.str.8 = [29 x i8] c"inverse so(3) time \09 = %.4e\0A\00"
@.str.9 = [25 x i8] c"ii = %d\09jj = %d\09kk = %d\0A\00"
@.str.10 = [33 x i8] c"alpha = %f\0Abeta = %f\0Agamma = %f\0A\00"
@M_PI = global i32 0
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [7 x i8] c"%.16f\0A\00"
@str = [30 x i8] c"about to combine coefficients\00"
@str.14 = [33 x i8] c"about to inverse so(3) transform\00"
@str.15 = [33 x i8] c"finished inverse so(3) transform\00"
@str.16 = [19 x i8] c"about to save data\00"
@str.17 = [59 x i8] c"test_soft_sym_correlate sigCoef patCoef bw degLim [result]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.17, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 3
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 4
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = shl i32 %10, 3
%15 = mul nsw i32 %14, %10
%16 = mul nsw i32 %15, %10
%17 = shl i32 %16, 3
%18 = tail call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to double*
%20 = tail call i64 @malloc(i32 %17)
%21 = inttoptr i64 %20 to double*
%22 = mul i32 %10, %10
%23 = shl i32 %22, 7
%24 = mul i32 %23, %10
%25 = tail call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
%27 = shl nsw i32 %10, 1
%28 = add i32 %27, 24
%29 = mul i32 %14, %28
%30 = tail call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to double*
%32 = tail call i64 @malloc(i32 %15)
%33 = inttoptr i64 %32 to double*
%34 = tail call i64 @malloc(i32 %15)
%35 = inttoptr i64 %34 to double*
%36 = tail call i64 @malloc(i32 %15)
%37 = inttoptr i64 %36 to double*
%38 = tail call i64 @malloc(i32 %15)
%39 = inttoptr i64 %38 to double*
%40 = shl i32 %22, 2
%41 = mul i32 %40, %10
%42 = sub nsw i32 %41, %10
%43 = sdiv i32 %42, 3
%44 = shl i32 %43, 3
%45 = tail call i64 @malloc(i32 %44)
%46 = inttoptr i64 %45 to double*
%47 = tail call i64 @malloc(i32 %44)
%48 = inttoptr i64 %47 to double*
%49 = icmp eq i64 %18, 0
%50 = icmp eq i64 %20, 0
%51 = select i1 %49, i1 true, i1 %50
%52 = icmp eq i64 %25, 0
%53 = select i1 %51, i1 true, i1 %52
%54 = icmp eq i64 %30, 0
%55 = select i1 %53, i1 true, i1 %54
%56 = icmp eq i64 %32, 0
%57 = select i1 %55, i1 true, i1 %56
%58 = icmp eq i64 %34, 0
%59 = select i1 %57, i1 true, i1 %58
%60 = icmp eq i64 %36, 0
%61 = select i1 %59, i1 true, i1 %60
%62 = icmp eq i64 %38, 0
%63 = select i1 %61, i1 true, i1 %62
%64 = icmp eq i64 %45, 0
%65 = select i1 %63, i1 true, i1 %64
%66 = icmp eq i64 %47, 0
%67 = select i1 %65, i1 true, i1 %66
br i1 %67, label %68, label %71
68: ; preds = %7
%69 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%70 = tail call i32 @exit(i32 1)
unreachable
71: ; preds = %7
%72 = getelementptr inbounds i8*, i8** %1, i64 1
%73 = load i8*, i8** %72
%74 = tail call i32* @fopen(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%75 = icmp eq i32 %22, 0
br i1 %75, label %86, label %76
76: ; preds = %71
%77 = zext i32 %22 to i64
br label %78
78: ; preds = %76, %78
%79 = phi i64 [ 0, %76 ], [ %84, %78 ]
%80 = getelementptr inbounds double, double* %33, i64 %79
%81 = tail call i32 @fscanf(i32* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %80)
%82 = getelementptr inbounds double, double* %35, i64 %79
%83 = tail call i32 @fscanf(i32* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %82)
%84 = add nuw nsw i64 %79, 1
%85 = icmp eq i64 %84, %77
br i1 %85, label %86, label %78
86: ; preds = %78, %71
%87 = tail call i32 @fclose(i32* %74)
%88 = getelementptr inbounds i8*, i8** %1, i64 2
%89 = load i8*, i8** %88
%90 = tail call i32* @fopen(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br i1 %75, label %101, label %91
91: ; preds = %86
%92 = zext i32 %22 to i64
br label %93
93: ; preds = %91, %93
%94 = phi i64 [ 0, %91 ], [ %99, %93 ]
%95 = getelementptr inbounds double, double* %37, i64 %94
%96 = tail call i32 @fscanf(i32* %90, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %95)
%97 = getelementptr inbounds double, double* %39, i64 %94
%98 = tail call i32 @fscanf(i32* %90, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %97)
%99 = add nuw nsw i64 %94, 1
%100 = icmp eq i64 %99, %92
br i1 %100, label %101, label %93
101: ; preds = %93, %86
%102 = tail call i32 @fclose(i32* %90)
%103 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%104 = tail call double (...) @csecond()
%105 = tail call i32 @so3CombineCoef(i32 %10, i32 %10, i32 %13, double* %33, double* %35, double* %37, double* %39, double* %46, double* %48)
%106 = tail call double (...) @csecond()
%107 = load i32*, i32** @stderr
%108 = fsub double %106, %104
%109 = tail call i32 @fprintf(i32* %107, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double %108)
%110 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.14, i64 0, i64 0))
%111 = tail call double (...) @csecond()
%112 = tail call i32 @Inverse_SO3_Naive_sym(i32 %10, double* %46, double* %48, double* %19, double* %21, double* %26, double* %31, i32 1)
%113 = tail call double (...) @csecond()
%114 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%115 = load i32*, i32** @stderr
%116 = fsub double %113, %111
%117 = tail call i32 @fprintf(i32* %115, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), double %116)
%118 = icmp sgt i32 %16, 0
br i1 %118, label %119, label %154
119: ; preds = %101
%120 = zext i32 %16 to i64
br label %121
121: ; preds = %121, %119
%122 = phi i64 [ 0, %119 ], [ %152, %121 ]
%123 = phi double [ 0.000000e+00, %119 ], [ %151, %121 ]
%124 = phi i32 [ 0, %119 ], [ %150, %121 ]
%125 = getelementptr inbounds double, double* %19, i64 %122
%126 = load double, double* %125
%127 = fcmp ult double %126, %123
%128 = trunc i64 %122 to i32
%129 = select i1 %127, i32 %124, i32 %128
%130 = select i1 %127, double %123, double %126
%131 = or i64 %122, 1
%132 = getelementptr inbounds double, double* %19, i64 %131
%133 = load double, double* %132
%134 = fcmp ult double %133, %130
%135 = trunc i64 %131 to i32
%136 = select i1 %134, i32 %129, i32 %135
%137 = select i1 %134, double %130, double %133
%138 = or i64 %122, 2
%139 = getelementptr inbounds double, double* %19, i64 %138
%140 = load double, double* %139
%141 = fcmp ult double %140, %137
%142 = trunc i64 %138 to i32
%143 = select i1 %141, i32 %136, i32 %142
%144 = select i1 %141, double %137, double %140
%145 = or i64 %122, 3
%146 = getelementptr inbounds double, double* %19, i64 %145
%147 = load double, double* %146
%148 = fcmp ult double %147, %144
%149 = trunc i64 %145 to i32
%150 = select i1 %148, i32 %143, i32 %149
%151 = select i1 %148, double %144, double %147
%152 = add nuw nsw i64 %122, 4
%153 = icmp eq i64 %152, %120
br i1 %153, label %154, label %121
154: ; preds = %121, %101
%155 = phi i32 [ 0, %101 ], [ %150, %121 ]
%156 = sitofp i32 %155 to double
%157 = sitofp i32 %10 to double
%158 = fmul double %157, 4.000000e+00
%159 = fmul double %158, %157
%160 = fdiv double %156, %159
%161 = fptosi double %160 to i32
%162 = tail call i32 @floor(i32 %161)
%163 = sitofp i32 %162 to double
%164 = fmul double %163, -4.000000e+00
%165 = fmul double %164, %157
%166 = tail call double @llvm.fmuladd.f64(double %165, double %157, double %156)
%167 = fptosi double %166 to i32
%168 = sitofp i32 %167 to double
%169 = fmul double %157, 2.000000e+00
%170 = fdiv double %168, %169
%171 = fptosi double %170 to i32
%172 = tail call i32 @floor(i32 %171)
%173 = mul i32 %22, -4
%174 = mul i32 %173, %162
%175 = mul nsw i32 %172, %27
%176 = sub i32 %155, %175
%177 = add i32 %176, %174
%178 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %162, i32 %172, i32 %177)
%179 = load i32, i32* @M_PI
%180 = mul nsw i32 %179, %172
%181 = sitofp i32 %180 to double
%182 = fdiv double %181, %157
%183 = shl nsw i32 %162, 1
%184 = or i32 %183, 1
%185 = mul nsw i32 %179, %184
%186 = sitofp i32 %185 to double
%187 = fdiv double %186, %158
%188 = mul nsw i32 %177, %179
%189 = sitofp i32 %188 to double
%190 = fdiv double %189, %157
%191 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), double %182, double %187, double %190)
%192 = icmp eq i32 %0, 6
br i1 %192, label %193, label %209
193: ; preds = %154
%194 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.16, i64 0, i64 0))
%195 = getelementptr inbounds i8*, i8** %1, i64 5
%196 = load i8*, i8** %195
%197 = tail call i32* @fopen(i8* %196, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br i1 %118, label %198, label %207
198: ; preds = %193
%199 = zext i32 %16 to i64
br label %200
200: ; preds = %198, %200
%201 = phi i64 [ 0, %198 ], [ %205, %200 ]
%202 = getelementptr inbounds double, double* %19, i64 %201
%203 = load double, double* %202
%204 = tail call i32 @fprintf(i32* %197, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), double %203)
%205 = add nuw nsw i64 %201, 1
%206 = icmp eq i64 %205, %199
br i1 %206, label %207, label %200
207: ; preds = %200, %193
%208 = tail call i32 @fclose(i32* %197)
br label %209
209: ; preds = %207, %154
%210 = tail call i32 @free(double* %48)
%211 = tail call i32 @free(double* %46)
%212 = tail call i32 @free(double* %39)
%213 = tail call i32 @free(double* %37)
%214 = tail call i32 @free(double* %35)
%215 = tail call i32 @free(double* %33)
%216 = tail call i32 @free(double* %31)
%217 = tail call i32 @free(double* %26)
%218 = tail call i32 @free(double* %21)
%219 = tail call i32 @free(double* %19)
ret i32 0
}