double __kernel_sin(double x, double y, int iy) {
  double z, r, v;
  int ix;
  ix = *(1 + (const int *)&x) & 0x7fffffff;
  if (ix < 0x3e400000) {
    if ((int)x == 0) {
      return x;
    }
  }
  z = x * x;
  v = z * x;
  r = 8.33333333332248946124e-03 +
      z * (-1.98412698298579493134e-04 +
           z * (2.75573137070700676789e-06 +
                z * (-2.50507602534068634195e-08 +
                     z * 1.58969099521155010221e-10)));
  if (iy == 0) {
    return x + v * (-1.66666666666666324348e-01 + z * r);
  } else {
    return x - ((z * (5.00000000000000000000e-01 * y - v * r) - y) -
                v * -1.66666666666666324348e-01);
  }
}


x86 assembly (clang, -O0):
<__kernel_sin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x3e400000,-0x3c(%rbp)
jge    114b <__kernel_sin+0x4b>
cvttsd2si -0x10(%rbp),%eax
cmp    $0x0,%eax
jne    1146 <__kernel_sin+0x46>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a3 <__kernel_sin+0x1a3>
jmp    114b <__kernel_sin+0x4b>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  0xe93(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe8f(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe6f(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe57(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    120a <__kernel_sin+0x10a>
movsd  -0x10(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe34(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a3 <__kernel_sin+0x1a3>
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdee(%rip),%xmm4
mulsd  %xmm4,%xmm3
addsd  %xmm1,%xmm3
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd96(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__kernel_sin>:
movq   %xmm0,%rax
shr    $0x36,%rax
and    $0x1ff,%eax
cmp    $0xf8,%eax
ja     111e <__kernel_sin+0x1e>
cvttsd2si %xmm0,%eax
test   %eax,%eax
jne    111e <__kernel_sin+0x1e>
ret
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
movsd  0xed2(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  0xece(%rip),%xmm4
movapd %xmm3,%xmm2
mulsd  %xmm3,%xmm4
addsd  0xec6(%rip),%xmm4
mulsd  %xmm0,%xmm2
mulsd  %xmm3,%xmm4
addsd  0xebe(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  0xeba(%rip),%xmm4
test   %edi,%edi
je     1197 <__kernel_sin+0x97>
mulsd  %xmm2,%xmm4
movsd  0xeb2(%rip),%xmm5
mulsd  %xmm1,%xmm5
subsd  %xmm4,%xmm5
mulsd  %xmm5,%xmm3
subsd  %xmm1,%xmm3
mulsd  0xea2(%rip),%xmm2
addsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
ret
mulsd  %xmm4,%xmm3
addsd  0xe95(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @__kernel_sin(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
%12 = bitcast double* %5 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = and i32 %14, 2147483647
store i32 %15, i32* %11
%16 = load i32, i32* %11
%17 = icmp slt i32 %16, 1044381696
br i1 %17, label %18, label %25
18: ; preds = %3
%19 = load double, double* %5
%20 = fptosi double %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load double, double* %5
store double %23, double* %4
br label %65
24: ; preds = %18
br label %25
25: ; preds = %24, %3
%26 = load double, double* %5
%27 = load double, double* %5
%28 = fmul double %26, %27
store double %28, double* %8
%29 = load double, double* %8
%30 = load double, double* %5
%31 = fmul double %29, %30
store double %31, double* %10
%32 = load double, double* %8
%33 = load double, double* %8
%34 = load double, double* %8
%35 = load double, double* %8
%36 = call double @llvm.fmuladd.f64(double %35, double 0x3DE5D93A5ACFD57C, double 0xBE5AE5E68A2B9CEB)
%37 = call double @llvm.fmuladd.f64(double %34, double %36, double 0x3EC71DE357B1FE7D)
%38 = call double @llvm.fmuladd.f64(double %33, double %37, double 0xBF2A01A019C161D5)
%39 = call double @llvm.fmuladd.f64(double %32, double %38, double 0x3F8111111110F8A6)
store double %39, double* %9
%40 = load i32, i32* %7
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %49
42: ; preds = %25
%43 = load double, double* %5
%44 = load double, double* %10
%45 = load double, double* %8
%46 = load double, double* %9
%47 = call double @llvm.fmuladd.f64(double %45, double %46, double 0xBFC5555555555549)
%48 = call double @llvm.fmuladd.f64(double %44, double %47, double %43)
store double %48, double* %4
br label %65
49: ; preds = %25
%50 = load double, double* %5
%51 = load double, double* %8
%52 = load double, double* %6
%53 = load double, double* %10
%54 = load double, double* %9
%55 = fmul double %53, %54
%56 = fneg double %55
%57 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %52, double %56)
%58 = load double, double* %6
%59 = fneg double %58
%60 = call double @llvm.fmuladd.f64(double %51, double %57, double %59)
%61 = load double, double* %10
%62 = fneg double %61
%63 = call double @llvm.fmuladd.f64(double %62, double 0xBFC5555555555549, double %60)
%64 = fsub double %50, %63
store double %64, double* %4
br label %65
65: ; preds = %49, %42, %22
%66 = load double, double* %4
ret double %66
}

LLVM IR (-O2):
define double @__kernel_sin(double %0, double %1, i32 %2) {
%4 = bitcast double %0 to i64
%5 = and i64 %4, 9205357638345293824
%6 = icmp ult i64 %5, 4485585228861014016
%7 = fptosi double %0 to i32
%8 = icmp eq i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %29, label %10
10: ; preds = %3
%11 = fmul double %0, %0
%12 = fmul double %11, %0
%13 = tail call double @llvm.fmuladd.f64(double %11, double 0x3DE5D93A5ACFD57C, double 0xBE5AE5E68A2B9CEB)
%14 = tail call double @llvm.fmuladd.f64(double %11, double %13, double 0x3EC71DE357B1FE7D)
%15 = tail call double @llvm.fmuladd.f64(double %11, double %14, double 0xBF2A01A019C161D5)
%16 = tail call double @llvm.fmuladd.f64(double %11, double %15, double 0x3F8111111110F8A6)
%17 = icmp eq i32 %2, 0
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = tail call double @llvm.fmuladd.f64(double %11, double %16, double 0xBFC5555555555549)
%20 = tail call double @llvm.fmuladd.f64(double %12, double %19, double %0)
br label %29
21: ; preds = %10
%22 = fneg double %12
%23 = fmul double %16, %22
%24 = tail call double @llvm.fmuladd.f64(double %1, double 5.000000e-01, double %23)
%25 = fneg double %1
%26 = tail call double @llvm.fmuladd.f64(double %11, double %24, double %25)
%27 = tail call double @llvm.fmuladd.f64(double %22, double 0xBFC5555555555549, double %26)
%28 = fsub double %0, %27
br label %29
29: ; preds = %3, %21, %18
%30 = phi double [ %20, %18 ], [ %28, %21 ], [ %0, %3 ]
ret double %30
}