double astSind(angle) const double angle;
{
  double resid;
  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):
<astSind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeba(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117a <astSind+0x5a>
jp     117a <astSind+0x5a>
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122f <astSind+0x10f>
movsd  -0x18(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a4 <astSind+0x84>
jp     11a4 <astSind+0x84>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122f <astSind+0x10f>
movsd  -0x18(%rbp),%xmm0
movsd  0xe5f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11d3 <astSind+0xb3>
jp     11d3 <astSind+0xb3>
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122f <astSind+0x10f>
movsd  -0x18(%rbp),%xmm0
movsd  0xe38(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11fd <astSind+0xdd>
jp     11fd <astSind+0xdd>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122f <astSind+0x10f>
jmp    1202 <astSind+0xe2>
jmp    1207 <astSind+0xe7>
jmp    120c <astSind+0xec>
movsd  0xe0c(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xdef(%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):
<astSind>:
push   %rax
movapd %xmm0,%xmm1
movsd  0xed3(%rip),%xmm0
movsd  %xmm1,(%rsp)
addsd  %xmm1,%xmm0
movsd  0xeca(%rip),%xmm1
call   1030 <fmod@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    115d <astSind+0x3d>
jp     115d <astSind+0x3d>
movsd  0xeb5(%rip),%xmm0
pop    %rax
ret
movsd  (%rsp),%xmm2
ucomisd 0xeae(%rip),%xmm1
jne    1170 <astSind+0x50>
jp     1170 <astSind+0x50>
pop    %rax
ret
ucomisd 0xeb0(%rip),%xmm1
jne    1186 <astSind+0x66>
jp     1186 <astSind+0x66>
movsd  0xe9c(%rip),%xmm0
pop    %rax
ret
ucomisd 0xea2(%rip),%xmm1
jne    1192 <astSind+0x72>
jnp    116e <astSind+0x4e>
movapd %xmm2,%xmm0
mulsd  0xe9a(%rip),%xmm0
divsd  0xe82(%rip),%xmm0
pop    %rax
jmp    1040 <sin@plt>

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

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