#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*/ do_ffir(float const *, int, float *, int *, int, int,
                           float *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *);
int downsamp(const float *in, float *out, int samples, int *outsamps,
             int state_idx, int decimate, int ncoef, float fc[], int init) {
  if (in && out) {
    do_ffir(in, samples, out, outsamps, state_idx, ncoef, fc, 0, decimate,
            init);
    return (1);
  } else
    printf("Bad signal(s) passed to downsamp()\n");
  return (0);
}


x86 assembly (clang, -O0):
<downsamp>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9d,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11aa <downsamp+0x8a>
cmpq   $0x0,-0x20(%rbp)
je     11aa <downsamp+0x8a>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x34(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r11
mov    -0x38(%rbp),%r10d
mov    0x20(%rbp),%eax
xor    %ebx,%ebx
mov    %r11,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <do_ffir@plt>
movl   $0x1,-0xc(%rbp)
jmp    11bd <downsamp+0x9d>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<downsamp>:
push   %rax
test   %rdi,%rdi
je     115a <downsamp+0x3a>
mov    %rsi,%rax
test   %rsi,%rsi
je     115a <downsamp+0x3a>
mov    %r9d,%r10d
mov    0x20(%rsp),%r11d
mov    0x10(%rsp),%r9d
mov    %edx,%esi
mov    %rax,%rdx
push   %r11
push   %r10
push   $0x0
push   0x30(%rsp)
call   1040 <do_ffir@plt>
add    $0x20,%rsp
mov    $0x1,%eax
pop    %rcx
ret
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Bad signal(s) passed to downsamp()\0A\00"
define i32 @downsamp(float* %0, float* %1, i32 %2, i32* %3, i32 %4, i32 %5, i32 %6, float* %7, i32 %8) {
%10 = alloca i32
%11 = alloca float*
%12 = alloca float*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca float*
%19 = alloca i32
store float* %0, float** %11
store float* %1, float** %12
store i32 %2, i32* %13
store i32* %3, i32** %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store float* %7, float** %18
store i32 %8, i32* %19
%20 = load float*, float** %11
%21 = icmp ne float* %20, null
br i1 %21, label %22, label %36
22: ; preds = %9
%23 = load float*, float** %12
%24 = icmp ne float* %23, null
br i1 %24, label %25, label %36
25: ; preds = %22
%26 = load float*, float** %11
%27 = load i32, i32* %13
%28 = load float*, float** %12
%29 = load i32*, i32** %14
%30 = load i32, i32* %15
%31 = load i32, i32* %17
%32 = load float*, float** %18
%33 = load i32, i32* %16
%34 = load i32, i32* %19
%35 = call i32 @do_ffir(float* %26, i32 %27, float* %28, i32* %29, i32 %30, i32 %31, float* %32, i32 0, i32 %33, i32 %34)
store i32 1, i32* %10
br label %39
36: ; preds = %22, %9
%37 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %36
store i32 0, i32* %10
br label %39
39: ; preds = %38, %25
%40 = load i32, i32* %10
ret i32 %40
}

LLVM IR (-O2):
@str = [35 x i8] c"Bad signal(s) passed to downsamp()\00"
define i32 @downsamp(float* %0, float* %1, i32 %2, i32* %3, i32 %4, i32 %5, i32 %6, float* %7, i32 %8) {
%10 = icmp ne float* %0, null
%11 = icmp ne float* %1, null
%12 = and i1 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @do_ffir(float* %0, i32 %2, float* %1, i32* %3, i32 %4, i32 %6, float* %7, i32 0, i32 %5, i32 %8)
br label %17
15: ; preds = %9
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ 1, %13 ], [ 0, %15 ]
ret i32 %18
}