double calculate_angle(unsigned int hour, unsigned int minute) {
  if (hour > 12 || minute > 59)
    return -1.0;
  double minute_angle = (minute / 60.0) * 360.0;
  double hour_angle = (hour / 12.0) * 360.0 + (minute / 60.0) * 360.0 / 12;
  return minute_angle - hour_angle;
}


x86 assembly (clang, -O0):
<calculate_angle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0xc,-0xc(%rbp)
ja     111e <calculate_angle+0x1e>
cmpl   $0x3b,-0x10(%rbp)
jbe    1130 <calculate_angle+0x30>
movsd  0xef2(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b9 <calculate_angle+0xb9>
mov    -0x10(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  0xe97(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe7b(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe77(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe63(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_angle>:
movsd  0xef8(%rip),%xmm0
cmp    $0xc,%edi
ja     1157 <calculate_angle+0x57>
cmp    $0x3b,%esi
ja     1157 <calculate_angle+0x57>
mov    %esi,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xee4(%rip),%xmm0
movsd  0xee4(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    %edi,%eax
cvtsi2sd %rax,%xmm2
movsd  0xed9(%rip),%xmm3
divsd  %xmm3,%xmm2
movapd %xmm0,%xmm4
divsd  %xmm3,%xmm4
mulsd  %xmm1,%xmm2
addsd  %xmm4,%xmm2
subsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @calculate_angle(i32 %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = icmp ugt i32 %8, 12
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp ugt i32 %11, 59
br i1 %12, label %13, label %14
13: ; preds = %10, %2
store double -1.000000e+00, double* %3
br label %31
14: ; preds = %10
%15 = load i32, i32* %5
%16 = uitofp i32 %15 to double
%17 = fdiv double %16, 6.000000e+01
%18 = fmul double %17, 3.600000e+02
store double %18, double* %6
%19 = load i32, i32* %4
%20 = uitofp i32 %19 to double
%21 = fdiv double %20, 1.200000e+01
%22 = load i32, i32* %5
%23 = uitofp i32 %22 to double
%24 = fdiv double %23, 6.000000e+01
%25 = fmul double %24, 3.600000e+02
%26 = fdiv double %25, 1.200000e+01
%27 = call double @llvm.fmuladd.f64(double %21, double 3.600000e+02, double %26)
store double %27, double* %7
%28 = load double, double* %6
%29 = load double, double* %7
%30 = fsub double %28, %29
store double %30, double* %3
br label %31
31: ; preds = %14, %13
%32 = load double, double* %3
ret double %32
}

LLVM IR (-O2):
define double @calculate_angle(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, 12
%4 = icmp ugt i32 %1, 59
%5 = or i1 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = uitofp i32 %1 to double
%8 = fdiv double %7, 6.000000e+01
%9 = fmul double %8, 3.600000e+02
%10 = uitofp i32 %0 to double
%11 = fdiv double %10, 1.200000e+01
%12 = fdiv double %9, 1.200000e+01
%13 = tail call double @llvm.fmuladd.f64(double %11, double 3.600000e+02, double %12)
%14 = fsub double %9, %13
br label %15
15: ; preds = %2, %6
%16 = phi double [ %14, %6 ], [ -1.000000e+00, %2 ]
ret double %16
}