#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 */
void WebRtcIsac_Highpass(const double *in, double *out, double *state,
                         size_t N) {
  static const double a_coef[2] = {1.86864659625574, -0.88360000000000};
  static const double b_coef[2] = {-1.99524591718270, 0.99600400000000};
  size_t k;
  for (k = 0; k < N; k++) {
    *out = *in + state[1];
    state[1] = state[0] + b_coef[0] * *in + a_coef[0] * *out;
    state[0] = b_coef[1] * *in++ + a_coef[1] * *out++;
  }
}


x86 assembly (clang, -O0):
<WebRtcIsac_Highpass>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11db <WebRtcIsac_Highpass+0xdb>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xebd(%rip),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe95(%rip),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xe8c(%rip),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  (%rax),%xmm2
movsd  0xe61(%rip),%xmm1
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <WebRtcIsac_Highpass+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<WebRtcIsac_Highpass>:
test   %rcx,%rcx
je     1177 <WebRtcIsac_Highpass+0x77>
movsd  0x8(%rdx),%xmm0
xor    %eax,%eax
movsd  0xeec(%rip),%xmm1
movsd  0xeec(%rip),%xmm2
movsd  0xeec(%rip),%xmm3
movsd  0xeec(%rip),%xmm4
nopl   0x0(%rax)
addsd  (%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi,%rax,8)
movsd  (%rdi,%rax,8),%xmm5
mulsd  %xmm1,%xmm5
addsd  (%rdx),%xmm5
mulsd  %xmm2,%xmm0
addsd  %xmm5,%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  (%rsi,%rax,8),%xmm5
mulsd  %xmm3,%xmm5
movsd  (%rdi,%rax,8),%xmm6
mulsd  %xmm4,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,(%rdx)
add    $0x1,%rax
cmp    %rax,%rcx
jne    1130 <WebRtcIsac_Highpass+0x30>
ret

LLVM IR (-O0):
@WebRtcIsac_Highpass.a_coef = internal constant [2 x double] [double 0x3FFDE5F9F92B33B0, double -8.836000e-01]
@WebRtcIsac_Highpass.b_coef = internal constant [2 x double] [double 0xBFFFEC86FB9C6F7F, double 9.960040e-01]
define void @WebRtcIsac_Highpass(double* %0, double* %1, double* %2, i64 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i64
%9 = alloca i64
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i64 %3, i64* %8
store i64 0, i64* %9
br label %10
10: ; preds = %47, %4
%11 = load i64, i64* %9
%12 = load i64, i64* %8
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %50
14: ; preds = %10
%15 = load double*, double** %5
%16 = load double, double* %15
%17 = load double*, double** %7
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fadd double %16, %19
%21 = load double*, double** %6
store double %20, double* %21
%22 = load double*, double** %7
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double, double* getelementptr inbounds ([2 x double], [2 x double]* @WebRtcIsac_Highpass.b_coef, i64 0, i64 0)
%26 = load double*, double** %5
%27 = load double, double* %26
%28 = call double @llvm.fmuladd.f64(double %25, double %27, double %24)
%29 = load double, double* getelementptr inbounds ([2 x double], [2 x double]* @WebRtcIsac_Highpass.a_coef, i64 0, i64 0)
%30 = load double*, double** %6
%31 = load double, double* %30
%32 = call double @llvm.fmuladd.f64(double %29, double %31, double %28)
%33 = load double*, double** %7
%34 = getelementptr inbounds double, double* %33, i64 1
store double %32, double* %34
%35 = load double, double* getelementptr inbounds ([2 x double], [2 x double]* @WebRtcIsac_Highpass.b_coef, i64 0, i64 1)
%36 = load double*, double** %5
%37 = getelementptr inbounds double, double* %36, i32 1
store double* %37, double** %5
%38 = load double, double* %36
%39 = load double, double* getelementptr inbounds ([2 x double], [2 x double]* @WebRtcIsac_Highpass.a_coef, i64 0, i64 1)
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i32 1
store double* %41, double** %6
%42 = load double, double* %40
%43 = fmul double %39, %42
%44 = call double @llvm.fmuladd.f64(double %35, double %38, double %43)
%45 = load double*, double** %7
%46 = getelementptr inbounds double, double* %45, i64 0
store double %44, double* %46
br label %47
47: ; preds = %14
%48 = load i64, i64* %9
%49 = add i64 %48, 1
store i64 %49, i64* %9
br label %10
50: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @WebRtcIsac_Highpass(double* nocapture %0, double* nocapture %1, double* nocapture %2, i64 %3) {
%5 = icmp eq i64 %3, 0
br i1 %5, label %28, label %6
6: ; preds = %4
%7 = getelementptr inbounds double, double* %2, i64 1
%8 = load double, double* %7
br label %9
9: ; preds = %6, %9
%10 = phi double [ %8, %6 ], [ %19, %9 ]
%11 = phi i64 [ 0, %6 ], [ %26, %9 ]
%12 = phi double* [ %0, %6 ], [ %20, %9 ]
%13 = phi double* [ %1, %6 ], [ %22, %9 ]
%14 = load double, double* %12
%15 = fadd double %14, %10
store double %15, double* %13
%16 = load double, double* %2
%17 = load double, double* %12
%18 = tail call double @llvm.fmuladd.f64(double %17, double 0xBFFFEC86FB9C6F7F, double %16)
%19 = tail call double @llvm.fmuladd.f64(double %15, double 0x3FFDE5F9F92B33B0, double %18)
store double %19, double* %7
%20 = getelementptr inbounds double, double* %12, i64 1
%21 = load double, double* %12
%22 = getelementptr inbounds double, double* %13, i64 1
%23 = load double, double* %13
%24 = fmul double %23, -8.836000e-01
%25 = tail call double @llvm.fmuladd.f64(double %21, double 9.960040e-01, double %24)
store double %25, double* %2
%26 = add nuw i64 %11, 1
%27 = icmp eq i64 %26, %3
br i1 %27, label %28, label %9
28: ; preds = %9, %4
ret void
}