#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 /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int hr, min, zone;
  printf("Enter a time (hr min): ");
  scanf("%d %d", &hr, &min);
  printf("am (1) or pm (2): ");
  scanf("%d", &zone);
  if (zone == 2) {
    if (hr < 12)
      printf("Military time: %.2d:%.2d", hr + 12, min);
    else
      printf("Military time: 12:%.2d", min);
  } else {
    if (hr < 12)
      printf("Military time: %.2d:%.2d", hr, min);
    else
      printf("Military time: 00:%.2d", min);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x2,-0x10(%rbp)
jne    11b9 <main+0x99>
cmpl   $0xc,-0x8(%rbp)
jge    11a3 <main+0x83>
mov    -0x8(%rbp),%esi
add    $0xc,%esi
mov    -0xc(%rbp),%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x94>
mov    -0xc(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
cmpl   $0xc,-0x8(%rbp)
jge    11dc <main+0xbc>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
mov    -0xc(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x2,0x10(%rsp)
mov    0x14(%rsp),%esi
jne    1184 <main+0x64>
cmp    $0xb,%esi
jg     119d <main+0x7d>
add    $0xc,%esi
mov    0xc(%rsp),%edx
jmp    118d <main+0x6d>
mov    0xc(%rsp),%edx
cmp    $0xb,%esi
jg     11aa <main+0x8a>
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11ba <main+0x9a>
mov    0xc(%rsp),%esi
lea    0xea2(%rip),%rdi
jmp    11b3 <main+0x93>
lea    0xeb0(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter a time (hr min): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [19 x i8] c"am (1) or pm (2): \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [25 x i8] c"Military time: %.2d:%.2d\00"
@.str.5 = [23 x i8] c"Military time: 12:%.2d\00"
@.str.6 = [23 x i8] c"Military time: 00:%.2d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %23
11: ; preds = %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 12
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 12
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %17)
br label %22
19: ; preds = %11
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %14
br label %34
23: ; preds = %0
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 12
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %27, i32 %28)
br label %33
30: ; preds = %23
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %26
br label %34
34: ; preds = %33, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter a time (hr min): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [19 x i8] c"am (1) or pm (2): \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [25 x i8] c"Military time: %.2d:%.2d\00"
@.str.5 = [23 x i8] c"Military time: 12:%.2d\00"
@.str.6 = [23 x i8] c"Military time: 00:%.2d\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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 2
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 12
br i1 %12, label %15, label %23
15: ; preds = %0
br i1 %14, label %16, label %20
16: ; preds = %15
%17 = add nsw i32 %13, 12
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %18)
br label %29
20: ; preds = %15
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %21)
br label %29
23: ; preds = %0
%24 = load i32, i32* %2
br i1 %14, label %25, label %27
25: ; preds = %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %24)
br label %29
27: ; preds = %23
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %24)
br label %29
29: ; preds = %25, %27, %16, %20
ret i32 0
}