#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 */
double L1(double *, int /*<<< orphan*/ *, int /*<<< orphan*/, int const,
          int const, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ fwt53_2D(double *, double const *, int const, int const,
                            int);
double *malloc(int const);
double L1_CDF53(const double *x, const double *pr, const double eps,
                const int nx, const int ny, const double flux) {
  double *wav = malloc(nx * ny * sizeof(double));
  fwt53_2D(wav, x, nx, ny, 1);
  double reg = L1(wav, NULL, 0, nx, ny, 1.);
  free(wav);
  return reg;
}


x86 assembly (clang, -O0):
<L1_CDF53>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x1,%r8d
call   1060 <fwt53_2D@plt>
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
mov    $0x1,%r9d
call   1040 <L1@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<L1_CDF53>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %rdi,%r14
mov    %edx,%edi
imul   %ecx,%edi
shl    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    $0x1,%r8d
call   1060 <fwt53_2D@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %ebp,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1040 <L1@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @L1_CDF53(double* %0, double* %1, double %2, i32 %3, i32 %4, double %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double*
%14 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double %2, double* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double %5, double* %12
%15 = load i32, i32* %10
%16 = load i32, i32* %11
%17 = mul nsw i32 %15, %16
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 8
%20 = trunc i64 %19 to i32
%21 = call double* @malloc(i32 %20)
store double* %21, double** %13
%22 = load double*, double** %13
%23 = load double*, double** %7
%24 = load i32, i32* %10
%25 = load i32, i32* %11
%26 = call i32 @fwt53_2D(double* %22, double* %23, i32 %24, i32 %25, i32 1)
%27 = load double*, double** %13
%28 = load i32, i32* %10
%29 = load i32, i32* %11
%30 = call double @L1(double* %27, i32* null, i32 0, i32 %28, i32 %29, i32 1)
store double %30, double* %14
%31 = load double*, double** %13
%32 = call i32 @free(double* %31)
%33 = load double, double* %14
ret double %33
}

LLVM IR (-O2):
define double @L1_CDF53(double* %0, double* nocapture readnone %1, double %2, i32 %3, i32 %4, double %5) {
%7 = shl i32 %3, 3
%8 = mul i32 %7, %4
%9 = tail call double* @malloc(i32 %8)
%10 = tail call i32 @fwt53_2D(double* %9, double* %0, i32 %3, i32 %4, i32 1)
%11 = tail call double @L1(double* %9, i32* null, i32 0, i32 %3, i32 %4, i32 1)
%12 = tail call i32 @free(double* %9)
ret double %11
}