#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 *);
void log_head(FILE *fp) {
  if (fp != NULL) {
    fprintf(fp, "%s", "Total critical,");
    fprintf(fp, "%d", 0);
    fprintf(fp, "%s\n", "       ");
    fprintf(fp, "%s", "Total errors,");
    fprintf(fp, "%d", 0);
    fprintf(fp, "%s\n", "       ");
    fprintf(fp, "%s", "Total warnings,");
    fprintf(fp, "%d", 0);
    fprintf(fp, "%s\n", "       ");
    fprintf(fp, "%s", "Total info,");
    fprintf(fp, "%d", 0);
    fprintf(fp, "%s\n", "       ");
    fclose(fp);
  }
}


x86 assembly (clang, -O0):
<log_head>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1248 <log_head+0x128>
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
lea    0xeba(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
lea    0xea6(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
lea    0xe97(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
lea    0xe64(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe3a(%rip),%rsi
lea    0xe63(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe36(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe25(%rip),%rsi
lea    0xe22(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdf8(%rip),%rsi
lea    0xe31(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdf4(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xde3(%rip),%rsi
lea    0xde0(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_head>:
test   %rdi,%rdi
je     123c <log_head+0x10c>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xeac(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <fprintf@plt>
lea    0xe9b(%rip),%r15
lea    0xe98(%rip),%r12
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <fprintf@plt>
lea    0xe8b(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <fprintf@plt>
lea    0xe65(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <fprintf@plt>
lea    0xe41(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"Total critical,\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [8 x i8] c" \00"
@.str.5 = [14 x i8] c"Total errors,\00"
@.str.6 = [16 x i8] c"Total warnings,\00"
@.str.7 = [12 x i8] c"Total info,\00"
define void @log_head(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %32
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32*, i32** %2
%9 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%10 = load i32*, i32** %2
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32*, i32** %2
%13 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32*, i32** %2
%15 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%16 = load i32*, i32** %2
%17 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%18 = load i32*, i32** %2
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%20 = load i32*, i32** %2
%21 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%22 = load i32*, i32** %2
%23 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32*, i32** %2
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%26 = load i32*, i32** %2
%27 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%28 = load i32*, i32** %2
%29 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32*, i32** %2
%31 = call i32 @fclose(i32* %30)
br label %32
32: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"Total critical,\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [8 x i8] c" \00"
@.str.5 = [14 x i8] c"Total errors,\00"
@.str.6 = [16 x i8] c"Total warnings,\00"
@.str.7 = [12 x i8] c"Total info,\00"
define void @log_head(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 15, i64 1, i32* %0)
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%6 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 13, i64 1, i32* %0)
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%9 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i64 15, i64 1, i32* %0)
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%12 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i64 11, i64 1, i32* %0)
%14 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%15 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%16 = tail call i32 @fclose(i32* %0)
br label %17
17: ; preds = %3, %1
ret void
}