#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 toupper(char);
int main(void) {
  int hours;
  int minutes;
  int mins_from_midnight;
  int eight_am = 8 * 60;
  int nine_43_am = 9 * 60 + 43;
  int eleven_19_am = 11 * 60 + 19;
  int twelve_47_pm = 12 * 60 + 47;
  int two_pm = 14 * 60;
  int three_45_pm = 15 * 60 + 45;
  int seven_pm = 19 * 60;
  int nine_45_pm = 21 * 60 + 45;
  char ampm;
  printf("Enter a time (XX:XX AM/PM): ");
  scanf("%d:%d %c", &hours, &minutes, &ampm);
  switch (toupper(ampm)) {
  case 'P':
    hours += 12;
    break;
  case 'A':
    break;
  default:
    printf("Invalid input!\n");
    return 0;
  }
  mins_from_midnight = hours * 60 + minutes;
  printf("Closest departure time is: ");
  if (mins_from_midnight >= 1 && mins_from_midnight < eight_am) {
    printf("8:00am arriving at 10:16am\n");
  }
  if (mins_from_midnight >= eight_am && mins_from_midnight < nine_43_am) {
    if (nine_43_am - mins_from_midnight < mins_from_midnight - eight_am) {
      printf("9:43am arriving at 11:52am\n");
    } else {
      printf("8:00am arriving at 10:16am\n");
    }
  }
  if (mins_from_midnight >= nine_43_am && mins_from_midnight < eleven_19_am) {
    if (eleven_19_am - mins_from_midnight < mins_from_midnight - nine_43_am) {
      printf("11:19am arriving at 1:31pm\n");
    } else {
      printf("9:43am arriving at 11:52am\n");
    }
  }
  if (mins_from_midnight >= eleven_19_am && mins_from_midnight < twelve_47_pm) {
    if (twelve_47_pm - mins_from_midnight < mins_from_midnight - eleven_19_am) {
      printf("12:47pm arriving at 3:00pm\n");
    } else {
      printf("11:19am arriving at 1:31pm\n");
    }
  }
  if (mins_from_midnight >= twelve_47_pm && mins_from_midnight < two_pm) {
    if (two_pm - mins_from_midnight < mins_from_midnight - twelve_47_pm) {
      printf("2:00pm arriving at 4:08pm\n");
    } else {
      printf("12:47pm arriving at 3:00pm\n");
    }
  }
  if (mins_from_midnight >= two_pm && mins_from_midnight < three_45_pm) {
    if (three_45_pm - mins_from_midnight < mins_from_midnight - two_pm) {
      printf("3:45pm arriving at 5:55pm\n");
    } else {
      printf("2:00pm arriving at 4:08pm\n");
    }
  }
  if (mins_from_midnight >= three_45_pm && mins_from_midnight < seven_pm) {
    if (seven_pm - mins_from_midnight < mins_from_midnight - three_45_pm) {
      printf("7:00pm arriving at 9:20\n");
    } else {
      printf("3:45pm arriving at 5:55pm\n");
    }
  }
  if (mins_from_midnight >= seven_pm && mins_from_midnight < nine_45_pm) {
    if (nine_45_pm - mins_from_midnight < mins_from_midnight - seven_pm) {
      printf("9:45pm arriving at 11:58pm\n");
    } else {
      printf("7:00pm arriving at 9:20\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e0,-0x14(%rbp)
movl   $0x247,-0x18(%rbp)
movl   $0x2a7,-0x1c(%rbp)
movl   $0x2ff,-0x20(%rbp)
movl   $0x348,-0x24(%rbp)
movl   $0x3b1,-0x28(%rbp)
movl   $0x474,-0x2c(%rbp)
movl   $0x519,-0x30(%rbp)
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x31(%rbp),%rcx
call   1050 <scanf@plt>
movsbl -0x31(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    %ecx,-0x38(%rbp)
sub    $0x41,%eax
je     11d6 <main+0xa6>
jmp    11b7 <main+0x87>
mov    -0x38(%rbp),%eax
sub    $0x50,%eax
jne    11db <main+0xab>
jmp    11c8 <main+0x98>
mov    -0x8(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x8(%rbp)
jmp    11f3 <main+0xc3>
jmp    11f3 <main+0xc3>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1454 <main+0x324>
imul   $0x3c,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
jl     122b <main+0xfb>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    122b <main+0xfb>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1279 <main+0x149>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1279 <main+0x149>
mov    -0x18(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1268 <main+0x138>
lea    0xe10(%rip),%rdi
call   1040 <printf@plt>
jmp    1274 <main+0x144>
lea    0xde3(%rip),%rdi
call   1040 <printf@plt>
jmp    1279 <main+0x149>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     12c7 <main+0x197>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12c7 <main+0x197>
mov    -0x1c(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x18(%rbp),%ecx
cmp    %ecx,%eax
jge    12b6 <main+0x186>
lea    0xdde(%rip),%rdi
call   1040 <printf@plt>
jmp    12c2 <main+0x192>
lea    0xdb1(%rip),%rdi
call   1040 <printf@plt>
jmp    12c7 <main+0x197>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     1315 <main+0x1e5>
mov    -0x10(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1315 <main+0x1e5>
mov    -0x20(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jge    1304 <main+0x1d4>
lea    0xdac(%rip),%rdi
call   1040 <printf@plt>
jmp    1310 <main+0x1e0>
lea    0xd7f(%rip),%rdi
call   1040 <printf@plt>
jmp    1315 <main+0x1e5>
mov    -0x10(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     1363 <main+0x233>
mov    -0x10(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1363 <main+0x233>
mov    -0x24(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1352 <main+0x222>
lea    0xd7a(%rip),%rdi
call   1040 <printf@plt>
jmp    135e <main+0x22e>
lea    0xd4d(%rip),%rdi
call   1040 <printf@plt>
jmp    1363 <main+0x233>
mov    -0x10(%rbp),%eax
cmp    -0x24(%rbp),%eax
jl     13b1 <main+0x281>
mov    -0x10(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13b1 <main+0x281>
mov    -0x28(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    13a0 <main+0x270>
lea    0xd47(%rip),%rdi
call   1040 <printf@plt>
jmp    13ac <main+0x27c>
lea    0xd1b(%rip),%rdi
call   1040 <printf@plt>
jmp    13b1 <main+0x281>
mov    -0x10(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     13ff <main+0x2cf>
mov    -0x10(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13ff <main+0x2cf>
mov    -0x2c(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    13ee <main+0x2be>
lea    0xd14(%rip),%rdi
call   1040 <printf@plt>
jmp    13fa <main+0x2ca>
lea    0xce8(%rip),%rdi
call   1040 <printf@plt>
jmp    13ff <main+0x2cf>
mov    -0x10(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jl     144d <main+0x31d>
mov    -0x10(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    144d <main+0x31d>
mov    -0x30(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
cmp    %ecx,%eax
jge    143c <main+0x30c>
lea    0xcdf(%rip),%rdi
call   1040 <printf@plt>
jmp    1448 <main+0x318>
lea    0xcb5(%rip),%rdi
call   1040 <printf@plt>
jmp    144d <main+0x31d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0xf(%rsp),%rcx
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%edi
call   1030 <toupper@plt>
cmp    $0x50,%eax
je     1188 <main+0x48>
cmp    $0x41,%eax
jne    11c1 <main+0x81>
mov    0x10(%rsp),%eax
jmp    1193 <main+0x53>
mov    0x10(%rsp),%eax
add    $0xc,%eax
mov    %eax,0x10(%rsp)
imul   $0x3c,%eax,%r14d
mov    0x14(%rsp),%ebx
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
lea    (%r14,%rbx,1),%eax
add    $0xffffffff,%eax
cmp    $0x1df,%eax
jae    11cd <main+0x8d>
lea    0xf3e(%rip),%rdi
jmp    12e9 <main+0x1a9>
lea    0xf4d(%rip),%rdi
jmp    12e9 <main+0x1a9>
add    %ebx,%r14d
lea    -0x1e0(%r14),%eax
cmp    $0x66,%eax
ja     11f9 <main+0xb9>
mov    $0x247,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xef2(%rip),%rax
lea    0xf06(%rip),%rdi
jmp    12e5 <main+0x1a5>
lea    -0x247(%r14),%eax
cmp    $0x5f,%eax
ja     1222 <main+0xe2>
mov    $0x2a7,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xeae(%rip),%rax
lea    0xec2(%rip),%rdi
jmp    12e5 <main+0x1a5>
lea    -0x2a7(%r14),%eax
cmp    $0x57,%eax
ja     124b <main+0x10b>
mov    $0x2ff,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xe6a(%rip),%rax
lea    0xe7e(%rip),%rdi
jmp    12e5 <main+0x1a5>
lea    -0x2ff(%r14),%eax
cmp    $0x48,%eax
ja     1271 <main+0x131>
mov    $0x348,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xe27(%rip),%rax
lea    0xe3a(%rip),%rdi
jmp    12e5 <main+0x1a5>
lea    -0x348(%r14),%eax
cmp    $0x68,%eax
ja     1297 <main+0x157>
mov    $0x3b1,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xde7(%rip),%rax
lea    0xdfa(%rip),%rdi
jmp    12e5 <main+0x1a5>
lea    -0x3b1(%r14),%eax
cmp    $0xc2,%eax
ja     12bf <main+0x17f>
mov    $0x474,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xda7(%rip),%rax
lea    0xdb8(%rip),%rdi
jmp    12e5 <main+0x1a5>
lea    -0x474(%r14),%eax
cmp    $0xa4,%eax
ja     12ee <main+0x1ae>
mov    $0x519,%ecx
sub    %r14d,%ecx
cmp    %eax,%ecx
lea    0xd64(%rip),%rax
lea    0xd78(%rip),%rdi
cmovb  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Enter a time (XX:XX AM/PM): \00"
@.str.1 = [9 x i8] c"%d:%d %c\00"
@.str.2 = [16 x i8] c"Invalid input!\0A\00"
@.str.3 = [28 x i8] c"Closest departure time is: \00"
@.str.4 = [28 x i8] c"8:00am arriving at 10:16am\0A\00"
@.str.5 = [28 x i8] c"9:43am arriving at 11:52am\0A\00"
@.str.6 = [28 x i8] c"11:19am arriving at 1:31pm\0A\00"
@.str.7 = [28 x i8] c"12:47pm arriving at 3:00pm\0A\00"
@.str.8 = [27 x i8] c"2:00pm arriving at 4:08pm\0A\00"
@.str.9 = [27 x i8] c"3:45pm arriving at 5:55pm\0A\00"
@.str.10 = [25 x i8] c"7:00pm arriving at 9:20\0A\00"
@.str.11 = [28 x i8] c"9:45pm arriving at 11:58pm\0A\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
store i32 0, i32* %1
store i32 480, i32* %5
store i32 583, i32* %6
store i32 679, i32* %7
store i32 767, i32* %8
store i32 840, i32* %9
store i32 945, i32* %10
store i32 1140, i32* %11
store i32 1305, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i8* %13)
%16 = load i8, i8* %13
%17 = call i32 @toupper(i8 signext %16)
switch i32 %17, label %22 [
i32 80, label %18
i32 65, label %21
]
18: ; preds = %0
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 12
store i32 %20, i32* %2
br label %24
21: ; preds = %0
br label %24
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %186
24: ; preds = %21, %18
%25 = load i32, i32* %2
%26 = mul nsw i32 %25, 60
%27 = load i32, i32* %3
%28 = add nsw i32 %26, %27
store i32 %28, i32* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = icmp sge i32 %30, 1
br i1 %31, label %32, label %38
32: ; preds = %24
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %32, %24
%39 = load i32, i32* %4
%40 = load i32, i32* %5
%41 = icmp sge i32 %39, %40
br i1 %41, label %42, label %59
42: ; preds = %38
%43 = load i32, i32* %4
%44 = load i32, i32* %6
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %59
46: ; preds = %42
%47 = load i32, i32* %6
%48 = load i32, i32* %4
%49 = sub nsw i32 %47, %48
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = sub nsw i32 %50, %51
%53 = icmp slt i32 %49, %52
br i1 %53, label %54, label %56
54: ; preds = %46
%55 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %58
56: ; preds = %46
%57 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %58
58: ; preds = %56, %54
br label %59
59: ; preds = %58, %42, %38
%60 = load i32, i32* %4
%61 = load i32, i32* %6
%62 = icmp sge i32 %60, %61
br i1 %62, label %63, label %80
63: ; preds = %59
%64 = load i32, i32* %4
%65 = load i32, i32* %7
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %80
67: ; preds = %63
%68 = load i32, i32* %7
%69 = load i32, i32* %4
%70 = sub nsw i32 %68, %69
%71 = load i32, i32* %4
%72 = load i32, i32* %6
%73 = sub nsw i32 %71, %72
%74 = icmp slt i32 %70, %73
br i1 %74, label %75, label %77
75: ; preds = %67
%76 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %79
77: ; preds = %67
%78 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %79
79: ; preds = %77, %75
br label %80
80: ; preds = %79, %63, %59
%81 = load i32, i32* %4
%82 = load i32, i32* %7
%83 = icmp sge i32 %81, %82
br i1 %83, label %84, label %101
84: ; preds = %80
%85 = load i32, i32* %4
%86 = load i32, i32* %8
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %101
88: ; preds = %84
%89 = load i32, i32* %8
%90 = load i32, i32* %4
%91 = sub nsw i32 %89, %90
%92 = load i32, i32* %4
%93 = load i32, i32* %7
%94 = sub nsw i32 %92, %93
%95 = icmp slt i32 %91, %94
br i1 %95, label %96, label %98
96: ; preds = %88
%97 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %100
98: ; preds = %88
%99 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %100
100: ; preds = %98, %96
br label %101
101: ; preds = %100, %84, %80
%102 = load i32, i32* %4
%103 = load i32, i32* %8
%104 = icmp sge i32 %102, %103
br i1 %104, label %105, label %122
105: ; preds = %101
%106 = load i32, i32* %4
%107 = load i32, i32* %9
%108 = icmp slt i32 %106, %107
br i1 %108, label %109, label %122
109: ; preds = %105
%110 = load i32, i32* %9
%111 = load i32, i32* %4
%112 = sub nsw i32 %110, %111
%113 = load i32, i32* %4
%114 = load i32, i32* %8
%115 = sub nsw i32 %113, %114
%116 = icmp slt i32 %112, %115
br i1 %116, label %117, label %119
117: ; preds = %109
%118 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %121
119: ; preds = %109
%120 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %121
121: ; preds = %119, %117
br label %122
122: ; preds = %121, %105, %101
%123 = load i32, i32* %4
%124 = load i32, i32* %9
%125 = icmp sge i32 %123, %124
br i1 %125, label %126, label %143
126: ; preds = %122
%127 = load i32, i32* %4
%128 = load i32, i32* %10
%129 = icmp slt i32 %127, %128
br i1 %129, label %130, label %143
130: ; preds = %126
%131 = load i32, i32* %10
%132 = load i32, i32* %4
%133 = sub nsw i32 %131, %132
%134 = load i32, i32* %4
%135 = load i32, i32* %9
%136 = sub nsw i32 %134, %135
%137 = icmp slt i32 %133, %136
br i1 %137, label %138, label %140
138: ; preds = %130
%139 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
br label %142
140: ; preds = %130
%141 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %142
142: ; preds = %140, %138
br label %143
143: ; preds = %142, %126, %122
%144 = load i32, i32* %4
%145 = load i32, i32* %10
%146 = icmp sge i32 %144, %145
br i1 %146, label %147, label %164
147: ; preds = %143
%148 = load i32, i32* %4
%149 = load i32, i32* %11
%150 = icmp slt i32 %148, %149
br i1 %150, label %151, label %164
151: ; preds = %147
%152 = load i32, i32* %11
%153 = load i32, i32* %4
%154 = sub nsw i32 %152, %153
%155 = load i32, i32* %4
%156 = load i32, i32* %10
%157 = sub nsw i32 %155, %156
%158 = icmp slt i32 %154, %157
br i1 %158, label %159, label %161
159: ; preds = %151
%160 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %163
161: ; preds = %151
%162 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
br label %163
163: ; preds = %161, %159
br label %164
164: ; preds = %163, %147, %143
%165 = load i32, i32* %4
%166 = load i32, i32* %11
%167 = icmp sge i32 %165, %166
br i1 %167, label %168, label %185
168: ; preds = %164
%169 = load i32, i32* %4
%170 = load i32, i32* %12
%171 = icmp slt i32 %169, %170
br i1 %171, label %172, label %185
172: ; preds = %168
%173 = load i32, i32* %12
%174 = load i32, i32* %4
%175 = sub nsw i32 %173, %174
%176 = load i32, i32* %4
%177 = load i32, i32* %11
%178 = sub nsw i32 %176, %177
%179 = icmp slt i32 %175, %178
br i1 %179, label %180, label %182
180: ; preds = %172
%181 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
br label %184
182: ; preds = %172
%183 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %184
184: ; preds = %182, %180
br label %185
185: ; preds = %184, %168, %164
store i32 0, i32* %1
br label %186
186: ; preds = %185, %22
%187 = load i32, i32* %1
ret i32 %187
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter a time (XX:XX AM/PM): \00"
@.str.1 = [9 x i8] c"%d:%d %c\00"
@.str.3 = [28 x i8] c"Closest departure time is: \00"
@str.12 = [27 x i8] c"9:45pm arriving at 11:58pm\00"
@str.14 = [24 x i8] c"7:00pm arriving at 9:20\00"
@str.16 = [26 x i8] c"3:45pm arriving at 5:55pm\00"
@str.18 = [26 x i8] c"2:00pm arriving at 4:08pm\00"
@str.20 = [27 x i8] c"12:47pm arriving at 3:00pm\00"
@str.22 = [27 x i8] c"11:19am arriving at 1:31pm\00"
@str.24 = [27 x i8] c"9:43am arriving at 11:52am\00"
@str.25 = [27 x i8] c"8:00am arriving at 10:16am\00"
@str.26 = [15 x i8] c"Invalid input!\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 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i8* %3)
%8 = load i8, i8* %3
%9 = call i32 @toupper(i8 signext %8)
switch i32 %9, label %72 [
i32 80, label %12
i32 65, label %10
]
10: ; preds = %0
%11 = load i32, i32* %1
br label %15
12: ; preds = %0
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 12
store i32 %14, i32* %1
br label %15
15: ; preds = %10, %12
%16 = phi i32 [ %11, %10 ], [ %14, %12 ]
%17 = mul nsw i32 %16, 60
%18 = load i32, i32* %2
%19 = add nsw i32 %17, %18
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%21 = add i32 %19, -1
%22 = icmp ult i32 %21, 479
br i1 %22, label %72, label %23
23: ; preds = %15
%24 = add i32 %19, -480
%25 = icmp ult i32 %24, 103
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = sub nuw nsw i32 583, %19
%28 = icmp ult i32 %27, %24
%29 = select i1 %28, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.24, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.25, i64 0, i64 0)
br label %72
30: ; preds = %23
%31 = add i32 %19, -583
%32 = icmp ult i32 %31, 96
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = sub nuw nsw i32 679, %19
%35 = icmp ult i32 %34, %31
%36 = select i1 %35, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.24, i64 0, i64 0)
br label %72
37: ; preds = %30
%38 = add i32 %19, -679
%39 = icmp ult i32 %38, 88
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = sub nuw nsw i32 767, %19
%42 = icmp ult i32 %41, %38
%43 = select i1 %42, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.20, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0)
br label %72
44: ; preds = %37
%45 = add i32 %19, -767
%46 = icmp ult i32 %45, 73
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = sub nuw nsw i32 840, %19
%49 = icmp ult i32 %48, %45
%50 = select i1 %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.18, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.20, i64 0, i64 0)
br label %72
51: ; preds = %44
%52 = add i32 %19, -840
%53 = icmp ult i32 %52, 105
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = sub nuw nsw i32 945, %19
%56 = icmp ult i32 %55, %52
%57 = select i1 %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.16, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.18, i64 0, i64 0)
br label %72
58: ; preds = %51
%59 = add i32 %19, -945
%60 = icmp ult i32 %59, 195
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = sub nuw nsw i32 1140, %19
%63 = icmp ult i32 %62, %59
%64 = select i1 %63, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.16, i64 0, i64 0)
br label %72
65: ; preds = %58
%66 = add i32 %19, -1140
%67 = icmp ult i32 %66, 165
br i1 %67, label %68, label %75
68: ; preds = %65
%69 = sub nuw nsw i32 1305, %19
%70 = icmp ult i32 %69, %66
%71 = select i1 %70, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0)
br label %72
72: ; preds = %68, %61, %54, %47, %40, %33, %26, %15, %0
%73 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0), %0 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.25, i64 0, i64 0), %15 ], [ %29, %26 ], [ %36, %33 ], [ %43, %40 ], [ %50, %47 ], [ %57, %54 ], [ %64, %61 ], [ %71, %68 ]
%74 = call i32 @puts(i8* dereferenceable(1) %73)
br label %75
75: ; preds = %72, %65
ret i32 0
}