#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 day1, month1, year1;
  int day2, month2, year2;
  int total1, total2;
  printf("Enter 1st date (yyyy/mm/dd): ");
  scanf("%d/%d/%d", &year1, &month1, &day1);
  total1 = year1 * 365 + month1 * 30 + day1;
  printf("Enter 2nd date (yyyy/mm/dd): ");
  scanf("%d/%d/%d", &year2, &month2, &day2);
  total2 = year2 * 365 + month2 * 30 + day2;
  if (total1 == total2) {
    printf("Dates are the same!\n");
  } else if (total1 < total2) {
    printf("%d/%d/%d is earlier than %d/%d/%d\n", year2, month2, day2, year1,
           month1, day1);
  } else {
    printf("%d/%d/%d is earlier than %d/%d/%d\n", year1, month1, day1, year2,
           month2, day2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1040 <scanf@plt>
imul   $0x16d,-0x10(%rbp),%eax
imul   $0x1e,-0xc(%rbp),%ecx
add    %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1040 <scanf@plt>
imul   $0x16d,-0x1c(%rbp),%eax
imul   $0x1e,-0x18(%rbp),%ecx
add    %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    11c0 <main+0xa0>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1220 <main+0x100>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11f6 <main+0xd6>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe73(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121b <main+0xfb>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x14(%rbp),%eax
lea    0xe49(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1220 <main+0x100>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rbx
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x18(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
imul   $0x16d,0x10(%rsp),%eax
mov    0x14(%rsp),%ecx
mov    %ecx,%ebp
shl    $0x5,%ebp
sub    %ecx,%ebp
sub    %ecx,%ebp
add    %eax,%ebp
add    0x18(%rsp),%ebp
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x24(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x1c(%rsp),%r8d
imul   $0x16d,%r8d,%eax
mov    0x20(%rsp),%r9d
mov    %r9d,%edx
shl    $0x5,%edx
sub    %r9d,%edx
sub    %r9d,%edx
add    %eax,%edx
mov    0x24(%rsp),%ecx
add    %ecx,%edx
cmp    %edx,%ebp
jne    11d9 <main+0xa9>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
jmp    1218 <main+0xe8>
mov    0x10(%rsp),%ebx
mov    0x14(%rsp),%r10d
mov    0x18(%rsp),%eax
jge    1200 <main+0xd0>
mov    %eax,(%rsp)
lea    0xe53(%rip),%rdi
mov    %r8d,%esi
mov    %r9d,%edx
mov    %ebx,%r8d
mov    %r10d,%r9d
jmp    1211 <main+0xe1>
mov    %ecx,(%rsp)
lea    0xe3b(%rip),%rdi
mov    %ebx,%esi
mov    %r10d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Enter 1st date (yyyy/mm/dd): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [30 x i8] c"Enter 2nd date (yyyy/mm/dd): \00"
@.str.3 = [21 x i8] c"Dates are the same!\0A\00"
@.str.4 = [35 x i8] c"%d/%d/%d is earlier 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
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %3, i32* %2)
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 365
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 30
%16 = add nsw i32 %13, %15
%17 = load i32, i32* %2
%18 = add nsw i32 %16, %17
store i32 %18, i32* %8
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %6, i32* %5)
%21 = load i32, i32* %7
%22 = mul nsw i32 %21, 365
%23 = load i32, i32* %6
%24 = mul nsw i32 %23, 30
%25 = add nsw i32 %22, %24
%26 = load i32, i32* %5
%27 = add nsw i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %54
33: ; preds = %0
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %45
37: ; preds = %33
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = load i32, i32* %5
%41 = load i32, i32* %4
%42 = load i32, i32* %3
%43 = load i32, i32* %2
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %38, i32 %39, i32 %40, i32 %41, i32 %42, i32 %43)
br label %53
45: ; preds = %33
%46 = load i32, i32* %4
%47 = load i32, i32* %3
%48 = load i32, i32* %2
%49 = load i32, i32* %7
%50 = load i32, i32* %6
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %46, i32 %47, i32 %48, i32 %49, i32 %50, i32 %51)
br label %53
53: ; preds = %45, %37
br label %54
54: ; preds = %53, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Enter 1st date (yyyy/mm/dd): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [30 x i8] c"Enter 2nd date (yyyy/mm/dd): \00"
@.str.4 = [35 x i8] c"%d/%d/%d is earlier than %d/%d/%d\0A\00"
@str = [20 x i8] c"Dates are the same!\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* %3, i32* %2, i32* %1)
%15 = load i32, i32* %3
%16 = mul nsw i32 %15, 365
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 30
%19 = add nsw i32 %18, %16
%20 = load i32, i32* %1
%21 = add nsw i32 %19, %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %5, i32* %4)
%24 = load i32, i32* %6
%25 = mul nsw i32 %24, 365
%26 = load i32, i32* %5
%27 = mul nsw i32 %26, 30
%28 = add nsw i32 %27, %25
%29 = load i32, i32* %4
%30 = add nsw i32 %28, %29
%31 = icmp eq i32 %21, %30
br i1 %31, label %32, label %34
32: ; preds = %0
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %43
34: ; preds = %0
%35 = icmp slt i32 %21, %30
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = load i32, i32* %1
br i1 %35, label %39, label %41
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %24, i32 %26, i32 %29, i32 %36, i32 %37, i32 %38)
br label %43
41: ; preds = %34
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %36, i32 %37, i32 %38, i32 %24, i32 %26, i32 %29)
br label %43
43: ; preds = %39, %41, %32
ret i32 0
}