#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*/ dyaddown_1D_keep_even(double *, int, double *, int);
int /*<<< orphan*/ free(double *);
double *malloc(int);
void dwt_no_extension(double *sigIn, int sigInLength, double *lowDe,
                      double *hiDe, int filterLen, double *approx,
                      double *detail, int sigOutLength) {
  int sigOutLengthTemp;
  double *approxTemp;
  double *detailTemp;
  sigOutLengthTemp = sigInLength + filterLen - 1;
  approxTemp = malloc(sigOutLengthTemp * sizeof(double));
  conv(sigIn, sigInLength, approxTemp, sigOutLengthTemp, lowDe, filterLen);
  dyaddown_1D_keep_even(approxTemp, sigOutLengthTemp, approx, sigOutLength);
  free(approxTemp);
  detailTemp = malloc(sigOutLengthTemp * sizeof(double));
  conv(sigIn, sigInLength, detailTemp, sigOutLengthTemp, hiDe, filterLen);
  dyaddown_1D_keep_even(detailTemp, sigOutLengthTemp, detail, sigOutLength);
  free(detailTemp);
  return;
}


x86 assembly (clang, -O0):
<dwt_no_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1040 <conv@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    0x18(%rbp),%ecx
call   1060 <dyaddown_1D_keep_even@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1040 <conv@plt>
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%ecx
call   1060 <dyaddown_1D_keep_even@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dwt_no_extension>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x20(%rsp)
mov    %r8d,%r13d
mov    %rcx,0x28(%rsp)
mov    %rdx,0x10(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rdi,0x18(%rsp)
mov    0x70(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0x78(%rsp),%eax
mov    %eax,0xc(%rsp)
lea    0x0(%rbp,%r13,1),%eax
lea    -0x1(%rbp,%r13,1),%r14d
lea    -0x8(,%rax,8),%r12d
ff
mov    %r12d,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    %r14d,%ecx
mov    0x10(%rsp),%r8
mov    %r13d,%r9d
call   1040 <conv@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    0x20(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1060 <dyaddown_1D_keep_even@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12d,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    0x18(%rsp),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    %r14d,%ecx
mov    0x28(%rsp),%r8
mov    %r13d,%r9d
call   1040 <conv@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    0x30(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1060 <dyaddown_1D_keep_even@plt>
mov    %rbx,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @dwt_no_extension(double* %0, i32 %1, double* %2, double* %3, i32 %4, double* %5, double* %6, i32 %7) {
%9 = add i32 %1, -1
%10 = add i32 %9, %4
%11 = shl i32 %10, 3
%12 = tail call double* @malloc(i32 %11)
%13 = tail call i32 @conv(double* %0, i32 %1, double* %12, i32 %10, double* %2, i32 %4)
%14 = tail call i32 @dyaddown_1D_keep_even(double* %12, i32 %10, double* %5, i32 %7)
%15 = tail call i32 @free(double* %12)
%16 = tail call double* @malloc(i32 %11)
%17 = tail call i32 @conv(double* %0, i32 %1, double* %16, i32 %10, double* %3, i32 %4)
%18 = tail call i32 @dyaddown_1D_keep_even(double* %16, i32 %10, double* %6, i32 %7)
%19 = tail call i32 @free(double* %16)
ret void
}