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

/* Variables and functions */
int /*<<< orphan*/ localtime_r(long *, struct tm *);
int /*<<< orphan*/ printf(char *, int, ...);
long time(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  long secondsSince1970 = time(NULL);
  long moreSecondsSince1970 = secondsSince1970 + 4000000;
  printf("It has been %ld seconds since 1970\n", secondsSince1970);
  printf("It will be: %ld seconds more in 4 millions seconds since 1970\n",
         moreSecondsSince1970);
  struct tm now;
  localtime_r(&secondsSince1970, &now);
  printf("The current date is %d-%d-%d\n", now.tm_mon + 1, now.tm_mday,
         now.tm_year + 1900);
  struct tm later;
  localtime_r(&moreSecondsSince1970, &later);
  printf("The date in 4 million seconds is %d-%d-%d\n", later.tm_mon + 1,
         later.tm_mday, later.tm_year + 1900);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x3d0900,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x30(%rbp),%esi
add    $0x1,%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
add    $0x76c,%ecx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x40(%rbp),%esi
add    $0x1,%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
add    $0x76c,%ecx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,0x28(%rsp)
lea    0x3d0900(%rax),%rbx
mov    %rbx,0x20(%rsp)
lea    0xeac(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <localtime_r@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
add    $0x1,%esi
mov    $0x76c,%ebx
mov    0x18(%rsp),%ecx
add    %ebx,%ecx
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <localtime_r@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
add    $0x1,%esi
add    0x8(%rsp),%ebx
lea    0xebf(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [36 x i8] c"It has been %ld seconds since 1970\0A\00"
@.str.1 = [63 x i8] c"It will be: %ld seconds more in 4 millions seconds since 1970\0A\00"
@.str.2 = [30 x i8] c"The current date is %d-%d-%d\0A\00"
@.str.3 = [43 x i8] c"The date in 4 million seconds is %d-%d-%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca %struct.tm
%9 = alloca %struct.tm
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i64 @time(i32* null)
store i64 %10, i64* %6
%11 = load i64, i64* %6
%12 = add nsw i64 %11, 4000000
store i64 %12, i64* %7
%13 = load i64, i64* %6
%14 = trunc i64 %13 to i32
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i64, i64* %7
%17 = trunc i64 %16 to i32
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = call i32 @localtime_r(i64* %6, %struct.tm* %8)
%20 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
%23 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 1
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 2
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 1900
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %24, i32 %27)
%29 = call i32 @localtime_r(i64* %7, %struct.tm* %9)
%30 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
%33 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
%34 = load i32, i32* %33
%35 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 2
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 1900
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %32, i32 %34, i32 %37)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [36 x i8] c"It has been %ld seconds since 1970\0A\00"
@.str.1 = [63 x i8] c"It will be: %ld seconds more in 4 millions seconds since 1970\0A\00"
@.str.2 = [30 x i8] c"The current date is %d-%d-%d\0A\00"
@.str.3 = [43 x i8] c"The date in 4 million seconds is %d-%d-%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca %struct.tm
%6 = alloca %struct.tm
%7 = bitcast i64* %3 to i8*
%8 = tail call i64 @time(i32* null)
store i64 %8, i64* %3
%9 = bitcast i64* %4 to i8*
%10 = add nsw i64 %8, 4000000
store i64 %10, i64* %4
%11 = trunc i64 %8 to i32
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = trunc i64 %10 to i32
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = bitcast %struct.tm* %5 to i8*
%16 = call i32 @localtime_r(i64* %3, %struct.tm* %5)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
%20 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1900
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %21, i32 %24)
%26 = bitcast %struct.tm* %6 to i8*
%27 = call i32 @localtime_r(i64* %4, %struct.tm* %6)
%28 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 1
%31 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1900
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %32, i32 %35)
ret i32 0
}