#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int scanf(char *, int *, int *, int *);
int main(void) {
  int month = 0;
  int year = 0;
  int day = 0;
  printf("Please enter a date (mm/dd/yyyy): ");
  while (scanf("%d/%d/%d", &month, &day, &year) < 3) {
    puts("Uh-oh. Input invalid. Did you include "
         "the slashes between the numbers?");
    char c = '\0';
    while ((c = getchar()) != '\n' && c != EOF) {
      continue;
    }
  }
  getchar();
  printf("You entered the date %d%02d%02d", year, month, day);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1060 <scanf@plt>
cmp    $0x3,%eax
jge    11ee <main+0xae>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
movb   $0x0,-0x11(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x12(%rbp)
je     11d4 <main+0x94>
movsbl -0x11(%rbp),%eax
mov    0x2e1f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11e4 <main+0xa4>
jmp    11e9 <main+0xa9>
jmp    11a3 <main+0x63>
jmp    1172 <main+0x32>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@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
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1060 <scanf@plt>
cmp    $0x2,%eax
jg     11f2 <main+0xb2>
lea    0xe91(%rip),%r14
mov    0x2e46(%rip),%rbp
lea    0xe7a(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0x10(%rsp),%rbx
jmp    11d6 <main+0x96>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1060 <scanf@plt>
cmp    $0x2,%eax
jg     11f2 <main+0xb2>
mov    %r14,%rdi
call   1030 <puts@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11c0 <main+0x80>
cmp    0x0(%rbp),%al
jne    11e0 <main+0xa0>
jmp    11c0 <main+0x80>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Please enter a date (mm/dd/yyyy): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [71 x i8] c"Uh-oh. Input invalid. Did you include the slashes between the numbers?\00"
@EOF = global i8 0
@.str.3 = [32 x i8] c"You entered the date %d%02d%02d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %25, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %4, i32* %3)
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = call i32 @puts(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
store i8 0, i8* %5
br label %12
12: ; preds = %24, %10
%13 = call signext i8 (...) @getchar()
store i8 %13, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = load i8, i8* @EOF
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %18, %20
br label %22
22: ; preds = %16, %12
%23 = phi i1 [ false, %12 ], [ %21, %16 ]
br i1 %23, label %24, label %25
24: ; preds = %22
br label %12
25: ; preds = %22
br label %7
26: ; preds = %7
%27 = call signext i8 (...) @getchar()
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
%32 = call signext i8 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Please enter a date (mm/dd/yyyy): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [71 x i8] c"Uh-oh. Input invalid. Did you include the slashes between the numbers?\00"
@EOF = global i8 0
@.str.3 = [32 x i8] c"You entered the date %d%02d%02d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %3, i32* %2)
%9 = icmp slt i32 %8, 3
br i1 %9, label %13, label %21
10: ; preds = %15
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %3, i32* %2)
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %21
13: ; preds = %0, %10
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %15, %13
%16 = call signext i8 (...) @getchar()
%17 = icmp ne i8 %16, 10
%18 = load i8, i8* @EOF
%19 = icmp ne i8 %16, %18
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %15, label %10
21: ; preds = %10, %0
%22 = call signext i8 (...) @getchar()
%23 = load i32, i32* %2
%24 = load i32, i32* %1
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
%27 = call signext i8 (...) @getchar()
ret i32 0
}