#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, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, char *, int *, int *, char *,
                         int *, int *, char *, char *);
int main() {
  int h1, h2, m1, m2, s1, s2;
  char a, b, c;
  scanf("%1d%1d%c%1d%1d%c%1d%1d%c%c", &h1, &h2, &a, &m1, &m2, &a, &s1, &s2, &b,
        &c);
  if (b == 'A') {
    if (h1 == 1 && h2 == 2)
      printf("00:%d%d:%d%d", m1, m2, s1, s2);
    else
      printf("%d%d:%d%d:%d%d", h1, h2, m1, m2, s1, s2);
  } else {
    if (h1 == 1 && h2 == 2)
      printf("12:%d%d:%d%d", m1, m2, s1, s2);
    else
      printf("%d%d:%d%d:%d%d", h1 + 1, h2 + 2, m1, m2, s1, s2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x2d(%rbp),%r14
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
lea    -0x28(%rbp),%rbx
lea    -0x2c(%rbp),%r11
lea    -0x2e(%rbp),%r10
lea    -0x2f(%rbp),%rax
mov    %r14,%rcx
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <scanf@plt>
movsbl -0x2e(%rbp),%eax
cmp    $0x41,%eax
jne    11e8 <main+0xc8>
cmpl   $0x1,-0x18(%rbp)
jne    11be <main+0x9e>
cmpl   $0x2,-0x1c(%rbp)
jne    11be <main+0x9e>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%eax
lea    0xe4f(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124c <main+0x12c>
cmpl   $0x1,-0x18(%rbp)
jne    121c <main+0xfc>
cmpl   $0x2,-0x1c(%rbp)
jne    121c <main+0xfc>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1247 <main+0x127>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x1c(%rbp),%edx
add    $0x2,%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%eax
lea    0xdeb(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124c <main+0x12c>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
sub    $0x8,%rsp
lea    0x1e(%rsp),%rax
lea    0xb(%rsp),%r10
lea    0xc(%rsp),%r11
lea    0x10(%rsp),%rbx
lea    0x1f(%rsp),%rcx
lea    0xeb7(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
push   %rax
push   %r10
push   %r11
push   %rbx
push   %rcx
call   1040 <scanf@plt>
add    $0x30,%rsp
mov    0x1c(%rsp),%esi
mov    %esi,%eax
xor    $0x1,%eax
mov    0x18(%rsp),%edx
mov    %edx,%ecx
xor    $0x2,%ecx
or     %eax,%ecx
sete   %al
cmpb   $0x41,0x3(%rsp)
jne    11b6 <main+0x96>
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%r9d
mov    0x4(%rsp),%r10d
test   %al,%al
je     11db <main+0xbb>
lea    0xe72(%rip),%rdi
mov    %ecx,%esi
mov    %r8d,%edx
mov    %r9d,%ecx
mov    %r10d,%r8d
jmp    11d2 <main+0xb2>
test   %al,%al
je     11ec <main+0xcc>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    121b <main+0xfb>
sub    $0x8,%rsp
lea    0xe42(%rip),%rdi
xor    %eax,%eax
push   %r10
jmp    1212 <main+0xf2>
add    $0x1,%esi
add    $0x2,%edx
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%r9d
mov    0x4(%rsp),%ebx
sub    $0x8,%rsp
lea    0xe19(%rip),%rdi
xor    %eax,%eax
push   %rbx
call   1030 <printf@plt>
add    $0x10,%rsp
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"%1d%1d%c%1d%1d%c%1d%1d%c%c\00"
@.str.1 = [13 x i8] c"00:%d%d:%d%d\00"
@.str.2 = [15 x i8] c"%d%d:%d%d:%d%d\00"
@.str.3 = [13 x i8] c"12:%d%d:%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = bitcast i32* %1 to i8*
%11 = bitcast i32* %2 to i8*
%12 = bitcast i32* %3 to i8*
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = call i32 @scanf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i8* %7, i32* %3, i32* %4, i8* %7, i32* %5, i32* %6, i8* %8, i8* %9)
%17 = load i8, i8* %8
%18 = icmp eq i8 %17, 65
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 1
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 2
%23 = select i1 %20, i1 %22, i1 false
br i1 %18, label %24, label %33
24: ; preds = %0
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = load i32, i32* %6
br i1 %23, label %29, label %31
29: ; preds = %24
%30 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26, i32 %27, i32 %28)
br label %48
31: ; preds = %24
%32 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %21, i32 %25, i32 %26, i32 %27, i32 %28)
br label %48
33: ; preds = %0
br i1 %23, label %34, label %40
34: ; preds = %33
%35 = load i32, i32* %3
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %35, i32 %36, i32 %37, i32 %38)
br label %48
40: ; preds = %33
%41 = add nsw i32 %19, 1
%42 = add nsw i32 %21, 2
%43 = load i32, i32* %3
%44 = load i32, i32* %4
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %41, i32 %42, i32 %43, i32 %44, i32 %45, i32 %46)
br label %48
48: ; preds = %34, %40, %29, %31
ret i32 0
}