#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_1_PI;
double mla(double, double, double);
scalar_t__ xrint(double);
double xsin(double d) {
  int q;
  double u, s;
  q = (int)xrint(d * M_1_PI);
  d = mla(q, -0.78539816290140151978 * 4, d);
  d = mla(q, -4.9604678871439933374e-10 * 4, d);
  d = mla(q, -1.1258708853173288931e-18 * 4, d);
  d = mla(q, -1.7607799325916000908e-27 * 4, d);
  s = d * d;
  if ((q & 1) != 0)
    d = -d;
  u = -7.97255955009037868891952e-18;
  u = mla(u, s, 2.81009972710863200091251e-15);
  u = mla(u, s, -7.64712219118158833288484e-13);
  u = mla(u, s, 1.60590430605664501629054e-10);
  u = mla(u, s, -2.50521083763502045810755e-08);
  u = mla(u, s, 2.75573192239198747630416e-06);
  u = mla(u, s, -0.000198412698412696162806809);
  u = mla(u, s, 0.00833333333333332974823815);
  u = mla(u, s, -0.166666666666666657414808);
  u = mla(s, u * d, d);
  return u;
}


x86 assembly (clang, -O0):
<xsin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ea7(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <xrint@plt>
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xec1(%rip),%xmm1
call   1040 <mla@plt>
movsd  %xmm0,-0x8(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe9d(%rip),%xmm1
call   1040 <mla@plt>
movsd  %xmm0,-0x8(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe79(%rip),%xmm1
call   1040 <mla@plt>
movsd  %xmm0,-0x8(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe55(%rip),%xmm1
call   1040 <mla@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f4 <xsin+0xd4>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe45(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe21(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xdfd(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xdd9(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xdb5(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd91(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd6d(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd49(%rip),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
call   1040 <mla@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsin>:
push   %rbx
sub    $0x20,%rsp
movapd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
mov    0x2eaa(%rip),%rax
movsd  (%rax),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <xrint@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xea6(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
call   1040 <mla@plt>
movapd %xmm0,%xmm2
movsd  0xe97(%rip),%xmm1
movsd  (%rsp),%xmm0
call   1040 <mla@plt>
movaps %xmm0,%xmm2
movsd  0xe8a(%rip),%xmm1
movsd  (%rsp),%xmm0
call   1040 <mla@plt>
movaps %xmm0,%xmm2
movsd  0xe7d(%rip),%xmm1
movsd  (%rsp),%xmm0
call   1040 <mla@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
test   $0x1,%bl
je     11ba <xsin+0x9a>
xorpd  0xeb6(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0xe58(%rip),%xmm0
movsd  0xe58(%rip),%xmm2
movapd %xmm1,(%rsp)
call   1040 <mla@plt>
movsd  0xe4e(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movsd  0xe45(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movsd  0xe3c(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movsd  0xe33(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movsd  0xe2a(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movsd  0xe21(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movsd  0xe18(%rip),%xmm2
movaps (%rsp),%xmm1
call   1040 <mla@plt>
movapd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm1
movaps (%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
jmp    1040 <mla@plt>

LLVM IR (-O0):
@M_1_PI = global double 0.000000e+00
define double @xsin(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
%7 = load double, double* @M_1_PI
%8 = fmul double %6, %7
%9 = call i64 @xrint(double %8)
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to double
%13 = load double, double* %2
%14 = call double @mla(double %12, double 0xC00921FB54000000, double %13)
store double %14, double* %2
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = load double, double* %2
%18 = call double @mla(double %16, double 0xBE210B4611000000, double %17)
store double %18, double* %2
%19 = load i32, i32* %3
%20 = sitofp i32 %19 to double
%21 = load double, double* %2
%22 = call double @mla(double %20, double 0xBC54C4C662000000, double %21)
store double %22, double* %2
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to double
%25 = load double, double* %2
%26 = call double @mla(double %24, double 0xBA81701B839A2520, double %25)
store double %26, double* %2
%27 = load double, double* %2
%28 = load double, double* %2
%29 = fmul double %27, %28
store double %29, double* %5
%30 = load i32, i32* %3
%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* %2
%35 = fneg double %34
store double %35, double* %2
br label %36
36: ; preds = %33, %1
store double 0xBC62622B22D526BE, double* %4
%37 = load double, double* %4
%38 = load double, double* %5
%39 = call double @mla(double %37, double %38, double 0x3CE94FA618796592)
store double %39, double* %4
%40 = load double, double* %4
%41 = load double, double* %5
%42 = call double @mla(double %40, double %41, double 0xBD6AE7EA531357BF)
store double %42, double* %4
%43 = load double, double* %4
%44 = load double, double* %5
%45 = call double @mla(double %43, double %44, double 0x3DE6124601C23966)
store double %45, double* %4
%46 = load double, double* %4
%47 = load double, double* %5
%48 = call double @mla(double %46, double %47, double 0xBE5AE64567CB5786)
store double %48, double* %4
%49 = load double, double* %4
%50 = load double, double* %5
%51 = call double @mla(double %49, double %50, double 0x3EC71DE3A5568A50)
store double %51, double* %4
%52 = load double, double* %4
%53 = load double, double* %5
%54 = call double @mla(double %52, double %53, double 0xBF2A01A01A019FC7)
store double %54, double* %4
%55 = load double, double* %4
%56 = load double, double* %5
%57 = call double @mla(double %55, double %56, double 0x3F8111111111110F)
store double %57, double* %4
%58 = load double, double* %4
%59 = load double, double* %5
%60 = call double @mla(double %58, double %59, double 0xBFC5555555555555)
store double %60, double* %4
%61 = load double, double* %5
%62 = load double, double* %4
%63 = load double, double* %2
%64 = fmul double %62, %63
%65 = load double, double* %2
%66 = call double @mla(double %61, double %64, double %65)
store double %66, double* %4
%67 = load double, double* %4
ret double %67
}

LLVM IR (-O2):
@M_1_PI = global double 0.000000e+00
define double @xsin(double %0) {
%2 = load double, double* @M_1_PI
%3 = fmul double %2, %0
%4 = tail call i64 @xrint(double %3)
%5 = trunc i64 %4 to i32
%6 = sitofp i32 %5 to double
%7 = tail call double @mla(double %6, double 0xC00921FB54000000, double %0)
%8 = tail call double @mla(double %6, double 0xBE210B4611000000, double %7)
%9 = tail call double @mla(double %6, double 0xBC54C4C662000000, double %8)
%10 = tail call double @mla(double %6, double 0xBA81701B839A2520, double %9)
%11 = fmul double %10, %10
%12 = and i32 %5, 1
%13 = icmp eq i32 %12, 0
%14 = fneg double %10
%15 = select i1 %13, double %10, double %14
%16 = tail call double @mla(double 0xBC62622B22D526BE, double %11, double 0x3CE94FA618796592)
%17 = tail call double @mla(double %16, double %11, double 0xBD6AE7EA531357BF)
%18 = tail call double @mla(double %17, double %11, double 0x3DE6124601C23966)
%19 = tail call double @mla(double %18, double %11, double 0xBE5AE64567CB5786)
%20 = tail call double @mla(double %19, double %11, double 0x3EC71DE3A5568A50)
%21 = tail call double @mla(double %20, double %11, double 0xBF2A01A01A019FC7)
%22 = tail call double @mla(double %21, double %11, double 0x3F8111111111110F)
%23 = tail call double @mla(double %22, double %11, double 0xBFC5555555555555)
%24 = fmul double %15, %23
%25 = tail call double @mla(double %11, double %24, double %15)
ret double %25
}