#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;
};
typedef int /*<<< orphan*/ fstamp;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
FILE *createFile(char *input) {
  struct tm *gtime;
  time_t now;
  time(&now);
  char fstamp[24] = "";
  strftime(fstamp, sizeof(fstamp), "%Y-%m-%d_%H:%M:%S.csv", localtime(&now));
  FILE *fp;
  char fname[200] = "./";
  strcat(fname, input);
  strcat(fname, fstamp);
  fp = fopen(fname, "w");
  return fp;
}


x86 assembly (clang, -O0):
<createFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x108(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x108(%rbp),%rdi
mov    %eax,%ecx
mov    $0x18,%esi
lea    0xe4f(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1040 <memset@plt>
movb   $0x2e,-0x100(%rbp)
movb   $0x2f,-0xff(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x100(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x100(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createFile>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe74(%rip),%rdx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x18,%esi
mov    %eax,%ecx
call   1050 <strftime@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0xf0(%rsp)
movw   $0x2f2e,0x30(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
lea    0xded(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fopen@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [22 x i8] c"%Y-%m-%d_%H:%M:%S.csv\00"
@.str.1 = [2 x i8] c"w\00"
define i32* @createFile(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm*
%4 = alloca i32
%5 = alloca [24 x i8]
%6 = alloca i32*
%7 = alloca [200 x i8]
store i8* %0, i8** %2
%8 = call i32 @time(i32* %4)
%9 = bitcast [24 x i8]* %5 to i8*
%10 = getelementptr inbounds [24 x i8], [24 x i8]* %5, i64 0, i64 0
%11 = call i32 @localtime(i32* %4)
%12 = call i32 @strftime(i8* %10, i32 24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = bitcast [200 x i8]* %7 to i8*
%14 = bitcast i8* %13 to [200 x i8]*
%15 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i32 0, i32 0
store i8 46, i8* %15
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i32 0, i32 1
store i8 47, i8* %16
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%18 = load i8*, i8** %2
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%21 = getelementptr inbounds [24 x i8], [24 x i8]* %5, i64 0, i64 0
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
ret i32* %25
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [22 x i8] c"%Y-%m-%d_%H:%M:%S.csv\00"
@.str.1 = [2 x i8] c"w\00"
define noalias i32* @createFile(i8* %0) {
%2 = alloca i32
%3 = alloca [24 x i8]
%4 = alloca [200 x i8]
%5 = bitcast i32* %2 to i8*
%6 = call i32 @time(i32* %2)
%7 = getelementptr inbounds [24 x i8], [24 x i8]* %3, i64 0, i64 0
%8 = call i32 @localtime(i32* %2)
%9 = call i32 @strftime(i8* %7, i32 24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
store i8 46, i8* %10
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 1
store i8 47, i8* %11
%12 = call i32 @strcat(i8* %10, i8* %0)
%13 = call i32 @strcat(i8* %10, i8* %7)
%14 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32* %14
}