#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 */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int mkdir(char const *, int);
int /*<<< orphan*/ umask(int /*<<< orphan*/);
int iupUnixMakeDirectory(const char *name) {
  mode_t oldmask = umask((mode_t)0);
  int fail = mkdir(name, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP |
                             S_IXGRP | S_IROTH | S_IXOTH);
  umask(oldmask);
  if (fail)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<iupUnixMakeDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %edi,%edi
call   1040 <umask@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
mov    0x2e86(%rip),%rax
or     (%rax),%esi
mov    0x2e8d(%rip),%rax
or     (%rax),%esi
mov    0x2e5c(%rip),%rax
or     (%rax),%esi
mov    0x2e73(%rip),%rax
or     (%rax),%esi
mov    0x2e5a(%rip),%rax
or     (%rax),%esi
mov    0x2e39(%rip),%rax
or     (%rax),%esi
mov    0x2e68(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <umask@plt>
cmpl   $0x0,-0x18(%rbp)
je     11a8 <iupUnixMakeDirectory+0x88>
movl   $0x0,-0x4(%rbp)
jmp    11af <iupUnixMakeDirectory+0x8f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupUnixMakeDirectory>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <umask@plt>
mov    0x2e74(%rip),%rcx
mov    0x2e95(%rip),%rdx
mov    (%rdx),%esi
or     (%rcx),%esi
mov    0x2e9a(%rip),%rcx
or     (%rcx),%esi
mov    0x2e69(%rip),%rcx
or     (%rcx),%esi
mov    0x2e80(%rip),%rcx
or     (%rcx),%esi
mov    0x2e67(%rip),%rcx
or     (%rcx),%esi
mov    0x2e46(%rip),%rcx
or     (%rcx),%esi
mov    %eax,%ebp
mov    0x2e73(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
call   1030 <mkdir@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1040 <umask@plt>
xor    %eax,%eax
test   %ebx,%ebx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @iupUnixMakeDirectory(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = call i32 @umask(i32 0)
store i32 %6, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* @S_IRUSR
%9 = load i32, i32* @S_IWUSR
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IXUSR
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IRGRP
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IWGRP
%16 = or i32 %14, %15
%17 = load i32, i32* @S_IXGRP
%18 = or i32 %16, %17
%19 = load i32, i32* @S_IROTH
%20 = or i32 %18, %19
%21 = load i32, i32* @S_IXOTH
%22 = or i32 %20, %21
%23 = call i32 @mkdir(i8* %7, i32 %22)
store i32 %23, i32* %5
%24 = load i32, i32* %4
%25 = call i32 @umask(i32 %24)
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %1
store i32 0, i32* %2
br label %30
29: ; preds = %1
store i32 1, i32* %2
br label %30
30: ; preds = %29, %28
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @iupUnixMakeDirectory(i8* nocapture %0) {
%2 = tail call i32 @umask(i32 0)
%3 = load i32, i32* @S_IRUSR
%4 = load i32, i32* @S_IWUSR
%5 = or i32 %4, %3
%6 = load i32, i32* @S_IXUSR
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IRGRP
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IWGRP
%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 = tail call i32 @mkdir(i8* %0, i32 %17)
%19 = tail call i32 @umask(i32 %2)
%20 = icmp eq i32 %18, 0
%21 = zext i1 %20 to i32
ret i32 %21
}