#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 dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int createLogfileName(char *resultStr, int maxSize) {
  time_t now;
  struct tm *timeInfo;
  time(&now);
  timeInfo = localtime(&now);
  char timeFormat[] = "%Y_%m_%d_%H_%M.csv";
  char timeStr[1024] = {0};
  strftime(resultStr, maxSize, timeFormat, timeInfo);
  return 0;
}


x86 assembly (clang, -O0):
<createLogfileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
call   1050 <time@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    0xe91(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe8e(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe8b(%rip),%ax
mov    %ax,-0x20(%rbp)
mov    0xe83(%rip),%al
mov    %al,-0x1e(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1060 <strftime@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createLogfileName>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x767363,0x1f(%rsp)
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@__const.createLogfileName.timeFormat = [19 x i8] c"%Y_%m_%d_%H_%M.csv\00"
define i32 @createLogfileName(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.tm*
%7 = alloca [19 x i8]
%8 = alloca [1024 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = call i32 @time(i32* %5)
%10 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %10, %struct.tm** %6
%11 = bitcast [19 x i8]* %7 to i8*
%12 = bitcast [1024 x i8]* %8 to i8*
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%16 = load %struct.tm*, %struct.tm** %6
%17 = call i32 @strftime(i8* %13, i32 %14, i8* %15, %struct.tm* %16)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@__const.createLogfileName.timeFormat = [19 x i8] c"%Y_%m_%d_%H_%M.csv\00"
define i32 @createLogfileName(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [19 x i8]
%5 = bitcast i32* %3 to i8*
%6 = call i32 @time(i32* %3)
%7 = call %struct.tm* @localtime(i32* %3)
%8 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%9 = call i32 @strftime(i8* %0, i32 %1, i8* %8, %struct.tm* %7)
ret i32 0
}