#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 EXIT_SUCCESS;
int /*<<< orphan*/ localtime_r(long *, struct tm *);
int /*<<< orphan*/ printf(char *, int, ...);
long time(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  long timeInSeconds = time(NULL);
  printf("Time since 1970 is %ld\n", timeInSeconds);
  timeInSeconds = timeInSeconds + 4000000;
  struct tm timeInFuture;
  localtime_r(&timeInSeconds, &timeInFuture);
  printf("The time in 4MM seconds will be, %d-%d-%d\n", timeInFuture.tm_mon + 1,
         timeInFuture.tm_mday, timeInFuture.tm_year + 1900);
  return EXIT_SUCCESS;
}


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
mov    %eax,%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x3d0900,%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
add    $0x76c,%ecx
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [24 x i8] c"Time since 1970 is %ld\0A\00"
@.str.1 = [43 x i8] c"The time in 4MM seconds will be, %d-%d-%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca %struct.tm
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @time(i32* null)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = trunc i64 %9 to i32
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i64, i64* %6
%13 = add nsw i64 %12, 4000000
store i64 %13, i64* %6
%14 = call i32 @localtime_r(i64* %6, %struct.tm* %7)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1900
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %19, i32 %22)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

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