#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, char *, int, char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdout;
int main() {
  int curHour, curMin, depHour, depMin;
  fputs("What is the current hour? ", stdout);
  scanf("%d", &curHour);
  fputs("What is the current minute? ", stdout);
  scanf("%d", &curMin);
  fputs("When does your bus leave in hours? ", stdout);
  scanf("%d", &depHour);
  fputs("When does your bus leave in minutes? ", stdout);
  scanf("%d", &depMin);
  int waitMin = (depHour * 60 + depMin) - (curHour * 60 + curMin);
  int waitHours = waitMin / 60;
  waitMin %= 60;
  char *hourString = "hours";
  char *minString = "minutes";
  if (waitHours == 1) {
    hourString = "hour";
  }
  if (waitMin == 1) {
    minString = "minute";
  }
  printf("Your bus leaves in %d %s and %d %s.\n", waitHours, hourString,
         waitMin, minString);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1040 <fputs@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe9b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe76(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe51(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
imul   $0x3c,-0x10(%rbp),%eax
add    -0x14(%rbp),%eax
imul   $0x3c,-0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
lea    0xe7c(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe77(%rip),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    122d <main+0xfd>
lea    0xe6a(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1242 <main+0x112>
lea    0xe5a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x30(%rbp),%r8
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2ea2(%rip),%r14
mov    (%r14),%esi
lea    0xeb8(%rip),%rdi
call   1040 <fputs@plt>
lea    0xec7(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%r14),%esi
lea    0xeb3(%rip),%rdi
call   1040 <fputs@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%r14),%esi
lea    0xeb4(%rip),%rdi
call   1040 <fputs@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%r14),%esi
lea    0xebc(%rip),%rdi
call   1040 <fputs@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
sub    0x14(%rsp),%eax
imul   $0x3c,%eax,%eax
sub    0x10(%rsp),%ecx
lea    (%rcx,%rax,1),%edx
add    $0xffffffc4,%edx
add    %eax,%ecx
cmp    $0x3c,%edx
lea    0xeb9(%rip),%rax
lea    0xea4(%rip),%rdx
cmovb  %rax,%rdx
movslq %ecx,%rcx
imul   $0xffffffff88888889,%rcx,%rsi
shr    $0x20,%rsi
add    %ecx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x5,%esi
add    %eax,%esi
imul   $0x3c,%esi,%eax
sub    %eax,%ecx
cmp    $0x1,%ecx
lea    0xe8a(%rip),%rax
lea    0xe76(%rip),%r8
cmove  %rax,%r8
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"What is the current hour? \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"What is the current minute? \00"
@.str.3 = [36 x i8] c"When does your bus leave in hours? \00"
@.str.4 = [38 x i8] c"When does your bus leave in minutes? \00"
@.str.5 = [6 x i8] c"hours\00"
@.str.6 = [8 x i8] c"minutes\00"
@.str.7 = [5 x i8] c"hour\00"
@.str.8 = [7 x i8] c"minute\00"
@.str.9 = [37 x i8] c"Your bus leaves in %d %s and %d %s.\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 i8*
%9 = alloca i8*
store i32 0, i32* %1
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* @stdout
%14 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* @stdout
%17 = call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = load i32, i32* @stdout
%20 = call i32 @fputs(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 60
%24 = load i32, i32* %5
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %2
%27 = mul nsw i32 %26, 60
%28 = load i32, i32* %3
%29 = add nsw i32 %27, %28
%30 = sub nsw i32 %25, %29
store i32 %30, i32* %6
%31 = load i32, i32* %6
%32 = sdiv i32 %31, 60
store i32 %32, i32* %7
%33 = load i32, i32* %6
%34 = srem i32 %33, 60
store i32 %34, i32* %6
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %9
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %38
37: ; preds = %0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %8
br label %38
38: ; preds = %37, %0
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %42
41: ; preds = %38
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8** %9
br label %42
42: ; preds = %41, %38
%43 = load i32, i32* %7
%44 = load i8*, i8** %8
%45 = load i32, i32* %6
%46 = load i8*, i8** %9
%47 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i32 %43, i8* %44, i32 %45, i8* %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"What is the current hour? \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"What is the current minute? \00"
@.str.3 = [36 x i8] c"When does your bus leave in hours? \00"
@.str.4 = [38 x i8] c"When does your bus leave in minutes? \00"
@.str.5 = [6 x i8] c"hours\00"
@.str.6 = [8 x i8] c"minutes\00"
@.str.7 = [5 x i8] c"hour\00"
@.str.8 = [7 x i8] c"minute\00"
@.str.9 = [37 x i8] c"Your bus leaves in %d %s and %d %s.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = load i32, i32* @stdout
%10 = tail call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* @stdout
%13 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = load i32, i32* @stdout
%19 = call i32 @fputs(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = sub i32 %21, %23
%26 = mul i32 %25, 60
%27 = sub i32 %22, %24
%28 = add i32 %27, %26
%29 = srem i32 %28, 60
%30 = add i32 %28, -60
%31 = icmp ult i32 %30, 60
%32 = select i1 %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0)
%33 = icmp eq i32 %29, 1
%34 = select i1 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%35 = sdiv i32 %28, 60
%36 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i32 %35, i8* %32, i32 %29, i8* %34)
ret i32 0
}