#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, mins_since_midnight;
  char tt;
  printf("Enter a time: ");
  scanf("%2d:%2d %c", &hh, &mm, &tt);
  if (tt == 'p' || tt == 'P')
    hh += 12;
  mins_since_midnight = hh * 60 + mm;
  if (mins_since_midnight <= ((8 * 60) + (103 / 2)))
    printf("Closest departure time is 8:00 a.m., arriving at 10:16 a.m.\n");
  else if (mins_since_midnight < ((9 * 60) + 43) + (96 / 2))
    printf("Closest departure time is 9:43 a.m., arriving at 11:52 a.m.\n");
  else if (mins_since_midnight < ((11 * 60) + 19) + (88 / 2))
    printf("Closest departure time is 11:19 a.m., arriving at 1:31 p.m.\n");
  else if (mins_since_midnight <= ((12 * 60) + 47) + (73 / 2))
    printf("Closest departure time is 12:47 p.m., arriving at 3:00 p.m.\n");
  else if (mins_since_midnight <= ((14 * 60) + (105 / 2)))
    printf("Closest departure time is 2:00 p.m., arriving at 4:08 p.m.\n");
  else if (mins_since_midnight <= ((15 * 60) + 45) + (195 / 2))
    printf("Closest departure time is 3:45 p.m., arriving at 5:55 p.m.\n");
  else if (mins_since_midnight <= ((19 * 60) + (165 / 2)))
    printf("Closest departure time is 7:00 p.m., arriving at 9:20 p.m.\n");
  else
    printf("Closest departure time is 9:45 p.m., arriving at 11:58 p.m.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x11(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x70,%eax
je     116d <main+0x4d>
movsbl -0x11(%rbp),%eax
cmp    $0x50,%eax
jne    1176 <main+0x56>
mov    -0x8(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x8(%rbp)
imul   $0x3c,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x213,-0x10(%rbp)
jg     119e <main+0x7e>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    127c <main+0x15c>
cmpl   $0x277,-0x10(%rbp)
jge    11bc <main+0x9c>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    1277 <main+0x157>
cmpl   $0x2d3,-0x10(%rbp)
jge    11da <main+0xba>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    1272 <main+0x152>
cmpl   $0x323,-0x10(%rbp)
jg     11f8 <main+0xd8>
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
jmp    126d <main+0x14d>
cmpl   $0x37c,-0x10(%rbp)
jg     1216 <main+0xf6>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
jmp    1268 <main+0x148>
cmpl   $0x412,-0x10(%rbp)
jg     1234 <main+0x114>
lea    0xf20(%rip),%rdi
call   1030 <printf@plt>
jmp    1263 <main+0x143>
cmpl   $0x4c6,-0x10(%rbp)
jg     1252 <main+0x132>
lea    0xf3e(%rip),%rdi
call   1030 <printf@plt>
jmp    125e <main+0x13e>
lea    0xf69(%rip),%rdi
call   1030 <printf@plt>
jmp    1263 <main+0x143>
jmp    1268 <main+0x148>
jmp    126d <main+0x14d>
jmp    1272 <main+0x152>
jmp    1277 <main+0x157>
jmp    127c <main+0x15c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0xf(%rsp),%rcx
call   1050 <scanf@plt>
mov    0xf(%rsp),%cl
and    $0xdf,%cl
mov    0x10(%rsp),%eax
cmp    $0x50,%cl
jne    1172 <main+0x42>
add    $0xc,%eax
mov    %eax,0x10(%rsp)
imul   $0x3c,%eax,%eax
add    0x14(%rsp),%eax
cmp    $0x214,%eax
jge    1189 <main+0x59>
lea    0x1034(%rip),%rdi
jmp    11f0 <main+0xc0>
cmp    $0x277,%eax
jae    1199 <main+0x69>
lea    0xfe8(%rip),%rdi
jmp    11f0 <main+0xc0>
cmp    $0x2d3,%eax
jae    11a9 <main+0x79>
lea    0xf9c(%rip),%rdi
jmp    11f0 <main+0xc0>
cmp    $0x324,%eax
jae    11b9 <main+0x89>
lea    0xf50(%rip),%rdi
jmp    11f0 <main+0xc0>
cmp    $0x37d,%eax
jae    11c9 <main+0x99>
lea    0xf05(%rip),%rdi
jmp    11f0 <main+0xc0>
cmp    $0x413,%eax
jae    11d9 <main+0xa9>
lea    0xeba(%rip),%rdi
jmp    11f0 <main+0xc0>
cmp    $0x4c7,%eax
lea    0xe71(%rip),%rax
lea    0xe2e(%rip),%rdi
cmovb  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter a time: \00"
@.str.1 = [11 x i8] c"%2d:%2d %c\00"
@.str.2 = [61 x i8] c"Closest departure time is 8:00 a.m., arriving at 10:16 a.m.\0A\00"
@.str.3 = [61 x i8] c"Closest departure time is 9:43 a.m., arriving at 11:52 a.m.\0A\00"
@.str.4 = [61 x i8] c"Closest departure time is 11:19 a.m., arriving at 1:31 p.m.\0A\00"
@.str.5 = [61 x i8] c"Closest departure time is 12:47 p.m., arriving at 3:00 p.m.\0A\00"
@.str.6 = [60 x i8] c"Closest departure time is 2:00 p.m., arriving at 4:08 p.m.\0A\00"
@.str.7 = [60 x i8] c"Closest departure time is 3:45 p.m., arriving at 5:55 p.m.\0A\00"
@.str.8 = [60 x i8] c"Closest departure time is 7:00 p.m., arriving at 9:20 p.m.\0A\00"
@.str.9 = [61 x i8] c"Closest departure time is 9:45 p.m., arriving at 11:58 p.m.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 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* %2, i32* %3, i8* %5)
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 112
br i1 %10, label %15, label %11
11: ; preds = %0
%12 = load i8, i8* %5
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 80
br i1 %14, label %15, label %18
15: ; preds = %11, %0
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 12
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %11
%19 = load i32, i32* %2
%20 = mul nsw i32 %19, 60
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = icmp sle i32 %23, 531
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
br label %65
27: ; preds = %18
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 631
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
br label %64
32: ; preds = %27
%33 = load i32, i32* %4
%34 = icmp slt i32 %33, 723
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
br label %63
37: ; preds = %32
%38 = load i32, i32* %4
%39 = icmp sle i32 %38, 803
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
br label %62
42: ; preds = %37
%43 = load i32, i32* %4
%44 = icmp sle i32 %43, 892
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
br label %61
47: ; preds = %42
%48 = load i32, i32* %4
%49 = icmp sle i32 %48, 1042
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0))
br label %60
52: ; preds = %47
%53 = load i32, i32* %4
%54 = icmp sle i32 %53, 1222
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0))
br label %59
57: ; preds = %52
%58 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0))
br label %59
59: ; preds = %57, %55
br label %60
60: ; preds = %59, %50
br label %61
61: ; preds = %60, %45
br label %62
62: ; preds = %61, %40
br label %63
63: ; preds = %62, %35
br label %64
64: ; preds = %63, %30
br label %65
65: ; preds = %64, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter a time: \00"
@.str.1 = [11 x i8] c"%2d:%2d %c\00"
@str = [60 x i8] c"Closest departure time is 9:45 p.m., arriving at 11:58 p.m.\00"
@str.10 = [59 x i8] c"Closest departure time is 7:00 p.m., arriving at 9:20 p.m.\00"
@str.11 = [59 x i8] c"Closest departure time is 3:45 p.m., arriving at 5:55 p.m.\00"
@str.12 = [59 x i8] c"Closest departure time is 2:00 p.m., arriving at 4:08 p.m.\00"
@str.13 = [60 x i8] c"Closest departure time is 12:47 p.m., arriving at 3:00 p.m.\00"
@str.14 = [60 x i8] c"Closest departure time is 11:19 a.m., arriving at 1:31 p.m.\00"
@str.15 = [60 x i8] c"Closest departure time is 9:43 a.m., arriving at 11:52 a.m.\00"
@str.16 = [60 x i8] c"Closest departure time is 8:00 a.m., arriving at 10:16 a.m.\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 ([15 x i8], [15 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 = mul nsw i32 %15, 60
%17 = load i32, i32* %2
%18 = add nsw i32 %16, %17
%19 = icmp slt i32 %18, 532
br i1 %19, label %33, label %20
20: ; preds = %14
%21 = icmp ult i32 %18, 631
br i1 %21, label %33, label %22
22: ; preds = %20
%23 = icmp ult i32 %18, 723
br i1 %23, label %33, label %24
24: ; preds = %22
%25 = icmp ult i32 %18, 804
br i1 %25, label %33, label %26
26: ; preds = %24
%27 = icmp ult i32 %18, 893
br i1 %27, label %33, label %28
28: ; preds = %26
%29 = icmp ult i32 %18, 1043
br i1 %29, label %33, label %30
30: ; preds = %28
%31 = icmp ult i32 %18, 1223
%32 = select i1 %31, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0)
br label %33
33: ; preds = %30, %28, %26, %24, %22, %20, %14
%34 = phi i8* [ getelementptr inbounds ([60 x i8], [60 x i8]* @str.16, i64 0, i64 0), %14 ], [ getelementptr inbounds ([60 x i8], [60 x i8]* @str.15, i64 0, i64 0), %20 ], [ getelementptr inbounds ([60 x i8], [60 x i8]* @str.14, i64 0, i64 0), %22 ], [ getelementptr inbounds ([60 x i8], [60 x i8]* @str.13, i64 0, i64 0), %24 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @str.12, i64 0, i64 0), %26 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @str.11, i64 0, i64 0), %28 ], [ %32, %30 ]
%35 = call i32 @puts(i8* dereferenceable(1) %34)
ret i32 0
}