#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 {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_isdst;
  scalar_t__ tm_hour;
  scalar_t__ tm_min;
  scalar_t__ tm_sec;
};

/* Variables and functions */
long long difftime(int, int);
int mktime(struct tm *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int time(int /*<<< orphan*/ *);
int main() {
  int day, month, year;
  struct tm time_struct;
  time_t time1, time2;
  time1 = time(NULL);
  printf("Enter birth year in format (day.month.year): ");
  scanf("%d.%d.%d", &day, &month, &year);
  time_struct.tm_year = year - 1900;
  time_struct.tm_mon = month - 1;
  time_struct.tm_mday = day;
  time_struct.tm_sec = 0;
  time_struct.tm_min = 0;
  time_struct.tm_hour = 0;
  time_struct.tm_isdst = -1;
  time2 = mktime(&time_struct);
  if (time2 == -1) {
    printf("Error getting time.\n");
    return -1;
  }
  long long diff_sec = difftime(time1, time2);
  int currentYear = diff_sec / 31536000;
  int afterTenYears = currentYear + 10;
  printf("Now: %d\nAfter 10 years: %d", currentYear, afterTenYears);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x3c(%rbp)
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1070 <scanf@plt>
mov    -0x10(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x30(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
lea    -0x38(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0xffffffff,-0x40(%rbp)
jne    11fa <main+0xaa>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    123e <main+0xee>
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1040 <difftime@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    $0x1e13380,%ecx
cqto
idiv   %rcx
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%ebp
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1080 <scanf@plt>
mov    $0xfffff894,%eax
add    0x4(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x14(%rsp)
mov    0xc(%rsp),%eax
mov    %eax,0x18(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movl   $0xffffffff,0x1c(%rsp)
ff
lea    0x10(%rsp),%rdi
call   1070 <mktime@plt>
cmp    $0xffffffff,%eax
je     1221 <main+0xc1>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <difftime@plt>
mov    %rax,%rcx
movabs $0x883148f5cb1270b9,%rdx
48 31 88
imul   %rdx
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x18,%rdx
lea    (%rdx,%rax,1),%esi
add    %eax,%edx
add    $0xa,%edx
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1232 <main+0xd2>
lea    0xe2a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@.str = [46 x i8] c"Enter birth year in format (day.month.year): \00"
@.str.1 = [9 x i8] c"%d.%d.%d\00"
@.str.2 = [21 x i8] c"Error getting time.\0A\00"
@.str.3 = [27 x i8] c"Now: %d\0AAfter 10 years: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.tm
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 @time(i32* null)
store i32 %11, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1900
%16 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
store i32 %15, i32* %16
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 1
store i32 %18, i32* %19
%20 = load i32, i32* %2
%21 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
store i32 %20, i32* %21
%22 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 6
store i64 0, i64* %22
%23 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 5
store i64 0, i64* %23
%24 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 4
store i64 0, i64* %24
%25 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
store i32 -1, i32* %25
%26 = call i32 @mktime(%struct.tm* %5)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %43
31: ; preds = %0
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = call i64 @difftime(i32 %32, i32 %33)
store i64 %34, i64* %8
%35 = load i64, i64* %8
%36 = sdiv i64 %35, 31536000
%37 = trunc i64 %36 to i32
store i32 %37, i32* %9
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 10
store i32 %39, i32* %10
%40 = load i32, i32* %9
%41 = load i32, i32* %10
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %40, i32 %41)
store i32 0, i32* %1
br label %43
43: ; preds = %31, %29
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@.str = [46 x i8] c"Enter birth year in format (day.month.year): \00"
@.str.1 = [9 x i8] c"%d.%d.%d\00"
@.str.3 = [27 x i8] c"Now: %d\0AAfter 10 years: %d\00"
@str = [20 x i8] c"Error getting time.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast %struct.tm* %4 to i8*
%9 = tail call i32 @time(i32* null)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%12 = load i32, i32* %3
%13 = add nsw i32 %12, -1900
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
store i32 %13, i32* %14
%15 = load i32, i32* %2
%16 = add nsw i32 %15, -1
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
store i32 %16, i32* %17
%18 = load i32, i32* %1
%19 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
store i32 %18, i32* %19
%20 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%21 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%22 = bitcast i64* %20 to i8*
store i32 -1, i32* %21
%23 = call i32 @mktime(%struct.tm* %4)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %27
25: ; preds = %0
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %33
27: ; preds = %0
%28 = call i64 @difftime(i32 %9, i32 %23)
%29 = sdiv i64 %28, 31536000
%30 = trunc i64 %29 to i32
%31 = add nsw i32 %30, 10
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %31)
br label %33
33: ; preds = %27, %25
%34 = phi i32 [ -1, %25 ], [ 0, %27 ]
ret i32 %34
}