#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_AllpassFilterForDec(double *InOut,
                                    const double *APSectionFactors,
                                    size_t lengthInOut, double *FilterState) {
  size_t n, j;
  double temp;
  for (j = 0; j < 2; j++) {
    for (n = 0; n < lengthInOut; n += 2) {
      temp = InOut[n];
      InOut[n] = FilterState[j] + APSectionFactors[j] * temp;
      FilterState[j] = -APSectionFactors[j] * InOut[n] + temp;
    }
  }
}


x86 assembly (clang, -O0):
<WebRtcIsac_AllpassFilterForDec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x2,-0x30(%rbp)
jae    11f5 <WebRtcIsac_AllpassFilterForDec+0xf5>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11df <WebRtcIsac_AllpassFilterForDec+0xdf>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
jmp    112f <WebRtcIsac_AllpassFilterForDec+0x2f>
jmp    11e4 <WebRtcIsac_AllpassFilterForDec+0xe4>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    111c <WebRtcIsac_AllpassFilterForDec+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<WebRtcIsac_AllpassFilterForDec>:
test   %rdx,%rdx
je     11e2 <WebRtcIsac_AllpassFilterForDec+0xe2>
movsd  (%rcx),%xmm0
lea    -0x1(%rdx),%rax
mov    %rax,%r8
shr    %r8
add    $0x1,%r8
cmp    $0x2,%rax
jae    1125 <WebRtcIsac_AllpassFilterForDec+0x25>
xor    %eax,%eax
jmp    1180 <WebRtcIsac_AllpassFilterForDec+0x80>
mov    %r8,%r9
and    $0xfffffffffffffffe,%r9
xor    %eax,%eax
xchg   %ax,%ax
movsd  (%rdi,%rax,8),%xmm1
movsd  (%rsi),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
mulsd  (%rsi),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rcx)
movsd  0x10(%rdi,%rax,8),%xmm0
movsd  (%rsi),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rdi,%rax,8)
mulsd  (%rsi),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,(%rcx)
add    $0x4,%rax
add    $0xfffffffffffffffe,%r9
jne    1130 <WebRtcIsac_AllpassFilterForDec+0x30>
test   $0x1,%r8b
je     11a8 <WebRtcIsac_AllpassFilterForDec+0xa8>
movsd  (%rdi,%rax,8),%xmm1
movsd  (%rsi),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
mulsd  (%rsi),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rcx)
movsd  0x8(%rcx),%xmm0
xor    %eax,%eax
nop
movsd  (%rdi,%rax,8),%xmm1
movsd  0x8(%rsi),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
mulsd  0x8(%rsi),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rcx)
add    $0x2,%rax
movapd %xmm1,%xmm0
cmp    %rdx,%rax
jb     11b0 <WebRtcIsac_AllpassFilterForDec+0xb0>
ret

LLVM IR (-O0):
define void @WebRtcIsac_AllpassFilterForDec(double* %0, double* %1, i64 %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i64
%8 = alloca double*
%9 = alloca i64
%10 = alloca i64
%11 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store i64 %2, i64* %7
store double* %3, double** %8
store i64 0, i64* %10
br label %12
12: ; preds = %56, %4
%13 = load i64, i64* %10
%14 = icmp ult i64 %13, 2
br i1 %14, label %15, label %59
15: ; preds = %12
store i64 0, i64* %9
br label %16
16: ; preds = %52, %15
%17 = load i64, i64* %9
%18 = load i64, i64* %7
%19 = icmp ult i64 %17, %18
br i1 %19, label %20, label %55
20: ; preds = %16
%21 = load double*, double** %5
%22 = load i64, i64* %9
%23 = getelementptr inbounds double, double* %21, i64 %22
%24 = load double, double* %23
store double %24, double* %11
%25 = load double*, double** %8
%26 = load i64, i64* %10
%27 = getelementptr inbounds double, double* %25, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %6
%30 = load i64, i64* %10
%31 = getelementptr inbounds double, double* %29, i64 %30
%32 = load double, double* %31
%33 = load double, double* %11
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double %28)
%35 = load double*, double** %5
%36 = load i64, i64* %9
%37 = getelementptr inbounds double, double* %35, i64 %36
store double %34, double* %37
%38 = load double*, double** %6
%39 = load i64, i64* %10
%40 = getelementptr inbounds double, double* %38, i64 %39
%41 = load double, double* %40
%42 = fneg double %41
%43 = load double*, double** %5
%44 = load i64, i64* %9
%45 = getelementptr inbounds double, double* %43, i64 %44
%46 = load double, double* %45
%47 = load double, double* %11
%48 = call double @llvm.fmuladd.f64(double %42, double %46, double %47)
%49 = load double*, double** %8
%50 = load i64, i64* %10
%51 = getelementptr inbounds double, double* %49, i64 %50
store double %48, double* %51
br label %52
52: ; preds = %20
%53 = load i64, i64* %9
%54 = add i64 %53, 2
store i64 %54, i64* %9
br label %16
55: ; preds = %16
br label %56
56: ; preds = %55
%57 = load i64, i64* %10
%58 = add i64 %57, 1
store i64 %58, i64* %10
br label %12
59: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @WebRtcIsac_AllpassFilterForDec(double* nocapture %0, double* nocapture %1, i64 %2, double* nocapture %3) {
%5 = icmp eq i64 %2, 0
br i1 %5, label %65, label %6
6: ; preds = %4
%7 = load double, double* %3
%8 = add i64 %2, -1
%9 = lshr i64 %8, 1
%10 = add nuw i64 %9, 1
%11 = and i64 %10, 1
%12 = icmp ult i64 %8, 2
br i1 %12, label %37, label %13
13: ; preds = %6
%14 = and i64 %10, -2
br label %15
15: ; preds = %15, %13
%16 = phi double [ %7, %13 ], [ %33, %15 ]
%17 = phi i64 [ 0, %13 ], [ %34, %15 ]
%18 = phi i64 [ 0, %13 ], [ %35, %15 ]
%19 = getelementptr inbounds double, double* %0, i64 %17
%20 = load double, double* %19
%21 = load double, double* %1
%22 = tail call double @llvm.fmuladd.f64(double %21, double %20, double %16)
store double %22, double* %19
%23 = load double, double* %1
%24 = fneg double %23
%25 = tail call double @llvm.fmuladd.f64(double %24, double %22, double %20)
store double %25, double* %3
%26 = or i64 %17, 2
%27 = getelementptr inbounds double, double* %0, i64 %26
%28 = load double, double* %27
%29 = load double, double* %1
%30 = tail call double @llvm.fmuladd.f64(double %29, double %28, double %25)
store double %30, double* %27
%31 = load double, double* %1
%32 = fneg double %31
%33 = tail call double @llvm.fmuladd.f64(double %32, double %30, double %28)
store double %33, double* %3
%34 = add nuw i64 %17, 4
%35 = add nuw i64 %18, 2
%36 = icmp eq i64 %35, %14
br i1 %36, label %37, label %15
37: ; preds = %15, %6
%38 = phi double [ %7, %6 ], [ %33, %15 ]
%39 = phi i64 [ 0, %6 ], [ %34, %15 ]
%40 = icmp eq i64 %11, 0
br i1 %40, label %49, label %41
41: ; preds = %37
%42 = getelementptr inbounds double, double* %0, i64 %39
%43 = load double, double* %42
%44 = load double, double* %1
%45 = tail call double @llvm.fmuladd.f64(double %44, double %43, double %38)
store double %45, double* %42
%46 = load double, double* %1
%47 = fneg double %46
%48 = tail call double @llvm.fmuladd.f64(double %47, double %45, double %43)
store double %48, double* %3
br label %49
49: ; preds = %37, %41
%50 = getelementptr inbounds double, double* %3, i64 1
%51 = getelementptr inbounds double, double* %1, i64 1
%52 = load double, double* %50
br label %53
53: ; preds = %53, %49
%54 = phi double [ %52, %49 ], [ %62, %53 ]
%55 = phi i64 [ 0, %49 ], [ %63, %53 ]
%56 = getelementptr inbounds double, double* %0, i64 %55
%57 = load double, double* %56
%58 = load double, double* %51
%59 = tail call double @llvm.fmuladd.f64(double %58, double %57, double %54)
store double %59, double* %56
%60 = load double, double* %51
%61 = fneg double %60
%62 = tail call double @llvm.fmuladd.f64(double %61, double %59, double %57)
store double %62, double* %50
%63 = add nuw i64 %55, 2
%64 = icmp ult i64 %63, %2
br i1 %64, label %53, label %65
65: ; preds = %53, %4
ret void
}