#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 *, int, int, double);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  int d, m;
  double s, dd;
  unsigned char sign;
  dd = 0;
  while (dd != -999.0) {
    sign = 0;
    scanf("%lf", &dd);
    if (dd == -999.0)
      continue;
    if (dd < 0) {
      sign = 1;
      dd *= -1.0;
    }
    d = (int)dd;
    m = (int)((dd - d) * 60);
    s = (dd - d - m / 60.0) * 3600;
    if (sign) {
      dd *= -1.0;
      d *= -1.0;
    }
    printf("\t%d %d %lf\n", d, m, s);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1159 <main+0x39>
jp     1159 <main+0x39>
jmp    1260 <main+0x140>
movb   $0x0,-0x21(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  0xe86(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    118f <main+0x6f>
jp     118f <main+0x6f>
jmp    1137 <main+0x17>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11b3 <main+0x93>
movb   $0x1,-0x21(%rbp)
movsd  0xe5f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%eax
mov    %eax,-0x8(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe47(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe21(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe09(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpb   $0x0,-0x21(%rbp)
je     1244 <main+0x124>
movsd  0xde6(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xdcf(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movsd  -0x18(%rbp),%xmm0
lea    0xdce(%rip),%rdi
call   1030 <printf@plt>
jmp    1137 <main+0x17>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xef7(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xeef(%rip),%rbx
jmp    1190 <main+0x70>
nopw   0x0(%rax,%rax,1)
movapd 0xec8(%rip),%xmm4
xorpd  %xmm4,%xmm1
movlpd %xmm1,0x8(%rsp)
xorpd  %xmm4,%xmm3
cvttsd2si %xmm3,%esi
cvttsd2si %xmm2,%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1190 <main+0x70>
jnp    1218 <main+0xf8>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe57(%rip),%xmm0
jne    11ad <main+0x8d>
jnp    1218 <main+0xf8>
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
movapd %xmm0,%xmm1
jbe    11cd <main+0xad>
movapd %xmm0,%xmm1
xorpd  0xe59(%rip),%xmm1
movlpd %xmm1,0x8(%rsp)
ucomisd %xmm0,%xmm2
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm3
movapd %xmm1,%xmm0
subsd  %xmm3,%xmm0
movapd %xmm0,%xmm2
movsd  0xe1b(%rip),%xmm5
mulsd  %xmm5,%xmm2
cvttpd2dq %xmm2,%xmm4
cvtdq2pd %xmm4,%xmm4
divsd  %xmm5,%xmm4
subsd  %xmm4,%xmm0
mulsd  0xe07(%rip),%xmm0
ja     1150 <main+0x30>
cvttsd2si %xmm1,%esi
jmp    116a <main+0x4a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [12 x i8] c"\09%d %d %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i8
store i32 0, i32* %1
store double 0.000000e+00, double* %5
br label %7
7: ; preds = %48, %14, %0
%8 = load double, double* %5
%9 = fcmp une double %8, -9.990000e+02
br i1 %9, label %10, label %53
10: ; preds = %7
store i8 0, i8* %6
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %5)
%12 = load double, double* %5
%13 = fcmp oeq double %12, -9.990000e+02
br i1 %13, label %14, label %15
14: ; preds = %10
br label %7
15: ; preds = %10
%16 = load double, double* %5
%17 = fcmp olt double %16, 0.000000e+00
br i1 %17, label %18, label %21
18: ; preds = %15
store i8 1, i8* %6
%19 = load double, double* %5
%20 = fmul double %19, -1.000000e+00
store double %20, double* %5
br label %21
21: ; preds = %18, %15
%22 = load double, double* %5
%23 = fptosi double %22 to i32
store i32 %23, i32* %2
%24 = load double, double* %5
%25 = load i32, i32* %2
%26 = sitofp i32 %25 to double
%27 = fsub double %24, %26
%28 = fmul double %27, 6.000000e+01
%29 = fptosi double %28 to i32
store i32 %29, i32* %3
%30 = load double, double* %5
%31 = load i32, i32* %2
%32 = sitofp i32 %31 to double
%33 = fsub double %30, %32
%34 = load i32, i32* %3
%35 = sitofp i32 %34 to double
%36 = fdiv double %35, 6.000000e+01
%37 = fsub double %33, %36
%38 = fmul double %37, 3.600000e+03
store double %38, double* %4
%39 = load i8, i8* %6
%40 = icmp ne i8 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %21
%42 = load double, double* %5
%43 = fmul double %42, -1.000000e+00
store double %43, double* %5
%44 = load i32, i32* %2
%45 = sitofp i32 %44 to double
%46 = fmul double %45, -1.000000e+00
%47 = fptosi double %46 to i32
store i32 %47, i32* %2
br label %48
48: ; preds = %41, %21
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = load double, double* %4
%52 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %49, i32 %50, double %51)
br label %7
53: ; preds = %7
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [12 x i8] c"\09%d %d %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
br label %3
3: ; preds = %0, %26
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fcmp oeq double %5, -9.990000e+02
br i1 %6, label %31, label %7
7: ; preds = %3
%8 = fcmp olt double %5, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = fneg double %5
store double %10, double* %1
br label %11
11: ; preds = %9, %7
%12 = phi double [ %10, %9 ], [ %5, %7 ]
%13 = fptosi double %12 to i32
%14 = sitofp i32 %13 to double
%15 = fsub double %12, %14
%16 = fmul double %15, 6.000000e+01
%17 = fptosi double %16 to i32
%18 = sitofp i32 %17 to double
%19 = fdiv double %18, 6.000000e+01
%20 = fsub double %15, %19
%21 = fmul double %20, 3.600000e+03
br i1 %8, label %22, label %26
22: ; preds = %11
%23 = fneg double %12
store double %23, double* %1
%24 = fneg double %14
%25 = fptosi double %24 to i32
br label %26
26: ; preds = %11, %22
%27 = phi i32 [ %25, %22 ], [ %13, %11 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %17, double %21)
%29 = load double, double* %1
%30 = fcmp une double %29, -9.990000e+02
br i1 %30, label %3, label %31
31: ; preds = %3, %26
ret i32 0
}