#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, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main(void) {
  int hour, minute, second, rest, rh, rm, rs;
  while (1) {
    scanf("%d %d %d\n", &hour, &minute, &second);
    if (hour == -1 && minute == -1 && second == -1)
      break;
    rest = 7200 - (hour * 3600 + minute * 60 + second);
    rh = rest / 3600;
    rest %= 3600;
    rm = rest / 60;
    rs = rest % 60;
    printf("%02d:%02d:%02d\n", rh, rm, rs);
    rest = (7200 - (hour * 3600 + minute * 60 + second)) * 3;
    rh = rest / 3600;
    rest %= 3600;
    rm = rest / 60;
    rs = rest % 60;
    printf("%02d:%02d:%02d\n", rh, rm, rs);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    116a <main+0x4a>
cmpl   $0xffffffff,-0xc(%rbp)
jne    116a <main+0x4a>
cmpl   $0xffffffff,-0x10(%rbp)
jne    116a <main+0x4a>
jmp    1240 <main+0x120>
imul   $0xe10,-0x8(%rbp),%ecx
imul   $0x3c,-0xc(%rbp),%eax
add    %eax,%ecx
add    -0x10(%rbp),%ecx
mov    $0x1c20,%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
imul   $0xe10,-0x8(%rbp),%ecx
imul   $0x3c,-0xc(%rbp),%eax
add    %eax,%ecx
add    -0x10(%rbp),%ecx
mov    $0x1c20,%eax
sub    %ecx,%eax
imul   $0x3,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xdd4(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
cmp    $0xffffffff,%eax
jne    1167 <main+0x47>
cmp    $0xffffffff,%edx
jne    1167 <main+0x47>
cmp    $0xffffffff,%ecx
je     12b9 <main+0x199>
lea    0xe9c(%rip),%rbx
lea    0xe8b(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
imul   $0xfffff1f0,%eax,%eax
imul   $0xffffffc4,%edx,%edx
add    %eax,%edx
sub    %ecx,%edx
mov    %edx,%eax
add    $0x1c20,%eax
cltq
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
lea    (%rcx,%rdx,1),%esi
add    $0x1c20,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0xb,%esi
add    %ecx,%esi
imul   $0xe10,%esi,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%ecx
movswl %cx,%edi
shr    $0xf,%ecx
sar    $0x5,%edi
add    %ecx,%edi
movswl %di,%edx
imul   $0x3c,%edi,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
mov    %rbx,%rdi
call   1030 <printf@plt>
imul   $0xfffff1f0,0xc(%rsp),%eax
ff
imul   $0xffffffc4,0x8(%rsp),%ecx
add    %eax,%ecx
sub    0x4(%rsp),%ecx
add    $0x1c20,%ecx
lea    (%rcx,%rcx,2),%eax
movslq %ecx,%rcx
imul   $0x1b4e81b5,%rcx,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rsi
sar    $0x7,%esi
add    %ecx,%esi
cltq
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xb,%ecx
add    %edx,%ecx
imul   $0xe10,%ecx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%ecx
movswl %cx,%edi
shr    $0xf,%ecx
sar    $0x5,%edi
add    %ecx,%edi
movswl %di,%edx
imul   $0x3c,%edi,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
cmp    $0xffffffff,%eax
jne    1190 <main+0x70>
cmp    $0xffffffff,%edx
jne    1190 <main+0x70>
cmp    $0xffffffff,%ecx
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %d\0A\00"
@.str.1 = [16 x i8] c"%02d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
br label %9
9: ; preds = %0, %20
%10 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %16
br label %62
20: ; preds = %16, %13, %9
%21 = load i32, i32* %2
%22 = mul nsw i32 %21, 3600
%23 = load i32, i32* %3
%24 = mul nsw i32 %23, 60
%25 = add nsw i32 %22, %24
%26 = load i32, i32* %4
%27 = add nsw i32 %25, %26
%28 = sub nsw i32 7200, %27
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = sdiv i32 %29, 3600
store i32 %30, i32* %6
%31 = load i32, i32* %5
%32 = srem i32 %31, 3600
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = sdiv i32 %33, 60
store i32 %34, i32* %7
%35 = load i32, i32* %5
%36 = srem i32 %35, 60
store i32 %36, i32* %8
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* %2
%42 = mul nsw i32 %41, 3600
%43 = load i32, i32* %3
%44 = mul nsw i32 %43, 60
%45 = add nsw i32 %42, %44
%46 = load i32, i32* %4
%47 = add nsw i32 %45, %46
%48 = sub nsw i32 7200, %47
%49 = mul nsw i32 %48, 3
store i32 %49, i32* %5
%50 = load i32, i32* %5
%51 = sdiv i32 %50, 3600
store i32 %51, i32* %6
%52 = load i32, i32* %5
%53 = srem i32 %52, 3600
store i32 %53, i32* %5
%54 = load i32, i32* %5
%55 = sdiv i32 %54, 60
store i32 %55, i32* %7
%56 = load i32, i32* %5
%57 = srem i32 %56, 60
store i32 %57, i32* %8
%58 = load i32, i32* %6
%59 = load i32, i32* %7
%60 = load i32, i32* %8
%61 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %58, i32 %59, i32 %60)
br label %9
62: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
@.str.1 = [16 x i8] c"%02d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, -1
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, -1
%12 = select i1 %9, i1 %11, i1 false
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, -1
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %59, label %16
16: ; preds = %0, %16
%17 = phi i32 [ %56, %16 ], [ %13, %0 ]
%18 = phi i32 [ %53, %16 ], [ %10, %0 ]
%19 = phi i32 [ %51, %16 ], [ %8, %0 ]
%20 = mul i32 %19, -3600
%21 = mul i32 %18, -60
%22 = add i32 %20, 7200
%23 = add i32 %22, %21
%24 = sub i32 %23, %17
%25 = sdiv i32 %24, 3600
%26 = srem i32 %24, 3600
%27 = trunc i32 %26 to i16
%28 = sdiv i16 %27, 60
%29 = sext i16 %28 to i32
%30 = srem i16 %27, 60
%31 = sext i16 %30 to i32
%32 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %29, i32 %31)
%33 = load i32, i32* %1
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = mul i32 %33, -3600
%37 = mul i32 %34, -60
%38 = add i32 %36, 7200
%39 = add i32 %38, %37
%40 = sub i32 %39, %35
%41 = mul nsw i32 %40, 3
%42 = sdiv i32 %40, 1200
%43 = srem i32 %41, 3600
%44 = trunc i32 %43 to i16
%45 = sdiv i16 %44, 60
%46 = sext i16 %45 to i32
%47 = srem i16 %44, 60
%48 = sext i16 %47 to i32
%49 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %46, i32 %48)
%50 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%51 = load i32, i32* %1
%52 = icmp eq i32 %51, -1
%53 = load i32, i32* %2
%54 = icmp eq i32 %53, -1
%55 = select i1 %52, i1 %54, i1 false
%56 = load i32, i32* %3
%57 = icmp eq i32 %56, -1
%58 = select i1 %55, i1 %57, i1 false
br i1 %58, label %59, label %16
59: ; preds = %16, %0
ret i32 0
}