#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*/ fwt97(double *, double const *, int const, int const);
void fwt97_2D(double *wav, const double *x, const int nx, const int ny,
              const int levels) {
  int i;
  for (i = 0; i < levels; ++i) {
    fwt97(wav, x, nx, ny);
    fwt97(wav, wav, nx, ny);
  }
}


x86 assembly (clang, -O0):
<fwt97_2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1171 <fwt97_2D+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <fwt97@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <fwt97@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1131 <fwt97_2D+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwt97_2D>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %r8d,%r8d
jle    1157 <fwt97_2D+0x47>
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %rsi,%r15
mov    %rdi,%rbp
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
mov    %r14d,%ecx
call   1030 <fwt97@plt>
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %r12d,%edx
mov    %r14d,%ecx
call   1030 <fwt97@plt>
add    $0xffffffff,%ebx
jne    1130 <fwt97_2D+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fwt97_2D(double* %0, double* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %12
12: ; preds = %27, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %10
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = load double*, double** %6
%18 = load double*, double** %7
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = call i32 @fwt97(double* %17, double* %18, i32 %19, i32 %20)
%22 = load double*, double** %6
%23 = load double*, double** %6
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = call i32 @fwt97(double* %22, double* %23, i32 %24, i32 %25)
br label %27
27: ; preds = %16
%28 = load i32, i32* %11
%29 = add nsw i32 %28, 1
store i32 %29, i32* %11
br label %12
30: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @fwt97_2D(double* %0, double* %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %13
7: ; preds = %5, %7
%8 = phi i32 [ %11, %7 ], [ 0, %5 ]
%9 = tail call i32 @fwt97(double* %0, double* %1, i32 %2, i32 %3)
%10 = tail call i32 @fwt97(double* %0, double* %0, i32 %2, i32 %3)
%11 = add nuw nsw i32 %8, 1
%12 = icmp eq i32 %11, %4
br i1 %12, label %13, label %7
13: ; preds = %7, %5
ret void
}