#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 */
double cos(double);
double sin(double);
void SetHP(float samplerate, float cutoff, double *a, double *b) {
  double w0, Q, alpha;
  w0 = 2 * 3.141592653589 * cutoff / samplerate;
  Q = 1.0;
  alpha = sin(w0) / (2.00 * Q);
  *b = (1.00 + cos(w0)) / 2.00;
  *(b + 1) = -(1.00 + cos(w0));
  *(b + 2) = (1.00 + cos(w0)) / 2.00;
  *a = 1.00 + alpha;
  *(a + 1) = -2.00 * cos(w0);
  *(a + 2) = 1.00 - alpha;
}


x86 assembly (clang, -O0):
<SetHP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xe90(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe5d(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe61(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe30(%rip),%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xdf7(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xdfb(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  0xdd6(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xdbc(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xd9f(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetHP>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
cvtss2sd %xmm1,%xmm1
mulsd  0xec7(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1030 <sin@plt>
mulsd  0xeb0(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
addsd  0xe9f(%rip),%xmm0
mulsd  0xe8f(%rip),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
addsd  0xe80(%rip),%xmm0
xorpd  0xe88(%rip),%xmm0
movlpd %xmm0,0x8(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0xe60(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  0xe4c(%rip),%xmm0
movsd  %xmm0,0x10(%rbx)
movsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0xe35(%rip),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0xe1f(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @SetHP(float %0, float %1, double* %2, double* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
store float %0, float* %5
store float %1, float* %6
store double* %2, double** %7
store double* %3, double** %8
%12 = load float, float* %6
%13 = fpext float %12 to double
%14 = fmul double 0x401921FB5444261E, %13
%15 = load float, float* %5
%16 = fpext float %15 to double
%17 = fdiv double %14, %16
store double %17, double* %9
store double 1.000000e+00, double* %10
%18 = load double, double* %9
%19 = call double @sin(double %18)
%20 = load double, double* %10
%21 = fmul double 2.000000e+00, %20
%22 = fdiv double %19, %21
store double %22, double* %11
%23 = load double, double* %9
%24 = call double @cos(double %23)
%25 = fadd double 1.000000e+00, %24
%26 = fdiv double %25, 2.000000e+00
%27 = load double*, double** %8
store double %26, double* %27
%28 = load double, double* %9
%29 = call double @cos(double %28)
%30 = fadd double 1.000000e+00, %29
%31 = fneg double %30
%32 = load double*, double** %8
%33 = getelementptr inbounds double, double* %32, i64 1
store double %31, double* %33
%34 = load double, double* %9
%35 = call double @cos(double %34)
%36 = fadd double 1.000000e+00, %35
%37 = fdiv double %36, 2.000000e+00
%38 = load double*, double** %8
%39 = getelementptr inbounds double, double* %38, i64 2
store double %37, double* %39
%40 = load double, double* %11
%41 = fadd double 1.000000e+00, %40
%42 = load double*, double** %7
store double %41, double* %42
%43 = load double, double* %9
%44 = call double @cos(double %43)
%45 = fmul double -2.000000e+00, %44
%46 = load double*, double** %7
%47 = getelementptr inbounds double, double* %46, i64 1
store double %45, double* %47
%48 = load double, double* %11
%49 = fsub double 1.000000e+00, %48
%50 = load double*, double** %7
%51 = getelementptr inbounds double, double* %50, i64 2
store double %49, double* %51
ret void
}

LLVM IR (-O2):
define void @SetHP(float %0, float %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fpext float %1 to double
%6 = fmul double %5, 0x401921FB5444261E
%7 = fpext float %0 to double
%8 = fdiv double %6, %7
%9 = tail call double @sin(double %8)
%10 = fmul double %9, 5.000000e-01
%11 = tail call double @cos(double %8)
%12 = fadd double %11, 1.000000e+00
%13 = fmul double %12, 5.000000e-01
store double %13, double* %3
%14 = tail call double @cos(double %8)
%15 = fadd double %14, 1.000000e+00
%16 = fneg double %15
%17 = getelementptr inbounds double, double* %3, i64 1
store double %16, double* %17
%18 = tail call double @cos(double %8)
%19 = fadd double %18, 1.000000e+00
%20 = fmul double %19, 5.000000e-01
%21 = getelementptr inbounds double, double* %3, i64 2
store double %20, double* %21
%22 = fadd double %10, 1.000000e+00
store double %22, double* %2
%23 = tail call double @cos(double %8)
%24 = fmul double %23, -2.000000e+00
%25 = getelementptr inbounds double, double* %2, i64 1
store double %24, double* %25
%26 = fsub double 1.000000e+00, %10
%27 = getelementptr inbounds double, double* %2, i64 2
store double %26, double* %27
ret void
}