#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 *);
int main(void) {
  int hour, minutes;
  printf("enter the time in 24hrs format (hh:mm) : ");
  scanf("%d:%d", &hour, &minutes);
  if (hour <= 12) {
    printf("time is %2d:%2d PM\n", hour, minutes);
  } else if (hour <= 11) {
    printf("time is %2d:%2d AM\n", hour, minutes);
  } else if (hour <= 23) {
    printf("time is %2d:%2d PM\n", hour - 12, minutes);
  } else {
    printf("time is %2d:%2d AM\n", hour - 12, minutes);
  }
  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    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0xc,-0x8(%rbp)
jg     1174 <main+0x54>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <main+0xbe>
cmpl   $0xb,-0x8(%rbp)
jg     1197 <main+0x77>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d9 <main+0xb9>
cmpl   $0x17,-0x8(%rbp)
jg     11bd <main+0x9d>
mov    -0x8(%rbp),%esi
sub    $0xc,%esi
mov    -0xc(%rbp),%edx
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d4 <main+0xb4>
mov    -0x8(%rbp),%esi
sub    $0xc,%esi
mov    -0xc(%rbp),%edx
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d9 <main+0xb9>
jmp    11de <main+0xbe>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xc,%eax
jg     115a <main+0x3a>
mov    (%rsp),%edx
lea    0xeda(%rip),%rdi
mov    %eax,%esi
jmp    1175 <main+0x55>
lea    -0xc(%rax),%esi
mov    (%rsp),%edx
cmp    $0x17,%eax
ja     116e <main+0x4e>
lea    0xec4(%rip),%rdi
jmp    1175 <main+0x55>
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"enter the time in 24hrs format (hh:mm) : \00"
@.str.1 = [6 x i8] c"%d:%d\00"
@.str.2 = [20 x i8] c"time is %2d:%2d PM\0A\00"
@.str.3 = [20 x i8] c"time is %2d:%2d AM\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 12
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10)
br label %34
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp sle i32 %13, 11
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %17)
br label %33
19: ; preds = %12
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 23
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sub nsw i32 %23, 12
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %25)
br label %32
27: ; preds = %19
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 12
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %30)
br label %32
32: ; preds = %27, %22
br label %33
33: ; preds = %32, %15
br label %34
34: ; preds = %33, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"enter the time in 24hrs format (hh:mm) : \00"
@.str.1 = [6 x i8] c"%d:%d\00"
@.str.2 = [20 x i8] c"time is %2d:%2d PM\0A\00"
@.str.3 = [20 x i8] c"time is %2d:%2d AM\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 13
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %10)
br label %20
12: ; preds = %0
%13 = icmp ult i32 %7, 24
%14 = add nsw i32 %7, -12
%15 = load i32, i32* %2
br i1 %13, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15)
br label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %14, i32 %15)
br label %20
20: ; preds = %18, %16, %9
ret i32 0
}