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

/* Variables and functions */
int /*<<< orphan*/ chkFileExist(char const *);
int ll_createfile(char const *);
int ll_createfile_postfix(char const *);
int laulogger_init(const char *file, int overwrite_f) {
  int ret = 0;
  if (file) {
    if (!chkFileExist(file)) {
      ret = ll_createfile(file);
    } else {
      if (overwrite_f) {
        ret = ll_createfile(file);
      } else {
        ret = ll_createfile_postfix(file);
      }
    }
  } else {
    return -10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<laulogger_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a5 <laulogger_init+0x75>
mov    -0x10(%rbp),%rdi
call   1050 <chkFileExist@plt>
cmp    $0x0,%eax
jne    1174 <laulogger_init+0x44>
mov    -0x10(%rbp),%rdi
call   1040 <ll_createfile@plt>
mov    %eax,-0x18(%rbp)
jmp    11a0 <laulogger_init+0x70>
cmpl   $0x0,-0x14(%rbp)
je     118f <laulogger_init+0x5f>
mov    -0x10(%rbp),%rdi
call   1040 <ll_createfile@plt>
mov    %eax,-0x18(%rbp)
jmp    119b <laulogger_init+0x6b>
mov    -0x10(%rbp),%rdi
call   1030 <ll_createfile_postfix@plt>
mov    %eax,-0x18(%rbp)
jmp    11a0 <laulogger_init+0x70>
jmp    11b1 <laulogger_init+0x81>
movl   $0xfffffff6,-0x4(%rbp)
jmp    11b8 <laulogger_init+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<laulogger_init>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1154 <laulogger_init+0x24>
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <chkFileExist@plt>
test   %eax,%eax
je     114a <laulogger_init+0x1a>
test   %ebp,%ebp
je     115b <laulogger_init+0x2b>
mov    %rbx,%rdi
call   1040 <ll_createfile@plt>
jmp    1163 <laulogger_init+0x33>
mov    $0xfffffff6,%eax
jmp    1165 <laulogger_init+0x35>
mov    %rbx,%rdi
call   1030 <ll_createfile_postfix@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @laulogger_init(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %27
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @chkFileExist(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = call i32 @ll_createfile(i8* %14)
store i32 %15, i32* %6
br label %26
16: ; preds = %9
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = call i32 @ll_createfile(i8* %20)
store i32 %21, i32* %6
br label %25
22: ; preds = %16
%23 = load i8*, i8** %4
%24 = call i32 @ll_createfile_postfix(i8* %23)
store i32 %24, i32* %6
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25, %13
br label %28
27: ; preds = %2
store i32 -10, i32* %3
br label %29
28: ; preds = %26
store i32 0, i32* %3
br label %29
29: ; preds = %28, %27
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @laulogger_init(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = tail call i32 @chkFileExist(i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @ll_createfile(i8* %0)
br label %15
9: ; preds = %4
%10 = icmp eq i32 %1, 0
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = tail call i32 @ll_createfile(i8* %0)
br label %15
13: ; preds = %9
%14 = tail call i32 @ll_createfile_postfix(i8* %0)
br label %15
15: ; preds = %11, %13, %7, %2
%16 = phi i32 [ -10, %2 ], [ 0, %7 ], [ 0, %13 ], [ 0, %11 ]
ret i32 %16
}