#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 *, char *);
int main(void) {
  int hh, mm;
  char tt;
  printf("Enter a 12-hour time: ");
  scanf("%2d:%2d %c", &hh, &mm, &tt);
  if (tt == 'p' || tt == 'P')
    hh += 12;
  printf("Equivalent 24-hour time: %2d:%2d\n", hh, mm);
  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    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0xd(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x70,%eax
je     116f <main+0x4f>
movsbl -0xd(%rbp),%eax
cmp    $0x50,%eax
jne    1178 <main+0x58>
mov    -0x8(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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    0xede(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0xf(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xf(%rsp),%al
and    $0xdf,%al
mov    0x10(%rsp),%esi
cmp    $0x50,%al
jne    1162 <main+0x42>
add    $0xc,%esi
mov    %esi,0x10(%rsp)
mov    0x14(%rsp),%edx
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter a 12-hour time: \00"
@.str.1 = [11 x i8] c"%2d:%2d %c\00"
@.str.2 = [34 x i8] c"Equivalent 24-hour time: %2d:%2d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i8* %4)
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 112
br i1 %9, label %14, label %10
10: ; preds = %0
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 80
br i1 %13, label %14, label %17
14: ; preds = %10, %0
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 12
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter a 12-hour time: \00"
@.str.1 = [11 x i8] c"%2d:%2d %c\00"
@.str.2 = [34 x i8] c"Equivalent 24-hour time: %2d:%2d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i8* %3)
%8 = load i8, i8* %3
%9 = and i8 %8, -33
%10 = icmp eq i8 %9, 80
%11 = load i32, i32* %1
br i1 %10, label %12, label %14
12: ; preds = %0
%13 = add nsw i32 %11, 12
store i32 %13, i32* %1
br label %14
14: ; preds = %0, %12
%15 = phi i32 [ %13, %12 ], [ %11, %0 ]
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16)
ret i32 0
}