#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*/ free(double *);
int /*<<< orphan*/ i_conv(double *, int, double *, int, double *, int);
double *malloc(int);
int /*<<< orphan*/ wkeep_1D_center(double *, int, double *, int);
int /*<<< orphan*/ wrev(double *, int, double *, int);
void cwt_iconv_real(double *sigIn, int sigInLength, double *f, int filterLen,
                    double *sigOut, int sigOutLength) {
  int len;
  double *fTemp, *buf;
  len = sigInLength + filterLen - 1;
  buf = malloc(len * sizeof(double));
  fTemp = malloc(filterLen * sizeof(double));
  wrev(f, filterLen, fTemp, filterLen);
  i_conv(sigIn, sigInLength, buf, len, fTemp, filterLen);
  free(fTemp);
  wkeep_1D_center(buf, len, sigOut, sigOutLength);
  free(buf);
  return;
}


x86 assembly (clang, -O0):
<cwt_iconv_real>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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
add    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <wrev@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%ecx
mov    -0x38(%rbp),%r8
mov    -0x1c(%rbp),%r9d
call   1070 <i_conv@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1040 <wkeep_1D_center@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cwt_iconv_real>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x4(%rsp)
mov    %r8,0x10(%rsp)
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,0x8(%rsp)
lea    (%rbx,%rbp,1),%eax
lea    (%rbx,%rbp,1),%r12d
add    $0xffffffff,%r12d
lea    -0x8(,%rax,8),%edi
call   1060 <malloc@plt>
mov    %rax,%r13
lea    0x0(,%rbx,8),%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
mov    %ebx,%ecx
call   1050 <wrev@plt>
mov    0x8(%rsp),%rdi
mov    %ebp,%esi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %r15,%r8
mov    %ebx,%r9d
call   1070 <i_conv@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
mov    %r12d,%esi
mov    0x10(%rsp),%rdx
mov    0x4(%rsp),%ecx
call   1040 <wkeep_1D_center@plt>
mov    %r13,%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 @cwt_iconv_real(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 double*
%15 = 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
%16 = load i32, i32* %8
%17 = load i32, i32* %10
%18 = add nsw i32 %16, %17
%19 = sub 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 i32, i32* %10
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 8
%28 = trunc i64 %27 to i32
%29 = call double* @malloc(i32 %28)
store double* %29, double** %14
%30 = load double*, double** %9
%31 = load i32, i32* %10
%32 = load double*, double** %14
%33 = load i32, i32* %10
%34 = call i32 @wrev(double* %30, i32 %31, double* %32, i32 %33)
%35 = load double*, double** %7
%36 = load i32, i32* %8
%37 = load double*, double** %15
%38 = load i32, i32* %13
%39 = load double*, double** %14
%40 = load i32, i32* %10
%41 = call i32 @i_conv(double* %35, i32 %36, double* %37, i32 %38, double* %39, i32 %40)
%42 = load double*, double** %14
%43 = call i32 @free(double* %42)
%44 = load double*, double** %15
%45 = load i32, i32* %13
%46 = load double*, double** %11
%47 = load i32, i32* %12
%48 = call i32 @wkeep_1D_center(double* %44, i32 %45, double* %46, i32 %47)
%49 = load double*, double** %15
%50 = call i32 @free(double* %49)
ret void
}

LLVM IR (-O2):
define void @cwt_iconv_real(double* %0, i32 %1, double* %2, i32 %3, double* %4, i32 %5) {
%7 = add i32 %1, -1
%8 = add i32 %7, %3
%9 = shl i32 %8, 3
%10 = tail call double* @malloc(i32 %9)
%11 = shl i32 %3, 3
%12 = tail call double* @malloc(i32 %11)
%13 = tail call i32 @wrev(double* %2, i32 %3, double* %12, i32 %3)
%14 = tail call i32 @i_conv(double* %0, i32 %1, double* %10, i32 %8, double* %12, i32 %3)
%15 = tail call i32 @free(double* %12)
%16 = tail call i32 @wkeep_1D_center(double* %10, i32 %8, double* %4, i32 %5)
%17 = tail call i32 @free(double* %10)
ret void
}