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

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int,
                           char const *, char const *);
int getpid();
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm const *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void logfileLine(FILE *fp, const char *cFunction, const char *cLogline) {
  if (!fp)
    return;
  time_t luClock;
  char cTime[32];
  pid_t pidThis;
  const struct tm *tmTime;
  pidThis = getpid();
  time(&luClock);
  tmTime = localtime(&luClock);
  strftime(cTime, 31, "%b %d %T", tmTime);
  fprintf(fp, "%s webhook[%u]::%s %s.\n", cTime, pidThis, cFunction, cLogline);
  fflush(fp);
}


x86 assembly (clang, -O0):
<logfileLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1184 <logfileLine+0x24>
jmp    11e5 <logfileLine+0x85>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x44(%rbp)
lea    -0x1c(%rbp),%rdi
call   1060 <time@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%rcx
mov    $0x1f,%esi
lea    0xe48(%rip),%rdx
call   1080 <strftime@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x44(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe32(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <fflush@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logfileLine>:
test   %rdi,%rdi
je     11e4 <logfileLine+0x84>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%r12d
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
lea    0xe60(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1f,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
lea    0xe4d(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
mov    %r12d,%ecx
mov    %r15,%r8
mov    %r14,%r9
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <fflush@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [9 x i8] c"%b %d %T\00"
@.str.1 = [24 x i8] c"%s webhook[%u]::%s %s.\0A\00"
define void @logfileLine(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [32 x i8]
%9 = alloca i32
%10 = alloca %struct.tm*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i32*, i32** %4
%12 = icmp ne i32* %11, null
br i1 %12, label %14, label %13
13: ; preds = %3
br label %29
14: ; preds = %3
%15 = call i32 (...) @getpid()
store i32 %15, i32* %9
%16 = call i32 @time(i32* %7)
%17 = call %struct.tm* @localtime(i32* %7)
store %struct.tm* %17, %struct.tm** %10
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%19 = load %struct.tm*, %struct.tm** %10
%20 = call i32 @strftime(i8* %18, i32 31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %19)
%21 = load i32*, i32** %4
%22 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%23 = load i32, i32* %9
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %23, i8* %24, i8* %25)
%27 = load i32*, i32** %4
%28 = call i32 @fflush(i32* %27)
br label %29
29: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [9 x i8] c"%b %d %T\00"
@.str.1 = [24 x i8] c"%s webhook[%u]::%s %s.\0A\00"
define void @logfileLine(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca [32 x i8]
%6 = icmp eq i32* %0, null
br i1 %6, label %16, label %7
7: ; preds = %3
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%10 = tail call i32 (...) @getpid()
%11 = call i32 @time(i32* %4)
%12 = call %struct.tm* @localtime(i32* %4)
%13 = call i32 @strftime(i8* %9, i32 31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %12)
%14 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %10, i8* %1, i8* %2)
%15 = call i32 @fflush(i32* %0)
br label %16
16: ; preds = %3, %7
ret void
}