#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, int, int);
long time(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  long secondsSince1970 = time(NULL);
  long fourMillionSecondsFromNow = secondsSince1970 + 4000000;
  struct tm now;
  localtime_r(&fourMillionSecondsFromNow, &now);
  printf("The date in 4 million seconds will be %d-%d-%d\n", now.tm_mon + 1,
         now.tm_mday, now.tm_year + 1900);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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)
lea    -0x20(%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    0xe79(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
xor    %edi,%edi
call   1050 <time@plt>
add    $0x3d0900,%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <localtime_r@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
add    $0x1,%esi
mov    $0x76c,%ecx
add    0x8(%rsp),%ecx
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [48 x i8] c"The date in 4 million seconds will be %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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i64 @time(i32* null)
store i64 %9, i64* %6
%10 = load i64, i64* %6
%11 = add nsw i64 %10, 4000000
store i64 %11, i64* %7
%12 = call i32 @localtime_r(i64* %7, %struct.tm* %8)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
%16 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 1
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 2
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1900
%21 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %17, i32 %20)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [48 x i8] c"The date in 4 million seconds will be %d-%d-%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca %struct.tm
%5 = tail call i64 @time(i32* null)
%6 = bitcast i64* %3 to i8*
%7 = add nsw i64 %5, 4000000
store i64 %7, i64* %3
%8 = bitcast %struct.tm* %4 to i8*
%9 = call i32 @localtime_r(i64* %3, %struct.tm* %4)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1900
%18 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14, i32 %17)
ret i32 0
}