#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*/ FIRCalcKaiserWindow(int, double *, double);
int /*<<< orphan*/ FIRCalcWindow(int, double, double *, double *);
int /*<<< orphan*/ free(double *);
double *malloc(int);
void FIRCalcKaiser(int length, double cutoff, double *coeffs, double alpha) {
  double *window;
  window = malloc(length * sizeof(double));
  FIRCalcKaiserWindow(length, window, alpha);
  FIRCalcWindow(length, cutoff, coeffs, window);
  free(window);
}


x86 assembly (clang, -O0):
<FIRCalcKaiser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rsi
movsd  -0x20(%rbp),%xmm0
call   1040 <FIRCalcKaiserWindow@plt>
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <FIRCalcWindow@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FIRCalcKaiser>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,(%rsp)
mov    %rsi,%r14
movsd  %xmm0,0x8(%rsp)
mov    %edi,%r15d
lea    0x0(,%r15,8),%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r15d,%edi
mov    %rax,%rsi
movsd  (%rsp),%xmm0
call   1040 <FIRCalcKaiserWindow@plt>
mov    %r15d,%edi
movsd  0x8(%rsp),%xmm0
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <FIRCalcWindow@plt>
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @FIRCalcKaiser(i32 %0, double %1, double* %2, double %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca double
%9 = alloca double*
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store double %3, double* %8
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 8
%13 = trunc i64 %12 to i32
%14 = call double* @malloc(i32 %13)
store double* %14, double** %9
%15 = load i32, i32* %5
%16 = load double*, double** %9
%17 = load double, double* %8
%18 = call i32 @FIRCalcKaiserWindow(i32 %15, double* %16, double %17)
%19 = load i32, i32* %5
%20 = load double, double* %6
%21 = load double*, double** %7
%22 = load double*, double** %9
%23 = call i32 @FIRCalcWindow(i32 %19, double %20, double* %21, double* %22)
%24 = load double*, double** %9
%25 = call i32 @free(double* %24)
ret void
}

LLVM IR (-O2):
define void @FIRCalcKaiser(i32 %0, double %1, double* %2, double %3) {
%5 = shl i32 %0, 3
%6 = tail call double* @malloc(i32 %5)
%7 = tail call i32 @FIRCalcKaiserWindow(i32 %0, double* %6, double %3)
%8 = tail call i32 @FIRCalcWindow(i32 %0, double %1, double* %2, double* %6)
%9 = tail call i32 @free(double* %6)
ret void
}