#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 *);
double *malloc(int);
int /*<<< orphan*/ wkeep_1D_center(double *, int, double *, int);
void idwt_detail_neo(double *detail, int sigInLength, double *hiRe,
                     int filterLen, double *sigOut, int sigOutLength) {
  int sigInLengthTemp, sigOutLengthTemp;
  double *detailTemp, *detailPre;
  sigInLengthTemp = 2 * sigInLength + 1;
  detailTemp = malloc(sigInLengthTemp * sizeof(double));
  dyadup_1D_feed_even(detail, sigInLength, detailTemp, sigInLengthTemp);
  sigOutLengthTemp = sigInLengthTemp + filterLen - 1;
  detailPre = malloc(sigOutLengthTemp * sizeof(double));
  conv(detailTemp, sigInLengthTemp, detailPre, sigOutLengthTemp, hiRe,
       filterLen);
  free(detailTemp);
  wkeep_1D_center(detailPre, sigOutLengthTemp, sigOut, sigOutLength);
  free(detailPre);
  return;
}


x86 assembly (clang, -O0):
<idwt_detail_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_detail_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_detail_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 double* @malloc(i32 %23)
store double* %24, double** %15
%25 = load double*, double** %7
%26 = load i32, i32* %8
%27 = load double*, double** %15
%28 = load i32, i32* %13
%29 = call i32 @dyadup_1D_feed_even(double* %25, i32 %26, double* %27, i32 %28)
%30 = load i32, i32* %13
%31 = load i32, i32* %10
%32 = add nsw i32 %30, %31
%33 = sub nsw i32 %32, 1
store i32 %33, i32* %14
%34 = load i32, i32* %14
%35 = sext i32 %34 to i64
%36 = mul i64 %35, 8
%37 = trunc i64 %36 to i32
%38 = call double* @malloc(i32 %37)
store double* %38, double** %16
%39 = load double*, double** %15
%40 = load i32, i32* %13
%41 = load double*, double** %16
%42 = load i32, i32* %14
%43 = load double*, double** %9
%44 = load i32, i32* %10
%45 = call i32 @conv(double* %39, i32 %40, double* %41, i32 %42, double* %43, i32 %44)
%46 = load double*, double** %15
%47 = call i32 @free(double* %46)
%48 = load double*, double** %16
%49 = load i32, i32* %14
%50 = load double*, double** %11
%51 = load i32, i32* %12
%52 = call i32 @wkeep_1D_center(double* %48, i32 %49, double* %50, i32 %51)
%53 = load double*, double** %16
%54 = call i32 @free(double* %53)
ret void
}

LLVM IR (-O2):
define void @idwt_detail_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 double* @malloc(i32 %9)
%11 = tail call i32 @dyadup_1D_feed_even(double* %0, i32 %1, double* %10, i32 %8)
%12 = add i32 %3, -1
%13 = add i32 %12, %8
%14 = shl i32 %13, 3
%15 = tail call double* @malloc(i32 %14)
%16 = tail call i32 @conv(double* %10, i32 %8, double* %15, i32 %13, double* %2, i32 %3)
%17 = tail call i32 @free(double* %10)
%18 = tail call i32 @wkeep_1D_center(double* %15, i32 %13, double* %4, i32 %5)
%19 = tail call i32 @free(double* %15)
ret void
}