#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 *);
int main(void) {
  int month_one, day_one, year_one, month_two, day_two, year_two;
  int first_date_earlier_flag = 0;
  printf("Enter first date (mm/dd/yy): ");
  scanf("%d/%d/%d", &month_one, &day_one, &year_one);
  printf("Enter second date (mm/dd/yy): ");
  scanf("%d/%d/%d", &month_two, &day_two, &year_two);
  if (month_one == 0 || month_one > 13 || day_one == 0 || day_one > 31 ||
      month_two == 0 || month_two > 13 || day_two == 0 || day_two > 31) {
    printf("Invalid input, please check dates.\n");
    return 1;
  }
  if (year_one < year_two) {
    first_date_earlier_flag = 1;
    if (first_date_earlier_flag == 0 && month_one < month_two) {
      first_date_earlier_flag = 1;
      if (day_one < day_two) {
        first_date_earlier_flag = 1;
      }
    }
  }
  printf("%d/%d/%d is ", month_one, day_one, year_one);
  if (first_date_earlier_flag) {
    printf("earlier");
  } else {
    printf("later");
  }
  printf(" than %d/%d/%d\n", month_two, day_two, year_two);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11d2 <main+0xb2>
cmpl   $0xd,-0x8(%rbp)
jg     11d2 <main+0xb2>
cmpl   $0x0,-0xc(%rbp)
je     11d2 <main+0xb2>
cmpl   $0x1f,-0xc(%rbp)
jg     11d2 <main+0xb2>
cmpl   $0x0,-0x14(%rbp)
je     11d2 <main+0xb2>
cmpl   $0xd,-0x14(%rbp)
jg     11d2 <main+0xb2>
cmpl   $0x0,-0x18(%rbp)
je     11d2 <main+0xb2>
cmpl   $0x1f,-0x18(%rbp)
jle    11ec <main+0xcc>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1299 <main+0x179>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1239 <main+0x119>
movl   $0x1,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1234 <main+0x114>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1234 <main+0x114>
movl   $0x1,-0x20(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    122f <main+0x10f>
movl   $0x1,-0x20(%rbp)
jmp    1234 <main+0x114>
jmp    1239 <main+0x119>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
je     126d <main+0x14d>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127b <main+0x15b>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rbx
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
test   %esi,%esi
je     1207 <main+0xd7>
cmp    $0xd,%esi
jg     1207 <main+0xd7>
mov    0x10(%rsp),%edx
test   %edx,%edx
je     1207 <main+0xd7>
cmp    $0x1f,%edx
jg     1207 <main+0xd7>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     1207 <main+0xd7>
cmp    $0xd,%eax
jg     1207 <main+0xd7>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1207 <main+0xd7>
cmp    $0x20,%eax
jge    1207 <main+0xd7>
mov    0xc(%rsp),%ecx
cmp    (%rsp),%ecx
lea    0xe7f(%rip),%rdi
lea    0xe85(%rip),%rax
lea    0xe86(%rip),%rbx
cmovl  %rax,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1218 <main+0xe8>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Enter first date (mm/dd/yy): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [31 x i8] c"Enter second date (mm/dd/yy): \00"
@.str.3 = [36 x i8] c"Invalid input, please check dates.\0A\00"
@.str.4 = [13 x i8] c"%d/%d/%d is \00"
@.str.5 = [8 x i8] c"earlier\00"
@.str.6 = [6 x i8] c"later\00"
@.str.7 = [16 x i8] c" than %d/%d/%d\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
store i32 0, i32* %1
store i32 0, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 0
br i1 %14, label %36, label %15
15: ; preds = %0
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 13
br i1 %17, label %36, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %36, label %21
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 31
br i1 %23, label %36, label %24
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 0
br i1 %26, label %36, label %27
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp sgt i32 %28, 13
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp sgt i32 %34, 31
br i1 %35, label %36, label %38
36: ; preds = %33, %30, %27, %24, %21, %18, %15, %0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %72
38: ; preds = %33
%39 = load i32, i32* %4
%40 = load i32, i32* %7
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %56
42: ; preds = %38
store i32 1, i32* %8
%43 = load i32, i32* %8
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %42
%46 = load i32, i32* %2
%47 = load i32, i32* %5
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %55
49: ; preds = %45
store i32 1, i32* %8
%50 = load i32, i32* %3
%51 = load i32, i32* %6
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %54
53: ; preds = %49
store i32 1, i32* %8
br label %54
54: ; preds = %53, %49
br label %55
55: ; preds = %54, %45, %42
br label %56
56: ; preds = %55, %38
%57 = load i32, i32* %2
%58 = load i32, i32* %3
%59 = load i32, i32* %4
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %57, i32 %58, i32 %59)
%61 = load i32, i32* %8
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %56
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %67
65: ; preds = %56
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %67
67: ; preds = %65, %63
%68 = load i32, i32* %5
%69 = load i32, i32* %6
%70 = load i32, i32* %7
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %68, i32 %69, i32 %70)
store i32 0, i32* %1
br label %72
72: ; preds = %67, %36
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [30 x i8] c"Enter first date (mm/dd/yy): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [31 x i8] c"Enter second date (mm/dd/yy): \00"
@.str.4 = [13 x i8] c"%d/%d/%d is \00"
@.str.5 = [8 x i8] c"earlier\00"
@.str.6 = [6 x i8] c"later\00"
@.str.7 = [16 x i8] c" than %d/%d/%d\0A\00"
@str = [35 x i8] c"Invalid input, please check dates.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 0
%19 = icmp sgt i32 %17, 13
%20 = or i1 %18, %19
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 0
%23 = select i1 %20, i1 true, i1 %22
%24 = icmp sgt i32 %21, 31
%25 = select i1 %23, i1 true, i1 %24
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 0
%28 = select i1 %25, i1 true, i1 %27
%29 = icmp sgt i32 %26, 13
%30 = select i1 %28, i1 true, i1 %29
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 0
%33 = select i1 %30, i1 true, i1 %32
%34 = icmp sgt i32 %31, 31
%35 = select i1 %33, i1 true, i1 %34
br i1 %35, label %36, label %38
36: ; preds = %0
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %49
38: ; preds = %0
%39 = load i32, i32* %3
%40 = load i32, i32* %6
%41 = icmp slt i32 %39, %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %21, i32 %39)
%43 = select i1 %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %43)
%45 = load i32, i32* %4
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %45, i32 %46, i32 %47)
br label %49
49: ; preds = %38, %36
%50 = phi i32 [ 1, %36 ], [ 0, %38 ]
ret i32 %50
}