#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 */
int ieee754_rem_pio2l(long double, long double *);
long double kernel_cosl(long double, long double);
long double kernel_sinl(long double, long double, int);
long double sinl(long double x) {
  long double y[2], z = 0.0L;
  int n;
  if (x >= -0.7853981633974483096156608458198757210492 &&
      x <= 0.7853981633974483096156608458198757210492)
    return kernel_sinl(x, z, 0);
  else if (x + x == x || x != x)
    return x - x;
  else {
    n = ieee754_rem_pio2l(x, y);
    switch (n & 3) {
    case 0:
      return kernel_sinl(y[0], y[1], 1);
    case 1:
      return kernel_cosl(y[0], y[1]);
    case 2:
      return -kernel_sinl(y[0], y[1], 1);
    default:
      return -kernel_cosl(y[0], y[1]);
    }
  }
}


x86 assembly (clang, -O0):
<sinl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fldz
fstpt  -0x50(%rbp)
fldt   -0x20(%rbp)
fldl   0xeb1(%rip)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jb     1195 <sinl+0x65>
jmp    1160 <sinl+0x30>
fldt   -0x20(%rbp)
fldl   0xe9f(%rip)
fucomip %st(1),%st
fstp   %st(0)
jb     1195 <sinl+0x65>
jmp    1178 <sinl+0x48>
fldt   -0x20(%rbp)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %edi,%edi
call   1050 <kernel_sinl@plt>
fstpt  -0x10(%rbp)
jmp    128d <sinl+0x15d>
fldt   -0x20(%rbp)
fld    %st(0)
fadd   %st(1),%st
fucomip %st(1),%st
fstp   %st(0)
jne    11b1 <sinl+0x81>
jp     11b1 <sinl+0x81>
jmp    11c1 <sinl+0x91>
fldt   -0x20(%rbp)
fucomip %st(0),%st
jnp    11ce <sinl+0x9e>
jmp    11c1 <sinl+0x91>
fldt   -0x20(%rbp)
fsub   %st,%st(0)
fstpt  -0x10(%rbp)
jmp    128d <sinl+0x15d>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    -0x40(%rbp),%rdi
call   1040 <ieee754_rem_pio2l@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x58(%rbp)
je     1218 <sinl+0xe8>
jmp    11f6 <sinl+0xc6>
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
je     1238 <sinl+0x108>
jmp    1207 <sinl+0xd7>
mov    -0x58(%rbp),%eax
sub    $0x2,%eax
je     1253 <sinl+0x123>
jmp    1275 <sinl+0x145>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
mov    $0x1,%edi
call   1050 <kernel_sinl@plt>
fstpt  -0x10(%rbp)
jmp    128d <sinl+0x15d>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <kernel_cosl@plt>
fstpt  -0x10(%rbp)
jmp    128d <sinl+0x15d>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
mov    $0x1,%edi
call   1050 <kernel_sinl@plt>
fchs
fstpt  -0x10(%rbp)
jmp    128d <sinl+0x15d>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <kernel_cosl@plt>
fchs
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinl>:
sub    $0x48,%rsp
fldt   0x50(%rsp)
fldl   0xec2(%rip)
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
jb     1165 <sinl+0x35>
fldl   0xebc(%rip)
fucomip %st(1),%st
jb     1165 <sinl+0x35>
fldz
fstpt  0x10(%rsp)
fstpt  (%rsp)
xor    %edi,%edi
call   1050 <kernel_sinl@plt>
add    $0x48,%rsp
ret
fld    %st(0)
fadd   %st(1),%st
fxch   %st(1)
fucomi %st(0),%st
jp     11b1 <sinl+0x81>
fxch   %st(1)
fucomip %st(1),%st
fldz
fxch   %st(1)
jne    117b <sinl+0x4b>
jnp    11b1 <sinl+0x81>
fstp   %st(1)
fstpt  (%rsp)
lea    0x20(%rsp),%rdi
call   1040 <ieee754_rem_pio2l@plt>
and    $0x3,%eax
cmp    $0x2,%eax
je     11ba <sinl+0x8a>
cmp    $0x1,%eax
je     11d5 <sinl+0xa5>
test   %eax,%eax
jne    11ee <sinl+0xbe>
fldt   0x20(%rsp)
fldt   0x30(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    $0x1,%edi
jmp    115b <sinl+0x2b>
fstp   %st(1)
fsub   %st,%st(0)
add    $0x48,%rsp
ret
fldt   0x20(%rsp)
fldt   0x30(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    $0x1,%edi
call   1050 <kernel_sinl@plt>
jmp    1202 <sinl+0xd2>
fldt   0x20(%rsp)
fldt   0x30(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <kernel_cosl@plt>
add    $0x48,%rsp
ret
fldt   0x20(%rsp)
fldt   0x30(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <kernel_cosl@plt>
fchs
add    $0x48,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca [2 x x86_fp80]
%5 = alloca x86_fp80
%6 = alloca i32
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 0xK00000000000000000000, x86_fp80* %5
%7 = load x86_fp80, x86_fp80* %3
%8 = fcmp oge x86_fp80 %7, 0xKBFFEC90FDAA22168C000
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load x86_fp80, x86_fp80* %3
%11 = fcmp ole x86_fp80 %10, 0xK3FFEC90FDAA22168C000
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load x86_fp80, x86_fp80* %3
%14 = load x86_fp80, x86_fp80* %5
%15 = call x86_fp80 @kernel_sinl(x86_fp80 %13, x86_fp80 %14, i32 0)
store x86_fp80 %15, x86_fp80* %2
br label %62
16: ; preds = %9, %1
%17 = load x86_fp80, x86_fp80* %3
%18 = load x86_fp80, x86_fp80* %3
%19 = fadd x86_fp80 %17, %18
%20 = load x86_fp80, x86_fp80* %3
%21 = fcmp oeq x86_fp80 %19, %20
br i1 %21, label %26, label %22
22: ; preds = %16
%23 = load x86_fp80, x86_fp80* %3
%24 = load x86_fp80, x86_fp80* %3
%25 = fcmp une x86_fp80 %23, %24
br i1 %25, label %26, label %30
26: ; preds = %22, %16
%27 = load x86_fp80, x86_fp80* %3
%28 = load x86_fp80, x86_fp80* %3
%29 = fsub x86_fp80 %27, %28
store x86_fp80 %29, x86_fp80* %2
br label %62
30: ; preds = %22
%31 = load x86_fp80, x86_fp80* %3
%32 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 0
%33 = call i32 @ieee754_rem_pio2l(x86_fp80 %31, x86_fp80* %32)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = and i32 %34, 3
switch i32 %35, label %55 [
i32 0, label %36
i32 1, label %42
i32 2, label %48
]
36: ; preds = %30
%37 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 0
%38 = load x86_fp80, x86_fp80* %37
%39 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 1
%40 = load x86_fp80, x86_fp80* %39
%41 = call x86_fp80 @kernel_sinl(x86_fp80 %38, x86_fp80 %40, i32 1)
store x86_fp80 %41, x86_fp80* %2
br label %62
42: ; preds = %30
%43 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 0
%44 = load x86_fp80, x86_fp80* %43
%45 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 1
%46 = load x86_fp80, x86_fp80* %45
%47 = call x86_fp80 @kernel_cosl(x86_fp80 %44, x86_fp80 %46)
store x86_fp80 %47, x86_fp80* %2
br label %62
48: ; preds = %30
%49 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 0
%50 = load x86_fp80, x86_fp80* %49
%51 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 1
%52 = load x86_fp80, x86_fp80* %51
%53 = call x86_fp80 @kernel_sinl(x86_fp80 %50, x86_fp80 %52, i32 1)
%54 = fneg x86_fp80 %53
store x86_fp80 %54, x86_fp80* %2
br label %62
55: ; preds = %30
%56 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 0
%57 = load x86_fp80, x86_fp80* %56
%58 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %4, i64 0, i64 1
%59 = load x86_fp80, x86_fp80* %58
%60 = call x86_fp80 @kernel_cosl(x86_fp80 %57, x86_fp80 %59)
%61 = fneg x86_fp80 %60
store x86_fp80 %61, x86_fp80* %2
br label %62
62: ; preds = %55, %48, %42, %36, %26, %12
%63 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %63
}

LLVM IR (-O2):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca [2 x x86_fp80]
%3 = bitcast [2 x x86_fp80]* %2 to i8*
%4 = fcmp oge x86_fp80 %0, 0xKBFFEC90FDAA22168C000
%5 = fcmp ole x86_fp80 %0, 0xK3FFEC90FDAA22168C000
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call x86_fp80 @kernel_sinl(x86_fp80 %0, x86_fp80 0xK00000000000000000000, i32 0)
br label %42
9: ; preds = %1
%10 = fadd x86_fp80 %0, %0
%11 = fcmp oeq x86_fp80 %10, %0
%12 = fcmp uno x86_fp80 %0, 0xK00000000000000000000
%13 = or i1 %12, %11
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = fsub x86_fp80 %0, %0
br label %42
16: ; preds = %9
%17 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %2, i64 0, i64 0
%18 = call i32 @ieee754_rem_pio2l(x86_fp80 %0, x86_fp80* %17)
%19 = and i32 %18, 3
switch i32 %19, label %36 [
i32 0, label %20
i32 1, label %25
i32 2, label %30
]
20: ; preds = %16
%21 = load x86_fp80, x86_fp80* %17
%22 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %2, i64 0, i64 1
%23 = load x86_fp80, x86_fp80* %22
%24 = call x86_fp80 @kernel_sinl(x86_fp80 %21, x86_fp80 %23, i32 1)
br label %42
25: ; preds = %16
%26 = load x86_fp80, x86_fp80* %17
%27 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %2, i64 0, i64 1
%28 = load x86_fp80, x86_fp80* %27
%29 = call x86_fp80 @kernel_cosl(x86_fp80 %26, x86_fp80 %28)
br label %42
30: ; preds = %16
%31 = load x86_fp80, x86_fp80* %17
%32 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %2, i64 0, i64 1
%33 = load x86_fp80, x86_fp80* %32
%34 = call x86_fp80 @kernel_sinl(x86_fp80 %31, x86_fp80 %33, i32 1)
%35 = fneg x86_fp80 %34
br label %42
36: ; preds = %16
%37 = load x86_fp80, x86_fp80* %17
%38 = getelementptr inbounds [2 x x86_fp80], [2 x x86_fp80]* %2, i64 0, i64 1
%39 = load x86_fp80, x86_fp80* %38
%40 = call x86_fp80 @kernel_cosl(x86_fp80 %37, x86_fp80 %39)
%41 = fneg x86_fp80 %40
br label %42
42: ; preds = %36, %30, %25, %20, %14, %7
%43 = phi x86_fp80 [ %8, %7 ], [ %15, %14 ], [ %41, %36 ], [ %35, %30 ], [ %29, %25 ], [ %24, %20 ]
ret x86_fp80 %43
}