#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 uint64_t;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  int /*<<< orphan*/ tm_year;
};

/* Variables and functions */
int getTensYear(int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
uint64_t getDateTime() {
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  uint64_t year = getTensYear(timeinfo->tm_year);
  uint64_t month = timeinfo->tm_mon + 1;
  uint64_t day = timeinfo->tm_mday;
  uint64_t hour = timeinfo->tm_hour;
  uint64_t min = timeinfo->tm_min;
  uint64_t sec = timeinfo->tm_sec;
  uint64_t f = year * 10000000000 + month * 100000000 + day * 1000000 +
               hour * 10000 + min * 100 + sec;
  return f;
}


x86 assembly (clang, -O0):
<getDateTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%edi
call   1040 <getTensYear@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
movabs $0x2540be400,%rcx
imul   %rcx,%rax
imul   $0x5f5e100,-0x18(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
imul   $0xf4240,-0x1c(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
imul   $0x2710,-0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
imul   $0x64,-0x24(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDateTime>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    0x14(%rax),%edi
call   1040 <getTensYear@plt>
mov    0x10(%rbx),%ecx
imul   $0x5f5e100,(%rbx),%edx
imul   $0x540be400,%eax,%eax
add    %eax,%edx
imul   $0xf4240,0x4(%rbx),%eax
add    %edx,%eax
imul   $0x2710,0x8(%rbx),%edx
add    %eax,%edx
imul   $0x64,0xc(%rbx),%eax
add    %edx,%eax
add    %ecx,%eax
add    $0x5f5e100,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @getDateTime() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = call i32 @time(i32* %1)
%11 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %11, %struct.tm** %2
%12 = load %struct.tm*, %struct.tm** %2
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 5
%14 = load i32, i32* %13
%15 = call i32 @getTensYear(i32 %14)
store i32 %15, i32* %3
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
%20 = load %struct.tm*, %struct.tm** %2
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 1
%22 = load i32, i32* %21
store i32 %22, i32* %5
%23 = load %struct.tm*, %struct.tm** %2
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 2
%25 = load i32, i32* %24
store i32 %25, i32* %6
%26 = load %struct.tm*, %struct.tm** %2
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 3
%28 = load i32, i32* %27
store i32 %28, i32* %7
%29 = load %struct.tm*, %struct.tm** %2
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 4
%31 = load i32, i32* %30
store i32 %31, i32* %8
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = mul nsw i64 %33, 10000000000
%35 = load i32, i32* %4
%36 = mul nsw i32 %35, 100000000
%37 = sext i32 %36 to i64
%38 = add nsw i64 %34, %37
%39 = load i32, i32* %5
%40 = mul nsw i32 %39, 1000000
%41 = sext i32 %40 to i64
%42 = add nsw i64 %38, %41
%43 = load i32, i32* %6
%44 = mul nsw i32 %43, 10000
%45 = sext i32 %44 to i64
%46 = add nsw i64 %42, %45
%47 = load i32, i32* %7
%48 = mul nsw i32 %47, 100
%49 = sext i32 %48 to i64
%50 = add nsw i64 %46, %49
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = add nsw i64 %50, %52
%54 = trunc i64 %53 to i32
store i32 %54, i32* %9
%55 = load i32, i32* %9
ret i32 %55
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define i32 @getDateTime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%6 = load i32, i32* %5
%7 = call i32 @getTensYear(i32 %6)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%17 = load i32, i32* %16
%18 = mul i32 %7, 1410065408
%19 = mul i32 %9, 100000000
%20 = mul nsw i32 %11, 1000000
%21 = mul nsw i32 %13, 10000
%22 = mul nsw i32 %15, 100
%23 = add i32 %18, 100000000
%24 = add i32 %23, %19
%25 = add i32 %24, %20
%26 = add i32 %25, %21
%27 = add i32 %26, %22
%28 = add i32 %27, %17
ret i32 %28
}