double pp_sin(double x) {
  double xi, y, q, q2;
  int sign;
  xi = x;
  sign = 1;
  while (xi < -1.57079632679489661923)
    xi += 6.28318530717958647692;
  while (xi > 4.71238898038468985769)
    xi -= 6.28318530717958647692;
  if (xi > 1.57079632679489661923) {
    xi -= 3.141592653589793238462643;
    sign = -1;
  }
  q = xi / 1.57079632679;
  q2 = q * q;
  y = ((((.00015148419 * q2 - .00467376557) * q2 + .07968967928) * q2 -
        .64596371106) *
           q2 +
       1.57079631847) *
      q;
  return (sign < 0 ? -y : y);
}


x86 assembly (clang, -O0):
<pp_sin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x2c(%rbp)
movsd  0xede(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1144 <pp_sin+0x44>
movsd  0xf1b(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    111a <pp_sin+0x1a>
jmp    1149 <pp_sin+0x49>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117b <pp_sin+0x7b>
movsd  -0x10(%rbp),%xmm0
movsd  0xee3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1149 <pp_sin+0x49>
movsd  -0x10(%rbp),%xmm0
movsd  0xe88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11af <pp_sin+0xaf>
movsd  -0x10(%rbp),%xmm0
movsd  0xe79(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe8c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe57(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe53(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe11(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf4(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    126a <pp_sin+0x16a>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1274 <pp_sin+0x174>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pp_sin>:
movsd  0xef8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    112a <pp_sin+0x2a>
movsd  0xef2(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
addsd  %xmm2,%xmm0
ucomisd %xmm0,%xmm1
ja     1120 <pp_sin+0x20>
ucomisd 0xede(%rip),%xmm0
jbe    115a <pp_sin+0x5a>
movsd  0xedc(%rip),%xmm1
movsd  0xecc(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
ja     1150 <pp_sin+0x50>
movsd  0xebe(%rip),%xmm1
ucomisd %xmm1,%xmm0
movsd  0xeba(%rip),%xmm2
addsd  %xmm0,%xmm2
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
divsd  0xea5(%rip),%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe9d(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe99(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe95(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe91(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe8d(%rip),%xmm0
mulsd  %xmm1,%xmm0
jbe    11d9 <pp_sin+0xd9>
xorpd  0xe87(%rip),%xmm0
ret

LLVM IR (-O0):
define double @pp_sin(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %2
%8 = load double, double* %2
store double %8, double* %3
store i32 1, i32* %7
br label %9
9: ; preds = %12, %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 0xBFF921FB54442D18
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load double, double* %3
%14 = fadd double %13, 0x401921FB54442D18
store double %14, double* %3
br label %9
15: ; preds = %9
br label %16
16: ; preds = %19, %15
%17 = load double, double* %3
%18 = fcmp ogt double %17, 0x4012D97C7F3321D2
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load double, double* %3
%21 = fsub double %20, 0x401921FB54442D18
store double %21, double* %3
br label %16
22: ; preds = %16
%23 = load double, double* %3
%24 = fcmp ogt double %23, 0x3FF921FB54442D18
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load double, double* %3
%27 = fsub double %26, 0x400921FB54442D18
store double %27, double* %3
store i32 -1, i32* %7
br label %28
28: ; preds = %25, %22
%29 = load double, double* %3
%30 = fdiv double %29, 0x3FF921FB5443D6F4
store double %30, double* %5
%31 = load double, double* %5
%32 = load double, double* %5
%33 = fmul double %31, %32
store double %33, double* %6
%34 = load double, double* %6
%35 = call double @llvm.fmuladd.f64(double 0x3F23DAF748A890AF, double %34, double 0xBF7324CC645B6D0E)
%36 = load double, double* %6
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double 0x3FB4668AF65619A5)
%38 = load double, double* %6
%39 = call double @llvm.fmuladd.f64(double %37, double %38, double 0xBFE4ABBC16ACF9CD)
%40 = load double, double* %6
%41 = call double @llvm.fmuladd.f64(double %39, double %40, double 0x3FF921FB520817F7)
%42 = load double, double* %5
%43 = fmul double %41, %42
store double %43, double* %4
%44 = load i32, i32* %7
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %28
%47 = load double, double* %4
%48 = fneg double %47
br label %51
49: ; preds = %28
%50 = load double, double* %4
br label %51
51: ; preds = %49, %46
%52 = phi double [ %48, %46 ], [ %50, %49 ]
ret double %52
}

LLVM IR (-O2):
define double @pp_sin(double %0) {
%2 = fcmp olt double %0, 0xBFF921FB54442D18
br i1 %2, label %6, label %3
3: ; preds = %6, %1
%4 = phi double [ %0, %1 ], [ %8, %6 ]
%5 = fcmp ogt double %4, 0x4012D97C7F3321D2
br i1 %5, label %10, label %14
6: ; preds = %1, %6
%7 = phi double [ %8, %6 ], [ %0, %1 ]
%8 = fadd double %7, 0x401921FB54442D18
%9 = fcmp olt double %8, 0xBFF921FB54442D18
br i1 %9, label %6, label %3
10: ; preds = %3, %10
%11 = phi double [ %12, %10 ], [ %4, %3 ]
%12 = fadd double %11, 0xC01921FB54442D18
%13 = fcmp ogt double %12, 0x4012D97C7F3321D2
br i1 %13, label %10, label %14
14: ; preds = %10, %3
%15 = phi double [ %4, %3 ], [ %12, %10 ]
%16 = fcmp ogt double %15, 0x3FF921FB54442D18
%17 = fadd double %15, 0xC00921FB54442D18
%18 = select i1 %16, double %17, double %15
%19 = fdiv double %18, 0x3FF921FB5443D6F4
%20 = fmul double %19, %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double 0x3F23DAF748A890AF, double 0xBF7324CC645B6D0E)
%22 = tail call double @llvm.fmuladd.f64(double %21, double %20, double 0x3FB4668AF65619A5)
%23 = tail call double @llvm.fmuladd.f64(double %22, double %20, double 0xBFE4ABBC16ACF9CD)
%24 = tail call double @llvm.fmuladd.f64(double %23, double %20, double 0x3FF921FB520817F7)
%25 = fmul double %19, %24
%26 = fneg double %25
%27 = select i1 %16, double %26, double %25
ret double %27
}