#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ L2_3term_so3(int, int, int, double *, double *, double *);
int /*<<< orphan*/ memcpy(double *, double *, int);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ vec_add_scalar_so3(double, double *, double *, int);
int /*<<< orphan*/ vec_add_so3(double *, double *, double *, int);
int /*<<< orphan*/ vec_mul_inplace_so3(double, double *, int);
int /*<<< orphan*/ vec_mul_so3(double, double *, double *, int);
int /*<<< orphan*/ vec_pt_mul_so3(double *, double *, double *, int);
int /*<<< orphan*/ wigSpec_L2(int, int, double *, double *, int, double *);
void genWigTrans_L2(int m1, int m2, int bw, double *sinEval, double *cosEval,
                    double *sinEval2, double *cosEval2, double *result,
                    double *workspace) {
  int i, j, lCtr, m, n;
  int tmpM1, tmpM2;
  double *prevprev, *prev;
  double *tmp0, *tmp1, *tmp2, *tmp3;
  double an, bn, cn;
  lCtr = 0;
  tmpM1 = ((m1) > 0 ? (m1) : (-m1));
  tmpM2 = ((m2) > 0 ? (m2) : (-m2));
  m = ((tmpM1) > (tmpM2) ? (tmpM1) : (tmpM2));
  n = 2 * bw;
  prevprev = workspace;
  prev = prevprev + n;
  tmp0 = prev + n;
  tmp1 = tmp0 + n;
  tmp2 = tmp1 + n;
  tmp3 = tmp2 + n;
  memset(prevprev, 0, sizeof(double) * n);
  wigSpec_L2(m1, m2, sinEval2, cosEval2, n, prev);
  for (i = 0; i < n; i++)
    result[(bw - m) * i] = prev[i];
  for (i = 0; i < bw - m - 1; i++) {
    L2_3term_so3(m + i, m1, m2, &an, &bn, &cn);
    vec_mul_so3(an, prevprev, tmp0, n);
    vec_add_scalar_so3(cn, cosEval, tmp1, n);
    vec_mul_inplace_so3(bn, tmp1, n);
    vec_pt_mul_so3(prev, tmp1, tmp2, n);
    vec_add_so3(tmp0, tmp2, tmp3, n);
    for (j = 0; j < n; j++)
      result[i + 1 + (bw - m) * j] = tmp3[j];
    memcpy(prevprev, prev, sizeof(double) * n);
    memcpy(prev, tmp3, sizeof(double) * n);
  }
}


x86 assembly (clang, -O0):
<genWigTrans_L2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11db <genWigTrans_L2+0x4b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x94(%rbp)
jmp    11e6 <genWigTrans_L2+0x56>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1207 <genWigTrans_L2+0x77>
mov    -0x8(%rbp),%eax
mov    %eax,-0x98(%rbp)
jmp    1212 <genWigTrans_L2+0x82>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x44(%rbp),%eax
jle    1235 <genWigTrans_L2+0xa5>
mov    -0x40(%rbp),%eax
mov    %eax,-0x9c(%rbp)
jmp    123e <genWigTrans_L2+0xae>
mov    -0x44(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x50(%rbp),%rdi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    -0x3c(%rbp),%r8d
mov    -0x58(%rbp),%r9
call   10a0 <wigSpec_L2@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    132b <genWigTrans_L2+0x19b>
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    -0x38(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ee <genWigTrans_L2+0x15e>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x38(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    145a <genWigTrans_L2+0x2ca>
mov    -0x38(%rbp),%edi
add    -0x2c(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    -0x80(%rbp),%rcx
lea    -0x88(%rbp),%r8
lea    -0x90(%rbp),%r9
call   1030 <L2_3term_so3@plt>
movsd  -0x80(%rbp),%xmm0
mov    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   10b0 <vec_mul_so3@plt>
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x20(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1090 <vec_add_scalar_so3@plt>
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x68(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1070 <vec_mul_inplace_so3@plt>
mov    -0x58(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
call   1060 <vec_pt_mul_so3@plt>
mov    -0x60(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x78(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
call   1080 <vec_add_so3@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    141e <genWigTrans_L2+0x28e>
mov    -0x78(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    -0xc(%rbp),%edx
sub    -0x38(%rbp),%edx
imul   -0x30(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13d9 <genWigTrans_L2+0x249>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0x78(%rbp),%rsi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1332 <genWigTrans_L2+0x1a2>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genWigTrans_L2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,0x88(%rsp)
mov    %edx,%r12d
mov    %esi,%r13d
mov    %edi,%ebp
mov    0xf0(%rsp),%rdi
mov    %ebp,%eax
neg    %eax
cmovs  %ebp,%eax
mov    %esi,%ebx
neg    %ebx
cmovs  %esi,%ebx
cmp    %ebx,%eax
cmova  %eax,%ebx
lea    (%r12,%r12,1),%eax
mov    %eax,0xc(%rsp)
movslq %eax,%r14
lea    (%rdi,%r14,8),%r15
shl    $0x4,%edx
xor    %esi,%esi
mov    %edx,0x44(%rsp)
call   1040 <memset@plt>
mov    %ebp,0x48(%rsp)
mov    %ebp,%edi
mov    %r13d,0x4c(%rsp)
mov    %r13d,%esi
mov    0x18(%rsp),%rdx
mov    0xe0(%rsp),%rcx
mov    %r14,0x10(%rsp)
mov    %r14d,%r8d
mov    %r15,%r9
call   10a0 <wigSpec_L2@plt>
mov    %r12,0x50(%rsp)
test   %r12d,%r12d
jle    158f <genWigTrans_L2+0x3ff>
mov    %rbx,%rdi
mov    %r15,0x38(%rsp)
mov    0xe8(%rsp),%rbp
mov    0x50(%rsp),%rcx
mov    %ecx,%r14d
sub    %edi,%r14d
mov    0xc(%rsp),%esi
cmp    $0x2,%esi
mov    $0x1,%eax
cmovge %esi,%eax
lea    -0x1(%rax),%rbx
mov    %eax,%r8d
and    $0x3,%r8d
xor    %edx,%edx
mov    %rbx,0x60(%rsp)
cmp    $0x3,%rbx
mov    %rax,0x28(%rsp)
jae    127d <genWigTrans_L2+0xed>
xor    %ecx,%ecx
mov    0xf0(%rsp),%r13
jmp    1322 <genWigTrans_L2+0x192>
mov    %rax,%r9
and    $0x7ffffffc,%r9d
mov    %esi,%r10d
sub    %edi,%r10d
sub    %edi,%r10d
lea    0x0(,%rcx,4),%r11d
lea    0x0(,%rdi,4),%eax
sub    %eax,%r11d
mov    0xf0(%rsp),%r13
mov    0x10(%rsp),%rax
lea    0x18(,%rax,8),%rbx
add    %r13,%rbx
lea    (%rcx,%rcx,2),%eax
lea    (%rdi,%rdi,2),%ecx
sub    %ecx,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  -0x18(%rbx,%rcx,8),%xmm0
movslq %edx,%rdx
movsd  %xmm0,0x0(%rbp,%rdx,8)
movsd  -0x10(%rbx,%rcx,8),%xmm0
lea    (%r14,%rdx,1),%esi
movslq %esi,%rsi
movsd  %xmm0,0x0(%rbp,%rsi,8)
movsd  -0x8(%rbx,%rcx,8),%xmm0
lea    (%r10,%rdx,1),%esi
movslq %esi,%rsi
movsd  %xmm0,0x0(%rbp,%rsi,8)
movsd  (%rbx,%rcx,8),%xmm0
lea    (%rax,%rdx,1),%esi
movslq %esi,%rsi
movsd  %xmm0,0x0(%rbp,%rsi,8)
add    $0x4,%rcx
add    %r11d,%edx
cmp    %rcx,%r9
jne    12d0 <genWigTrans_L2+0x140>
test   %r8,%r8
je     135a <genWigTrans_L2+0x1ca>
mov    0x10(%rsp),%rax
add    %rcx,%rax
lea    0x0(,%rax,8),%rax
add    %r13,%rax
imul   %r14d,%ecx
xor    %edx,%edx
movsd  (%rax,%rdx,8),%xmm0
movslq %ecx,%rcx
movsd  %xmm0,0x0(%rbp,%rcx,8)
add    $0x1,%rdx
add    %r14d,%ecx
cmp    %rdx,%r8
jne    1340 <genWigTrans_L2+0x1b0>
mov    %r14,0x30(%rsp)
cmp    $0x2,%r14d
jl     158f <genWigTrans_L2+0x3ff>
mov    0x10(%rsp),%rcx
mov    0x38(%rsp),%rax
lea    (%rax,%rcx,8),%rax
mov    %rax,0x78(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x70(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x68(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x18(%rsp)
mov    0x30(%rsp),%rax
add    $0xffffffff,%eax
mov    %eax,0x40(%rsp)
mov    0x28(%rsp),%r14
and    $0x7ffffffe,%r14d
mov    %r14,0x58(%rsp)
mov    0xc(%rsp),%r14d
sub    %edi,%r14d
sub    %edi,%r14d
lea    (%rcx,%rcx,4),%rax
lea    0x8(,%rax,8),%r12
add    %r13,%r12
xor    %ebp,%ebp
movl   $0x1,0x24(%rsp)
mov    %rdi,0x80(%rsp)
jmp    1434 <genWigTrans_L2+0x2a4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xf0(%rsp),%r13
mov    %r13,%rdi
mov    0x38(%rsp),%r15
mov    %r15,%rsi
mov    0x44(%rsp),%ebx
mov    %ebx,%edx
call   1050 <memcpy@plt>
mov    %r15,%rdi
mov    0x18(%rsp),%rsi
mov    %ebx,%edx
call   1050 <memcpy@plt>
addl   $0x1,0x24(%rsp)
cmp    0x40(%rsp),%ebp
mov    0x80(%rsp),%rdi
je     158f <genWigTrans_L2+0x3ff>
mov    %rbp,0x10(%rsp)
add    %ebp,%edi
mov    0x48(%rsp),%esi
mov    0x4c(%rsp),%edx
lea    0xa0(%rsp),%rcx
lea    0x98(%rsp),%r8
lea    0x90(%rsp),%r9
call   1030 <L2_3term_so3@plt>
movsd  0xa0(%rsp),%xmm0
mov    %r13,%rdi
mov    0x78(%rsp),%r13
mov    %r13,%rsi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   10b0 <vec_mul_so3@plt>
movsd  0x90(%rsp),%xmm0
mov    0x88(%rsp),%rdi
mov    0x70(%rsp),%r15
mov    %r15,%rsi
mov    %ebx,%edx
call   1090 <vec_add_scalar_so3@plt>
movsd  0x98(%rsp),%xmm0
mov    %r15,%rdi
mov    %ebx,%esi
call   1070 <vec_mul_inplace_so3@plt>
mov    0x38(%rsp),%rdi
mov    %r15,%rsi
mov    0x18(%rsp),%r15
mov    0x68(%rsp),%rbp
mov    %rbp,%rdx
mov    %ebx,%ecx
call   1060 <vec_pt_mul_so3@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    0x10(%rsp),%rbp
mov    %r15,%rdx
mov    %ebx,%ecx
call   1080 <vec_add_so3@plt>
add    $0x1,%ebp
cmpl   $0x0,0x50(%rsp)
jle    13f0 <genWigTrans_L2+0x260>
cmpq   $0x0,0x60(%rsp)
je     1550 <genWigTrans_L2+0x3c0>
mov    %rbp,%r8
mov    0x24(%rsp),%eax
mov    %eax,%ecx
xor    %eax,%eax
mov    0xe8(%rsp),%rsi
mov    0x30(%rsp),%rdi
mov    0x28(%rsp),%rbx
mov    0x58(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%r12,%rax,8),%xmm0
movslq %ecx,%rcx
movsd  %xmm0,(%rsi,%rcx,8)
movsd  (%r12,%rax,8),%xmm0
lea    (%rdi,%rcx,1),%edx
movslq %edx,%rdx
movsd  %xmm0,(%rsi,%rdx,8)
add    $0x2,%rax
add    %r14d,%ecx
cmp    %rax,%rbp
jne    1520 <genWigTrans_L2+0x390>
jmp    155a <genWigTrans_L2+0x3ca>
xchg   %ax,%ax
mov    %rbp,%r8
xor    %eax,%eax
mov    0x28(%rsp),%rbx
test   $0x1,%bl
mov    %r8,%rbp
je     13f0 <genWigTrans_L2+0x260>
mov    0x18(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm0
mov    0x30(%rsp),%rcx
imul   %eax,%ecx
add    %ebp,%ecx
movslq %ecx,%rax
mov    0xe8(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
jmp    13f0 <genWigTrans_L2+0x260>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @genWigTrans_L2(i32 %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca double*
%27 = alloca double*
%28 = alloca double*
%29 = alloca double*
%30 = alloca double*
%31 = alloca double*
%32 = alloca double
%33 = alloca double
%34 = alloca double
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store double* %3, double** %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
store i32 0, i32* %21
%35 = load i32, i32* %10
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %9
%38 = load i32, i32* %10
br label %42
39: ; preds = %9
%40 = load i32, i32* %10
%41 = sub nsw i32 0, %40
br label %42
42: ; preds = %39, %37
%43 = phi i32 [ %38, %37 ], [ %41, %39 ]
store i32 %43, i32* %24
%44 = load i32, i32* %11
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load i32, i32* %11
br label %51
48: ; preds = %42
%49 = load i32, i32* %11
%50 = sub nsw i32 0, %49
br label %51
51: ; preds = %48, %46
%52 = phi i32 [ %47, %46 ], [ %50, %48 ]
store i32 %52, i32* %25
%53 = load i32, i32* %24
%54 = load i32, i32* %25
%55 = icmp sgt i32 %53, %54
br i1 %55, label %56, label %58
56: ; preds = %51
%57 = load i32, i32* %24
br label %60
58: ; preds = %51
%59 = load i32, i32* %25
br label %60
60: ; preds = %58, %56
%61 = phi i32 [ %57, %56 ], [ %59, %58 ]
store i32 %61, i32* %22
%62 = load i32, i32* %12
%63 = mul nsw i32 2, %62
store i32 %63, i32* %23
%64 = load double*, double** %18
store double* %64, double** %26
%65 = load double*, double** %26
%66 = load i32, i32* %23
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
store double* %68, double** %27
%69 = load double*, double** %27
%70 = load i32, i32* %23
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double* %72, double** %28
%73 = load double*, double** %28
%74 = load i32, i32* %23
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
store double* %76, double** %29
%77 = load double*, double** %29
%78 = load i32, i32* %23
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
store double* %80, double** %30
%81 = load double*, double** %30
%82 = load i32, i32* %23
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
store double* %84, double** %31
%85 = load double*, double** %26
%86 = load i32, i32* %23
%87 = sext i32 %86 to i64
%88 = mul i64 8, %87
%89 = trunc i64 %88 to i32
%90 = call i32 @memset(double* %85, i32 0, i32 %89)
%91 = load i32, i32* %10
%92 = load i32, i32* %11
%93 = load double*, double** %15
%94 = load double*, double** %16
%95 = load i32, i32* %23
%96 = load double*, double** %27
%97 = call i32 @wigSpec_L2(i32 %91, i32 %92, double* %93, double* %94, i32 %95, double* %96)
store i32 0, i32* %19
br label %98
98: ; preds = %116, %60
%99 = load i32, i32* %19
%100 = load i32, i32* %23
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %119
102: ; preds = %98
%103 = load double*, double** %27
%104 = load i32, i32* %19
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = load double*, double** %17
%109 = load i32, i32* %12
%110 = load i32, i32* %22
%111 = sub nsw i32 %109, %110
%112 = load i32, i32* %19
%113 = mul nsw i32 %111, %112
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %108, i64 %114
store double %107, double* %115
br label %116
116: ; preds = %102
%117 = load i32, i32* %19
%118 = add nsw i32 %117, 1
store i32 %118, i32* %19
br label %98
119: ; preds = %98
store i32 0, i32* %19
br label %120
120: ; preds = %197, %119
%121 = load i32, i32* %19
%122 = load i32, i32* %12
%123 = load i32, i32* %22
%124 = sub nsw i32 %122, %123
%125 = sub nsw i32 %124, 1
%126 = icmp slt i32 %121, %125
br i1 %126, label %127, label %200
127: ; preds = %120
%128 = load i32, i32* %22
%129 = load i32, i32* %19
%130 = add nsw i32 %128, %129
%131 = load i32, i32* %10
%132 = load i32, i32* %11
%133 = call i32 @L2_3term_so3(i32 %130, i32 %131, i32 %132, double* %32, double* %33, double* %34)
%134 = load double, double* %32
%135 = load double*, double** %26
%136 = load double*, double** %28
%137 = load i32, i32* %23
%138 = call i32 @vec_mul_so3(double %134, double* %135, double* %136, i32 %137)
%139 = load double, double* %34
%140 = load double*, double** %14
%141 = load double*, double** %29
%142 = load i32, i32* %23
%143 = call i32 @vec_add_scalar_so3(double %139, double* %140, double* %141, i32 %142)
%144 = load double, double* %33
%145 = load double*, double** %29
%146 = load i32, i32* %23
%147 = call i32 @vec_mul_inplace_so3(double %144, double* %145, i32 %146)
%148 = load double*, double** %27
%149 = load double*, double** %29
%150 = load double*, double** %30
%151 = load i32, i32* %23
%152 = call i32 @vec_pt_mul_so3(double* %148, double* %149, double* %150, i32 %151)
%153 = load double*, double** %28
%154 = load double*, double** %30
%155 = load double*, double** %31
%156 = load i32, i32* %23
%157 = call i32 @vec_add_so3(double* %153, double* %154, double* %155, i32 %156)
store i32 0, i32* %20
br label %158
158: ; preds = %179, %127
%159 = load i32, i32* %20
%160 = load i32, i32* %23
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %182
162: ; preds = %158
%163 = load double*, double** %31
%164 = load i32, i32* %20
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %163, i64 %165
%167 = load double, double* %166
%168 = load double*, double** %17
%169 = load i32, i32* %19
%170 = add nsw i32 %169, 1
%171 = load i32, i32* %12
%172 = load i32, i32* %22
%173 = sub nsw i32 %171, %172
%174 = load i32, i32* %20
%175 = mul nsw i32 %173, %174
%176 = add nsw i32 %170, %175
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds double, double* %168, i64 %177
store double %167, double* %178
br label %179
179: ; preds = %162
%180 = load i32, i32* %20
%181 = add nsw i32 %180, 1
store i32 %181, i32* %20
br label %158
182: ; preds = %158
%183 = load double*, double** %26
%184 = load double*, double** %27
%185 = load i32, i32* %23
%186 = sext i32 %185 to i64
%187 = mul i64 8, %186
%188 = trunc i64 %187 to i32
%189 = call i32 @memcpy(double* %183, double* %184, i32 %188)
%190 = load double*, double** %27
%191 = load double*, double** %31
%192 = load i32, i32* %23
%193 = sext i32 %192 to i64
%194 = mul i64 8, %193
%195 = trunc i64 %194 to i32
%196 = call i32 @memcpy(double* %190, double* %191, i32 %195)
br label %197
197: ; preds = %182
%198 = load i32, i32* %19
%199 = add nsw i32 %198, 1
store i32 %199, i32* %19
br label %120
200: ; preds = %120
ret void
}

LLVM IR (-O2):
define void @genWigTrans_L2(i32 %0, i32 %1, i32 %2, double* nocapture readnone %3, double* %4, double* %5, double* %6, double* nocapture writeonly %7, double* %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = bitcast double* %10 to i8*
%14 = bitcast double* %11 to i8*
%15 = bitcast double* %12 to i8*
%16 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%17 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%18 = icmp ugt i32 %16, %17
%19 = select i1 %18, i32 %16, i32 %17
%20 = shl i32 %2, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %8, i64 %21
%23 = getelementptr inbounds double, double* %22, i64 %21
%24 = getelementptr inbounds double, double* %23, i64 %21
%25 = getelementptr inbounds double, double* %24, i64 %21
%26 = getelementptr inbounds double, double* %25, i64 %21
%27 = shl i32 %2, 4
%28 = tail call i32 @memset(double* %8, i32 0, i32 %27)
%29 = tail call i32 @wigSpec_L2(i32 %0, i32 %1, double* %5, double* %6, i32 %20, double* %22)
%30 = icmp sgt i32 %2, 0
br i1 %30, label %31, label %145
31: ; preds = %9
%32 = sub nsw i32 %2, %19
%33 = call i32 @llvm.smax.i32(i32 %20, i32 1)
%34 = zext i32 %33 to i64
%35 = add nsw i64 %34, -1
%36 = and i64 %34, 3
%37 = icmp ult i64 %35, 3
br i1 %37, label %40, label %38
38: ; preds = %31
%39 = and i64 %34, 2147483644
br label %63
40: ; preds = %63, %31
%41 = phi i64 [ 0, %31 ], [ %93, %63 ]
%42 = icmp eq i64 %36, 0
br i1 %42, label %55, label %43
43: ; preds = %40, %43
%44 = phi i64 [ %52, %43 ], [ %41, %40 ]
%45 = phi i64 [ %53, %43 ], [ 0, %40 ]
%46 = trunc i64 %44 to i32
%47 = getelementptr inbounds double, double* %22, i64 %44
%48 = load double, double* %47
%49 = mul nsw i32 %32, %46
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %7, i64 %50
store double %48, double* %51
%52 = add nuw nsw i64 %44, 1
%53 = add i64 %45, 1
%54 = icmp eq i64 %53, %36
br i1 %54, label %55, label %43
55: ; preds = %43, %40
%56 = icmp sgt i32 %32, 1
br i1 %56, label %57, label %145
57: ; preds = %55
%58 = add nsw i32 %32, -1
%59 = and i64 %34, 1
%60 = icmp eq i64 %35, 0
%61 = and i64 %34, 2147483646
%62 = icmp eq i64 %59, 0
br label %96
63: ; preds = %63, %38
%64 = phi i64 [ 0, %38 ], [ %93, %63 ]
%65 = phi i64 [ 0, %38 ], [ %94, %63 ]
%66 = trunc i64 %64 to i32
%67 = getelementptr inbounds double, double* %22, i64 %64
%68 = load double, double* %67
%69 = mul nsw i32 %32, %66
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %7, i64 %70
store double %68, double* %71
%72 = or i64 %64, 1
%73 = trunc i64 %72 to i32
%74 = getelementptr inbounds double, double* %22, i64 %72
%75 = load double, double* %74
%76 = mul nsw i32 %32, %73
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %7, i64 %77
store double %75, double* %78
%79 = or i64 %64, 2
%80 = trunc i64 %79 to i32
%81 = getelementptr inbounds double, double* %22, i64 %79
%82 = load double, double* %81
%83 = mul nsw i32 %32, %80
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %7, i64 %84
store double %82, double* %85
%86 = or i64 %64, 3
%87 = trunc i64 %86 to i32
%88 = getelementptr inbounds double, double* %22, i64 %86
%89 = load double, double* %88
%90 = mul nsw i32 %32, %87
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %7, i64 %91
store double %89, double* %92
%93 = add nuw nsw i64 %64, 4
%94 = add i64 %65, 4
%95 = icmp eq i64 %94, %39
br i1 %95, label %40, label %63
96: ; preds = %57, %141
%97 = phi i32 [ 0, %57 ], [ %108, %141 ]
%98 = add nuw nsw i32 %97, %19
%99 = call i32 @L2_3term_so3(i32 %98, i32 %0, i32 %1, double* %10, double* %11, double* %12)
%100 = load double, double* %10
%101 = call i32 @vec_mul_so3(double %100, double* %8, double* %23, i32 %20)
%102 = load double, double* %12
%103 = call i32 @vec_add_scalar_so3(double %102, double* %4, double* %24, i32 %20)
%104 = load double, double* %11
%105 = call i32 @vec_mul_inplace_so3(double %104, double* %24, i32 %20)
%106 = call i32 @vec_pt_mul_so3(double* %22, double* %24, double* %25, i32 %20)
%107 = call i32 @vec_add_so3(double* %23, double* %25, double* %26, i32 %20)
%108 = add nuw nsw i32 %97, 1
br i1 %30, label %109, label %141
109: ; preds = %96
br i1 %60, label %131, label %110
110: ; preds = %109, %110
%111 = phi i64 [ %128, %110 ], [ 0, %109 ]
%112 = phi i64 [ %129, %110 ], [ 0, %109 ]
%113 = trunc i64 %111 to i32
%114 = getelementptr inbounds double, double* %26, i64 %111
%115 = load double, double* %114
%116 = mul nsw i32 %32, %113
%117 = add nsw i32 %108, %116
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %7, i64 %118
store double %115, double* %119
%120 = or i64 %111, 1
%121 = trunc i64 %120 to i32
%122 = getelementptr inbounds double, double* %26, i64 %120
%123 = load double, double* %122
%124 = mul nsw i32 %32, %121
%125 = add nsw i32 %108, %124
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %7, i64 %126
store double %123, double* %127
%128 = add nuw nsw i64 %111, 2
%129 = add i64 %112, 2
%130 = icmp eq i64 %129, %61
br i1 %130, label %131, label %110
131: ; preds = %110, %109
%132 = phi i64 [ 0, %109 ], [ %128, %110 ]
br i1 %62, label %141, label %133
133: ; preds = %131
%134 = trunc i64 %132 to i32
%135 = getelementptr inbounds double, double* %26, i64 %132
%136 = load double, double* %135
%137 = mul nsw i32 %32, %134
%138 = add nsw i32 %108, %137
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %7, i64 %139
store double %136, double* %140
br label %141
141: ; preds = %133, %131, %96
%142 = call i32 @memcpy(double* %8, double* %22, i32 %27)
%143 = call i32 @memcpy(double* %22, double* %26, i32 %27)
%144 = icmp eq i32 %108, %58
br i1 %144, label %145, label %96
145: ; preds = %141, %9, %55
ret void
}