#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*/ conv(double *, int, double *, int, double *, int);
int /*<<< orphan*/ dyadup_1D_feed_even(double *, int, double *, int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ wkeep_1D_center(double *, int, double *, int);
void idwt_approx_neo(double *approx, int sigInLength, double *lowRe,
                     int filterLen, double *sigOut, int sigOutLength) {
  int sigInLengthTemp, sigOutLengthTemp;
  double *approxTemp, *approxPre;
  sigInLengthTemp = 2 * sigInLength + 1;
  approxTemp = (double *)malloc(sigInLengthTemp * sizeof(double));
  dyadup_1D_feed_even(approx, sigInLength, approxTemp, sigInLengthTemp);
  sigOutLengthTemp = sigInLengthTemp + filterLen - 1;
  approxPre = (double *)malloc(sigOutLengthTemp * sizeof(double));
  conv(approxTemp, sigInLengthTemp, approxPre, sigOutLengthTemp, lowRe,
       filterLen);
  free(approxTemp);
  wkeep_1D_center(approxPre, sigOutLengthTemp, sigOut, sigOutLength);
  free(approxPre);
  return;
}


x86 assembly (clang, -O0):
<idwt_approx_neo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%ecx
call   1060 <dyadup_1D_feed_even@plt>
mov    -0x30(%rbp),%eax
add    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
call   1050 <conv@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1040 <wkeep_1D_center@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idwt_approx_neo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8,0x10(%rsp)
mov    %ecx,%ebp
mov    %rdx,%r12
mov    %esi,%ebx
mov    %rdi,%r13
lea    (%rbx,%rbx,1),%eax
lea    (%rbx,%rbx,1),%r14d
add    $0x1,%r14d
lea    0x8(,%rax,8),%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %r13,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
mov    %r14d,%ecx
call   1060 <dyadup_1D_feed_even@plt>
lea    0x1(%rbp,%rbx,2),%eax
lea    0x0(%rbp,%rbx,2),%r13d
lea    -0x8(,%rax,8),%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rax,%rdx
mov    %r13d,%ecx
mov    %r12,%r8
mov    %ebp,%r9d
call   1050 <conv@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    0x10(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1040 <wkeep_1D_center@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @idwt_approx_neo(double* %0, i32 %1, double* %2, i32 %3, double* %4, i32 %5) {
%7 = alloca double*
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
store double* %0, double** %7
store i32 %1, i32* %8
store double* %2, double** %9
store i32 %3, i32* %10
store double* %4, double** %11
store i32 %5, i32* %12
%17 = load i32, i32* %8
%18 = mul nsw i32 2, %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %13
%20 = load i32, i32* %13
%21 = sext i32 %20 to i64
%22 = mul i64 %21, 8
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
store double* %25, double** %15
%26 = load double*, double** %7
%27 = load i32, i32* %8
%28 = load double*, double** %15
%29 = load i32, i32* %13
%30 = call i32 @dyadup_1D_feed_even(double* %26, i32 %27, double* %28, i32 %29)
%31 = load i32, i32* %13
%32 = load i32, i32* %10
%33 = add nsw i32 %31, %32
%34 = sub nsw i32 %33, 1
store i32 %34, i32* %14
%35 = load i32, i32* %14
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 8
%38 = trunc i64 %37 to i32
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double*
store double* %40, double** %16
%41 = load double*, double** %15
%42 = load i32, i32* %13
%43 = load double*, double** %16
%44 = load i32, i32* %14
%45 = load double*, double** %9
%46 = load i32, i32* %10
%47 = call i32 @conv(double* %41, i32 %42, double* %43, i32 %44, double* %45, i32 %46)
%48 = load double*, double** %15
%49 = call i32 @free(double* %48)
%50 = load double*, double** %16
%51 = load i32, i32* %14
%52 = load double*, double** %11
%53 = load i32, i32* %12
%54 = call i32 @wkeep_1D_center(double* %50, i32 %51, double* %52, i32 %53)
%55 = load double*, double** %16
%56 = call i32 @free(double* %55)
ret void
}

LLVM IR (-O2):
define void @idwt_approx_neo(double* %0, i32 %1, double* %2, i32 %3, double* %4, i32 %5) {
%7 = shl nsw i32 %1, 1
%8 = or i32 %7, 1
%9 = shl i32 %8, 3
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to double*
%12 = tail call i32 @dyadup_1D_feed_even(double* %0, i32 %1, double* %11, i32 %8)
%13 = add i32 %3, -1
%14 = add i32 %13, %8
%15 = shl i32 %14, 3
%16 = tail call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to double*
%18 = tail call i32 @conv(double* %11, i32 %8, double* %17, i32 %14, double* %2, i32 %3)
%19 = tail call i32 @free(double* %11)
%20 = tail call i32 @wkeep_1D_center(double* %17, i32 %14, double* %4, i32 %5)
%21 = tail call i32 @free(double* %17)
ret void
}