#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 /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int hr, min;
  scanf("%d%d", &hr, &min);
  if (hr == 24)
    printf("00\n%.2d\nam\n", min);
  else if (hr >= 00 && hr < 12)
    printf("%.2d\n%.2d\nam\n", hr, min);
  else if (hr >= 12 && hr < 24) {
    if (hr == 12)
      printf("%.2d\n%.2d\npm\n", hr, min);
    else
      printf("%.2d\n%.2d\npm\n", (hr - 12), min);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x18,-0x8(%rbp)
jne    1163 <main+0x43>
mov    -0xc(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
cmpl   $0x0,-0x8(%rbp)
jl     1190 <main+0x70>
cmpl   $0xc,-0x8(%rbp)
jge    1190 <main+0x70>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
cmpl   $0xc,-0x8(%rbp)
jl     11e3 <main+0xc3>
cmpl   $0x18,-0x8(%rbp)
jge    11e3 <main+0xc3>
cmpl   $0xc,-0x8(%rbp)
jne    11c7 <main+0xa7>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <main+0xbe>
mov    -0x8(%rbp),%esi
sub    $0xc,%esi
mov    -0xc(%rbp),%edx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
jmp    11e8 <main+0xc8>
jmp    11ed <main+0xcd>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x18,%esi
jne    1151 <main+0x31>
mov    (%rsp),%esi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1189 <main+0x69>
cmp    $0xb,%esi
ja     1162 <main+0x42>
mov    (%rsp),%edx
lea    0xeb1(%rip),%rdi
jmp    1182 <main+0x62>
lea    -0xc(%rsi),%eax
cmp    $0xb,%eax
ja     1189 <main+0x69>
mov    (%rsp),%edx
lea    0xeab(%rip),%rdi
cmp    $0xc,%esi
jne    1180 <main+0x60>
mov    $0xc,%esi
jmp    1182 <main+0x62>
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [12 x i8] c"00\0A%.2d\0Aam\0A\00"
@.str.2 = [14 x i8] c"%.2d\0A%.2d\0Aam\0A\00"
@.str.3 = [14 x i8] c"%.2d\0A%.2d\0Apm\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 24
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %3
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %41
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 12
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %18)
br label %40
20: ; preds = %13, %10
%21 = load i32, i32* %2
%22 = icmp sge i32 %21, 12
br i1 %22, label %23, label %39
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 24
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 12
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %31)
br label %38
33: ; preds = %26
%34 = load i32, i32* %2
%35 = sub nsw i32 %34, 12
%36 = load i32, i32* %3
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %35, i32 %36)
br label %38
38: ; preds = %33, %29
br label %39
39: ; preds = %38, %23, %20
br label %40
40: ; preds = %39, %16
br label %41
41: ; preds = %40, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [12 x i8] c"00\0A%.2d\0Aam\0A\00"
@.str.2 = [14 x i8] c"%.2d\0A%.2d\0Aam\0A\00"
@.str.3 = [14 x i8] c"%.2d\0A%.2d\0Apm\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 24
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %26
11: ; preds = %0
%12 = icmp ult i32 %6, 12
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = load i32, i32* %2
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %14)
br label %26
16: ; preds = %11
%17 = add i32 %6, -12
%18 = icmp ult i32 %17, 12
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = icmp eq i32 %6, 12
%21 = load i32, i32* %2
br i1 %20, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 12, i32 %21)
br label %26
24: ; preds = %19
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %21)
br label %26
26: ; preds = %13, %22, %24, %16, %8
ret i32 0
}