#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_neo(double *approx, double *detail, int sigInLength, double *lowRe,
              double *hiRe, int filterLen, double *sigOut, int sigOutLength) {
  int sigInLengthTemp, sigOutLengthTemp, count;
  double *approxTemp, *detailTemp, *approxPre, *detailPre;
  double *sigOutPre;
  sigInLengthTemp = 2 * sigInLength + 1;
  approxTemp = malloc(sigInLengthTemp * sizeof(double));
  detailTemp = malloc(sigInLengthTemp * sizeof(double));
  dyadup_1D_feed_even(approx, sigInLength, approxTemp, sigInLengthTemp);
  dyadup_1D_feed_even(detail, sigInLength, detailTemp, sigInLengthTemp);
  sigOutLengthTemp = sigInLengthTemp + filterLen - 1;
  approxPre = malloc(sigOutLengthTemp * sizeof(double));
  detailPre = malloc(sigOutLengthTemp * sizeof(double));
  conv(approxTemp, sigInLengthTemp, approxPre, sigOutLengthTemp, lowRe,
       filterLen);
  conv(detailTemp, sigInLengthTemp, detailPre, sigOutLengthTemp, hiRe,
       filterLen);
  free(approxTemp);
  free(detailTemp);
  sigOutPre = malloc(sigOutLengthTemp * sizeof(double));
  for (count = 0; count < sigOutLengthTemp; count++)
    sigOutPre[count] = approxPre[count] + detailPre[count];
  free(approxPre);
  free(detailPre);
  wkeep_1D_center(sigOutPre, sigOutLengthTemp, sigOut, sigOutLength);
  free(sigOutPre);
  return;
}


x86 assembly (clang, -O0):
<idwt_neo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x14(%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)
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%ecx
call   1060 <dyadup_1D_feed_even@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x30(%rbp),%ecx
call   1060 <dyadup_1D_feed_even@plt>
mov    -0x30(%rbp),%eax
add    -0x2c(%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,-0x50(%rbp)
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x2c(%rbp),%r9d
call   1050 <conv@plt>
mov    -0x48(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x58(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
call   1050 <conv@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12a3 <idwt_neo+0x153>
mov    -0x50(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1262 <idwt_neo+0x112>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%ecx
call   1040 <wkeep_1D_center@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idwt_neo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9d,%r14d
mov    %r8,0x38(%rsp)
mov    %rcx,0x30(%rsp)
mov    %edx,%ebx
mov    %rsi,0x8(%rsp)
mov    %rdi,%r13
mov    0x88(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,0x40(%rsp)
lea    (%rbx,%rbx,1),%eax
lea    (%rbx,%rbx,1),%r15d
add    $0x1,%r15d
lea    0x8(,%rax,8),%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    %rax,0x20(%rsp)
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %rax,0x28(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1060 <dyadup_1D_feed_even@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
mov    %r15d,%ecx
call   1060 <dyadup_1D_feed_even@plt>
mov    %r14,0x18(%rsp)
lea    (%r14,%rbx,2),%r12d
lea    0x0(,%r12,8),%ebx
mov    %ebx,0x8(%rsp)
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    0x30(%rsp),%r8
mov    %r14d,%r9d
call   1050 <conv@plt>
mov    0x28(%rsp),%r14
mov    %r14,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
mov    %r12d,%ecx
mov    0x38(%rsp),%r8
mov    0x18(%rsp),%r9
call   1050 <conv@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
test   %r12d,%r12d
jle    136b <idwt_neo+0x21b>
mov    %r12d,%eax
cmp    $0x4,%r12d
jae    127b <idwt_neo+0x12b>
xor    %ecx,%ecx
jmp    1350 <idwt_neo+0x200>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     13a5 <idwt_neo+0x255>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd 0x0(%r13,%rdx,8),%xmm0
movupd 0x10(%r13,%rdx,8),%xmm1
movupd 0x0(%rbp,%rdx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rbp,%rdx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm0,0x10(%rbx,%rdx,8)
movupd 0x20(%r13,%rdx,8),%xmm0
movupd 0x30(%r13,%rdx,8),%xmm1
movupd 0x20(%rbp,%rdx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x30(%rbp,%rdx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,0x20(%rbx,%rdx,8)
movupd %xmm0,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    12b0 <idwt_neo+0x160>
test   $0x1,%sil
je     1348 <idwt_neo+0x1f8>
movupd 0x0(%r13,%rdx,8),%xmm0
movupd 0x10(%r13,%rdx,8),%xmm1
movupd 0x0(%rbp,%rdx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rbp,%rdx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm0,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
je     136b <idwt_neo+0x21b>
nopl   (%rax)
movsd  0x0(%r13,%rcx,8),%xmm0
addsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1350 <idwt_neo+0x200>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    0x40(%rsp),%rdx
mov    0x14(%rsp),%ecx
call   1040 <wkeep_1D_center@plt>
mov    %rbx,%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
xor    %edx,%edx
test   $0x1,%sil
jne    131b <idwt_neo+0x1cb>
jmp    1348 <idwt_neo+0x1f8>

LLVM IR (-O0):
define void @idwt_neo(double* %0, double* %1, i32 %2, double* %3, double* %4, i32 %5, double* %6, i32 %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca double*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
store double* %0, double** %9
store double* %1, double** %10
store i32 %2, i32* %11
store double* %3, double** %12
store double* %4, double** %13
store i32 %5, i32* %14
store double* %6, double** %15
store i32 %7, i32* %16
%25 = load i32, i32* %11
%26 = mul nsw i32 2, %25
%27 = add nsw i32 %26, 1
store i32 %27, i32* %17
%28 = load i32, i32* %17
%29 = sext i32 %28 to i64
%30 = mul i64 %29, 8
%31 = trunc i64 %30 to i32
%32 = call double* @malloc(i32 %31)
store double* %32, double** %20
%33 = load i32, i32* %17
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 8
%36 = trunc i64 %35 to i32
%37 = call double* @malloc(i32 %36)
store double* %37, double** %21
%38 = load double*, double** %9
%39 = load i32, i32* %11
%40 = load double*, double** %20
%41 = load i32, i32* %17
%42 = call i32 @dyadup_1D_feed_even(double* %38, i32 %39, double* %40, i32 %41)
%43 = load double*, double** %10
%44 = load i32, i32* %11
%45 = load double*, double** %21
%46 = load i32, i32* %17
%47 = call i32 @dyadup_1D_feed_even(double* %43, i32 %44, double* %45, i32 %46)
%48 = load i32, i32* %17
%49 = load i32, i32* %14
%50 = add nsw i32 %48, %49
%51 = sub nsw i32 %50, 1
store i32 %51, i32* %18
%52 = load i32, i32* %18
%53 = sext i32 %52 to i64
%54 = mul i64 %53, 8
%55 = trunc i64 %54 to i32
%56 = call double* @malloc(i32 %55)
store double* %56, double** %22
%57 = load i32, i32* %18
%58 = sext i32 %57 to i64
%59 = mul i64 %58, 8
%60 = trunc i64 %59 to i32
%61 = call double* @malloc(i32 %60)
store double* %61, double** %23
%62 = load double*, double** %20
%63 = load i32, i32* %17
%64 = load double*, double** %22
%65 = load i32, i32* %18
%66 = load double*, double** %12
%67 = load i32, i32* %14
%68 = call i32 @conv(double* %62, i32 %63, double* %64, i32 %65, double* %66, i32 %67)
%69 = load double*, double** %21
%70 = load i32, i32* %17
%71 = load double*, double** %23
%72 = load i32, i32* %18
%73 = load double*, double** %13
%74 = load i32, i32* %14
%75 = call i32 @conv(double* %69, i32 %70, double* %71, i32 %72, double* %73, i32 %74)
%76 = load double*, double** %20
%77 = call i32 @free(double* %76)
%78 = load double*, double** %21
%79 = call i32 @free(double* %78)
%80 = load i32, i32* %18
%81 = sext i32 %80 to i64
%82 = mul i64 %81, 8
%83 = trunc i64 %82 to i32
%84 = call double* @malloc(i32 %83)
store double* %84, double** %24
store i32 0, i32* %19
br label %85
85: ; preds = %105, %8
%86 = load i32, i32* %19
%87 = load i32, i32* %18
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %108
89: ; preds = %85
%90 = load double*, double** %22
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = load double*, double** %23
%96 = load i32, i32* %19
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
%99 = load double, double* %98
%100 = fadd double %94, %99
%101 = load double*, double** %24
%102 = load i32, i32* %19
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
store double %100, double* %104
br label %105
105: ; preds = %89
%106 = load i32, i32* %19
%107 = add nsw i32 %106, 1
store i32 %107, i32* %19
br label %85
108: ; preds = %85
%109 = load double*, double** %22
%110 = call i32 @free(double* %109)
%111 = load double*, double** %23
%112 = call i32 @free(double* %111)
%113 = load double*, double** %24
%114 = load i32, i32* %18
%115 = load double*, double** %15
%116 = load i32, i32* %16
%117 = call i32 @wkeep_1D_center(double* %113, i32 %114, double* %115, i32 %116)
%118 = load double*, double** %24
%119 = call i32 @free(double* %118)
ret void
}

LLVM IR (-O2):
define void @idwt_neo(double* %0, double* %1, i32 %2, double* %3, double* %4, i32 %5, double* %6, i32 %7) {
%9 = shl nsw i32 %2, 1
%10 = or i32 %9, 1
%11 = shl i32 %10, 3
%12 = tail call double* @malloc(i32 %11)
%13 = tail call double* @malloc(i32 %11)
%14 = tail call i32 @dyadup_1D_feed_even(double* %0, i32 %2, double* %12, i32 %10)
%15 = tail call i32 @dyadup_1D_feed_even(double* %1, i32 %2, double* %13, i32 %10)
%16 = add i32 %9, %5
%17 = shl i32 %16, 3
%18 = tail call double* @malloc(i32 %17)
%19 = tail call double* @malloc(i32 %17)
%20 = tail call i32 @conv(double* %12, i32 %10, double* %18, i32 %16, double* %3, i32 %5)
%21 = tail call i32 @conv(double* %13, i32 %10, double* %19, i32 %16, double* %4, i32 %5)
%22 = tail call i32 @free(double* %12)
%23 = tail call i32 @free(double* %13)
%24 = tail call double* @malloc(i32 %17)
%25 = icmp sgt i32 %16, 0
br i1 %25, label %26, label %117
26: ; preds = %8
%27 = zext i32 %16 to i64
%28 = icmp ult i32 %16, 4
br i1 %28, label %105, label %29
29: ; preds = %26
%30 = and i64 %27, 4294967292
%31 = add nsw i64 %30, -4
%32 = lshr exact i64 %31, 2
%33 = add nuw nsw i64 %32, 1
%34 = and i64 %33, 1
%35 = icmp eq i64 %31, 0
br i1 %35, label %81, label %36
36: ; preds = %29
%37 = and i64 %33, 9223372036854775806
br label %38
38: ; preds = %38, %36
%39 = phi i64 [ 0, %36 ], [ %78, %38 ]
%40 = phi i64 [ 0, %36 ], [ %79, %38 ]
%41 = getelementptr inbounds double, double* %18, i64 %39
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = getelementptr inbounds double, double* %41, i64 2
%45 = bitcast double* %44 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = getelementptr inbounds double, double* %19, i64 %39
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = getelementptr inbounds double, double* %47, i64 2
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = fadd <2 x double> %43, %49
%54 = fadd <2 x double> %46, %52
%55 = getelementptr inbounds double, double* %24, i64 %39
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %53, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %54, <2 x double>* %58
%59 = or i64 %39, 4
%60 = getelementptr inbounds double, double* %18, i64 %59
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %60, i64 2
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = getelementptr inbounds double, double* %19, i64 %59
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = getelementptr inbounds double, double* %66, i64 2
%70 = bitcast double* %69 to <2 x double>*
%71 = load <2 x double>, <2 x double>* %70
%72 = fadd <2 x double> %62, %68
%73 = fadd <2 x double> %65, %71
%74 = getelementptr inbounds double, double* %24, i64 %59
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %72, <2 x double>* %75
%76 = getelementptr inbounds double, double* %74, i64 2
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %73, <2 x double>* %77
%78 = add nuw i64 %39, 8
%79 = add i64 %40, 2
%80 = icmp eq i64 %79, %37
br i1 %80, label %81, label %38
81: ; preds = %38, %29
%82 = phi i64 [ 0, %29 ], [ %78, %38 ]
%83 = icmp eq i64 %34, 0
br i1 %83, label %103, label %84
84: ; preds = %81
%85 = getelementptr inbounds double, double* %18, i64 %82
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = getelementptr inbounds double, double* %85, i64 2
%89 = bitcast double* %88 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = getelementptr inbounds double, double* %19, i64 %82
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = getelementptr inbounds double, double* %91, i64 2
%95 = bitcast double* %94 to <2 x double>*
%96 = load <2 x double>, <2 x double>* %95
%97 = fadd <2 x double> %87, %93
%98 = fadd <2 x double> %90, %96
%99 = getelementptr inbounds double, double* %24, i64 %82
%100 = bitcast double* %99 to <2 x double>*
store <2 x double> %97, <2 x double>* %100
%101 = getelementptr inbounds double, double* %99, i64 2
%102 = bitcast double* %101 to <2 x double>*
store <2 x double> %98, <2 x double>* %102
br label %103
103: ; preds = %81, %84
%104 = icmp eq i64 %30, %27
br i1 %104, label %117, label %105
105: ; preds = %26, %103
%106 = phi i64 [ 0, %26 ], [ %30, %103 ]
br label %107
107: ; preds = %105, %107
%108 = phi i64 [ %115, %107 ], [ %106, %105 ]
%109 = getelementptr inbounds double, double* %18, i64 %108
%110 = load double, double* %109
%111 = getelementptr inbounds double, double* %19, i64 %108
%112 = load double, double* %111
%113 = fadd double %110, %112
%114 = getelementptr inbounds double, double* %24, i64 %108
store double %113, double* %114
%115 = add nuw nsw i64 %108, 1
%116 = icmp eq i64 %115, %27
br i1 %116, label %117, label %107
117: ; preds = %107, %103, %8
%118 = tail call i32 @free(double* %18)
%119 = tail call i32 @free(double* %19)
%120 = tail call i32 @wkeep_1D_center(double* %24, i32 %16, double* %6, i32 %7)
%121 = tail call i32 @free(double* %24)
ret void
}