#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 S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXOTH;
scalar_t__ core_directory_verify_existence(char const *);
int mkdir(char const *, int);
int core_directory_create(const char *directory) {
  int status;
  if (core_directory_verify_existence(directory)) {
    return 0;
  }
  status = mkdir(directory, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
  if (status == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<core_directory_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <core_directory_verify_existence@plt>
cmp    $0x0,%rax
je     114b <core_directory_create+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1198 <core_directory_create+0x78>
mov    -0x10(%rbp),%rdi
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
mov    0x2e79(%rip),%rax
or     (%rax),%esi
mov    0x2e60(%rip),%rax
or     (%rax),%esi
mov    0x2e6f(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1191 <core_directory_create+0x71>
movl   $0x1,-0x4(%rbp)
jmp    1198 <core_directory_create+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<core_directory_create>:
push   %rbx
mov    %rdi,%rbx
call   1040 <core_directory_verify_existence@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <core_directory_create+0x15>
pop    %rbx
ret
mov    0x2eac(%rip),%rax
mov    0x2e95(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e7a(%rip),%rax
or     (%rax),%esi
mov    0x2e89(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
call   1030 <mkdir@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @core_directory_create(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @core_directory_verify_existence(i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %23
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i32, i32* @S_IRWXU
%12 = load i32, i32* @S_IRWXG
%13 = or i32 %11, %12
%14 = load i32, i32* @S_IROTH
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IXOTH
%17 = or i32 %15, %16
%18 = call i32 @mkdir(i8* %10, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %9
store i32 1, i32* %2
br label %23
22: ; preds = %9
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21, %8
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @core_directory_create(i8* %0) {
%2 = tail call i64 @core_directory_verify_existence(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1
%5 = load i32, i32* @S_IRWXU
%6 = load i32, i32* @S_IRWXG
%7 = or i32 %6, %5
%8 = load i32, i32* @S_IROTH
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IXOTH
%11 = or i32 %9, %10
%12 = tail call i32 @mkdir(i8* %0, i32 %11)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %14, %4 ]
ret i32 %16
}