#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 */
typedef int /*<<< orphan*/ int16_t;
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
double _freq3db(double, int);
int /*<<< orphan*/ _rcLowPass1(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int,
                               double);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *malloc_exit(int);
void rcLowPass(int16_t *out, int len, double freq, int order) {
  freq = _freq3db(freq, order);
  __m128d *tmp = malloc_exit(len * sizeof(__m128d));
  for (int i = 0; i < order; ++i) {
    _rcLowPass1(out, tmp, len, freq);
  }
  free(tmp);
}


x86 assembly (clang, -O0):
<rcLowPass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1050 <_freq3db@plt>
movsd  %xmm0,-0x18(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc_exit@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b2 <rcLowPass+0x72>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0xc(%rbp),%edx
movsd  -0x18(%rbp),%xmm0
call   1060 <_rcLowPass1@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1183 <rcLowPass+0x43>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcLowPass>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%r15
mov    %edx,%edi
call   1050 <_freq3db@plt>
movsd  %xmm0,(%rsp)
lea    0x0(,%r14,4),%edi
call   1040 <malloc_exit@plt>
mov    %rax,%r12
test   %ebx,%ebx
jle    1188 <rcLowPass+0x48>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
movsd  (%rsp),%xmm0
call   1060 <_rcLowPass1@plt>
add    $0xffffffff,%ebx
jne    1170 <rcLowPass+0x30>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @rcLowPass(i32* %0, i32 %1, double %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store double %2, double* %7
store i32 %3, i32* %8
%11 = load double, double* %7
%12 = load i32, i32* %8
%13 = call double @_freq3db(double %11, i32 %12)
store double %13, double* %7
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 4
%17 = trunc i64 %16 to i32
%18 = call i32* @malloc_exit(i32 %17)
store i32* %18, i32** %9
store i32 0, i32* %10
br label %19
19: ; preds = %29, %4
%20 = load i32, i32* %10
%21 = load i32, i32* %8
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = load i32*, i32** %5
%25 = load i32*, i32** %9
%26 = load i32, i32* %6
%27 = load double, double* %7
%28 = call i32 @_rcLowPass1(i32* %24, i32* %25, i32 %26, double %27)
br label %29
29: ; preds = %23
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
br label %19
32: ; preds = %19
%33 = load i32*, i32** %9
%34 = call i32 @free(i32* %33)
ret void
}

LLVM IR (-O2):
define void @rcLowPass(i32* %0, i32 %1, double %2, i32 %3) {
%5 = tail call double @_freq3db(double %2, i32 %3)
%6 = shl i32 %1, 2
%7 = tail call i32* @malloc_exit(i32 %6)
%8 = icmp sgt i32 %3, 0
br i1 %8, label %11, label %9
9: ; preds = %11, %4
%10 = tail call i32 @free(i32* %7)
ret void
11: ; preds = %4, %11
%12 = phi i32 [ %14, %11 ], [ 0, %4 ]
%13 = tail call i32 @_rcLowPass1(i32* %0, i32* %7, i32 %1, double %5)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %3
br i1 %15, label %9, label %11
}