#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 earliest_year, earliest_month, earliest_day;
  int year, month, day;
  bool date_earlier_flag;
  earliest_year = 99;
  earliest_month = 12;
  earliest_day = 31;
  for (;;) {
    date_earlier_flag = false;
    printf("Enter a date (mm/dd/yy): ");
    scanf("%2d/%2d/%2d", &month, &day, &year);
    if (!(year || month || day)) {
      break;
    }
    if (year < earliest_year) {
      date_earlier_flag = true;
    } else if (year == earliest_year && month < earliest_month) {
      date_earlier_flag = true;
    } else if (month == earliest_month && day < earliest_day) {
      date_earlier_flag = true;
    }
    if (date_earlier_flag) {
      earliest_year = year;
      earliest_month = month;
      earliest_day = day;
    }
  }
  printf("%02d/%02d/%02d is earliest date.\n", earliest_month, earliest_day,
         earliest_year);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x63,-0x8(%rbp)
movl   $0xc,-0xc(%rbp)
movl   $0x1f,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1194 <main+0x74>
cmpl   $0x0,-0x18(%rbp)
jne    1194 <main+0x74>
cmpl   $0x0,-0x1c(%rbp)
jne    1194 <main+0x74>
jmp    121a <main+0xfa>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ac <main+0x8c>
movl   $0x1,-0x20(%rbp)
jmp    11f9 <main+0xd9>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d0 <main+0xb0>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d0 <main+0xb0>
movl   $0x1,-0x20(%rbp)
jmp    11f4 <main+0xd4>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11ef <main+0xcf>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ef <main+0xcf>
movl   $0x1,-0x20(%rbp)
jmp    11f4 <main+0xd4>
jmp    11f9 <main+0xd9>
cmpl   $0x0,-0x20(%rbp)
je     1215 <main+0xf5>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%edx
test   %eax,%eax
jne    1184 <main+0x64>
test   %ecx,%ecx
jne    1184 <main+0x64>
test   %edx,%edx
jne    1184 <main+0x64>
mov    $0x1f,%r14d
mov    $0xc,%ebp
mov    $0x63,%ebx
jmp    1212 <main+0xf2>
mov    $0x63,%ebx
mov    $0xc,%ebp
mov    $0x1f,%r14d
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%r15
lea    0x14(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %ebx,%eax
jl     11d0 <main+0xb0>
jne    11ba <main+0x9a>
cmp    %ebp,%ecx
jl     11d0 <main+0xb0>
cmp    %ebp,%ecx
jne    11d7 <main+0xb7>
cmp    %r14d,%edx
jge    11d7 <main+0xb7>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ebx
mov    %ecx,%ebp
mov    %edx,%r14d
lea    0xe22(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%edx
test   %eax,%eax
jne    11b0 <main+0x90>
test   %ecx,%ecx
jne    11b0 <main+0x90>
test   %edx,%edx
jne    11b0 <main+0x90>
lea    0xe0d(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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