#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*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, char *,
                           char *);
int /*<<< orphan*/ set_current_time(char *);
void write_to_log(char *getline, char *completion, char *ip, FILE *logfile) {
  char curr_time[4096] = {0};
  set_current_time(curr_time);
  fprintf(logfile, "%s\t%s\t%s\t%s\n", curr_time, ip, getline, completion);
  fclose(logfile);
}


x86 assembly (clang, -O0):
<write_to_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x1020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1040 <memset@plt>
lea    -0x1020(%rbp),%rdi
call   1060 <set_current_time@plt>
mov    -0x20(%rbp),%rdi
lea    -0x1020(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xe68(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_log>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1000,%rsp
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%r13
mov    $0x1000,%edx
mov    %r13,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r13,%rdi
call   1060 <set_current_time@plt>
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %r12,%r8
mov    %r15,%r9
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x1000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%s\09%s\09%s\09%s\0A\00"
define void @write_to_log(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca [4096 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%10 = bitcast [4096 x i8]* %9 to i8*
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%12 = call i32 @set_current_time(i8* %11)
%13 = load i32*, i32** %8
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i8* %16, i8* %17)
%19 = load i32*, i32** %8
%20 = call i32 @fclose(i32* %19)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s\09%s\09%s\09%s\0A\00"
define void @write_to_log(i8* %0, i8* %1, i8* %2, i32* nocapture %3) {
%5 = alloca [4096 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%7 = call i32 @set_current_time(i8* %6)
%8 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %2, i8* %0, i8* %1)
%9 = call i32 @fclose(i32* %3)
ret void
}