#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 hours, minutes, now, i;
  int departure[8] = {480, 583, 679, 767, 840, 945, 1140, 1305};
  int arrival[8] = {616, 712, 811, 900, 968, 1075, 1280, 1438};
  printf("Enter a time (24H format): ");
  scanf("%2d:%2d", &hours, &minutes);
  now = hours * 60 + minutes;
  printf("Closest departure time is: ");
  for (i = 0; i < 8; i += 1) {
    if (departure[i] < now) {
      continue;
    } else {
      if (departure[i] - now <= now - departure[i - 1]) {
        printf("Closest departure time is %d:%d, arriving at %d:%d\n",
               departure[i] / 60, departure[i] % 60, arrival[i] / 60,
               arrival[i] % 60);
      } else {
        printf("Closest departure time is %d:%d, arriving at %d:%d\n",
               departure[i - 1] / 60, departure[i - 1] % 60,
               arrival[i - 1] / 60, arrival[i - 1] % 60);
      }
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
imul   $0x3c,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    12e9 <main+0x1c9>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
cmp    -0x10(%rbp),%eax
jge    11e8 <main+0xc8>
jmp    12db <main+0x1bb>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
sub    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
sub    -0x40(%rbp,%rdx,4),%ecx
cmp    %ecx,%eax
jg     126b <main+0x14b>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x64(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
movslq -0x14(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
mov    $0x3c,%edi
cltd
idiv   %edi
mov    %edx,%r8d
mov    -0x64(%rbp),%edx
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d6 <main+0x1b6>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x68(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,4),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,4),%eax
mov    $0x3c,%edi
cltd
idiv   %edi
mov    %edx,%r8d
mov    -0x68(%rbp),%edx
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e9 <main+0x1c9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c8 <main+0xa8>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xf16(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf22(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
imul   $0x3c,0x4(%rsp),%ebx
add    (%rsp),%ebx
lea    0xf0e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1e0,%eax
cmp    $0x1e0,%ebx
jle    11fc <main+0xdc>
cmp    $0x248,%ebx
jb     11b6 <main+0x96>
cmp    $0x2a8,%ebx
jb     11c2 <main+0xa2>
cmp    $0x300,%ebx
jb     11ce <main+0xae>
cmp    $0x349,%ebx
jb     11da <main+0xba>
cmp    $0x3b2,%ebx
jb     11e6 <main+0xc6>
cmp    $0x475,%ebx
jb     11f2 <main+0xd2>
cmp    $0x51a,%ebx
jae    12b0 <main+0x190>
mov    $0x519,%eax
mov    $0x7,%ebp
jmp    11fc <main+0xdc>
mov    $0x247,%eax
mov    $0x1,%ebp
jmp    11fc <main+0xdc>
mov    $0x2a7,%eax
mov    $0x2,%ebp
jmp    11fc <main+0xdc>
mov    $0x2ff,%eax
mov    $0x3,%ebp
jmp    11fc <main+0xdc>
mov    $0x348,%eax
mov    $0x4,%ebp
jmp    11fc <main+0xdc>
mov    $0x3b1,%eax
mov    $0x5,%ebp
jmp    11fc <main+0xdc>
mov    $0x474,%eax
mov    $0x6,%ebp
mov    %eax,%esi
sub    %ebx,%esi
mov    %ebp,%ecx
lea    0xdf7(%rip),%rdx
mov    -0x4(%rdx,%rcx,4),%edx
sub    %edx,%ebx
cmp    %ebx,%esi
jle    1268 <main+0x148>
lea    -0x1(%rcx),%rax
movslq %edx,%rcx
imul   $0xffffffff88888889,%rcx,%rsi
shr    $0x20,%rsi
add    %edx,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x5,%esi
add    %ecx,%esi
imul   $0x3c,%esi,%ecx
sub    %ecx,%edx
lea    0xde3(%rip),%rcx
movslq (%rcx,%rax,4),%r8
imul   $0xffffffff88888889,%r8,%rcx
shr    $0x20,%rcx
add    %r8d,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x5,%ecx
add    %eax,%ecx
imul   $0x3c,%ecx,%eax
sub    %eax,%r8d
lea    0xe1a(%rip),%rdi
jmp    12a9 <main+0x189>
imul   $0x8889,%eax,%esi
shr    $0x15,%esi
imul   $0x3c,%esi,%edx
sub    %edx,%eax
movzwl %ax,%edx
lea    0xda0(%rip),%rax
movslq (%rax,%rcx,4),%r8
imul   $0xffffffff88888889,%r8,%rcx
shr    $0x20,%rcx
add    %r8d,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x5,%ecx
add    %eax,%ecx
imul   $0x3c,%ecx,%eax
sub    %eax,%r8d
lea    0xdd7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.departure = [8 x i32] [i32 480, i32 583, i32 679, i32 767, i32 840, i32 945, i32 1140, i32 1305]
@__const.main.arrival = [8 x i32] [i32 616, i32 712, i32 811, i32 900, i32 968, i32 1075, i32 1280, i32 1438]
@.str = [28 x i8] c"Enter a time (24H format): \00"
@.str.1 = [8 x i8] c"%2d:%2d\00"
@.str.2 = [28 x i8] c"Closest departure time is: \00"
@.str.3 = [52 x i8] c"Closest departure time is %d:%d, arriving at %d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [8 x i32]
%7 = alloca [8 x i32]
store i32 0, i32* %1
%8 = bitcast [8 x i32]* %6 to i8*
%9 = bitcast [8 x i32]* %7 to i8*
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%12 = load i32, i32* %2
%13 = mul nsw i32 %12, 60
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
store i32 %15, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %17
17: ; preds = %92, %0
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 8
br i1 %19, label %20, label %95
20: ; preds = %17
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %20
br label %92
28: ; preds = %20
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %4
%34 = sub nsw i32 %32, %33
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = sub nsw i32 %35, %40
%42 = icmp sle i32 %34, %41
br i1 %42, label %43, label %65
43: ; preds = %28
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = sdiv i32 %47, 60
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = srem i32 %52, 60
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = sdiv i32 %57, 60
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = srem i32 %62, 60
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %48, i32 %53, i32 %58, i32 %63)
br label %91
65: ; preds = %28
%66 = load i32, i32* %5
%67 = sub nsw i32 %66, 1
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = sdiv i32 %70, 60
%72 = load i32, i32* %5
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = srem i32 %76, 60
%78 = load i32, i32* %5
%79 = sub nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %80
%82 = load i32, i32* %81
%83 = sdiv i32 %82, 60
%84 = load i32, i32* %5
%85 = sub nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = srem i32 %88, 60
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %71, i32 %77, i32 %83, i32 %89)
br label %91
91: ; preds = %65, %43
br label %95
92: ; preds = %27
%93 = load i32, i32* %5
%94 = add nsw i32 %93, 1
store i32 %94, i32* %5
br label %17
95: ; preds = %91, %17
ret i32 0
}

LLVM IR (-O2):
@__const.main.departure = [8 x i32] [i32 480, i32 583, i32 679, i32 767, i32 840, i32 945, i32 1140, i32 1305]
@__const.main.arrival = [8 x i32] [i32 616, i32 712, i32 811, i32 900, i32 968, i32 1075, i32 1280, i32 1438]
@.str = [28 x i8] c"Enter a time (24H format): \00"
@.str.1 = [8 x i8] c"%2d:%2d\00"
@.str.2 = [28 x i8] c"Closest departure time is: \00"
@.str.3 = [52 x i8] c"Closest departure time is %d:%d, arriving at %d:%d\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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = mul nsw i32 %7, 60
%9 = load i32, i32* %2
%10 = add nsw i32 %8, %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp sgt i32 %10, 480
br i1 %12, label %44, label %13
13: ; preds = %56, %54, %52, %50, %48, %46, %44, %0
%14 = phi i32 [ 0, %0 ], [ 1, %44 ], [ 2, %46 ], [ 3, %48 ], [ 4, %50 ], [ 5, %52 ], [ 6, %54 ], [ 7, %56 ]
%15 = phi i32 [ 480, %0 ], [ 583, %44 ], [ 679, %46 ], [ 767, %48 ], [ 840, %50 ], [ 945, %52 ], [ 1140, %54 ], [ 1305, %56 ]
%16 = sub nsw i32 %15, %10
%17 = add nsw i32 %14, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [8 x i32], [8 x i32]* @__const.main.departure, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = sub nsw i32 %10, %20
%22 = icmp sgt i32 %16, %21
br i1 %22, label %36, label %23
23: ; preds = %13
%24 = zext i32 %14 to i64
%25 = trunc i32 %15 to i16
%26 = udiv i16 %25, 60
%27 = zext i16 %26 to i32
%28 = trunc i32 %15 to i16
%29 = urem i16 %28, 60
%30 = zext i16 %29 to i32
%31 = getelementptr inbounds [8 x i32], [8 x i32]* @__const.main.arrival, i64 0, i64 %24
%32 = load i32, i32* %31
%33 = sdiv i32 %32, 60
%34 = srem i32 %32, 60
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %30, i32 %33, i32 %34)
br label %58
36: ; preds = %13
%37 = sdiv i32 %20, 60
%38 = srem i32 %20, 60
%39 = getelementptr inbounds [8 x i32], [8 x i32]* @__const.main.arrival, i64 0, i64 %18
%40 = load i32, i32* %39
%41 = sdiv i32 %40, 60
%42 = srem i32 %40, 60
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %38, i32 %41, i32 %42)
br label %58
44: ; preds = %0
%45 = icmp ugt i32 %10, 583
br i1 %45, label %46, label %13
46: ; preds = %44
%47 = icmp ugt i32 %10, 679
br i1 %47, label %48, label %13
48: ; preds = %46
%49 = icmp ugt i32 %10, 767
br i1 %49, label %50, label %13
50: ; preds = %48
%51 = icmp ugt i32 %10, 840
br i1 %51, label %52, label %13
52: ; preds = %50
%53 = icmp ugt i32 %10, 945
br i1 %53, label %54, label %13
54: ; preds = %52
%55 = icmp ugt i32 %10, 1140
br i1 %55, label %56, label %13
56: ; preds = %54
%57 = icmp ugt i32 %10, 1305
br i1 %57, label %58, label %13
58: ; preds = %56, %23, %36
ret i32 0
}