float _tanf(float x) {
  long int n;
  float xn;
  float f, g;
  float x_int, x_fract;
  float result;
  float xnum, xden;
  if ((x > (float)(+9.099024257348e3L)) || (x < (float)-(+9.099024257348e3L))) {
    return (float)0.0;
  }
  x_int = ((float)(((long)(x))));
  x_fract = ((float)(x) - (float)(x_int));
  g = (float)0.5;
  if (x <= (float)0.0) {
    g = -g;
  }
  n = ((
      long)(((float)(((float)(x) *
                      (float)((float)(0.63661977236758134307553505349006L)))) +
             (float)(g))));
  xn = ((float)(n));
  f = ((float)(x_int) - (float)(((float)(xn) * (float)((1.5703125F)))));
  f = ((float)(f) + (float)(x_fract));
  f = ((float)(f) - (float)(((float)(xn) * (float)((4.84466552734375e-4F)))));
  f = ((float)(f) - (float)(((float)(xn) *
                             (float)((-6.39757837755768678308360248557e-7F)))));
  if (f < (float)0.0) {
    g = -f;
  } else {
    g = f;
  }
  if (g < (float)(+3.452669830012e-4F)) {
    if (n & 0x0001) {
      result = ((float)(-1.0) / (float)(f));
    } else {
      result = f;
    }
    return result;
  }
  g = ((float)(f) * (float)(f));
  xnum = ((float)(g) * (float)((+1.075154738488e-3F)));
  xnum = ((float)(xnum) + (float)((-1.113614403566e-1F)));
  xnum = ((float)(xnum) * (float)(g));
  xnum = ((float)(xnum) * (float)(f));
  xnum = ((float)(xnum) + (float)(f));
  xden = ((float)(g) * (float)((+1.597339213300e-2F)));
  xden = ((float)(xden) + (float)((-4.446947720281e-1F)));
  xden = ((float)(xden) * (float)(g));
  xden = ((float)(xden) + (float)((+1.000000000000F)));
  if (n & 0x0001) {
    result = xnum;
    xnum = -xden;
    xden = result;
  }
  result = ((float)(xnum) / (float)(xden));
  return result;
}


x86 assembly (clang, -O0):
<_tanf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1131 <_tanf+0x31>
movss  0xedd(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    113e <_tanf+0x3e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13d1 <_tanf+0x2d1>
cvttss2si -0x8(%rbp),%rax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xea3(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     118e <_tanf+0x8e>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  0xe78(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %rax,-0x10(%rbp)
cvtsi2ssq -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe39(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xdfa(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xdca(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1278 <_tanf+0x178>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1282 <_tanf+0x182>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xd92(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    12d6 <_tanf+0x1d6>
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     12bd <_tanf+0x1bd>
movss  0xd86(%rip),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    12c7 <_tanf+0x1c7>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13d1 <_tanf+0x2d1>
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xd43(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xd2d(%rip),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xcea(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xcd4(%rip),%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xcaf(%rip),%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     13b8 <_tanf+0x2b8>
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x30(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm0
divss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_tanf>:
movaps %xmm0,%xmm1
ucomiss 0xef6(%rip),%xmm0
xorps  %xmm0,%xmm0
ja     122e <_tanf+0x12e>
movss  0xee9(%rip),%xmm2
ucomiss %xmm1,%xmm2
ja     122e <_tanf+0x12e>
xorps  %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm1,%xmm2
cvttss2si %xmm1,%rcx
cvtsi2ss %rcx,%xmm3
setb   %al
movaps %xmm1,%xmm4
mulss  0xec4(%rip),%xmm1
lea    0xee9(%rip),%rcx
addss  (%rcx,%rax,4),%xmm1
cvttss2si %xmm1,%rax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
subss  %xmm3,%xmm4
movss  0xea3(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm3,%xmm1
addss  %xmm4,%xmm1
movss  0xe93(%rip),%xmm3
mulss  %xmm0,%xmm3
addss  %xmm1,%xmm3
mulss  0xe87(%rip),%xmm0
addss  %xmm3,%xmm0
movaps 0xea8(%rip),%xmm1
xorps  %xmm0,%xmm1
movaps %xmm0,%xmm3
cmpltss %xmm2,%xmm3
andps  %xmm3,%xmm1
andnps %xmm0,%xmm3
orps   %xmm1,%xmm3
movss  0xe64(%rip),%xmm1
ucomiss %xmm3,%xmm1
jbe    11cd <_tanf+0xcd>
test   $0x1,%al
je     122e <_tanf+0x12e>
movss  0xe6b(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret
movaps %xmm0,%xmm3
mulss  %xmm0,%xmm3
movss  0xe40(%rip),%xmm1
mulss  %xmm3,%xmm1
addss  0xe38(%rip),%xmm1
mulss  %xmm3,%xmm1
mulss  %xmm0,%xmm1
addss  %xmm0,%xmm1
movss  0xe28(%rip),%xmm2
mulss  %xmm3,%xmm2
addss  0xe20(%rip),%xmm2
mulss  %xmm3,%xmm2
addss  0xe18(%rip),%xmm2
test   $0x1,%al
je     1224 <_tanf+0x124>
xorps  0xe21(%rip),%xmm2
movaps %xmm2,%xmm0
jmp    122a <_tanf+0x12a>
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @_tanf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i64
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %3
%13 = load float, float* %3
%14 = fcmp ogt float %13, 0x40C1C58320000000
br i1 %14, label %18, label %15
15: ; preds = %1
%16 = load float, float* %3
%17 = fcmp olt float %16, 0xC0C1C58320000000
br i1 %17, label %18, label %19
18: ; preds = %15, %1
store float 0.000000e+00, float* %2
br label %113
19: ; preds = %15
%20 = load float, float* %3
%21 = fptosi float %20 to i64
%22 = sitofp i64 %21 to float
store float %22, float* %8
%23 = load float, float* %3
%24 = load float, float* %8
%25 = fsub float %23, %24
store float %25, float* %9
store float 5.000000e-01, float* %7
%26 = load float, float* %3
%27 = fcmp ole float %26, 0.000000e+00
br i1 %27, label %28, label %31
28: ; preds = %19
%29 = load float, float* %7
%30 = fneg float %29
store float %30, float* %7
br label %31
31: ; preds = %28, %19
%32 = load float, float* %3
%33 = load float, float* %7
%34 = call float @llvm.fmuladd.f32(float %32, float 0x3FE45F3060000000, float %33)
%35 = fptosi float %34 to i64
store i64 %35, i64* %4
%36 = load i64, i64* %4
%37 = sitofp i64 %36 to float
store float %37, float* %5
%38 = load float, float* %8
%39 = load float, float* %5
%40 = fneg float %39
%41 = call float @llvm.fmuladd.f32(float %40, float 0x3FF9200000000000, float %38)
store float %41, float* %6
%42 = load float, float* %6
%43 = load float, float* %9
%44 = fadd float %42, %43
store float %44, float* %6
%45 = load float, float* %6
%46 = load float, float* %5
%47 = fneg float %46
%48 = call float @llvm.fmuladd.f32(float %47, float 0x3F3FC00000000000, float %45)
store float %48, float* %6
%49 = load float, float* %6
%50 = load float, float* %5
%51 = fneg float %50
%52 = call float @llvm.fmuladd.f32(float %51, float 0xBEA5777A60000000, float %49)
store float %52, float* %6
%53 = load float, float* %6
%54 = fcmp olt float %53, 0.000000e+00
br i1 %54, label %55, label %58
55: ; preds = %31
%56 = load float, float* %6
%57 = fneg float %56
store float %57, float* %7
br label %60
58: ; preds = %31
%59 = load float, float* %6
store float %59, float* %7
br label %60
60: ; preds = %58, %55
%61 = load float, float* %7
%62 = fcmp olt float %61, 0x3F36A09E60000000
br i1 %62, label %63, label %74
63: ; preds = %60
%64 = load i64, i64* %4
%65 = and i64 %64, 1
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %63
%68 = load float, float* %6
%69 = fdiv float -1.000000e+00, %68
store float %69, float* %10
br label %72
70: ; preds = %63
%71 = load float, float* %6
store float %71, float* %10
br label %72
72: ; preds = %70, %67
%73 = load float, float* %10
store float %73, float* %2
br label %113
74: ; preds = %60
%75 = load float, float* %6
%76 = load float, float* %6
%77 = fmul float %75, %76
store float %77, float* %7
%78 = load float, float* %7
%79 = fmul float %78, 0x3F519D86A0000000
store float %79, float* %11
%80 = load float, float* %11
%81 = fadd float %80, 0xBFBC822F00000000
store float %81, float* %11
%82 = load float, float* %11
%83 = load float, float* %7
%84 = fmul float %82, %83
store float %84, float* %11
%85 = load float, float* %11
%86 = load float, float* %6
%87 = fmul float %85, %86
store float %87, float* %11
%88 = load float, float* %11
%89 = load float, float* %6
%90 = fadd float %88, %89
store float %90, float* %11
%91 = load float, float* %7
%92 = fmul float %91, 0x3F905B5440000000
store float %92, float* %12
%93 = load float, float* %12
%94 = fadd float %93, 0xBFDC75E100000000
store float %94, float* %12
%95 = load float, float* %12
%96 = load float, float* %7
%97 = fmul float %95, %96
store float %97, float* %12
%98 = load float, float* %12
%99 = fadd float %98, 1.000000e+00
store float %99, float* %12
%100 = load i64, i64* %4
%101 = and i64 %100, 1
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %108
103: ; preds = %74
%104 = load float, float* %11
store float %104, float* %10
%105 = load float, float* %12
%106 = fneg float %105
store float %106, float* %11
%107 = load float, float* %10
store float %107, float* %12
br label %108
108: ; preds = %103, %74
%109 = load float, float* %11
%110 = load float, float* %12
%111 = fdiv float %109, %110
store float %111, float* %10
%112 = load float, float* %10
store float %112, float* %2
br label %113
113: ; preds = %108, %72, %18
%114 = load float, float* %2
ret float %114
}

LLVM IR (-O2):
define float @_tanf(float %0) {
%2 = fcmp ogt float %0, 0x40C1C58320000000
%3 = fcmp olt float %0, 0xC0C1C58320000000
%4 = or i1 %2, %3
br i1 %4, label %45, label %5
5: ; preds = %1
%6 = fptosi float %0 to i64
%7 = sitofp i64 %6 to float
%8 = fsub float %0, %7
%9 = fcmp ugt float %0, 0.000000e+00
%10 = select i1 %9, float 5.000000e-01, float -5.000000e-01
%11 = tail call float @llvm.fmuladd.f32(float %0, float 0x3FE45F3060000000, float %10)
%12 = fptosi float %11 to i64
%13 = sitofp i64 %12 to float
%14 = fneg float %13
%15 = tail call float @llvm.fmuladd.f32(float %14, float 0x3FF9200000000000, float %7)
%16 = fadd float %8, %15
%17 = tail call float @llvm.fmuladd.f32(float %14, float 0x3F3FC00000000000, float %16)
%18 = tail call float @llvm.fmuladd.f32(float %14, float 0xBEA5777A60000000, float %17)
%19 = fcmp olt float %18, 0.000000e+00
%20 = fneg float %18
%21 = select i1 %19, float %20, float %18
%22 = fcmp olt float %21, 0x3F36A09E60000000
br i1 %22, label %23, label %28
23: ; preds = %5
%24 = and i64 %12, 1
%25 = icmp eq i64 %24, 0
%26 = fdiv float -1.000000e+00, %18
%27 = select i1 %25, float %18, float %26
br label %45
28: ; preds = %5
%29 = fmul float %18, %18
%30 = fmul float %29, 0x3F519D86A0000000
%31 = fadd float %30, 0xBFBC822F00000000
%32 = fmul float %29, %31
%33 = fmul float %18, %32
%34 = fadd float %18, %33
%35 = fmul float %29, 0x3F905B5440000000
%36 = fadd float %35, 0xBFDC75E100000000
%37 = fmul float %29, %36
%38 = fadd float %37, 1.000000e+00
%39 = and i64 %12, 1
%40 = icmp eq i64 %39, 0
%41 = fneg float %38
%42 = select i1 %40, float %34, float %41
%43 = select i1 %40, float %38, float %34
%44 = fdiv float %42, %43
br label %45
45: ; preds = %1, %28, %23
%46 = phi float [ %27, %23 ], [ %44, %28 ], [ 0.000000e+00, %1 ]
ret float %46
}