double sind(angle)
double angle;
{
  double resid;
  if (fmod(angle, 90.0) == 0.0) {
    resid = fmod(angle - 90.0, 360.0);
    if (resid == 0.0) {
      return 1.0;
    } else if (resid == 90.0) {
      return 0.0;
    } else if (resid == 180.0) {
      return -1.0;
    } else if (resid == 270.0) {
      return 0.0;
    }
  }
  return sin(angle * 3.141592653589793238462643 / 180.0);
}


x86 assembly (clang, -O0):
<sind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec6(%rip),%xmm1
call   1030 <fmod@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1236 <sind+0x116>
jp     1236 <sind+0x116>
movsd  -0x10(%rbp),%xmm0
movsd  0xea1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe9d(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    119f <sind+0x7f>
jp     119f <sind+0x7f>
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1259 <sind+0x139>
movsd  -0x18(%rbp),%xmm0
movsd  0xe54(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11c9 <sind+0xa9>
jp     11c9 <sind+0xa9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1259 <sind+0x139>
movsd  -0x18(%rbp),%xmm0
movsd  0xe3a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11f8 <sind+0xd8>
jp     11f8 <sind+0xd8>
movsd  0xe3a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1259 <sind+0x139>
movsd  -0x18(%rbp),%xmm0
movsd  0xe13(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1222 <sind+0x102>
jp     1222 <sind+0x102>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1259 <sind+0x139>
jmp    1227 <sind+0x107>
jmp    122c <sind+0x10c>
jmp    1231 <sind+0x111>
jmp    1236 <sind+0x116>
movsd  0xde2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xdc5(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sind>:
push   %rax
movsd  0xed7(%rip),%xmm1
movsd  %xmm0,(%rsp)
call   1030 <fmod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a7 <sind+0x87>
jp     11a7 <sind+0x87>
movsd  0xec1(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  0xebc(%rip),%xmm1
call   1030 <fmod@plt>
ucomisd 0xedf(%rip),%xmm0
jne    116f <sind+0x4f>
jp     116f <sind+0x4f>
movsd  0xeab(%rip),%xmm0
pop    %rax
ret
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd 0xe81(%rip),%xmm1
jne    1185 <sind+0x65>
jp     1185 <sind+0x65>
pop    %rax
ret
ucomisd 0xe9b(%rip),%xmm1
jne    119b <sind+0x7b>
jp     119b <sind+0x7b>
movsd  0xe87(%rip),%xmm0
pop    %rax
ret
ucomisd 0xe8d(%rip),%xmm1
jne    11a7 <sind+0x87>
jnp    1183 <sind+0x63>
movsd  (%rsp),%xmm0
mulsd  0xe84(%rip),%xmm0
divsd  0xe6c(%rip),%xmm0
pop    %rax
jmp    1040 <sin@plt>

LLVM IR (-O0):
define double @sind(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = call double @fmod(double %5, double 9.000000e+01)
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %31
8: ; preds = %1
%9 = load double, double* %3
%10 = fsub double %9, 9.000000e+01
%11 = call double @fmod(double %10, double 3.600000e+02)
store double %11, double* %4
%12 = load double, double* %4
%13 = fcmp oeq double %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %8
store double 1.000000e+00, double* %2
br label %36
15: ; preds = %8
%16 = load double, double* %4
%17 = fcmp oeq double %16, 9.000000e+01
br i1 %17, label %18, label %19
18: ; preds = %15
store double 0.000000e+00, double* %2
br label %36
19: ; preds = %15
%20 = load double, double* %4
%21 = fcmp oeq double %20, 1.800000e+02
br i1 %21, label %22, label %23
22: ; preds = %19
store double -1.000000e+00, double* %2
br label %36
23: ; preds = %19
%24 = load double, double* %4
%25 = fcmp oeq double %24, 2.700000e+02
br i1 %25, label %26, label %27
26: ; preds = %23
store double 0.000000e+00, double* %2
br label %36
27: ; preds = %23
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30, %1
%32 = load double, double* %3
%33 = fmul double %32, 0x400921FB54442D18
%34 = fdiv double %33, 1.800000e+02
%35 = call double @sin(double %34)
store double %35, double* %2
br label %36
36: ; preds = %31, %26, %22, %18, %14
%37 = load double, double* %2
ret double %37
}

LLVM IR (-O2):
define double @sind(double %0) {
%2 = tail call double @fmod(double %0, double 9.000000e+01)
%3 = fcmp oeq double %2, 0.000000e+00
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = fadd double %0, -9.000000e+01
%6 = tail call double @fmod(double %5, double 3.600000e+02)
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %18, label %8
8: ; preds = %4
%9 = fcmp oeq double %6, 9.000000e+01
br i1 %9, label %18, label %10
10: ; preds = %8
%11 = fcmp oeq double %6, 1.800000e+02
br i1 %11, label %18, label %12
12: ; preds = %10
%13 = fcmp oeq double %6, 2.700000e+02
br i1 %13, label %18, label %14
14: ; preds = %12, %1
%15 = fmul double %0, 0x400921FB54442D18
%16 = fdiv double %15, 1.800000e+02
%17 = tail call double @sin(double %16)
br label %18
18: ; preds = %12, %10, %8, %4, %14
%19 = phi double [ %17, %14 ], [ 1.000000e+00, %4 ], [ 0.000000e+00, %8 ], [ -1.000000e+00, %10 ], [ 0.000000e+00, %12 ]
ret double %19
}