#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int /*<<< orphan*/ createDirectory(char *, int);
int /*<<< orphan*/ errx(int, char *);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
int help(char *, char *);
int /*<<< orphan*/ no_argument;
int optind;
int version(char *);
int main(int argc, char *argv[]) {
  struct option longopts[] = {{"parents", no_argument, 0, 'p'},
                              {"help", no_argument, 0, 0},
                              {"version", no_argument, 0, 1},
                              {0, 0, 0, 0}};
  bool parents = false;
  int c;
  while ((c = getopt_long(argc, argv, "p", longopts, NULL)) != -1) {
    switch (c) {
    case 0:
      return help(argv[0],
                  "[OPTIONS] DIR...\n"
                  "  -p, --parents            create parent directories\n"
                  "      --help               display this help\n"
                  "      --version            display version info");
    case 1:
      return version(argv[0]);
    case 'p':
      parents = true;
      break;
    case '?':
      return 1;
    }
  }
  if (optind >= argc)
    errx(1, "missing operand");
  for (int i = optind; i < argc; i++) {
    createDirectory(argv[i], parents);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe7c(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x70,-0x60(%rbp)
add    $0x18,%rdi
lea    0xe5b(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x50(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x48(%rbp)
add    $0x18,%rdi
lea    0xe37(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x1,-0x30(%rbp)
add    $0x18,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1060 <memset@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x70(%rbp),%rcx
lea    0xdee(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x78(%rbp)
cmp    $0xffffffff,%eax
je     12c5 <main+0x165>
mov    -0x78(%rbp),%eax
mov    %eax,-0x80(%rbp)
test   %eax,%eax
je     1279 <main+0x119>
jmp    1246 <main+0xe6>
mov    -0x80(%rbp),%eax
sub    $0x1,%eax
je     1294 <main+0x134>
jmp    1257 <main+0xf7>
mov    -0x80(%rbp),%eax
sub    $0x3f,%eax
je     12b4 <main+0x154>
jmp    1268 <main+0x108>
mov    -0x80(%rbp),%eax
sub    $0x70,%eax
je     12a8 <main+0x148>
jmp    12c0 <main+0x160>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd8e(%rip),%rsi
call   1080 <help@plt>
mov    %eax,-0x4(%rbp)
jmp    1322 <main+0x1c2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <version@plt>
mov    %eax,-0x4(%rbp)
jmp    1322 <main+0x1c2>
movl   $0x1,-0x74(%rbp)
jmp    12c0 <main+0x160>
movl   $0x1,-0x4(%rbp)
jmp    1322 <main+0x1c2>
jmp    120b <main+0xab>
mov    0x2d1c(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     12e8 <main+0x188>
mov    $0x1,%edi
lea    0xdd5(%rip),%rsi
call   1050 <errx@plt>
mov    0x2cf9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1322 <main+0x1c2>
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x74(%rbp),%esi
call   1030 <createDirectory@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12f4 <main+0x194>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xe96(%rip),%rax
mov    %rax,(%rsp)
mov    0x2e63(%rip),%rax
mov    (%rax),%al
mov    %al,0x8(%rsp)
movabs $0x7000000000,%rcx
mov    %rcx,0xc(%rsp)
lea    0xe77(%rip),%rcx
mov    %rcx,0x18(%rsp)
mov    %al,0x20(%rsp)
movq   $0x0,0x24(%rsp)
lea    0xe63(%rip),%rcx
mov    %rcx,0x30(%rsp)
mov    %al,0x38(%rsp)
movabs $0x100000000,%rax
mov    %rax,0x3c(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x48(%rsp)
movq   $0x0,0x58(%rsp)
xor    %r15d,%r15d
lea    0xe2e(%rip),%r12
mov    %rsp,%r13
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
test   %eax,%eax
jle    1210 <main+0xc0>
cmp    $0x1,%eax
je     122d <main+0xdd>
cmp    $0x3f,%eax
je     123a <main+0xea>
cmp    $0x70,%eax
jne    11e0 <main+0x90>
mov    $0x1,%r15d
jmp    11e0 <main+0x90>
xchg   %ax,%ax
cmp    $0xffffffff,%eax
je     1242 <main+0xf2>
test   %eax,%eax
jne    11e0 <main+0x90>
mov    (%r14),%rdi
lea    0xdf2(%rip),%rsi
call   1070 <help@plt>
mov    %eax,%r12d
jmp    1294 <main+0x144>
mov    (%r14),%rdi
call   1060 <version@plt>
mov    %eax,%r12d
jmp    1294 <main+0x144>
mov    $0x1,%r12d
jmp    1294 <main+0x144>
mov    0x2d9f(%rip),%rbx
mov    (%rbx),%eax
cmp    %ebp,%eax
jl     1262 <main+0x112>
lea    0xe62(%rip),%rsi
mov    $0x1,%edi
call   1050 <errx@plt>
mov    (%rbx),%eax
xor    %r12d,%r12d
cmp    %ebp,%eax
jge    1294 <main+0x144>
movslq %eax,%rcx
lea    (%r14,%rcx,8),%r14
sub    %eax,%ebp
xor    %r12d,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
mov    %r15d,%esi
call   1030 <createDirectory@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1280 <main+0x130>
mov    %r12d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [8 x i8] c"parents\00"
@no_argument = global i32 0
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [8 x i8] c"version\00"
@.str.3 = [2 x i8] c"p\00"
@.str.4 = [163 x i8] c"[OPTIONS] DIR...\0A -p, --parents create parent directories\0A --help display this help\0A --version display version info\00"
@optind = global i32 0
@.str.5 = [16 x i8] c"missing operand\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x %struct.option]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %6, i64 0, i64 0
%11 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 1
%13 = load i32, i32* @no_argument
%14 = trunc i32 %13 to i8
store i8 %14, i8* %12
%15 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 2
store i32 0, i32* %15
%16 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 3
store i32 112, i32* %16
%17 = getelementptr inbounds %struct.option, %struct.option* %10, i64 1
%18 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %18
%19 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 1
%20 = load i32, i32* @no_argument
%21 = trunc i32 %20 to i8
store i8 %21, i8* %19
%22 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 2
store i32 0, i32* %22
%23 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 3
store i32 0, i32* %23
%24 = getelementptr inbounds %struct.option, %struct.option* %17, i64 1
%25 = getelementptr inbounds %struct.option, %struct.option* %24, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %25
%26 = getelementptr inbounds %struct.option, %struct.option* %24, i32 0, i32 1
%27 = load i32, i32* @no_argument
%28 = trunc i32 %27 to i8
store i8 %28, i8* %26
%29 = getelementptr inbounds %struct.option, %struct.option* %24, i32 0, i32 2
store i32 0, i32* %29
%30 = getelementptr inbounds %struct.option, %struct.option* %24, i32 0, i32 3
store i32 1, i32* %30
%31 = getelementptr inbounds %struct.option, %struct.option* %24, i64 1
%32 = bitcast %struct.option* %31 to i8*
store i32 0, i32* %7
br label %33
33: ; preds = %53, %2
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %6, i64 0, i64 0
%37 = call i32 @getopt_long(i32 %34, i8** %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %struct.option* %36, i32* null)
store i32 %37, i32* %8
%38 = icmp ne i32 %37, -1
br i1 %38, label %39, label %54
39: ; preds = %33
%40 = load i32, i32* %8
switch i32 %40, label %53 [
i32 0, label %41
i32 1, label %46
i32 112, label %51
i32 63, label %52
]
41: ; preds = %39
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 0
%44 = load i8*, i8** %43
%45 = call i32 @help(i8* %44, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.4, i64 0, i64 0))
store i32 %45, i32* %3
br label %77
46: ; preds = %39
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 @version(i8* %49)
store i32 %50, i32* %3
br label %77
51: ; preds = %39
store i32 1, i32* %7
br label %53
52: ; preds = %39
store i32 1, i32* %3
br label %77
53: ; preds = %39, %51
br label %33
54: ; preds = %33
%55 = load i32, i32* @optind
%56 = load i32, i32* %4
%57 = icmp sge i32 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @errx(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %58, %54
%61 = load i32, i32* @optind
store i32 %61, i32* %9
br label %62
62: ; preds = %74, %60
%63 = load i32, i32* %9
%64 = load i32, i32* %4
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %77
66: ; preds = %62
%67 = load i8**, i8*** %5
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = load i32, i32* %7
%73 = call i32 @createDirectory(i8* %71, i32 %72)
br label %74
74: ; preds = %66
%75 = load i32, i32* %9
%76 = add nsw i32 %75, 1
store i32 %76, i32* %9
br label %62
77: ; preds = %41, %46, %52, %62
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [8 x i8] c"parents\00"
@no_argument = global i32 0
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [8 x i8] c"version\00"
@.str.3 = [2 x i8] c"p\00"
@.str.4 = [163 x i8] c"[OPTIONS] DIR...\0A -p, --parents create parent directories\0A --help display this help\0A --version display version info\00"
@optind = global i32 0
@.str.5 = [16 x i8] c"missing operand\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4 x %struct.option]
%4 = bitcast [4 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 0, i32 1
%8 = load i32, i32* @no_argument
%9 = trunc i32 %8 to i8
store i8 %9, i8* %7
%10 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 0, i32 2
store i32 0, i32* %10
%11 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 0, i32 3
store i32 112, i32* %11
%12 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 1, i32 1
store i8 %9, i8* %13
%14 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 1, i32 2
store i32 0, i32* %14
%15 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 1, i32 3
store i32 0, i32* %15
%16 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 2, i32 1
store i8 %9, i8* %17
%18 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 2, i32 2
store i32 0, i32* %18
%19 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 2, i32 3
store i32 1, i32* %19
%20 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 3
%21 = bitcast %struct.option* %20 to i8*
br label %22
22: ; preds = %24, %2
%23 = phi i32 [ 0, %2 ], [ 1, %24 ]
br label %24
24: ; preds = %22, %24
%25 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %struct.option* %5, i32* null)
switch i32 %25, label %24 [
i32 -1, label %32
i32 0, label %26
i32 1, label %29
i32 112, label %22
i32 63, label %51
]
26: ; preds = %24
%27 = load i8*, i8** %1
%28 = call i32 @help(i8* %27, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.4, i64 0, i64 0))
br label %51
29: ; preds = %24
%30 = load i8*, i8** %1
%31 = call i32 @version(i8* %30)
br label %51
32: ; preds = %24
%33 = load i32, i32* @optind
%34 = icmp slt i32 %33, %0
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = call i32 @errx(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32, i32* @optind
br label %38
38: ; preds = %35, %32
%39 = phi i32 [ %37, %35 ], [ %33, %32 ]
%40 = icmp slt i32 %39, %0
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = sext i32 %39 to i64
br label %43
43: ; preds = %41, %43
%44 = phi i64 [ %42, %41 ], [ %48, %43 ]
%45 = getelementptr inbounds i8*, i8** %1, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 @createDirectory(i8* %46, i32 %23)
%48 = add nsw i64 %44, 1
%49 = trunc i64 %48 to i32
%50 = icmp eq i32 %49, %0
br i1 %50, label %51, label %43
51: ; preds = %24, %43, %38, %29, %26
%52 = phi i32 [ %31, %29 ], [ %28, %26 ], [ 0, %38 ], [ 0, %43 ], [ 1, %24 ]
ret i32 %52
}