#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 tm_hour;
  int tm_min;
  int /*<<< orphan*/ tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, int,
                           int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  time_t t = time(NULL);
  struct tm *tm = localtime(&t);
  fprintf(stdout, "%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 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    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x20(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe5c(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    0x2e93(%rip),%rcx
mov    (%rcx),%edi
mov    $0x76c,%edx
add    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
add    $0x1,%ecx
mov    0xc(%rax),%r9d
mov    0x10(%rax),%r10d
mov    0x14(%rax),%eax
lea    0xe8e(%rip),%rsi
push   %rax
push   %r10
call   1040 <fprintf@plt>
add    $0x10,%rsp
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@stdout = global i32 0
@.str = [28 x i8] c"%04d-%02d-%02d_%02d%02d%02d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%7 = load i32, i32* @stdout
%8 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
%11 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21)
ret i32 0
}