#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void create_log() {
  time_t rawtime;
  struct tm *timeinfo;
  char logname[34] = "/var/log/lwsfc/lwsfc.log-", date[9];
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  strftime(date, 9, "%Y%m%d", timeinfo);
  strcat(logname, date);
  FILE *fp = fopen(logname, "a");
  fclose(fp);
}


x86 assembly (clang, -O0):
<create_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x40(%rbp),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x22,%edx
call   1050 <memcpy@plt>
lea    -0x4(%rbp),%rdi
call   1060 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x49(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x9,%esi
lea    0xe6b(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x40(%rbp),%rdi
lea    -0x49(%rbp),%rsi
call   1090 <strcat@plt>
lea    -0x40(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_log>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xea2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movw   $0x0,0x30(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe80(%rip),%rdx
lea    0x3f(%rsp),%r14
mov    %r14,%rdi
mov    $0x9,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rdi
call   1040 <fclose@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@__const.create_log.logname = [34 x i8] c"/var/log/lwsfc/lwsfc.log-\00\00\00\00\00\00\00\00\00"
@.str = [7 x i8] c"%Y%m%d\00"
@.str.1 = [2 x i8] c"a\00"
define void @create_log() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca [34 x i8]
%4 = alloca [9 x i8]
%5 = alloca i32*
%6 = bitcast [34 x i8]* %3 to i8*
%7 = call i32 @time(i32* %1)
%8 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %8, %struct.tm** %2
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %2
%11 = call i32 @strftime(i8* %9, i32 9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = getelementptr inbounds [34 x i8], [34 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%14 = call i32 @strcat(i8* %12, i8* %13)
%15 = getelementptr inbounds [34 x i8], [34 x i8]* %3, i64 0, i64 0
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %5
%17 = load i32*, i32** %5
%18 = call i32 @fclose(i32* %17)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@__const.create_log.logname = [34 x i8] c"/var/log/lwsfc/lwsfc.log-\00\00\00\00\00\00\00\00\00"
@.str = [7 x i8] c"%Y%m%d\00"
@.str.1 = [2 x i8] c"a\00"
define void @create_log() {
%1 = alloca i32
%2 = alloca [34 x i8]
%3 = alloca [9 x i8]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [34 x i8], [34 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%7 = call i32 @time(i32* %1)
%8 = call %struct.tm* @localtime(i32* %1)
%9 = call i32 @strftime(i8* %6, i32 9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%10 = call i32 @strcat(i8* %5, i8* %6)
%11 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @fclose(i32* %11)
ret void
}