#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 fmod(float, double);
float fa_fast_sin(float angle) {
  float real_angle;
  float square, result;
  int sign;
  angle = angle + 6.28318530717958647692;
  angle = fmod(angle, 6.28318530717958647692);
  if (angle <= 3.14159265358979323846) {
    real_angle = 3.14159265358979323846 - angle;
    angle = ((real_angle) < (angle) ? (real_angle) : (angle));
    sign = 1;
  } else {
    angle = angle - 3.14159265358979323846;
    real_angle = 3.14159265358979323846 - angle;
    angle = ((real_angle) < (angle) ? (real_angle) : (angle));
    sign = -1;
  }
  square = angle * angle;
  result = 7.61e-03f;
  result *= square;
  result -= 1.6605e-01f;
  result *= square;
  result += 1.0f;
  result *= angle;
  return result * sign;
}


x86 assembly (clang, -O0):
<fa_fast_sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeda(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xec0(%rip),%xmm1
call   1030 <fmod@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11cd <fa_fast_sin+0xbd>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11ad <fa_fast_sin+0x9d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    11b7 <fa_fast_sin+0xa7>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
jmp    1246 <fa_fast_sin+0x136>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe22(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe04(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    122b <fa_fast_sin+0x11b>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1235 <fa_fast_sin+0x125>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xdbb(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xd96(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xd72(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fa_fast_sin>:
push   %rax
cvtss2sd %xmm0,%xmm0
movsd  0xee3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <fmod@plt>
cvtss2sd %xmm0,%xmm2
movsd  0xed2(%rip),%xmm1
ucomisd %xmm2,%xmm1
jae    1168 <fa_fast_sin+0x58>
addsd  0xecc(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
subsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
minss  %xmm0,%xmm1
movss  0xeb6(%rip),%xmm2
jmp    117c <fa_fast_sin+0x6c>
subsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
minss  %xmm0,%xmm1
movss  0xe9c(%rip),%xmm2
movaps %xmm1,%xmm3
mulss  %xmm1,%xmm3
movss  0xe95(%rip),%xmm0
mulss  %xmm3,%xmm0
addss  0xe8d(%rip),%xmm0
mulss  %xmm3,%xmm0
addss  0xe75(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fa_fast_sin(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store float %0, float* %2
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fadd double %8, 0x401921FB54442D18
%10 = fptrunc double %9 to float
store float %10, float* %2
%11 = load float, float* %2
%12 = call float @fmod(float %11, double 0x401921FB54442D18)
store float %12, float* %2
%13 = load float, float* %2
%14 = fpext float %13 to double
%15 = fcmp ole double %14, 0x400921FB54442D18
br i1 %15, label %16, label %30
16: ; preds = %1
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = fsub double 0x400921FB54442D18, %18
%20 = fptrunc double %19 to float
store float %20, float* %3
%21 = load float, float* %3
%22 = load float, float* %2
%23 = fcmp olt float %21, %22
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = load float, float* %3
br label %28
26: ; preds = %16
%27 = load float, float* %2
br label %28
28: ; preds = %26, %24
%29 = phi float [ %25, %24 ], [ %27, %26 ]
store float %29, float* %2
store i32 1, i32* %6
br label %48
30: ; preds = %1
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = fsub double %32, 0x400921FB54442D18
%34 = fptrunc double %33 to float
store float %34, float* %2
%35 = load float, float* %2
%36 = fpext float %35 to double
%37 = fsub double 0x400921FB54442D18, %36
%38 = fptrunc double %37 to float
store float %38, float* %3
%39 = load float, float* %3
%40 = load float, float* %2
%41 = fcmp olt float %39, %40
br i1 %41, label %42, label %44
42: ; preds = %30
%43 = load float, float* %3
br label %46
44: ; preds = %30
%45 = load float, float* %2
br label %46
46: ; preds = %44, %42
%47 = phi float [ %43, %42 ], [ %45, %44 ]
store float %47, float* %2
store i32 -1, i32* %6
br label %48
48: ; preds = %46, %28
%49 = load float, float* %2
%50 = load float, float* %2
%51 = fmul float %49, %50
store float %51, float* %4
store float 0x3F7F2BA9E0000000, float* %5
%52 = load float, float* %4
%53 = load float, float* %5
%54 = fmul float %53, %52
store float %54, float* %5
%55 = load float, float* %5
%56 = fsub float %55, 0x3FC5412060000000
store float %56, float* %5
%57 = load float, float* %4
%58 = load float, float* %5
%59 = fmul float %58, %57
store float %59, float* %5
%60 = load float, float* %5
%61 = fadd float %60, 1.000000e+00
store float %61, float* %5
%62 = load float, float* %2
%63 = load float, float* %5
%64 = fmul float %63, %62
store float %64, float* %5
%65 = load float, float* %5
%66 = load i32, i32* %6
%67 = sitofp i32 %66 to float
%68 = fmul float %65, %67
ret float %68
}

LLVM IR (-O2):
define float @fa_fast_sin(float %0) {
%2 = fpext float %0 to double
%3 = fadd double %2, 0x401921FB54442D18
%4 = fptrunc double %3 to float
%5 = tail call float @fmod(float %4, double 0x401921FB54442D18)
%6 = fpext float %5 to double
%7 = fcmp ugt double %6, 0x400921FB54442D18
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = fsub double 0x400921FB54442D18, %6
%10 = fptrunc double %9 to float
%11 = fcmp ogt float %5, %10
%12 = select i1 %11, float %10, float %5
br label %21
13: ; preds = %1
%14 = fadd double %6, 0xC00921FB54442D18
%15 = fptrunc double %14 to float
%16 = fpext float %15 to double
%17 = fsub double 0x400921FB54442D18, %16
%18 = fptrunc double %17 to float
%19 = fcmp olt float %18, %15
%20 = select i1 %19, float %18, float %15
br label %21
21: ; preds = %13, %8
%22 = phi float [ %12, %8 ], [ %20, %13 ]
%23 = phi float [ 1.000000e+00, %8 ], [ -1.000000e+00, %13 ]
%24 = fmul float %22, %22
%25 = fmul float %24, 0x3F7F2BA9E0000000
%26 = fadd float %25, 0xBFC5412060000000
%27 = fmul float %24, %26
%28 = fadd float %27, 1.000000e+00
%29 = fmul float %22, %28
%30 = fmul float %23, %29
ret float %30
}