#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 */
typedef int time_t;
struct tm {
  void *tm_mday;
  void *tm_mon;
  void *tm_year;
};

/* Variables and functions */
void *atoi(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
int /*<<< orphan*/ midstr(char *, char *, int, int);
int mktime(struct tm *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int time(int /*<<< orphan*/);
void output_days_passed(int days, char *date) {
  char buffer[128];
  time_t now, past;
  struct tm tm;
  now = time(0);
  memset(&tm, 0, sizeof(struct tm));
  tm.tm_year = atoi(midstr(buffer, date, 0, 2));
  tm.tm_mon = atoi(midstr(buffer, date, 2, 2)) - 1;
  tm.tm_mday = atoi(midstr(buffer, date, 4, 2));
  past = mktime(&tm);
  if (past == -1) {
    fprintf(stderr, "ERROR: days_passed.e Cannot parse date: (%s)\n", date);
    exit(1);
  }
  if (now - (days * 86400) > past)
    printf("yes\n");
  else
    printf("no\n");
}


x86 assembly (clang, -O0):
<output_days_passed>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,-0x94(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x2,%ecx
call   1090 <midstr@plt>
mov    %eax,%edi
call   1080 <atoi@plt>
mov    %rax,-0xa0(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%ecx
mov    %ecx,%edx
call   1090 <midstr@plt>
mov    %eax,%edi
call   1080 <atoi@plt>
add    $0xffffffffffffffff,%rax
mov    %rax,-0xa8(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1090 <midstr@plt>
mov    %eax,%edi
call   1080 <atoi@plt>
mov    %rax,-0xb0(%rbp)
lea    -0xb0(%rbp),%rdi
call   1070 <mktime@plt>
mov    %eax,-0x98(%rbp)
cmpl   $0xffffffff,-0x98(%rbp)
jne    126a <output_days_passed+0xea>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xda5(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x94(%rbp),%eax
imul   $0x15180,-0x4(%rbp),%ecx
sub    %ecx,%eax
cmp    -0x98(%rbp),%eax
jle    1296 <output_days_passed+0x116>
lea    0xda2(%rip),%rdi
call   1030 <printf@plt>
jmp    12a2 <output_days_passed+0x122>
lea    0xd96(%rip),%rdi
call   1030 <printf@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_days_passed>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa0,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x2,%ecx
call   1090 <midstr@plt>
mov    %eax,%edi
call   1080 <atoi@plt>
mov    %rax,0x18(%rsp)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1090 <midstr@plt>
mov    %eax,%edi
call   1080 <atoi@plt>
add    $0xffffffffffffffff,%rax
mov    %rax,0x10(%rsp)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1090 <midstr@plt>
mov    %eax,%edi
call   1080 <atoi@plt>
mov    %rax,0x8(%rsp)
mov    %r15,%rdi
call   1070 <mktime@plt>
cmp    $0xffffffff,%eax
je     125a <output_days_passed+0xda>
imul   $0xfffeae80,%r14d,%ecx
add    %ecx,%ebp
cmp    %eax,%ebp
lea    0xdf7(%rip),%rax
lea    0xded(%rip),%rdi
cmovg  %rax,%rdi
call   1030 <puts@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i8*, i8*, i8* }
@stderr = global i32 0
@.str = [46 x i8] c"ERROR: days_passed.e Cannot parse date: (%s)\0A\00"
@.str.1 = [5 x i8] c"yes\0A\00"
@.str.2 = [4 x i8] c"no\0A\00"
define void @output_days_passed(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [128 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tm
store i32 %0, i32* %3
store i8* %1, i8** %4
%9 = call i32 @time(i32 0)
store i32 %9, i32* %6
%10 = call i32 @memset(%struct.tm* %8, i32 0, i32 24)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @midstr(i8* %11, i8* %12, i32 0, i32 2)
%14 = call i8* @atoi(i32 %13)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 2
store i8* %14, i8** %15
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%17 = load i8*, i8** %4
%18 = call i32 @midstr(i8* %16, i8* %17, i32 2, i32 2)
%19 = call i8* @atoi(i32 %18)
%20 = getelementptr i8, i8* %19, i64 -1
%21 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 1
store i8* %20, i8** %21
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%23 = load i8*, i8** %4
%24 = call i32 @midstr(i8* %22, i8* %23, i32 4, i32 2)
%25 = call i8* @atoi(i32 %24)
%26 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
store i8* %25, i8** %26
%27 = call i32 @mktime(%struct.tm* %8)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %35
30: ; preds = %2
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %4
%33 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %2
%36 = load i32, i32* %6
%37 = load i32, i32* %3
%38 = mul nsw i32 %37, 86400
%39 = sub nsw i32 %36, %38
%40 = load i32, i32* %7
%41 = icmp sgt i32 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %35
%43 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %46
44: ; preds = %35
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %42
ret void
}

LLVM IR (-O2):
%struct.tm = type { i8*, i8*, i8* }
@stderr = global i32 0
@.str = [46 x i8] c"ERROR: days_passed.e Cannot parse date: (%s)\0A\00"
@str = [3 x i8] c"no\00"
@str.3 = [4 x i8] c"yes\00"
define void @output_days_passed(i32 %0, i8* %1) {
%3 = alloca [128 x i8]
%4 = alloca %struct.tm
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = bitcast %struct.tm* %4 to i8*
%7 = tail call i32 @time(i32 0)
%8 = call i32 @memset(%struct.tm* %4, i32 0, i32 24)
%9 = call i32 @midstr(i8* %5, i8* %1, i32 0, i32 2)
%10 = call i8* @atoi(i32 %9)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
store i8* %10, i8** %11
%12 = call i32 @midstr(i8* %5, i8* %1, i32 2, i32 2)
%13 = call i8* @atoi(i32 %12)
%14 = getelementptr i8, i8* %13, i64 -1
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
store i8* %14, i8** %15
%16 = call i32 @midstr(i8* %5, i8* %1, i32 4, i32 2)
%17 = call i8* @atoi(i32 %16)
%18 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
store i8* %17, i8** %18
%19 = call i32 @mktime(%struct.tm* %4)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %1)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %2
%26 = mul i32 %0, -86400
%27 = add i32 %7, %26
%28 = icmp sgt i32 %27, %19
%29 = select i1 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%30 = call i32 @puts(i8* dereferenceable(1) %29)
ret void
}