#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 fabs(double);
int /*<<< orphan*/ printf(char *, double);
int scanf(char *, double *, double *);
int main() {
  double a, ma, ha, h, m;
  while (scanf("%lf:%lf", &h, &m) == 2) {
    if (h == 0)
      break;
    ha = ((h * 30) + ((m / 60) * 30));
    ma = (m * 6);
    a = fabs(ha - ma);
    if (a > 180)
      a = 360 - a;
    printf("%.3lf\n", a);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf0a(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    120b <main+0xeb>
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1169 <main+0x49>
jp     1169 <main+0x49>
jmp    120b <main+0xeb>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xe9d(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe89(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe7d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe60(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xe6d(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe27(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f5 <main+0xd5>
movsd  0xe35(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf0e(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1214 <main+0xf4>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1160 <main+0x40>
jnp    1214 <main+0xf4>
lea    0xee1(%rip),%r14
lea    0xed2(%rip),%r15
lea    0x8(%rsp),%r12
lea    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm2
divsd  0xe6e(%rip),%xmm2
movsd  0xe6e(%rip),%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xe62(%rip),%xmm1
addsd  %xmm0,%xmm1
andpd  0xe76(%rip),%xmm1
movsd  0xe56(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  0xe52(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1214 <main+0xf4>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe20(%rip),%xmm0
jne    1180 <main+0x60>
jp     1180 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%lf:%lf\00"
@.str.1 = [7 x i8] c"%.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
br label %7
7: ; preds = %31, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %5, double* %6)
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %34
10: ; preds = %7
%11 = load double, double* %5
%12 = fcmp oeq double %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
br label %34
14: ; preds = %10
%15 = load double, double* %5
%16 = load double, double* %6
%17 = fdiv double %16, 6.000000e+01
%18 = fmul double %17, 3.000000e+01
%19 = call double @llvm.fmuladd.f64(double %15, double 3.000000e+01, double %18)
store double %19, double* %4
%20 = load double, double* %6
%21 = fmul double %20, 6.000000e+00
store double %21, double* %3
%22 = load double, double* %4
%23 = load double, double* %3
%24 = fsub double %22, %23
%25 = call double @llvm.fabs.f64(double %24)
store double %25, double* %2
%26 = load double, double* %2
%27 = fcmp ogt double %26, 1.800000e+02
br i1 %27, label %28, label %31
28: ; preds = %14
%29 = load double, double* %2
%30 = fsub double 3.600000e+02, %29
store double %30, double* %2
br label %31
31: ; preds = %28, %14
%32 = load double, double* %2
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %32)
br label %7
34: ; preds = %13, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%lf:%lf\00"
@.str.1 = [7 x i8] c"%.3lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %1, double* %2)
%6 = icmp ne i32 %5, 2
%7 = load double, double* %1
%8 = fcmp oeq double %7, 0.000000e+00
%9 = select i1 %6, i1 true, i1 %8
br i1 %9, label %28, label %10
10: ; preds = %0, %10
%11 = phi double [ %25, %10 ], [ %7, %0 ]
%12 = load double, double* %2
%13 = fdiv double %12, 6.000000e+01
%14 = fmul double %13, 3.000000e+01
%15 = call double @llvm.fmuladd.f64(double %11, double 3.000000e+01, double %14)
%16 = fmul double %12, 6.000000e+00
%17 = fsub double %15, %16
%18 = call double @llvm.fabs.f64(double %17)
%19 = fcmp ogt double %18, 1.800000e+02
%20 = fsub double 3.600000e+02, %18
%21 = select i1 %19, double %20, double %18
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %1, double* %2)
%24 = icmp ne i32 %23, 2
%25 = load double, double* %1
%26 = fcmp oeq double %25, 0.000000e+00
%27 = select i1 %24, i1 true, i1 %26
br i1 %27, label %28, label %10
28: ; preds = %10, %0
ret i32 0
}