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


x86 assembly (clang, -O0):
<L1_ATROUS>:
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)
movl   $0x4,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x4,%r8d
call   1040 <atrous_fwd@plt>
mov    -0x38(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x20(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
mov    $0x1,%r9d
call   1060 <entropy_xlogx@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x40(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<L1_ATROUS>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %rdi,%r15
lea    0x0(,%r14,4),%r12d
mov    %ecx,%edi
imul   %r12d,%edi
shl    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    $0x4,%r8d
call   1040 <atrous_fwd@plt>
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %r12d,%ecx
mov    %ebx,%r8d
mov    $0x1,%r9d
call   1060 <entropy_xlogx@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbp,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @L1_ATROUS(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 i32
%14 = alloca double*
%15 = 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
store i32 4, i32* %13
%16 = load i32, i32* %10
%17 = mul nsw i32 4, %16
%18 = load i32, i32* %11
%19 = mul nsw i32 %17, %18
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = trunc i64 %21 to i32
%23 = call double* @malloc(i32 %22)
store double* %23, double** %14
%24 = load double*, double** %7
%25 = load double*, double** %14
%26 = load i32, i32* %10
%27 = load i32, i32* %11
%28 = call i32 @atrous_fwd(double* %24, double* %25, i32 %26, i32 %27, i32 4)
%29 = load double*, double** %14
%30 = load i32, i32* %10
%31 = mul nsw i32 4, %30
%32 = load i32, i32* %11
%33 = call double @entropy_xlogx(double* %29, i32* null, i32 0, i32 %31, i32 %32, i32 1)
store double %33, double* %15
%34 = load double*, double** %14
%35 = call i32 @free(double* %34)
%36 = load double, double* %15
ret double %36
}

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