#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 /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int t[2], i;
  float h, m, ans;
  while (1) {
    scanf("%d:%d", &t[0], &t[1]);
    if (t[0] == 0 && t[1] == 0)
      break;
    h = t[0] * 30 + t[1] * 0.5;
    m = t[1] * 6;
    ans = h - m > 0 ? h - m : m - h;
    ans = ans > 180 ? 360 - ans : ans;
    printf("%.3f\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rsi
lea    -0xc(%rbp),%rdx
add    $0x4,%rdx
lea    0xece(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1160 <main+0x40>
cmpl   $0x0,-0x8(%rbp)
jne    1160 <main+0x40>
jmp    122d <main+0x10d>
imul   $0x1e,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe8b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
imul   $0x6,-0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11bd <main+0x9d>
movss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11cc <main+0xac>
movss  -0x18(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  0xe25(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1203 <main+0xe3>
movss  0xe18(%rip),%xmm0
subss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    120d <main+0xed>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    0xdf3(%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
push   %rax
lea    0x4(%rsp),%r14
lea    0xedc(%rip),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%ecx
mov    0x4(%rsp),%eax
mov    %ecx,%edx
or     %eax,%edx
je     120b <main+0xeb>
lea    0xebf(%rip),%r15
lea    0xeb2(%rip),%r12
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
shl    $0x5,%edx
sub    %ecx,%edx
sub    %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe71(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    %eax,%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
subss  %xmm0,%xmm1
xorps  %xmm3,%xmm3
cmpltss %xmm2,%xmm3
andps  %xmm3,%xmm2
andnps %xmm1,%xmm3
orps   %xmm2,%xmm3
movss  0xe3e(%rip),%xmm1
subss  %xmm3,%xmm1
movss  0xe36(%rip),%xmm0
cmpltss %xmm3,%xmm0
andps  %xmm0,%xmm1
andnps %xmm3,%xmm0
orps   %xmm1,%xmm0
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%ecx
mov    0x4(%rsp),%eax
mov    %ecx,%edx
or     %eax,%edx
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d:%d\00"
@.str.1 = [6 x i8] c"%.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
br label %7
7: ; preds = %0, %54
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %7
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
br label %58
19: ; preds = %14, %7
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %20
%22 = mul nsw i32 %21, 30
%23 = sitofp i32 %22 to double
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%25 = load i32, i32* %24
%26 = sitofp i32 %25 to double
%27 = call double @llvm.fmuladd.f64(double %26, double 5.000000e-01, double %23)
%28 = fptrunc double %27 to float
store float %28, float* %4
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%30 = load i32, i32* %29
%31 = mul nsw i32 %30, 6
%32 = sitofp i32 %31 to float
store float %32, float* %5
%33 = load float, float* %4
%34 = load float, float* %5
%35 = fsub float %33, %34
%36 = fcmp ogt float %35, 0.000000e+00
br i1 %36, label %37, label %41
37: ; preds = %19
%38 = load float, float* %4
%39 = load float, float* %5
%40 = fsub float %38, %39
br label %45
41: ; preds = %19
%42 = load float, float* %5
%43 = load float, float* %4
%44 = fsub float %42, %43
br label %45
45: ; preds = %41, %37
%46 = phi float [ %40, %37 ], [ %44, %41 ]
store float %46, float* %6
%47 = load float, float* %6
%48 = fcmp ogt float %47, 1.800000e+02
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load float, float* %6
%51 = fsub float 3.600000e+02, %50
br label %54
52: ; preds = %45
%53 = load float, float* %6
br label %54
54: ; preds = %52, %49
%55 = phi float [ %51, %49 ], [ %53, %52 ]
store float %55, float* %6
%56 = load float, float* %6
%57 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float %56)
br label %7
58: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d:%d\00"
@.str.1 = [6 x i8] c"%.3f\0A\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %35, label %11
11: ; preds = %0, %11
%12 = phi i32 [ %32, %11 ], [ %8, %0 ]
%13 = phi i32 [ %30, %11 ], [ %6, %0 ]
%14 = mul nsw i32 %13, 30
%15 = sitofp i32 %14 to double
%16 = sitofp i32 %12 to double
%17 = call double @llvm.fmuladd.f64(double %16, double 5.000000e-01, double %15)
%18 = fptrunc double %17 to float
%19 = mul nsw i32 %12, 6
%20 = sitofp i32 %19 to float
%21 = fsub float %18, %20
%22 = fcmp ogt float %21, 0.000000e+00
%23 = fsub float %20, %18
%24 = select i1 %22, float %21, float %23
%25 = fcmp ogt float %24, 1.800000e+02
%26 = fsub float 3.600000e+02, %24
%27 = select i1 %25, float %26, float %24
%28 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float %27)
%29 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 0
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 0
%34 = select i1 %31, i1 %33, i1 false
br i1 %34, label %35, label %11
35: ; preds = %11, %0
ret i32 0
}