#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*/ PHYSFS_setErrorCode(scalar_t__);
int /*<<< orphan*/ S_IRWXU;
scalar_t__ errcodeFromErrno();
int mkdir(char const *, int /*<<< orphan*/);
int __PHYSFS_platformMkDir(const char *path) {
  const int rc = mkdir(path, S_IRWXU);
  do {
    if (rc == -1) {
      if (errcodeFromErrno())
        PHYSFS_setErrorCode(errcodeFromErrno());
      return 0;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<__PHYSFS_platformMkDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1187 <__PHYSFS_platformMkDir+0x57>
mov    $0x0,%al
call   1040 <errcodeFromErrno@plt>
cmp    $0x0,%rax
je     117b <__PHYSFS_platformMkDir+0x4b>
mov    $0x0,%al
call   1040 <errcodeFromErrno@plt>
mov    %rax,%rdi
call   1050 <PHYSFS_setErrorCode@plt>
movl   $0x0,-0x4(%rbp)
jmp    1193 <__PHYSFS_platformMkDir+0x63>
jmp    118c <__PHYSFS_platformMkDir+0x5c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__PHYSFS_platformMkDir>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1030 <mkdir@plt>
mov    $0x1,%ebx
cmp    $0xffffffff,%eax
jne    1168 <__PHYSFS_platformMkDir+0x38>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <errcodeFromErrno@plt>
test   %rax,%rax
je     1168 <__PHYSFS_platformMkDir+0x38>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <errcodeFromErrno@plt>
mov    %rax,%rdi
call   1050 <PHYSFS_setErrorCode@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@S_IRWXU = global i32 0
define i32 @__PHYSFS_platformMkDir(i8* nocapture %0) {
%2 = load i32, i32* @S_IRWXU
%3 = tail call i32 @mkdir(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = tail call i64 (...) @errcodeFromErrno()
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i64 (...) @errcodeFromErrno()
%10 = tail call i32 @PHYSFS_setErrorCode(i64 %9)
br label %11
11: ; preds = %1, %5, %8
%12 = phi i32 [ 0, %8 ], [ 0, %5 ], [ 1, %1 ]
ret i32 %12
}