#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 *);
int /*<<< orphan*/ iswt2(double *, double *, double *, double *, int, int,
                         double *, int, int, double *, double *, int, int);
double *malloc(int);
int /*<<< orphan*/ verbatim_copy(double *, int, double *, int);
void iswt2_input1_step(double *matrixIn, int matrixInRow, int matrixInCol,
                       double *matrixOut, int matrixOutRow, int matrixOutCol,
                       double *filterLow, double *filterHi, int filterLength,
                       int step) {
  int count;
  double *matrixApproxTemp, *matrixApproxOut;
  matrixApproxTemp = malloc(matrixInRow * matrixInCol * sizeof(double));
  matrixApproxOut = malloc(matrixInRow * matrixInCol * sizeof(double));
  verbatim_copy(matrixIn + 3 * step * matrixInRow * matrixInCol,
                matrixInRow * matrixInCol, matrixApproxTemp,
                matrixInRow * matrixInCol);
  for (count = 0; count < step; count++) {
    iswt2(matrixApproxTemp,
          matrixIn + (step - count - 1) * matrixInRow * matrixInCol,
          matrixIn + (step - count - 1) * matrixInRow * matrixInCol +
              step * matrixInRow * matrixInCol,
          matrixIn + (step - count - 1) * matrixInRow * matrixInCol +
              2 * step * matrixInRow * matrixInCol,
          matrixInRow, matrixInCol, matrixApproxOut, matrixOutRow, matrixOutCol,
          filterLow, filterHi, filterLength, step - count);
    if (count != (step - 1)) {
      verbatim_copy(matrixApproxOut, matrixInRow * matrixInCol,
                    matrixApproxTemp, matrixInRow * matrixInCol);
    }
  }
  free(matrixApproxTemp);
  verbatim_copy(matrixApproxOut, matrixInRow * matrixInCol, matrixOut,
                matrixInRow * matrixInCol);
  free(matrixApproxOut);
  return;
}


x86 assembly (clang, -O0):
<iswt2_input1_step>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x28(%rbp)
mov    %esi,-0x2c(%rbp)
mov    %edx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8d,-0x3c(%rbp)
mov    %r9d,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
imul   $0x3,0x28(%rbp),%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x2c(%rbp),%esi
imul   -0x30(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
imul   -0x30(%rbp),%ecx
call   1060 <verbatim_copy@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    0x28(%rbp),%eax
jge    12fa <iswt2_input1_step+0x1ba>
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x28(%rbp),%eax
sub    -0x44(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x28(%rbp),%rdx
mov    0x28(%rbp),%eax
sub    -0x44(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    0x28(%rbp),%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x28(%rbp),%rcx
mov    0x28(%rbp),%eax
sub    -0x44(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    0x28(%rbp),%eax
shl    $0x1,%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x58(%rbp),%r12
mov    -0x3c(%rbp),%r15d
mov    -0x40(%rbp),%r14d
mov    0x10(%rbp),%rbx
mov    0x18(%rbp),%r11
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
sub    -0x44(%rbp),%eax
mov    %r12,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %eax,0x30(%rsp)
call   1040 <iswt2@plt>
mov    -0x44(%rbp),%eax
mov    0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     12e7 <iswt2_input1_step+0x1a7>
mov    -0x58(%rbp),%rdi
mov    -0x2c(%rbp),%esi
imul   -0x30(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
imul   -0x30(%rbp),%ecx
call   1060 <verbatim_copy@plt>
jmp    12ec <iswt2_input1_step+0x1ac>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11da <iswt2_input1_step+0x9a>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
mov    -0x2c(%rbp),%esi
imul   -0x30(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
imul   -0x30(%rbp),%ecx
call   1060 <verbatim_copy@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswt2_input1_step>:
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,0x10(%rsp)
mov    %rdi,%r14
mov    0xa8(%rsp),%r13d
mov    0xa0(%rsp),%eax
mov    %rax,0x38(%rsp)
mov    0x98(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0x90(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    %edx,0xc(%rsp)
mov    %edx,%ebx
mov    %esi,0x8(%rsp)
imul   %esi,%ebx
lea    0x0(,%rbx,8),%r15d
mov    %r15d,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %r15d,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%ebp
imul   %r13d,%ebp
lea    0x0(%rbp,%rbp,2),%eax
cltq
mov    %r14,0x40(%rsp)
lea    (%r14,%rax,8),%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %ebx,%ecx
call   1060 <verbatim_copy@plt>
test   %r13d,%r13d
jle    127f <iswt2_input1_step+0x13f>
movslq %ebp,%rax
mov    %rax,0x20(%rsp)
add    %ebp,%ebp
movslq %ebp,%rax
mov    %rax,0x18(%rsp)
mov    %r13d,%ebp
add    $0xffffffff,%r13d
mov    %r13d,%r14d
imul   %ebx,%r14d
jmp    1219 <iswt2_input1_step+0xd9>
cs nopw 0x0(%rax,%rax,1)
nop
sub    %ebx,%r14d
add    $0xffffffffffffffff,%rbp
je     127f <iswt2_input1_step+0x13f>
movslq %r14d,%rax
mov    0x40(%rsp),%rcx
lea    (%rcx,%rax,8),%rsi
mov    0x20(%rsp),%rax
lea    (%rsi,%rax,8),%rdx
mov    0x18(%rsp),%rax
lea    (%rsi,%rax,8),%rcx
sub    $0x8,%rsp
mov    %r12,%rdi
mov    0x10(%rsp),%r8d
mov    0x14(%rsp),%r9d
push   %rbp
push   0x48(%rsp)
push   0x48(%rsp)
push   0x48(%rsp)
push   0x78(%rsp)
push   0x78(%rsp)
push   %r15
call   1040 <iswt2@plt>
add    $0x40,%rsp
sub    $0x1,%r13
jb     1210 <iswt2_input1_step+0xd0>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %ebx,%ecx
call   1060 <verbatim_copy@plt>
jmp    1210 <iswt2_input1_step+0xd0>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    0x10(%rsp),%rdx
mov    %ebx,%ecx
call   1060 <verbatim_copy@plt>
mov    %r15,%rdi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @iswt2_input1_step(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, double* %6, double* %7, i32 %8, i32 %9) {
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca double*
%23 = alloca double*
store double* %0, double** %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store double* %3, double** %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store double* %6, double** %17
store double* %7, double** %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%24 = load i32, i32* %12
%25 = load i32, i32* %13
%26 = mul nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 8
%29 = trunc i64 %28 to i32
%30 = call double* @malloc(i32 %29)
store double* %30, double** %22
%31 = load i32, i32* %12
%32 = load i32, i32* %13
%33 = mul nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 8
%36 = trunc i64 %35 to i32
%37 = call double* @malloc(i32 %36)
store double* %37, double** %23
%38 = load double*, double** %11
%39 = load i32, i32* %20
%40 = mul nsw i32 3, %39
%41 = load i32, i32* %12
%42 = mul nsw i32 %40, %41
%43 = load i32, i32* %13
%44 = mul nsw i32 %42, %43
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %38, i64 %45
%47 = load i32, i32* %12
%48 = load i32, i32* %13
%49 = mul nsw i32 %47, %48
%50 = load double*, double** %22
%51 = load i32, i32* %12
%52 = load i32, i32* %13
%53 = mul nsw i32 %51, %52
%54 = call i32 @verbatim_copy(double* %46, i32 %49, double* %50, i32 %53)
store i32 0, i32* %21
br label %55
55: ; preds = %136, %10
%56 = load i32, i32* %21
%57 = load i32, i32* %20
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %139
59: ; preds = %55
%60 = load double*, double** %22
%61 = load double*, double** %11
%62 = load i32, i32* %20
%63 = load i32, i32* %21
%64 = sub nsw i32 %62, %63
%65 = sub nsw i32 %64, 1
%66 = load i32, i32* %12
%67 = mul nsw i32 %65, %66
%68 = load i32, i32* %13
%69 = mul nsw i32 %67, %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %61, i64 %70
%72 = load double*, double** %11
%73 = load i32, i32* %20
%74 = load i32, i32* %21
%75 = sub nsw i32 %73, %74
%76 = sub nsw i32 %75, 1
%77 = load i32, i32* %12
%78 = mul nsw i32 %76, %77
%79 = load i32, i32* %13
%80 = mul nsw i32 %78, %79
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %72, i64 %81
%83 = load i32, i32* %20
%84 = load i32, i32* %12
%85 = mul nsw i32 %83, %84
%86 = load i32, i32* %13
%87 = mul nsw i32 %85, %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %82, i64 %88
%90 = load double*, double** %11
%91 = load i32, i32* %20
%92 = load i32, i32* %21
%93 = sub nsw i32 %91, %92
%94 = sub nsw i32 %93, 1
%95 = load i32, i32* %12
%96 = mul nsw i32 %94, %95
%97 = load i32, i32* %13
%98 = mul nsw i32 %96, %97
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %90, i64 %99
%101 = load i32, i32* %20
%102 = mul nsw i32 2, %101
%103 = load i32, i32* %12
%104 = mul nsw i32 %102, %103
%105 = load i32, i32* %13
%106 = mul nsw i32 %104, %105
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %100, i64 %107
%109 = load i32, i32* %12
%110 = load i32, i32* %13
%111 = load double*, double** %23
%112 = load i32, i32* %15
%113 = load i32, i32* %16
%114 = load double*, double** %17
%115 = load double*, double** %18
%116 = load i32, i32* %19
%117 = load i32, i32* %20
%118 = load i32, i32* %21
%119 = sub nsw i32 %117, %118
%120 = call i32 @iswt2(double* %60, double* %71, double* %89, double* %108, i32 %109, i32 %110, double* %111, i32 %112, i32 %113, double* %114, double* %115, i32 %116, i32 %119)
%121 = load i32, i32* %21
%122 = load i32, i32* %20
%123 = sub nsw i32 %122, 1
%124 = icmp ne i32 %121, %123
br i1 %124, label %125, label %135
125: ; preds = %59
%126 = load double*, double** %23
%127 = load i32, i32* %12
%128 = load i32, i32* %13
%129 = mul nsw i32 %127, %128
%130 = load double*, double** %22
%131 = load i32, i32* %12
%132 = load i32, i32* %13
%133 = mul nsw i32 %131, %132
%134 = call i32 @verbatim_copy(double* %126, i32 %129, double* %130, i32 %133)
br label %135
135: ; preds = %125, %59
br label %136
136: ; preds = %135
%137 = load i32, i32* %21
%138 = add nsw i32 %137, 1
store i32 %138, i32* %21
br label %55
139: ; preds = %55
%140 = load double*, double** %22
%141 = call i32 @free(double* %140)
%142 = load double*, double** %23
%143 = load i32, i32* %12
%144 = load i32, i32* %13
%145 = mul nsw i32 %143, %144
%146 = load double*, double** %14
%147 = load i32, i32* %12
%148 = load i32, i32* %13
%149 = mul nsw i32 %147, %148
%150 = call i32 @verbatim_copy(double* %142, i32 %145, double* %146, i32 %149)
%151 = load double*, double** %23
%152 = call i32 @free(double* %151)
ret void
}

LLVM IR (-O2):
define void @iswt2_input1_step(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, double* %6, double* %7, i32 %8, i32 %9) {
%11 = mul i32 %2, %1
%12 = shl i32 %11, 3
%13 = tail call double* @malloc(i32 %12)
%14 = tail call double* @malloc(i32 %12)
%15 = mul i32 %11, 3
%16 = mul i32 %15, %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = tail call i32 @verbatim_copy(double* %18, i32 %11, double* %13, i32 %11)
%20 = icmp sgt i32 %9, 0
br i1 %20, label %21, label %49
21: ; preds = %10
%22 = mul i32 %11, %9
%23 = sext i32 %22 to i64
%24 = shl i32 %11, 1
%25 = mul i32 %24, %9
%26 = sext i32 %25 to i64
%27 = add nsw i32 %9, -1
%28 = zext i32 %9 to i64
%29 = zext i32 %27 to i64
%30 = zext i32 %9 to i64
br label %31
31: ; preds = %21, %46
%32 = phi i64 [ 0, %21 ], [ %47, %46 ]
%33 = sub nsw i64 %28, %32
%34 = trunc i64 %33 to i32
%35 = add i32 %34, -1
%36 = mul i32 %11, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %0, i64 %37
%39 = getelementptr inbounds double, double* %38, i64 %23
%40 = getelementptr inbounds double, double* %38, i64 %26
%41 = trunc i64 %33 to i32
%42 = tail call i32 @iswt2(double* %13, double* %38, double* %39, double* %40, i32 %1, i32 %2, double* %14, i32 %4, i32 %5, double* %6, double* %7, i32 %8, i32 %41)
%43 = icmp eq i64 %32, %29
br i1 %43, label %46, label %44
44: ; preds = %31
%45 = tail call i32 @verbatim_copy(double* %14, i32 %11, double* %13, i32 %11)
br label %46
46: ; preds = %31, %44
%47 = add nuw nsw i64 %32, 1
%48 = icmp eq i64 %47, %30
br i1 %48, label %49, label %31
49: ; preds = %46, %10
%50 = tail call i32 @free(double* %13)
%51 = tail call i32 @verbatim_copy(double* %14, i32 %11, double* %3, i32 %11)
%52 = tail call i32 @free(double* %14)
ret void
}