#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 */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
double cos(double);
int /*<<< orphan*/ lround16(double);
int tan(double);
void bp2(int16_t *a, int16_t *b, float fc, float q) {
  double th = 2 * 3.141592654 * fc;
  double C = (1 - tan(th * q / 2)) / (1 + tan(th * q / 2));
  a[0] = lround16(16383.0 * (1 + C) * cos(th));
  a[1] = lround16(-16383.0 * C);
  b[0] = lround16(-16383.0 * (C - 1) / 2);
  b[1] = lround16(-16383.0 * 1.0050);
}


x86 assembly (clang, -O0):
<bp2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <tan@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <tan@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe46(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
movsd  0xe41(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <lround16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
movsd  0xdfd(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1050 <lround16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
movsd  -0x28(%rbp),%xmm1
movsd  0xde5(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdbd(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <lround16@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  0xd9c(%rip),%xmm0
call   1050 <lround16@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bp2>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
cvtss2sd %xmm0,%xmm2
mulsd  0xeb6(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0xea5(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <tan@plt>
mov    $0x1,%ebp
sub    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1030 <tan@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe71(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe6d(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
call   1050 <lround16@plt>
mov    %eax,(%rbx)
movsd  0x8(%rsp),%xmm0
mulsd  0xe49(%rip),%xmm0
call   1050 <lround16@plt>
mov    %eax,0x4(%rbx)
movsd  0x8(%rsp),%xmm0
addsd  0xe3b(%rip),%xmm0
mulsd  0xe2b(%rip),%xmm0
mulsd  0xe0b(%rip),%xmm0
call   1050 <lround16@plt>
mov    %eax,(%r14)
movsd  0xe23(%rip),%xmm0
call   1050 <lround16@plt>
mov    %eax,0x4(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @bp2(i32* nocapture writeonly %0, i32* nocapture writeonly %1, float %2, float %3) {
%5 = fpext float %2 to double
%6 = fmul double %5, 0x401921FB54524550
%7 = fpext float %3 to double
%8 = fmul double %6, %7
%9 = fmul double %8, 5.000000e-01
%10 = tail call i32 @tan(double %9)
%11 = sub nsw i32 1, %10
%12 = tail call i32 @tan(double %9)
%13 = add nsw i32 %12, 1
%14 = sdiv i32 %11, %13
%15 = sitofp i32 %14 to double
%16 = fadd double %15, 1.000000e+00
%17 = fmul double %16, 1.638300e+04
%18 = tail call double @cos(double %6)
%19 = fmul double %18, %17
%20 = tail call i32 @lround16(double %19)
store i32 %20, i32* %0
%21 = fmul double %15, -1.638300e+04
%22 = tail call i32 @lround16(double %21)
%23 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %22, i32* %23
%24 = fadd double %15, -1.000000e+00
%25 = fmul double %24, -1.638300e+04
%26 = fmul double %25, 5.000000e-01
%27 = tail call i32 @lround16(double %26)
store i32 %27, i32* %1
%28 = tail call i32 @lround16(double 0xC0D0143A8F5C28F5)
%29 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %28, i32* %29
ret void
}