#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void printLog(FILE *out, char *msg, char *file, int line, int exit_status) {
  if (file) {
    fprintf(out, "%s. File: %s Line: %d\t", msg, file, line);
  } else {
    fprintf(out, "%s", msg);
  }
  if (exit_status != 0) {
    fprintf(out, "\n");
    exit(exit_status);
  }
}


x86 assembly (clang, -O0):
<printLog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1169 <printLog+0x49>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    117f <printLog+0x5f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x20(%rbp)
je     11a3 <printLog+0x83>
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLog>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rbx
test   %rcx,%rcx
je     1173 <printLog+0x33>
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <fprintf@plt>
test   %ebp,%ebp
jne    1182 <printLog+0x42>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rdx,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
test   %ebp,%ebp
je     116c <printLog+0x2c>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %ebp,%edi
call   1060 <exit@plt>

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

LLVM IR (-O2):
@.str = [23 x i8] c"%s. File: %s Line: %d\09\00"
define void @printLog(i32* nocapture %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = icmp eq i8* %2, null
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i32 %3)
br label %11
9: ; preds = %5
%10 = tail call i32 @fputs(i8* %1, i32* %0)
br label %11
11: ; preds = %9, %7
%12 = icmp eq i32 %4, 0
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = tail call i32 @fputc(i32 10, i32* %0)
%15 = tail call i32 @exit(i32 %4)
unreachable
16: ; preds = %11
ret void
}