#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 check_date(int);
int diffdate(int, int, int, int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int DN, MN, AN, DH, MH, AH;
  DN = check_date(1);
  MN = check_date(2);
  AN = check_date(3);
  DH = check_date(1);
  MH = check_date(2);
  AH = check_date(3);
  while (AN >= AH) {
    AH = check_date(3);
  }
  printf("%d\n", diffdate(DN, MN, AN, DH, MH, AH));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <check_date@plt>
mov    %eax,-0x8(%rbp)
mov    $0x2,%edi
call   1040 <check_date@plt>
mov    %eax,-0xc(%rbp)
mov    $0x3,%edi
call   1040 <check_date@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <check_date@plt>
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
call   1040 <check_date@plt>
mov    %eax,-0x18(%rbp)
mov    $0x3,%edi
call   1040 <check_date@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11ab <main+0x7b>
mov    $0x3,%edi
call   1040 <check_date@plt>
mov    %eax,-0x1c(%rbp)
jmp    118d <main+0x5d>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
call   1050 <diffdate@plt>
mov    %eax,%esi
lea    0xe33(%rip),%rdi
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   %r12
push   %rbx
mov    $0x1,%edi
call   1040 <check_date@plt>
mov    %eax,%r14d
mov    $0x2,%edi
call   1040 <check_date@plt>
mov    %eax,%r15d
mov    $0x3,%edi
call   1040 <check_date@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1040 <check_date@plt>
mov    %eax,%r12d
mov    $0x2,%edi
call   1040 <check_date@plt>
mov    %eax,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x3,%edi
call   1040 <check_date@plt>
cmp    %eax,%ebx
jge    1180 <main+0x50>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
call   1050 <diffdate@plt>
lea    0xe55(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%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
store i32 0, i32* %1
%8 = call i32 @check_date(i32 1)
store i32 %8, i32* %2
%9 = call i32 @check_date(i32 2)
store i32 %9, i32* %3
%10 = call i32 @check_date(i32 3)
store i32 %10, i32* %4
%11 = call i32 @check_date(i32 1)
store i32 %11, i32* %5
%12 = call i32 @check_date(i32 2)
store i32 %12, i32* %6
%13 = call i32 @check_date(i32 3)
store i32 %13, i32* %7
br label %14
14: ; preds = %18, %0
%15 = load i32, i32* %4
%16 = load i32, i32* %7
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @check_date(i32 3)
store i32 %19, i32* %7
br label %14
20: ; preds = %14
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = call i32 @diffdate(i32 %21, i32 %22, i32 %23, i32 %24, i32 %25, i32 %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @check_date(i32 1)
%2 = tail call i32 @check_date(i32 2)
%3 = tail call i32 @check_date(i32 3)
%4 = tail call i32 @check_date(i32 1)
%5 = tail call i32 @check_date(i32 2)
%6 = tail call i32 @check_date(i32 3)
%7 = icmp slt i32 %3, %6
br i1 %7, label %11, label %8
8: ; preds = %0, %8
%9 = tail call i32 @check_date(i32 3)
%10 = icmp slt i32 %3, %9
br i1 %10, label %11, label %8
11: ; preds = %8, %0
%12 = phi i32 [ %6, %0 ], [ %9, %8 ]
%13 = tail call i32 @diffdate(i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}