#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 makeDirectory(char *);
int /*<<< orphan*/ printf(char *);
int mkdir_main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("mkdir: wrong number of parameters\n");
    return -1;
  }
  char *directoryName = argv[1];
  int retVal = 0;
  retVal = makeDirectory(directoryName);
  if (retVal == -1) {
    printf("mkdir: directory full\n");
  }
  return retVal;
}


x86 assembly (clang, -O0):
<mkdir_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1151 <mkdir_main+0x31>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <mkdir_main+0x6c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <makeDirectory@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1186 <mkdir_main+0x66>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdir_main>:
push   %rax
cmp    $0x2,%edi
jne    1136 <mkdir_main+0x16>
mov    0x8(%rsi),%rdi
call   1040 <makeDirectory@plt>
cmp    $0xffffffff,%eax
je     113f <mkdir_main+0x1f>
pop    %rcx
ret
lea    0xed9(%rip),%rdi
jmp    1146 <mkdir_main+0x26>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"mkdir: wrong number of parameters\0A\00"
@.str.1 = [23 x i8] c"mkdir: directory full\0A\00"
define i32 @mkdir_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %24
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %6
store i32 0, i32* %7
%16 = load i8*, i8** %6
%17 = call i32 @makeDirectory(i8* %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %12
%23 = load i32, i32* %7
store i32 %23, i32* %3
br label %24
24: ; preds = %22, %10
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@str = [22 x i8] c"mkdir: directory full\00"
@str.2 = [34 x i8] c"mkdir: wrong number of parameters\00"
define i32 @mkdir_main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @makeDirectory(i8* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %4, %2
%10 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0), %4 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %4
%13 = phi i32 [ %7, %4 ], [ -1, %9 ]
ret i32 %13
}