#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*/ assert(int);
int create_config(char const *);
int /*<<< orphan*/ create_db(char const *);
int /*<<< orphan*/ eprintf(char *, char const *);
scalar_t__ exists(char const *);
int /*<<< orphan*/ mkdir(char const *, int);
void init(const char *path) {
  if (exists(path)) {
    eprintf("%s is already initialized\n", path);
  }
  assert(!mkdir(path, 0755));
  assert(create_config(path));
  create_db(path);
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <exists@plt>
cmp    $0x0,%rax
je     118f <init+0x2f>
mov    -0x8(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1070 <eprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <create_config@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1060 <create_db@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rbx
mov    %rdi,%rbx
call   1080 <exists@plt>
test   %rax,%rax
je     117d <init+0x1d>
lea    0xe8b(%rip),%rdi
mov    %rbx,%rsi
call   1070 <eprintf@plt>
mov    %rbx,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <create_config@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <create_db@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"%s is already initialized\0A\00"
define void @init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @exists(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @eprintf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %1
%10 = load i8*, i8** %2
%11 = call i32 @mkdir(i8* %10, i32 493)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i8*, i8** %2
%17 = call i32 @create_config(i8* %16)
%18 = call i32 @assert(i32 %17)
%19 = load i8*, i8** %2
%20 = call i32 @create_db(i8* %19)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s is already initialized\0A\00"
define void @init(i8* %0) {
%2 = tail call i64 @exists(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @eprintf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @mkdir(i8* %0, i32 493)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @create_config(i8* %0)
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @create_db(i8* %0)
ret void
}