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

/* Variables and functions */
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ snprintf(char *, int const, char *, int, int, int,
                            int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/);
char *formatDateYYYYMMDDHHMISS(const time_t t, char *szDateBuff,
                               const int nSize) {
  time_t timer = t;
  struct tm tm;
  localtime_r(&timer, &tm);
  snprintf(szDateBuff, nSize, "%04d%02d%02d%02d%02d%02d", tm.tm_year + 1900,
           tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
  return szDateBuff;
}


x86 assembly (clang, -O0):
<formatDateYYYYMMDDHHMISS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%ecx
add    $0x76c,%ecx
mov    -0x2c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x28(%rbp),%r9d
mov    -0x1c(%rbp),%r11d
mov    -0x20(%rbp),%r10d
mov    -0x24(%rbp),%eax
lea    0xe8d(%rip),%rdx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <snprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatDateYYYYMMDDHHMISS>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <localtime_r@plt>
mov    $0x76c,%ecx
add    0x8(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x10(%rsp),%r9d
add    $0x1,%r8d
mov    0x1c(%rsp),%r10d
mov    0x18(%rsp),%ebp
mov    0x14(%rsp),%eax
sub    $0x8,%rsp
lea    0xe90(%rip),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
push   %rax
push   %rbp
push   %r10
call   1040 <snprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [25 x i8] c"%04d%02d%02d%02d%02d%02d\00"
define i8* @formatDateYYYYMMDDHHMISS(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tm
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
store i32 %9, i32* %7
%10 = call i32 @localtime_r(i32* %7, %struct.tm* %8)
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1900
%16 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
%19 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 2
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 5
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 3
%26 = load i32, i32* %25
%27 = call i32 @snprintf(i8* %11, i32 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26)
%28 = load i8*, i8** %5
ret i8* %28
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [25 x i8] c"%04d%02d%02d%02d%02d%02d\00"
define i8* @formatDateYYYYMMDDHHMISS(i32 %0, i8* returned %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.tm
%6 = bitcast i32* %4 to i8*
store i32 %0, i32* %4
%7 = bitcast %struct.tm* %5 to i8*
%8 = call i32 @localtime_r(i32* %4, %struct.tm* %5)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1900
%12 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 5
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 4
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 3
%22 = load i32, i32* %21
%23 = call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22)
ret i8* %1
}