#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 max(double, double, double);
double min(double, double, double);
int /*<<< orphan*/ printf(char *, double);
int scanf(char *, double *);
int main(int argc, char *argv[]) {
  double sum = 0.0;
  double tempx = 0.0;
  double tempy = 0.0;
  double sm;
  double sh;
  double mh;
  double dsm;
  double dsh;
  double dmh;
  double bsm, bsh, bmh;
  double d;
  sm = 3600.0 / 59;
  sh = 43200.0 / 719;
  mh = 43200.0 / 11;
  while (scanf("%lf", &d) == 1 && d != -1) {
    dsm = sm * d / 360;
    dsh = sh * d / 360;
    dmh = mh * d / 360;
    bsm = sm - dsm;
    bsh = sh - dsh;
    bmh = mh - dmh;
    tempx = max(dsh, dsm, dmh);
    tempy = min(bsh, bsm, bmh);
    while (tempx <= 43200 && tempy <= 43200) {
      tempx = max(dsh, dsm, dmh);
      tempy = min(bsh, bsm, bmh);
      if (tempx < tempy) {
        sum += tempy - tempx;
      }
      if (tempy == bsm) {
        dsm += sm;
        bsm += sm;
      }
      if (tempy == bsh) {
        dsh += sh;
        bsh += sh;
      }
      if (tempy == bmh) {
        dmh += mh;
        bmh += mh;
      }
    }
    printf("%.3lf", sum / 432);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x78(%rbp),%rsi
call   1060 <scanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x79(%rbp)
jne    11d4 <main+0x94>
movsd  -0x78(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    11e4 <main+0xa4>
jmp    13ec <main+0x2ac>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xe2a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xe0f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xdf4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
call   1050 <max@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
call   1040 <min@plt>
movsd  %xmm0,-0x28(%rbp)
xor    %eax,%eax
movsd  0xd8a(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x7a(%rbp)
jb     12bf <main+0x17f>
movsd  0xd74(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0x7a(%rbp)
mov    -0x7a(%rbp),%al
test   $0x1,%al
jne    12cf <main+0x18f>
jmp    13ca <main+0x28a>
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
call   1050 <max@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
call   1040 <min@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1329 <main+0x1e9>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jne    135d <main+0x21d>
jp     135d <main+0x21d>
movsd  -0x30(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x68(%rbp),%xmm0
jne    1391 <main+0x251>
jp     1391 <main+0x251>
movsd  -0x38(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x70(%rbp),%xmm0
jne    13c5 <main+0x285>
jp     13c5 <main+0x285>
movsd  -0x40(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1294 <main+0x154>
movsd  -0x18(%rbp),%xmm0
movsd  0xc59(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xc5a(%rip),%rdi
call   1030 <printf@plt>
jmp    1198 <main+0x58>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xf0d(%rip),%rdi
lea    0x28(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    13d5 <main+0x295>
movsd  0x28(%rsp),%xmm2
ucomisd 0xe8c(%rip),%xmm2
jne    117c <main+0x3c>
jnp    13d5 <main+0x295>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xed7(%rip),%r14
lea    0xecc(%rip),%r15
lea    0x28(%rsp),%rbx
nopl   0x0(%rax)
movapd %xmm2,%xmm3
movsd  0xe5c(%rip),%xmm0
mulsd  %xmm0,%xmm3
divsd  0xe58(%rip),%xmm3
unpcklpd %xmm2,%xmm2
movapd 0xe7c(%rip),%xmm1
mulpd  %xmm1,%xmm2
divpd  0xe80(%rip),%xmm2
subsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rsp)
subpd  %xmm2,%xmm1
movapd %xmm1,0x10(%rsp)
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movapd %xmm0,0x30(%rsp)
movapd %xmm3,0x50(%rsp)
movapd %xmm3,%xmm1
movapd %xmm2,0x40(%rsp)
call   1050 <max@plt>
movsd  %xmm0,0x60(%rsp)
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <min@plt>
movsd  0xdea(%rip),%xmm1
ucomisd 0x60(%rsp),%xmm1
jb     1395 <main+0x255>
ucomisd %xmm0,%xmm1
jb     1395 <main+0x255>
movaps 0x40(%rsp),%xmm3
movaps 0x10(%rsp),%xmm1
movaps 0x30(%rsp),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps %xmm1,0x10(%rsp)
movaps %xmm0,0x30(%rsp)
movaps 0x50(%rsp),%xmm1
movaps %xmm3,0x40(%rsp)
movaps %xmm3,%xmm2
call   1050 <max@plt>
movaps %xmm0,0x60(%rsp)
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <min@plt>
ucomisd 0x8(%rsp),%xmm0
jne    12b8 <main+0x178>
jp     12b8 <main+0x178>
movapd 0x50(%rsp),%xmm1
addsd  0xd56(%rip),%xmm1
movapd %xmm1,0x50(%rsp)
movsd  0xd57(%rip),%xmm8
movapd 0x40(%rsp),%xmm5
movapd 0x10(%rsp),%xmm9
movapd 0x30(%rsp),%xmm3
jne    12ec <main+0x1ac>
jp     12ec <main+0x1ac>
movsd  0x8(%rsp),%xmm1
addsd  0xd22(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm3,%xmm2
addsd  0xd30(%rip),%xmm2
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
cmpeqpd %xmm9,%xmm1
movapd %xmm1,0x70(%rsp)
testb  $0x1,0x78(%rsp)
jne    1317 <main+0x1d7>
movapd %xmm3,%xmm2
movapd %xmm5,%xmm3
addsd  0xd0d(%rip),%xmm3
movapd %xmm9,%xmm4
addpd  0xd10(%rip),%xmm4
testb  $0x1,0x70(%rsp)
jne    133b <main+0x1fb>
movapd %xmm5,%xmm3
movapd %xmm0,%xmm5
movapd 0x60(%rsp),%xmm6
subsd  %xmm6,%xmm5
ucomisd %xmm6,%xmm8
cmpltsd %xmm0,%xmm6
andpd  %xmm6,%xmm5
movsd  0xcc1(%rip),%xmm7
andnpd %xmm7,%xmm6
orpd   %xmm5,%xmm6
movsd  0x20(%rsp),%xmm5
addsd  %xmm6,%xmm5
movsd  %xmm5,0x20(%rsp)
jb     1395 <main+0x255>
andpd  %xmm1,%xmm4
andnpd %xmm9,%xmm1
orpd   %xmm4,%xmm1
ucomisd %xmm0,%xmm8
movapd %xmm2,%xmm0
jae    1260 <main+0x120>
movsd  0x20(%rsp),%xmm0
divsd  0xc95(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    13d5 <main+0x295>
movsd  0x28(%rsp),%xmm2
ucomisd 0xc37(%rip),%xmm2
jne    11a0 <main+0x60>
jp     11a0 <main+0x60>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [6 x i8] c"%.3lf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0x404E822B63CBEEA5, double* %9
store double 0x404E0AAE76EBB484, double* %10
store double 0x40AEAE8BA2E8BA2F, double* %11
br label %19
19: ; preds = %117, %2
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %18)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load double, double* %18
%24 = fcmp une double %23, -1.000000e+00
br label %25
25: ; preds = %22, %19
%26 = phi i1 [ false, %19 ], [ %24, %22 ]
br i1 %26, label %27, label %121
27: ; preds = %25
%28 = load double, double* %9
%29 = load double, double* %18
%30 = fmul double %28, %29
%31 = fdiv double %30, 3.600000e+02
store double %31, double* %12
%32 = load double, double* %10
%33 = load double, double* %18
%34 = fmul double %32, %33
%35 = fdiv double %34, 3.600000e+02
store double %35, double* %13
%36 = load double, double* %11
%37 = load double, double* %18
%38 = fmul double %36, %37
%39 = fdiv double %38, 3.600000e+02
store double %39, double* %14
%40 = load double, double* %9
%41 = load double, double* %12
%42 = fsub double %40, %41
store double %42, double* %15
%43 = load double, double* %10
%44 = load double, double* %13
%45 = fsub double %43, %44
store double %45, double* %16
%46 = load double, double* %11
%47 = load double, double* %14
%48 = fsub double %46, %47
store double %48, double* %17
%49 = load double, double* %13
%50 = load double, double* %12
%51 = load double, double* %14
%52 = call double @max(double %49, double %50, double %51)
store double %52, double* %7
%53 = load double, double* %16
%54 = load double, double* %15
%55 = load double, double* %17
%56 = call double @min(double %53, double %54, double %55)
store double %56, double* %8
br label %57
57: ; preds = %116, %27
%58 = load double, double* %7
%59 = fcmp ole double %58, 4.320000e+04
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load double, double* %8
%62 = fcmp ole double %61, 4.320000e+04
br label %63
63: ; preds = %60, %57
%64 = phi i1 [ false, %57 ], [ %62, %60 ]
br i1 %64, label %65, label %117
65: ; preds = %63
%66 = load double, double* %13
%67 = load double, double* %12
%68 = load double, double* %14
%69 = call double @max(double %66, double %67, double %68)
store double %69, double* %7
%70 = load double, double* %16
%71 = load double, double* %15
%72 = load double, double* %17
%73 = call double @min(double %70, double %71, double %72)
store double %73, double* %8
%74 = load double, double* %7
%75 = load double, double* %8
%76 = fcmp olt double %74, %75
br i1 %76, label %77, label %83
77: ; preds = %65
%78 = load double, double* %8
%79 = load double, double* %7
%80 = fsub double %78, %79
%81 = load double, double* %6
%82 = fadd double %81, %80
store double %82, double* %6
br label %83
83: ; preds = %77, %65
%84 = load double, double* %8
%85 = load double, double* %15
%86 = fcmp oeq double %84, %85
br i1 %86, label %87, label %94
87: ; preds = %83
%88 = load double, double* %9
%89 = load double, double* %12
%90 = fadd double %89, %88
store double %90, double* %12
%91 = load double, double* %9
%92 = load double, double* %15
%93 = fadd double %92, %91
store double %93, double* %15
br label %94
94: ; preds = %87, %83
%95 = load double, double* %8
%96 = load double, double* %16
%97 = fcmp oeq double %95, %96
br i1 %97, label %98, label %105
98: ; preds = %94
%99 = load double, double* %10
%100 = load double, double* %13
%101 = fadd double %100, %99
store double %101, double* %13
%102 = load double, double* %10
%103 = load double, double* %16
%104 = fadd double %103, %102
store double %104, double* %16
br label %105
105: ; preds = %98, %94
%106 = load double, double* %8
%107 = load double, double* %17
%108 = fcmp oeq double %106, %107
br i1 %108, label %109, label %116
109: ; preds = %105
%110 = load double, double* %11
%111 = load double, double* %14
%112 = fadd double %111, %110
store double %112, double* %14
%113 = load double, double* %11
%114 = load double, double* %17
%115 = fadd double %114, %113
store double %115, double* %17
br label %116
116: ; preds = %109, %105
br label %57
117: ; preds = %63
%118 = load double, double* %6
%119 = fdiv double %118, 4.320000e+02
%120 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %119)
br label %19
121: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [6 x i8] c"%.3lf\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%6 = icmp eq i32 %5, 1
%7 = load double, double* %3
%8 = fcmp une double %7, -1.000000e+00
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %73
10: ; preds = %2, %64
%11 = phi double [ %70, %64 ], [ %7, %2 ]
%12 = phi double [ %65, %64 ], [ 0.000000e+00, %2 ]
%13 = fmul double %11, 0x404E822B63CBEEA5
%14 = fdiv double %13, 3.600000e+02
%15 = insertelement <2 x double> poison, double %11, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = fmul <2 x double> %16, <double 0x40AEAE8BA2E8BA2F, double 0x404E0AAE76EBB484>
%18 = fdiv <2 x double> %17, <double 3.600000e+02, double 3.600000e+02>
%19 = fsub double 0x404E822B63CBEEA5, %14
%20 = fsub <2 x double> <double 0x40AEAE8BA2E8BA2F, double 0x404E0AAE76EBB484>, %18
%21 = extractelement <2 x double> %18, i64 0
%22 = extractelement <2 x double> %18, i64 1
%23 = call double @max(double %22, double %14, double %21)
%24 = extractelement <2 x double> %20, i64 0
%25 = extractelement <2 x double> %20, i64 1
%26 = call double @min(double %25, double %19, double %24)
%27 = fcmp ole double %23, 4.320000e+04
%28 = fcmp ole double %26, 4.320000e+04
%29 = select i1 %27, i1 %28, i1 false
br i1 %29, label %30, label %64
30: ; preds = %10, %30
%31 = phi double [ %49, %30 ], [ %19, %10 ]
%32 = phi double [ %59, %30 ], [ %21, %10 ]
%33 = phi double [ %55, %30 ], [ %22, %10 ]
%34 = phi double [ %48, %30 ], [ %14, %10 ]
%35 = phi double [ %44, %30 ], [ %12, %10 ]
%36 = phi <2 x double> [ %60, %30 ], [ %20, %10 ]
%37 = call double @max(double %33, double %34, double %32)
%38 = extractelement <2 x double> %36, i64 0
%39 = extractelement <2 x double> %36, i64 1
%40 = call double @min(double %39, double %31, double %38)
%41 = fcmp olt double %37, %40
%42 = fsub double %40, %37
%43 = select i1 %41, double %42, double -0.000000e+00
%44 = fadd double %35, %43
%45 = fcmp oeq double %40, %31
%46 = fadd double %34, 0x404E822B63CBEEA5
%47 = fadd double %31, 0x404E822B63CBEEA5
%48 = select i1 %45, double %46, double %34
%49 = select i1 %45, double %47, double %31
%50 = fadd double %33, 0x404E0AAE76EBB484
%51 = insertelement <2 x double> poison, double %40, i64 0
%52 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> zeroinitializer
%53 = fcmp oeq <2 x double> %52, %36
%54 = extractelement <2 x i1> %53, i64 1
%55 = select i1 %54, double %50, double %33
%56 = fadd double %32, 0x40AEAE8BA2E8BA2F
%57 = fadd <2 x double> %36, <double 0x40AEAE8BA2E8BA2F, double 0x404E0AAE76EBB484>
%58 = extractelement <2 x i1> %53, i64 0
%59 = select i1 %58, double %56, double %32
%60 = select <2 x i1> %53, <2 x double> %57, <2 x double> %36
%61 = fcmp ole double %37, 4.320000e+04
%62 = fcmp ole double %40, 4.320000e+04
%63 = select i1 %61, i1 %62, i1 false
br i1 %63, label %30, label %64
64: ; preds = %30, %10
%65 = phi double [ %12, %10 ], [ %44, %30 ]
%66 = fdiv double %65, 4.320000e+02
%67 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %66)
%68 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%69 = icmp eq i32 %68, 1
%70 = load double, double* %3
%71 = fcmp une double %70, -1.000000e+00
%72 = select i1 %69, i1 %71, i1 false
br i1 %72, label %10, label %73
73: ; preds = %64, %2
ret i32 0
}