#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 max1(double, double, double);
double min1(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) {
    sum = 0;
    dsm = sm * d / 360;
    dsh = sh * d / 360;
    dmh = mh * d / 360;
    bsm = sm - dsm;
    bsh = sh - dsh;
    bmh = mh - dmh;
    tempx = max1(dsh, dsm, dmh);
    tempy = min1(bsh, bsm, bmh);
    while (tempx <= 43200 && tempy <= 43200) {
      tempx = max1(dsh, dsm, dmh);
      tempy = min1(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\n", 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    13f4 <main+0x2b4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xe22(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xe07(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xdec(%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 <max1@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
call   1030 <min1@plt>
movsd  %xmm0,-0x28(%rbp)
xor    %eax,%eax
movsd  0xd82(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x7a(%rbp)
jb     12c7 <main+0x187>
movsd  0xd6c(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0x7a(%rbp)
mov    -0x7a(%rbp),%al
test   $0x1,%al
jne    12d7 <main+0x197>
jmp    13d2 <main+0x292>
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
call   1050 <max1@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
call   1030 <min1@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1331 <main+0x1f1>
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    1365 <main+0x225>
jp     1365 <main+0x225>
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    1399 <main+0x259>
jp     1399 <main+0x259>
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    13cd <main+0x28d>
jp     13cd <main+0x28d>
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    129c <main+0x15c>
movsd  -0x18(%rbp),%xmm0
movsd  0xc51(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xc52(%rip),%rdi
call   1040 <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    13c8 <main+0x288>
movsd  0x28(%rsp),%xmm2
ucomisd 0xe8c(%rip),%xmm2
jne    117c <main+0x3c>
jnp    13c8 <main+0x288>
lea    0xee1(%rip),%r14
lea    0xed6(%rip),%r15
lea    0x28(%rsp),%rbx
nop
movapd %xmm2,%xmm3
movsd  0xe6c(%rip),%xmm0
mulsd  %xmm0,%xmm3
divsd  0xe68(%rip),%xmm3
unpcklpd %xmm2,%xmm2
movapd 0xe8c(%rip),%xmm1
mulpd  %xmm1,%xmm2
divpd  0xe90(%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 <max1@plt>
movsd  %xmm0,0x20(%rsp)
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <min1@plt>
movsd  0xdfa(%rip),%xmm1
ucomisd 0x20(%rsp),%xmm1
xorpd  %xmm5,%xmm5
jb     138a <main+0x24a>
ucomisd %xmm0,%xmm1
movapd 0x40(%rsp),%xmm3
movapd 0x10(%rsp),%xmm1
movapd 0x30(%rsp),%xmm0
jb     138a <main+0x24a>
xorpd  %xmm5,%xmm5
xchg   %ax,%ax
movapd %xmm1,0x10(%rsp)
movsd  %xmm5,0x20(%rsp)
movapd %xmm0,0x30(%rsp)
movaps 0x50(%rsp),%xmm1
movapd %xmm3,0x40(%rsp)
movapd %xmm3,%xmm2
call   1050 <max1@plt>
movapd %xmm0,0x70(%rsp)
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <min1@plt>
ucomisd 0x8(%rsp),%xmm0
jne    12b3 <main+0x173>
jp     12b3 <main+0x173>
movapd 0x50(%rsp),%xmm1
addsd  0xd5b(%rip),%xmm1
movapd %xmm1,0x50(%rsp)
movsd  0xd5c(%rip),%xmm8
movapd 0x40(%rsp),%xmm5
movapd 0x10(%rsp),%xmm9
movapd 0x30(%rsp),%xmm3
jne    12e7 <main+0x1a7>
jp     12e7 <main+0x1a7>
movsd  0x8(%rsp),%xmm1
addsd  0xd27(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm3,%xmm2
addsd  0xd35(%rip),%xmm2
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
cmpeqpd %xmm9,%xmm1
movapd %xmm1,0x60(%rsp)
testb  $0x1,0x68(%rsp)
jne    1312 <main+0x1d2>
movapd %xmm3,%xmm2
movapd %xmm5,%xmm3
addsd  0xd12(%rip),%xmm3
movapd %xmm9,%xmm4
addpd  0xd15(%rip),%xmm4
testb  $0x1,0x60(%rsp)
jne    1336 <main+0x1f6>
movapd %xmm5,%xmm3
movapd %xmm0,%xmm5
movapd 0x70(%rsp),%xmm6
subsd  %xmm6,%xmm5
ucomisd %xmm6,%xmm8
cmpltsd %xmm0,%xmm6
andpd  %xmm6,%xmm5
movsd  0xcc6(%rip),%xmm7
andnpd %xmm7,%xmm6
orpd   %xmm5,%xmm6
movsd  0x20(%rsp),%xmm5
addsd  %xmm6,%xmm5
jb     138a <main+0x24a>
andpd  %xmm1,%xmm4
andnpd %xmm9,%xmm1
orpd   %xmm4,%xmm1
ucomisd %xmm0,%xmm8
movapd %xmm2,%xmm0
jae    1250 <main+0x110>
divsd  0xca6(%rip),%xmm5
mov    %r14,%rdi
movapd %xmm5,%xmm0
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    13c8 <main+0x288>
movsd  0x28(%rsp),%xmm2
ucomisd 0xc44(%rip),%xmm2
jne    1190 <main+0x50>
jp     1190 <main+0x50>
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 = [7 x i8] c"%.3lf\0A\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
store double 0.000000e+00, double* %6
%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 @max1(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 @min1(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 @max1(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 @min1(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 ([7 x i8], [7 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 = [7 x i8] c"%.3lf\0A\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 %72
10: ; preds = %2, %63
%11 = phi double [ %69, %63 ], [ %7, %2 ]
%12 = fmul double %11, 0x404E822B63CBEEA5
%13 = fdiv double %12, 3.600000e+02
%14 = insertelement <2 x double> poison, double %11, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = fmul <2 x double> %15, <double 0x40AEAE8BA2E8BA2F, double 0x404E0AAE76EBB484>
%17 = fdiv <2 x double> %16, <double 3.600000e+02, double 3.600000e+02>
%18 = fsub double 0x404E822B63CBEEA5, %13
%19 = fsub <2 x double> <double 0x40AEAE8BA2E8BA2F, double 0x404E0AAE76EBB484>, %17
%20 = extractelement <2 x double> %17, i64 0
%21 = extractelement <2 x double> %17, i64 1
%22 = call double @max1(double %21, double %13, double %20)
%23 = extractelement <2 x double> %19, i64 0
%24 = extractelement <2 x double> %19, i64 1
%25 = call double @min1(double %24, double %18, double %23)
%26 = fcmp ole double %22, 4.320000e+04
%27 = fcmp ole double %25, 4.320000e+04
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %29, label %63
29: ; preds = %10, %29
%30 = phi double [ %48, %29 ], [ %18, %10 ]
%31 = phi double [ %58, %29 ], [ %20, %10 ]
%32 = phi double [ %54, %29 ], [ %21, %10 ]
%33 = phi double [ %47, %29 ], [ %13, %10 ]
%34 = phi double [ %43, %29 ], [ 0.000000e+00, %10 ]
%35 = phi <2 x double> [ %59, %29 ], [ %19, %10 ]
%36 = call double @max1(double %32, double %33, double %31)
%37 = extractelement <2 x double> %35, i64 0
%38 = extractelement <2 x double> %35, i64 1
%39 = call double @min1(double %38, double %30, double %37)
%40 = fcmp olt double %36, %39
%41 = fsub double %39, %36
%42 = select i1 %40, double %41, double -0.000000e+00
%43 = fadd double %34, %42
%44 = fcmp oeq double %39, %30
%45 = fadd double %33, 0x404E822B63CBEEA5
%46 = fadd double %30, 0x404E822B63CBEEA5
%47 = select i1 %44, double %45, double %33
%48 = select i1 %44, double %46, double %30
%49 = fadd double %32, 0x404E0AAE76EBB484
%50 = insertelement <2 x double> poison, double %39, i64 0
%51 = shufflevector <2 x double> %50, <2 x double> poison, <2 x i32> zeroinitializer
%52 = fcmp oeq <2 x double> %51, %35
%53 = extractelement <2 x i1> %52, i64 1
%54 = select i1 %53, double %49, double %32
%55 = fadd double %31, 0x40AEAE8BA2E8BA2F
%56 = fadd <2 x double> %35, <double 0x40AEAE8BA2E8BA2F, double 0x404E0AAE76EBB484>
%57 = extractelement <2 x i1> %52, i64 0
%58 = select i1 %57, double %55, double %31
%59 = select <2 x i1> %52, <2 x double> %56, <2 x double> %35
%60 = fcmp ole double %36, 4.320000e+04
%61 = fcmp ole double %39, 4.320000e+04
%62 = select i1 %60, i1 %61, i1 false
br i1 %62, label %29, label %63
63: ; preds = %29, %10
%64 = phi double [ 0.000000e+00, %10 ], [ %43, %29 ]
%65 = fdiv double %64, 4.320000e+02
%66 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %65)
%67 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%68 = icmp eq i32 %67, 1
%69 = load double, double* %3
%70 = fcmp une double %69, -1.000000e+00
%71 = select i1 %68, i1 %70, i1 false
br i1 %71, label %10, label %72
72: ; preds = %63, %2
ret i32 0
}