#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) {
  struct date {
    int month;
    int day;
    int year;
  };
  struct date today, tomorrow;
  const int daysPerMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  printf("Enter today's date (mm dd yyyy): ");
  scanf("%i%i%i", &today.month, &today.day, &today.year);
  if (today.day != daysPerMonth[today.month - 1]) {
    tomorrow.day = today.day + 1;
    tomorrow.month = today.month;
    tomorrow.year = today.year;
  } else if (today.month == 12) {
    tomorrow.day = 1;
    tomorrow.month = 1;
    tomorrow.year = today.year + 1;
  } else {
    tomorrow.day = 1;
    tomorrow.month = today.month + 1;
    tomorrow.year = today.year;
  }
  printf("Tomorrow's date is %i/%i/%i.\n", tomorrow.month, tomorrow.day,
         tomorrow.year);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    -0x10(%rbp),%rdx
add    $0x4,%rdx
lea    -0x10(%rbp),%rcx
add    $0x8,%rcx
lea    0xed5(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
je     11b2 <main+0x82>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11f3 <main+0xc3>
cmpl   $0xc,-0x10(%rbp)
jne    11d8 <main+0xa8>
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ee <main+0xbe>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11f3 <main+0xc3>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf05(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xf0f(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
movslq 0x8(%rsp),%rsi
lea    0xea3(%rip),%rax
cmp    -0x4(%rax,%rsi,4),%edx
jne    117b <main+0x5b>
cmp    $0xc,%esi
jne    1180 <main+0x60>
mov    0x10(%rsp),%ecx
add    $0x1,%ecx
mov    $0x1,%edx
mov    $0x1,%esi
jmp    118c <main+0x6c>
add    $0x1,%edx
jmp    1188 <main+0x68>
add    $0x1,%esi
mov    $0x1,%edx
mov    0x10(%rsp),%ecx
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.date = type { i32, i32, i32 }
@__const.main.daysPerMonth = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [34 x i8] c"Enter today's date (mm dd yyyy): \00"
@.str.1 = [7 x i8] c"%i%i%i\00"
@.str.2 = [30 x i8] c"Tomorrow's date is %i/%i/%i.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.date
%3 = alloca %struct.date
%4 = alloca [12 x i32]
store i32 0, i32* %1
%5 = bitcast [12 x i32]* %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 0
%8 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 1
%9 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 2
%10 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8, i32* %9)
%11 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 0
%14 = load i32, i32* %13
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [12 x i32], [12 x i32]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %12, %18
br i1 %19, label %20, label %31
20: ; preds = %0
%21 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 1
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
%24 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 1
store i32 %23, i32* %24
%25 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 0
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 0
store i32 %26, i32* %27
%28 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 2
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 2
store i32 %29, i32* %30
br label %52
31: ; preds = %0
%32 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 0
%33 = load i32, i32* %32
%34 = icmp eq i32 %33, 12
br i1 %34, label %35, label %42
35: ; preds = %31
%36 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 1
store i32 1, i32* %36
%37 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 0
store i32 1, i32* %37
%38 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 2
%39 = load i32, i32* %38
%40 = add nsw i32 %39, 1
%41 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 2
store i32 %40, i32* %41
br label %51
42: ; preds = %31
%43 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 1
store i32 1, i32* %43
%44 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 0
%45 = load i32, i32* %44
%46 = add nsw i32 %45, 1
%47 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 0
store i32 %46, i32* %47
%48 = getelementptr inbounds %struct.date, %struct.date* %2, i32 0, i32 2
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 2
store i32 %49, i32* %50
br label %51
51: ; preds = %42, %35
br label %52
52: ; preds = %51, %20
%53 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 0
%54 = load i32, i32* %53
%55 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 1
%56 = load i32, i32* %55
%57 = getelementptr inbounds %struct.date, %struct.date* %3, i32 0, i32 2
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %54, i32 %56, i32 %58)
ret i32 0
}

LLVM IR (-O2):
%struct.date = type { i32, i32, i32 }
@__const.main.daysPerMonth = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [34 x i8] c"Enter today's date (mm dd yyyy): \00"
@.str.1 = [7 x i8] c"%i%i%i\00"
@.str.2 = [30 x i8] c"Tomorrow's date is %i/%i/%i.\0A\00"
define i32 @main() {
%1 = alloca %struct.date
%2 = bitcast %struct.date* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds %struct.date, %struct.date* %1, i64 0, i32 0
%5 = getelementptr inbounds %struct.date, %struct.date* %1, i64 0, i32 1
%6 = getelementptr inbounds %struct.date, %struct.date* %1, i64 0, i32 2
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.main.daysPerMonth, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %8, %13
br i1 %14, label %18, label %15
15: ; preds = %0
%16 = add nsw i32 %8, 1
%17 = load i32, i32* %6
br label %26
18: ; preds = %0
%19 = icmp eq i32 %9, 12
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
br label %26
23: ; preds = %18
%24 = add nsw i32 %9, 1
%25 = load i32, i32* %6
br label %26
26: ; preds = %20, %23, %15
%27 = phi i32 [ %17, %15 ], [ %22, %20 ], [ %25, %23 ]
%28 = phi i32 [ %16, %15 ], [ 1, %20 ], [ 1, %23 ]
%29 = phi i32 [ %9, %15 ], [ 1, %20 ], [ %24, %23 ]
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %28, i32 %27)
ret i32 0
}