#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 */
float af_filter_fir(unsigned int, float const *, float const *);
float *af_filter_pfir(unsigned int n, unsigned int d, unsigned int xi,
                      const float **w, const float **x, float *y,
                      unsigned int s) {
  register const float *xt = *x + xi;
  register const float *wt = *w;
  register int nt = 2 * n;
  while (d-- > 0) {
    *y = af_filter_fir(n, wt, xt);
    wt += n;
    xt += nt;
    y += s;
  }
  return y;
}


x86 assembly (clang, -O0):
<af_filter_pfir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0xc(%rbp),%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jbe    11c7 <af_filter_pfir+0xb7>
mov    -0x4(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <af_filter_fir@plt>
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    0x10(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    1159 <af_filter_pfir+0x49>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<af_filter_pfir>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r15
mov    %rdi,0x8(%rsp)
test   %esi,%esi
je     118c <af_filter_pfir+0x7c>
mov    %esi,%r12d
mov    0x8(%rsp),%rsi
lea    (%rsi,%rsi,1),%eax
mov    (%rcx),%rbx
mov    %edx,%ebp
shl    $0x2,%rbp
add    (%r8),%rbp
mov    %esi,%ecx
movslq %eax,%r13
mov    0x50(%rsp),%r14d
shl    $0x2,%rcx
mov    %rcx,0x10(%rsp)
shl    $0x2,%r13
shl    $0x2,%r14
nopl   0x0(%rax)
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1030 <af_filter_fir@plt>
add    0x10(%rsp),%rbx
add    %r13,%rbp
lea    (%r15,%r14,1),%rax
movss  %xmm0,(%r15)
mov    %rax,%r15
add    $0xffffffff,%r12d
jne    1160 <af_filter_pfir+0x50>
jmp    118f <af_filter_pfir+0x7f>
mov    %r15,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float* @af_filter_pfir(i32 %0, i32 %1, i32 %2, float** %3, float** %4, float* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float**
%12 = alloca float**
%13 = alloca float*
%14 = alloca i32
%15 = alloca float*
%16 = alloca float*
%17 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store float** %3, float*** %11
store float** %4, float*** %12
store float* %5, float** %13
store i32 %6, i32* %14
%18 = load float**, float*** %12
%19 = load float*, float** %18
%20 = load i32, i32* %10
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds float, float* %19, i64 %21
store float* %22, float** %15
%23 = load float**, float*** %11
%24 = load float*, float** %23
store float* %24, float** %16
%25 = load i32, i32* %8
%26 = mul i32 2, %25
store i32 %26, i32* %17
br label %27
27: ; preds = %31, %7
%28 = load i32, i32* %9
%29 = add i32 %28, -1
store i32 %29, i32* %9
%30 = icmp ugt i32 %28, 0
br i1 %30, label %31, label %49
31: ; preds = %27
%32 = load i32, i32* %8
%33 = load float*, float** %16
%34 = load float*, float** %15
%35 = call float @af_filter_fir(i32 %32, float* %33, float* %34)
%36 = load float*, float** %13
store float %35, float* %36
%37 = load i32, i32* %8
%38 = load float*, float** %16
%39 = zext i32 %37 to i64
%40 = getelementptr inbounds float, float* %38, i64 %39
store float* %40, float** %16
%41 = load i32, i32* %17
%42 = load float*, float** %15
%43 = sext i32 %41 to i64
%44 = getelementptr inbounds float, float* %42, i64 %43
store float* %44, float** %15
%45 = load i32, i32* %14
%46 = load float*, float** %13
%47 = zext i32 %45 to i64
%48 = getelementptr inbounds float, float* %46, i64 %47
store float* %48, float** %13
br label %27
49: ; preds = %27
%50 = load float*, float** %13
ret float* %50
}

LLVM IR (-O2):
define float* @af_filter_pfir(i32 %0, i32 %1, i32 %2, float** nocapture %3, float** nocapture %4, float* writeonly %5, i32 %6) {
%8 = icmp eq i32 %1, 0
br i1 %8, label %29, label %9
9: ; preds = %7
%10 = shl i32 %0, 1
%11 = load float*, float** %3
%12 = load float*, float** %4
%13 = zext i32 %2 to i64
%14 = getelementptr inbounds float, float* %12, i64 %13
%15 = zext i32 %0 to i64
%16 = sext i32 %10 to i64
%17 = zext i32 %6 to i64
br label %18
18: ; preds = %9, %18
%19 = phi i32 [ %1, %9 ], [ %23, %18 ]
%20 = phi float* [ %11, %9 ], [ %25, %18 ]
%21 = phi float* [ %14, %9 ], [ %26, %18 ]
%22 = phi float* [ %5, %9 ], [ %27, %18 ]
%23 = add i32 %19, -1
%24 = tail call float @af_filter_fir(i32 %0, float* %20, float* %21)
store float %24, float* %22
%25 = getelementptr inbounds float, float* %20, i64 %15
%26 = getelementptr inbounds float, float* %21, i64 %16
%27 = getelementptr inbounds float, float* %22, i64 %17
%28 = icmp eq i32 %23, 0
br i1 %28, label %29, label %18
29: ; preds = %18, %7
%30 = phi float* [ %5, %7 ], [ %27, %18 ]
ret float* %30
}