#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_IRWXG;
int S_IRWXO;
int S_IRWXU;
int mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ umask(int /*<<< orphan*/);
int executeMkdirCommand(char *arg) {
  int ret = 0;
  mode_t process_mask = umask(0);
  ret = mkdir(arg, S_IRWXU | S_IRWXG | S_IRWXO);
  if (!ret) {
    printf("Directory %s created\n", arg);
  } else {
    perror("Error");
  }
  umask(process_mask);
  return ret;
}


x86 assembly (clang, -O0):
<executeMkdirCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %edi,%edi
call   1050 <umask@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
mov    0x2e67(%rip),%rax
or     (%rax),%esi
mov    0x2e76(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11a3 <executeMkdirCommand+0x63>
mov    -0x8(%rbp),%rsi
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
jmp    11af <executeMkdirCommand+0x6f>
lea    0xe6c(%rip),%rdi
call   1060 <perror@plt>
mov    -0x10(%rbp),%edi
call   1050 <umask@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<executeMkdirCommand>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <umask@plt>
mov    0x2e8b(%rip),%rcx
mov    0x2e7c(%rip),%rdx
mov    (%rdx),%esi
or     (%rcx),%esi
mov    %eax,%r14d
mov    0x2e86(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
call   1030 <mkdir@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1198 <executeMkdirCommand+0x58>
lea    0xe7f(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r14d,%edi
call   1050 <umask@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe77(%rip),%rdi
call   1060 <perror@plt>
jmp    1189 <executeMkdirCommand+0x49>

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IRWXO = global i32 0
@.str = [22 x i8] c"Directory %s created\0A\00"
@.str.1 = [6 x i8] c"Error\00"
define i32 @executeMkdirCommand(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = call i32 @umask(i32 0)
store i32 %5, i32* %4
%6 = load i8*, i8** %2
%7 = load i32, i32* @S_IRWXU
%8 = load i32, i32* @S_IRWXG
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IRWXO
%11 = or i32 %9, %10
%12 = call i32 @mkdir(i8* %6, i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %1
%16 = load i8*, i8** %2
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %20
18: ; preds = %1
%19 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i32, i32* %4
%22 = call i32 @umask(i32 %21)
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IRWXO = global i32 0
@.str = [22 x i8] c"Directory %s created\0A\00"
@.str.1 = [6 x i8] c"Error\00"
define i32 @executeMkdirCommand(i8* %0) {
%2 = tail call i32 @umask(i32 0)
%3 = load i32, i32* @S_IRWXU
%4 = load i32, i32* @S_IRWXG
%5 = or i32 %4, %3
%6 = load i32, i32* @S_IRWXO
%7 = or i32 %5, %6
%8 = tail call i32 @mkdir(i8* %0, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %14
12: ; preds = %1
%13 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = tail call i32 @umask(i32 %2)
ret i32 %8
}