#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*/ free(double *);
double *malloc(int);
int /*<<< orphan*/ matrix_tran(double *, int, int, double *, int, int);
int /*<<< orphan*/ swt_conv(double *, int, double *, int, double *, int,
                            double *, double *, int);
int /*<<< orphan*/ swt_exp2(int, int *);
void swt2_output4(double *matrixIn, int matrixInRow, int matrixInCol,
                  double *matrixOutApprox, double *matrixOutColDetail,
                  double *matrixOutRowDetail, double *matrixOutDetail,
                  int matrixOutRow, int matrixOutCol, double *filterLow,
                  double *filterHi, int filterLength, int step) {
  int row, col, count;
  int filterLen, twt;
  double *matrixOutApproxPre, *matrixOutDetailPre;
  double *filterLowM, *filterHiM;
  double *pMatrixOutApproxPre, *pMatrixOutDetailPre;
  matrixOutApproxPre = malloc(matrixInRow * matrixOutCol * sizeof(double));
  matrixOutDetailPre = malloc(matrixInRow * matrixOutCol * sizeof(double));
  swt_exp2(step, &twt);
  filterLen = filterLength * twt;
  filterLowM = malloc(filterLen * sizeof(double));
  filterHiM = malloc(filterLen * sizeof(double));
  for (count = 0; count < filterLen; count++) {
    if (count % twt == 0) {
      filterLowM[count] = filterLow[count / twt];
      filterHiM[count] = filterHi[count / twt];
    } else {
      filterLowM[count] = 0;
      filterHiM[count] = 0;
    }
  }
  for (row = 0; row < matrixInRow; row++) {
    swt_conv(matrixIn + row * matrixInCol, matrixInCol,
             matrixOutApproxPre + row * matrixInCol, matrixInCol,
             matrixOutDetailPre + row * matrixInCol, matrixInCol, filterLowM,
             filterHiM, filterLen);
  }
  pMatrixOutApproxPre = malloc(matrixInRow * matrixOutCol * sizeof(double));
  matrix_tran(matrixOutApproxPre, matrixInRow, matrixInCol, pMatrixOutApproxPre,
              matrixInRow, matrixInCol);
  free(matrixOutApproxPre);
  pMatrixOutDetailPre = malloc(matrixInRow * matrixOutCol * sizeof(double));
  matrix_tran(matrixOutDetailPre, matrixInRow, matrixInCol, pMatrixOutDetailPre,
              matrixInRow, matrixInCol);
  free(matrixOutDetailPre);
  for (col = 0; col < matrixInCol; col++) {
    swt_conv(pMatrixOutApproxPre + col * matrixInRow, matrixInRow,
             matrixOutApprox + col * matrixInRow, matrixInRow,
             matrixOutColDetail + col * matrixInRow, matrixInRow, filterLowM,
             filterHiM, filterLen);
  }
  free(pMatrixOutApproxPre);
  for (col = 0; col < matrixInCol; col++) {
    swt_conv(pMatrixOutDetailPre + col * matrixInRow, matrixInRow,
             matrixOutRowDetail + col * matrixInRow, matrixInRow,
             matrixOutDetail + col * matrixInRow, matrixInRow, filterLowM,
             filterHiM, filterLen);
  }
  free(pMatrixOutDetailPre);
  return;
}


x86 assembly (clang, -O0):
<swt2_output4>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0xc(%rbp),%eax
imul   0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
imul   0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    0x40(%rbp),%edi
lea    -0x3c(%rbp),%rsi
call   1070 <swt_exp2@plt>
mov    0x38(%rbp),%eax
imul   -0x3c(%rbp),%eax
mov    %eax,-0x38(%rbp)
movslq -0x38(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x38(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    12a4 <swt2_output4+0x154>
mov    -0x34(%rbp),%eax
cltd
idivl  -0x3c(%rbp)
cmp    $0x0,%edx
jne    1271 <swt2_output4+0x121>
mov    0x28(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x3c(%rbp)
mov    %eax,%ecx
mov    -0x80(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x3c(%rbp)
mov    %eax,%ecx
mov    -0x78(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1291 <swt2_output4+0x141>
mov    -0x58(%rbp),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1296 <swt2_output4+0x146>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11fc <swt2_output4+0xac>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1328 <swt2_output4+0x1d8>
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x2c(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x10(%rbp),%ecx
mov    -0x50(%rbp),%r8
mov    -0x2c(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
mov    -0x10(%rbp),%r9d
mov    -0x58(%rbp),%r11
mov    -0x60(%rbp),%r10
mov    -0x38(%rbp),%eax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1050 <swt_conv@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ab <swt2_output4+0x15b>
mov    -0xc(%rbp),%eax
imul   0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x68(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
call   1060 <matrix_tran@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
imul   0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x70(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
call   1060 <matrix_tran@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1424 <swt2_output4+0x2d4>
mov    -0x68(%rbp),%rdi
mov    -0x30(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x30(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x30(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
mov    -0xc(%rbp),%r9d
mov    -0x58(%rbp),%r11
mov    -0x60(%rbp),%r10
mov    -0x38(%rbp),%eax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1050 <swt_conv@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13a7 <swt2_output4+0x257>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    14b1 <swt2_output4+0x361>
mov    -0x70(%rbp),%rdi
mov    -0x30(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0xc(%rbp),%ecx
mov    0x10(%rbp),%r8
mov    -0x30(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
mov    -0xc(%rbp),%r9d
mov    -0x58(%rbp),%r11
mov    -0x60(%rbp),%r10
mov    -0x38(%rbp),%eax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1050 <swt_conv@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1434 <swt2_output4+0x2e4>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swt2_output4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x50(%rsp)
mov    %r8,0x48(%rsp)
mov    %rcx,0x40(%rsp)
mov    %edx,0x4(%rsp)
mov    %rdi,%r14
mov    0xc0(%rsp),%ebp
mov    0xa0(%rsp),%ebx
mov    %esi,(%rsp)
imul   %esi,%ebx
shl    $0x3,%ebx
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    %ebx,0x28(%rsp)
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0x34(%rsp),%rsi
mov    %ebp,%edi
call   1070 <swt_exp2@plt>
mov    0x34(%rsp),%r12d
mov    0xb8(%rsp),%r13d
imul   %r12d,%r13d
lea    0x0(,%r13,8),%r15d
mov    %r15d,%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
mov    %r15d,%edi
call   1040 <malloc@plt>
mov    %rax,%rsi
test   %r13d,%r13d
jle    1233 <swt2_output4+0xe3>
mov    0xb0(%rsp),%r8
mov    0xa8(%rsp),%rdi
mov    %r13d,%ebx
xor    %ecx,%ecx
jmp    1214 <swt2_output4+0xc4>
xchg   %ax,%ax
movsd  %xmm0,0x0(%rbp,%rcx,8)
movsd  %xmm1,(%rsi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rbx
je     1233 <swt2_output4+0xe3>
mov    %ecx,%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
test   %edx,%edx
jne    1200 <swt2_output4+0xb0>
cltq
movsd  (%rdi,%rax,8),%xmm0
movsd  (%r8,%rax,8),%xmm1
jmp    1200 <swt2_output4+0xb0>
cmpl   $0x0,(%rsp)
mov    %r13,%r12
mov    %rsi,%rax
jle    12a7 <swt2_output4+0x157>
movslq 0x4(%rsp),%rcx
mov    (%rsp),%ebx
shl    $0x3,%rcx
mov    %rcx,0x18(%rsp)
mov    0x10(%rsp),%r15
mov    0x8(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,0x20(%rsp)
sub    $0x8,%rsp
mov    %r14,%rdi
mov    0xc(%rsp),%ecx
mov    %ecx,%esi
mov    %r13,%rdx
mov    %r15,%r8
mov    %ecx,%r9d
push   %r12
push   %rax
push   %rbp
mov    %rax,%r14
call   1050 <swt_conv@plt>
mov    %r14,%rax
mov    0x40(%rsp),%r14
add    $0x20,%rsp
mov    0x18(%rsp),%rcx
add    %rcx,%r14
add    %rcx,%r13
add    %rcx,%r15
add    $0xffffffffffffffff,%rbx
jne    1260 <swt2_output4+0x110>
mov    %rax,0x38(%rsp)
mov    %rbp,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    0x28(%rsp),%r14d
mov    %r14d,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    (%rsp),%ebx
mov    %ebx,%esi
mov    0x4(%rsp),%r12d
mov    %r12d,%edx
mov    %rax,%rcx
mov    %ebx,%r8d
mov    %r12d,%r9d
call   1060 <matrix_tran@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14d,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %rax,%rcx
mov    %ebx,%r8d
mov    %r12d,%r9d
call   1060 <matrix_tran@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
test   %r12d,%r12d
mov    %r14,0x8(%rsp)
jle    13fc <swt2_output4+0x2ac>
mov    0x90(%rsp),%r14
movslq (%rsp),%r15
mov    %r12d,%r12d
shl    $0x3,%r15
mov    %r12,0x10(%rsp)
mov    %r13,0x28(%rsp)
mov    %r13,%rbp
mov    0x48(%rsp),%rbx
mov    0x40(%rsp),%r13
nopw   0x0(%rax,%rax,1)
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    0x8(%rsp),%ecx
mov    %ecx,%esi
mov    %r13,%rdx
mov    %rbx,%r8
mov    %ecx,%r9d
push   0x28(%rsp)
push   0x48(%rsp)
push   0x30(%rsp)
call   1050 <swt_conv@plt>
add    $0x20,%rsp
add    %r15,%rbp
add    %r15,%r13
add    %r15,%rbx
add    $0xffffffffffffffff,%r12
jne    1360 <swt2_output4+0x210>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
cmpl   $0x0,0x4(%rsp)
mov    0x50(%rsp),%rbp
mov    (%rsp),%r12d
mov    0x10(%rsp),%r13
jle    1404 <swt2_output4+0x2b4>
mov    0x8(%rsp),%rbx
xchg   %ax,%ax
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
mov    %r12d,%ecx
mov    %r14,%r8
mov    %r12d,%r9d
push   0x28(%rsp)
push   0x48(%rsp)
push   0x30(%rsp)
call   1050 <swt_conv@plt>
add    $0x20,%rsp
add    %r15,%rbx
add    %r15,%rbp
add    %r15,%r14
add    $0xffffffffffffffff,%r13
jne    13c0 <swt2_output4+0x270>
jmp    1404 <swt2_output4+0x2b4>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @swt2_output4(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, double* %6, i32 %7, i32 %8, double* %9, double* %10, i32 %11, i32 %12) {
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca double*
%24 = alloca double*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca double*
%33 = alloca double*
%34 = alloca double*
%35 = alloca double*
%36 = alloca double*
%37 = alloca double*
store double* %0, double** %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store double* %3, double** %17
store double* %4, double** %18
store double* %5, double** %19
store double* %6, double** %20
store i32 %7, i32* %21
store i32 %8, i32* %22
store double* %9, double** %23
store double* %10, double** %24
store i32 %11, i32* %25
store i32 %12, i32* %26
%38 = load i32, i32* %15
%39 = load i32, i32* %22
%40 = mul nsw i32 %38, %39
%41 = sext i32 %40 to i64
%42 = mul i64 %41, 8
%43 = trunc i64 %42 to i32
%44 = call double* @malloc(i32 %43)
store double* %44, double** %32
%45 = load i32, i32* %15
%46 = load i32, i32* %22
%47 = mul nsw i32 %45, %46
%48 = sext i32 %47 to i64
%49 = mul i64 %48, 8
%50 = trunc i64 %49 to i32
%51 = call double* @malloc(i32 %50)
store double* %51, double** %33
%52 = load i32, i32* %26
%53 = call i32 @swt_exp2(i32 %52, i32* %31)
%54 = load i32, i32* %25
%55 = load i32, i32* %31
%56 = mul nsw i32 %54, %55
store i32 %56, i32* %30
%57 = load i32, i32* %30
%58 = sext i32 %57 to i64
%59 = mul i64 %58, 8
%60 = trunc i64 %59 to i32
%61 = call double* @malloc(i32 %60)
store double* %61, double** %34
%62 = load i32, i32* %30
%63 = sext i32 %62 to i64
%64 = mul i64 %63, 8
%65 = trunc i64 %64 to i32
%66 = call double* @malloc(i32 %65)
store double* %66, double** %35
store i32 0, i32* %29
br label %67
67: ; preds = %109, %13
%68 = load i32, i32* %29
%69 = load i32, i32* %30
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %112
71: ; preds = %67
%72 = load i32, i32* %29
%73 = load i32, i32* %31
%74 = srem i32 %72, %73
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %99
76: ; preds = %71
%77 = load double*, double** %23
%78 = load i32, i32* %29
%79 = load i32, i32* %31
%80 = sdiv i32 %78, %79
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %77, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %34
%85 = load i32, i32* %29
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
store double %83, double* %87
%88 = load double*, double** %24
%89 = load i32, i32* %29
%90 = load i32, i32* %31
%91 = sdiv i32 %89, %90
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %88, i64 %92
%94 = load double, double* %93
%95 = load double*, double** %35
%96 = load i32, i32* %29
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
store double %94, double* %98
br label %108
99: ; preds = %71
%100 = load double*, double** %34
%101 = load i32, i32* %29
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %100, i64 %102
store double 0.000000e+00, double* %103
%104 = load double*, double** %35
%105 = load i32, i32* %29
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
store double 0.000000e+00, double* %107
br label %108
108: ; preds = %99, %76
br label %109
109: ; preds = %108
%110 = load i32, i32* %29
%111 = add nsw i32 %110, 1
store i32 %111, i32* %29
br label %67
112: ; preds = %67
store i32 0, i32* %27
br label %113
113: ; preds = %143, %112
%114 = load i32, i32* %27
%115 = load i32, i32* %15
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %146
117: ; preds = %113
%118 = load double*, double** %14
%119 = load i32, i32* %27
%120 = load i32, i32* %16
%121 = mul nsw i32 %119, %120
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double, double* %118, i64 %122
%124 = load i32, i32* %16
%125 = load double*, double** %32
%126 = load i32, i32* %27
%127 = load i32, i32* %16
%128 = mul nsw i32 %126, %127
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %125, i64 %129
%131 = load i32, i32* %16
%132 = load double*, double** %33
%133 = load i32, i32* %27
%134 = load i32, i32* %16
%135 = mul nsw i32 %133, %134
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %132, i64 %136
%138 = load i32, i32* %16
%139 = load double*, double** %34
%140 = load double*, double** %35
%141 = load i32, i32* %30
%142 = call i32 @swt_conv(double* %123, i32 %124, double* %130, i32 %131, double* %137, i32 %138, double* %139, double* %140, i32 %141)
br label %143
143: ; preds = %117
%144 = load i32, i32* %27
%145 = add nsw i32 %144, 1
store i32 %145, i32* %27
br label %113
146: ; preds = %113
%147 = load i32, i32* %15
%148 = load i32, i32* %22
%149 = mul nsw i32 %147, %148
%150 = sext i32 %149 to i64
%151 = mul i64 %150, 8
%152 = trunc i64 %151 to i32
%153 = call double* @malloc(i32 %152)
store double* %153, double** %36
%154 = load double*, double** %32
%155 = load i32, i32* %15
%156 = load i32, i32* %16
%157 = load double*, double** %36
%158 = load i32, i32* %15
%159 = load i32, i32* %16
%160 = call i32 @matrix_tran(double* %154, i32 %155, i32 %156, double* %157, i32 %158, i32 %159)
%161 = load double*, double** %32
%162 = call i32 @free(double* %161)
%163 = load i32, i32* %15
%164 = load i32, i32* %22
%165 = mul nsw i32 %163, %164
%166 = sext i32 %165 to i64
%167 = mul i64 %166, 8
%168 = trunc i64 %167 to i32
%169 = call double* @malloc(i32 %168)
store double* %169, double** %37
%170 = load double*, double** %33
%171 = load i32, i32* %15
%172 = load i32, i32* %16
%173 = load double*, double** %37
%174 = load i32, i32* %15
%175 = load i32, i32* %16
%176 = call i32 @matrix_tran(double* %170, i32 %171, i32 %172, double* %173, i32 %174, i32 %175)
%177 = load double*, double** %33
%178 = call i32 @free(double* %177)
store i32 0, i32* %28
br label %179
179: ; preds = %209, %146
%180 = load i32, i32* %28
%181 = load i32, i32* %16
%182 = icmp slt i32 %180, %181
br i1 %182, label %183, label %212
183: ; preds = %179
%184 = load double*, double** %36
%185 = load i32, i32* %28
%186 = load i32, i32* %15
%187 = mul nsw i32 %185, %186
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds double, double* %184, i64 %188
%190 = load i32, i32* %15
%191 = load double*, double** %17
%192 = load i32, i32* %28
%193 = load i32, i32* %15
%194 = mul nsw i32 %192, %193
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds double, double* %191, i64 %195
%197 = load i32, i32* %15
%198 = load double*, double** %18
%199 = load i32, i32* %28
%200 = load i32, i32* %15
%201 = mul nsw i32 %199, %200
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %198, i64 %202
%204 = load i32, i32* %15
%205 = load double*, double** %34
%206 = load double*, double** %35
%207 = load i32, i32* %30
%208 = call i32 @swt_conv(double* %189, i32 %190, double* %196, i32 %197, double* %203, i32 %204, double* %205, double* %206, i32 %207)
br label %209
209: ; preds = %183
%210 = load i32, i32* %28
%211 = add nsw i32 %210, 1
store i32 %211, i32* %28
br label %179
212: ; preds = %179
%213 = load double*, double** %36
%214 = call i32 @free(double* %213)
store i32 0, i32* %28
br label %215
215: ; preds = %245, %212
%216 = load i32, i32* %28
%217 = load i32, i32* %16
%218 = icmp slt i32 %216, %217
br i1 %218, label %219, label %248
219: ; preds = %215
%220 = load double*, double** %37
%221 = load i32, i32* %28
%222 = load i32, i32* %15
%223 = mul nsw i32 %221, %222
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds double, double* %220, i64 %224
%226 = load i32, i32* %15
%227 = load double*, double** %19
%228 = load i32, i32* %28
%229 = load i32, i32* %15
%230 = mul nsw i32 %228, %229
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds double, double* %227, i64 %231
%233 = load i32, i32* %15
%234 = load double*, double** %20
%235 = load i32, i32* %28
%236 = load i32, i32* %15
%237 = mul nsw i32 %235, %236
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds double, double* %234, i64 %238
%240 = load i32, i32* %15
%241 = load double*, double** %34
%242 = load double*, double** %35
%243 = load i32, i32* %30
%244 = call i32 @swt_conv(double* %225, i32 %226, double* %232, i32 %233, double* %239, i32 %240, double* %241, double* %242, i32 %243)
br label %245
245: ; preds = %219
%246 = load i32, i32* %28
%247 = add nsw i32 %246, 1
store i32 %247, i32* %28
br label %215
248: ; preds = %215
%249 = load double*, double** %37
%250 = call i32 @free(double* %249)
ret void
}

LLVM IR (-O2):
define void @swt2_output4(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, double* %6, i32 %7, i32 %8, double* nocapture %9, double* nocapture %10, i32 %11, i32 %12) {
%14 = alloca i32
%15 = bitcast i32* %14 to i8*
%16 = shl i32 %1, 3
%17 = mul i32 %16, %8
%18 = tail call double* @malloc(i32 %17)
%19 = tail call double* @malloc(i32 %17)
%20 = call i32 @swt_exp2(i32 %12, i32* %14)
%21 = load i32, i32* %14
%22 = mul nsw i32 %21, %11
%23 = shl i32 %22, 3
%24 = call double* @malloc(i32 %23)
%25 = call double* @malloc(i32 %23)
%26 = icmp sgt i32 %22, 0
br i1 %26, label %27, label %29
27: ; preds = %13
%28 = zext i32 %22 to i64
br label %34
29: ; preds = %46, %13
%30 = icmp sgt i32 %1, 0
br i1 %30, label %31, label %62
31: ; preds = %29
%32 = sext i32 %2 to i64
%33 = zext i32 %1 to i64
br label %53
34: ; preds = %27, %46
%35 = phi i64 [ 0, %27 ], [ %51, %46 ]
%36 = trunc i64 %35 to i32
%37 = srem i32 %36, %21
%38 = sdiv i32 %36, %21
%39 = icmp eq i32 %37, 0
br i1 %39, label %40, label %46
40: ; preds = %34
%41 = sext i32 %38 to i64
%42 = getelementptr inbounds double, double* %9, i64 %41
%43 = load double, double* %42
%44 = getelementptr inbounds double, double* %10, i64 %41
%45 = load double, double* %44
br label %46
46: ; preds = %34, %40
%47 = phi double [ %43, %40 ], [ 0.000000e+00, %34 ]
%48 = phi double [ %45, %40 ], [ 0.000000e+00, %34 ]
%49 = getelementptr inbounds double, double* %24, i64 %35
store double %47, double* %49
%50 = getelementptr inbounds double, double* %25, i64 %35
store double %48, double* %50
%51 = add nuw nsw i64 %35, 1
%52 = icmp eq i64 %51, %28
br i1 %52, label %29, label %34
53: ; preds = %31, %53
%54 = phi i64 [ 0, %31 ], [ %60, %53 ]
%55 = mul nsw i64 %54, %32
%56 = getelementptr inbounds double, double* %0, i64 %55
%57 = getelementptr inbounds double, double* %18, i64 %55
%58 = getelementptr inbounds double, double* %19, i64 %55
%59 = call i32 @swt_conv(double* %56, i32 %2, double* %57, i32 %2, double* %58, i32 %2, double* %24, double* %25, i32 %22)
%60 = add nuw nsw i64 %54, 1
%61 = icmp eq i64 %60, %33
br i1 %61, label %62, label %53
62: ; preds = %53, %29
%63 = call double* @malloc(i32 %17)
%64 = call i32 @matrix_tran(double* %18, i32 %1, i32 %2, double* %63, i32 %1, i32 %2)
%65 = call i32 @free(double* %18)
%66 = call double* @malloc(i32 %17)
%67 = call i32 @matrix_tran(double* %19, i32 %1, i32 %2, double* %66, i32 %1, i32 %2)
%68 = call i32 @free(double* %19)
%69 = icmp sgt i32 %2, 0
br i1 %69, label %72, label %70
70: ; preds = %62
%71 = call i32 @free(double* %63)
br label %98
72: ; preds = %62
%73 = sext i32 %1 to i64
%74 = zext i32 %2 to i64
br label %75
75: ; preds = %72, %75
%76 = phi i64 [ 0, %72 ], [ %82, %75 ]
%77 = mul nsw i64 %76, %73
%78 = getelementptr inbounds double, double* %63, i64 %77
%79 = getelementptr inbounds double, double* %3, i64 %77
%80 = getelementptr inbounds double, double* %4, i64 %77
%81 = call i32 @swt_conv(double* %78, i32 %1, double* %79, i32 %1, double* %80, i32 %1, double* %24, double* %25, i32 %22)
%82 = add nuw nsw i64 %76, 1
%83 = icmp eq i64 %82, %74
br i1 %83, label %84, label %75
84: ; preds = %75
%85 = call i32 @free(double* %63)
br i1 %69, label %86, label %98
86: ; preds = %84
%87 = sext i32 %1 to i64
%88 = zext i32 %2 to i64
br label %89
89: ; preds = %86, %89
%90 = phi i64 [ 0, %86 ], [ %96, %89 ]
%91 = mul nsw i64 %90, %87
%92 = getelementptr inbounds double, double* %66, i64 %91
%93 = getelementptr inbounds double, double* %5, i64 %91
%94 = getelementptr inbounds double, double* %6, i64 %91
%95 = call i32 @swt_conv(double* %92, i32 %1, double* %93, i32 %1, double* %94, i32 %1, double* %24, double* %25, i32 %22)
%96 = add nuw nsw i64 %90, 1
%97 = icmp eq i64 %96, %88
br i1 %97, label %98, label %89
98: ; preds = %89, %70, %84
%99 = call i32 @free(double* %66)
ret void
}