#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_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int errno;
int mkdir(char *, int);
int create(char *path) {
  errno = 0;
  if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH |
                      S_IXOTH) == -1) {
    return -errno;
  }
  return 0;
}


x86 assembly (clang, -O0):
<create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e9d(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
mov    0x2e9b(%rip),%rax
or     (%rax),%esi
mov    0x2e9a(%rip),%rax
or     (%rax),%esi
mov    0x2e69(%rip),%rax
or     (%rax),%esi
mov    0x2e78(%rip),%rax
or     (%rax),%esi
mov    0x2e4f(%rip),%rax
or     (%rax),%esi
mov    0x2e7e(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    118d <create+0x7d>
xor    %eax,%eax
mov    0x2e3d(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <create+0x84>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create>:
push   %rbx
mov    0x2e90(%rip),%rax
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2eb6(%rip),%rax
or     (%rax),%esi
mov    0x2e85(%rip),%rax
or     (%rax),%esi
mov    0x2e94(%rip),%rax
or     (%rax),%esi
mov    0x2e7b(%rip),%rbx
mov    0x2e64(%rip),%rax
or     (%rax),%esi
movl   $0x0,(%rbx)
mov    0x2e8d(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
xor    %ecx,%ecx
sub    (%rbx),%ecx
xor    %edx,%edx
cmp    $0xffffffff,%eax
cmovne %edx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @create(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
store i32 0, i32* @errno
%4 = load i8*, i8** %3
%5 = load i32, i32* @S_IRUSR
%6 = load i32, i32* @S_IWUSR
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IXUSR
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IRGRP
%11 = or i32 %9, %10
%12 = load i32, i32* @S_IXGRP
%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* %4, i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %1
%21 = load i32, i32* @errno
%22 = sub nsw i32 0, %21
store i32 %22, i32* %2
br label %24
23: ; preds = %1
store i32 0, i32* %2
br label %24
24: ; preds = %23, %20
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@errno = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @create(i8* nocapture %0) {
store i32 0, i32* @errno
%2 = load i32, i32* @S_IRUSR
%3 = load i32, i32* @S_IWUSR
%4 = or i32 %3, %2
%5 = load i32, i32* @S_IXUSR
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IRGRP
%8 = or i32 %6, %7
%9 = load i32, i32* @S_IXGRP
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IROTH
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IXOTH
%14 = or i32 %12, %13
%15 = tail call i32 @mkdir(i8* %0, i32 %14)
%16 = icmp eq i32 %15, -1
%17 = load i32, i32* @errno
%18 = sub nsw i32 0, %17
%19 = select i1 %16, i32 %18, i32 0
ret i32 %19
}