#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 fastercos(float);
float fastersin(float);
float fastertanfull(float x) {
  static const float twopi = 6.2831853071795865f;
  static const float invtwopi = 0.15915494309189534f;
  int k = x * invtwopi;
  float half = (x < 0) ? -0.5f : 0.5f;
  float xnew = x - (half + k) * twopi;
  return fastersin(xnew) / fastercos(xnew);
}


x86 assembly (clang, -O0):
<fastertanfull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xed7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeb6(%rip),%xmm3
movss  0xeb2(%rip),%xmm2
xorps  %xmm1,%xmm1
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm2
addss  %xmm2,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe69(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <fastersin@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <fastercos@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastertanfull>:
push   %rax
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
movss  0xecc(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttps2dq %xmm1,%xmm1
cvtdq2ps %xmm1,%xmm1
lea    0xec2(%rip),%rcx
addss  (%rcx,%rax,4),%xmm1
mulss  0xeb1(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,(%rsp)
call   1040 <fastersin@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1030 <fastercos@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@fastertanfull.twopi = internal constant float 0x401921FB60000000
@fastertanfull.invtwopi = internal constant float 0x3FC45F3060000000
define float @fastertanfull(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store float %0, float* %2
%6 = load float, float* %2
%7 = fmul float %6, 0x3FC45F3060000000
%8 = fptosi float %7 to i32
store i32 %8, i32* %3
%9 = load float, float* %2
%10 = fcmp olt float %9, 0.000000e+00
%11 = zext i1 %10 to i64
%12 = select i1 %10, float -5.000000e-01, float 5.000000e-01
store float %12, float* %4
%13 = load float, float* %2
%14 = load float, float* %4
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to float
%17 = fadd float %14, %16
%18 = fneg float %17
%19 = call float @llvm.fmuladd.f32(float %18, float 0x401921FB60000000, float %13)
store float %19, float* %5
%20 = load float, float* %5
%21 = call float @fastersin(float %20)
%22 = load float, float* %5
%23 = call float @fastercos(float %22)
%24 = fdiv float %21, %23
ret float %24
}

LLVM IR (-O2):
define float @fastertanfull(float %0) {
%2 = fmul float %0, 0x3FC45F3060000000
%3 = fptosi float %2 to i32
%4 = fcmp olt float %0, 0.000000e+00
%5 = select i1 %4, float -5.000000e-01, float 5.000000e-01
%6 = sitofp i32 %3 to float
%7 = fadd float %5, %6
%8 = fneg float %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float 0x401921FB60000000, float %0)
%10 = tail call float @fastersin(float %9)
%11 = tail call float @fastercos(float %9)
%12 = fdiv float %10, %11
ret float %12
}