#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 */
double M_PI;
double sin(double radians) {
  const double c1 = 1.00000000000000000000e+00;
  const double c2 = -1.66666671633720397949e-01;
  const double c3 = 8.33333376795053482056e-03;
  const double c4 = -1.98412497411482036114e-04;
  const double c5 = 2.75565571428160183132e-06;
  const double c6 = -2.50368472620721149724e-08;
  const double c7 = 1.58849267073435385100e-10;
  const double c8 = -6.58925550841432672300e-13;
  const int mod = (int)(radians * (1.0 / M_PI));
  const double x1 = (radians - (double)(mod * M_PI));
  const double x2 = x1 * x1;
  const double cx = (mod & 1) ? -x1 : x1;
  double accum;
  accum = x2 * c8;
  accum = x2 * (c7 + accum);
  accum = x2 * (c6 + accum);
  accum = x2 * (c5 + accum);
  accum = x2 * (c4 + accum);
  accum = x2 * (c3 + accum);
  accum = x2 * (c2 + accum);
  accum = cx * (c1 + accum);
  return accum;
}


x86 assembly (clang, -O0):
<sin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xf1a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xf05(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xef0(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
mov    0x2e63(%rip),%rax
divsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x4c(%rbp),%xmm0
mov    0x2e43(%rip),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x4c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1211 <sin+0x111>
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    121b <sin+0x11b>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xddb(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xdcc(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xdb9(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xda6(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd93(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd80(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd6d(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  0xd1a(%rip),%xmm1
addsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin>:
mov    0x2ee1(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xeed(%rip),%xmm2
movapd %xmm2,%xmm3
divsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
cvttsd2si %xmm3,%eax
cvttpd2dq %xmm3,%xmm3
cvtdq2pd %xmm3,%xmm3
mulsd  %xmm1,%xmm3
subsd  %xmm3,%xmm0
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
test   $0x1,%al
je     1147 <sin+0x47>
xorpd  0xef9(%rip),%xmm0
movsd  0xeb9(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xeb5(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xeb1(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xead(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xea9(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xea5(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xea1(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @sin(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %3
store double 0xBFC5555560000000, double* %4
store double 0x3F81111120000000, double* %5
store double 0xBF2A019E60000000, double* %6
store double 0x3EC71DB9C0000000, double* %7
store double 0xBE5AE21380000000, double* %8
store double 0x3DE5D50300000000, double* %9
store double 0xBD672F12E0000000, double* %10
%16 = load double, double* %2
%17 = load double, double* @M_PI
%18 = fdiv double 1.000000e+00, %17
%19 = fmul double %16, %18
%20 = fptosi double %19 to i32
store i32 %20, i32* %11
%21 = load double, double* %2
%22 = load i32, i32* %11
%23 = sitofp i32 %22 to double
%24 = load double, double* @M_PI
%25 = fneg double %23
%26 = call double @llvm.fmuladd.f64(double %25, double %24, double %21)
store double %26, double* %12
%27 = load double, double* %12
%28 = load double, double* %12
%29 = fmul double %27, %28
store double %29, double* %13
%30 = load i32, i32* %11
%31 = and i32 %30, 1
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %1
%34 = load double, double* %12
%35 = fneg double %34
br label %38
36: ; preds = %1
%37 = load double, double* %12
br label %38
38: ; preds = %36, %33
%39 = phi double [ %35, %33 ], [ %37, %36 ]
store double %39, double* %14
%40 = load double, double* %13
%41 = fmul double %40, 0xBD672F12E0000000
store double %41, double* %15
%42 = load double, double* %13
%43 = load double, double* %15
%44 = fadd double 0x3DE5D50300000000, %43
%45 = fmul double %42, %44
store double %45, double* %15
%46 = load double, double* %13
%47 = load double, double* %15
%48 = fadd double 0xBE5AE21380000000, %47
%49 = fmul double %46, %48
store double %49, double* %15
%50 = load double, double* %13
%51 = load double, double* %15
%52 = fadd double 0x3EC71DB9C0000000, %51
%53 = fmul double %50, %52
store double %53, double* %15
%54 = load double, double* %13
%55 = load double, double* %15
%56 = fadd double 0xBF2A019E60000000, %55
%57 = fmul double %54, %56
store double %57, double* %15
%58 = load double, double* %13
%59 = load double, double* %15
%60 = fadd double 0x3F81111120000000, %59
%61 = fmul double %58, %60
store double %61, double* %15
%62 = load double, double* %13
%63 = load double, double* %15
%64 = fadd double 0xBFC5555560000000, %63
%65 = fmul double %62, %64
store double %65, double* %15
%66 = load double, double* %14
%67 = load double, double* %15
%68 = fadd double 1.000000e+00, %67
%69 = fmul double %66, %68
store double %69, double* %15
%70 = load double, double* %15
ret double %70
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @sin(double %0) {
%2 = load double, double* @M_PI
%3 = fdiv double 1.000000e+00, %2
%4 = fmul double %3, %0
%5 = fptosi double %4 to i32
%6 = sitofp i32 %5 to double
%7 = fneg double %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double %2, double %0)
%9 = fmul double %8, %8
%10 = and i32 %5, 1
%11 = icmp eq i32 %10, 0
%12 = fneg double %8
%13 = select i1 %11, double %8, double %12
%14 = fmul double %9, 0x3D672F12E0000000
%15 = fsub double 0x3DE5D50300000000, %14
%16 = fmul double %9, %15
%17 = fadd double %16, 0xBE5AE21380000000
%18 = fmul double %9, %17
%19 = fadd double %18, 0x3EC71DB9C0000000
%20 = fmul double %9, %19
%21 = fadd double %20, 0xBF2A019E60000000
%22 = fmul double %9, %21
%23 = fadd double %22, 0x3F81111120000000
%24 = fmul double %9, %23
%25 = fadd double %24, 0xBFC5555560000000
%26 = fmul double %9, %25
%27 = fadd double %26, 1.000000e+00
%28 = fmul double %13, %27
ret double %28
}