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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
char *klog_gettime();
int /*<<< orphan*/ strcat(char *, char *);
void klog_filelog(char *file_path) {
  char string[80];
  strcat(string, "\n=> LOG: ");
  strcat(string, klog_gettime());
  strcat(string, "\n");
  FILE *fp = fopen(file_path, "a");
  fputs(string, fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<klog_filelog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    $0x0,%al
call   1050 <klog_gettime@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
lea    -0x60(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x68(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<klog_filelog>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%r14
lea    0xe9d(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1070 <strcat@plt>
xor    %eax,%eax
call   1050 <klog_gettime@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1070 <strcat@plt>
lea    0xe83(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcat@plt>
lea    0xe76(%rip),%rsi
mov    %r14,%rdi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0A=> LOG: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c"a\00"
define void @klog_filelog(i8* %0) {
%2 = alloca i8*
%3 = alloca [80 x i8]
%4 = alloca i32*
store i8* %0, i8** %2
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%8 = call i8* (...) @klog_gettime()
%9 = call i32 @strcat(i8* %7, i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %2
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %13, i32** %4
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%15 = load i32*, i32** %4
%16 = call i32 @fputs(i8* %14, i32* %15)
%17 = load i32*, i32** %4
%18 = call i32 @fclose(i32* %17)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"\0A=> LOG: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c"a\00"
define void @klog_filelog(i8* nocapture %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i8* (...) @klog_gettime()
%6 = call i32 @strcat(i8* %3, i8* %5)
%7 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @fputs(i8* %3, i32* %8)
%10 = call i32 @fclose(i32* %8)
ret void
}