#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 mode_t;

/* Variables and functions */
int /*<<< orphan*/ drmake(int, char **, int, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ mkdir_exit(char *, int);
int /*<<< orphan*/ optarg;
scalar_t__ optind;
int strtol(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  mode_t mode = 0755;
  int o, parents;
  o = parents = 0;
  while ((o = getopt(argc, argv, "hpm:")) != -1)
    switch (o) {
    case 'm':
      mode = strtol(optarg, NULL, 8);
      break;
    case 'p':
      parents = 1;
      break;
    case 'h':
      mkdir_exit("Usage  mkdir -pm:\n", 0);
      break;
    case '?':
      mkdir_exit("", 1);
      break;
    default:
      break;
    }
  argv += optind;
  argc -= optind;
  drmake(argc, argv, mode, parents);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1ed,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe87(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     122f <main+0xef>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x3f,%eax
je     120f <main+0xcf>
jmp    119e <main+0x5e>
mov    -0x20(%rbp),%eax
sub    $0x68,%eax
je     11fc <main+0xbc>
jmp    11af <main+0x6f>
mov    -0x20(%rbp),%eax
sub    $0x6d,%eax
je     11d1 <main+0x91>
jmp    11c0 <main+0x80>
mov    -0x20(%rbp),%eax
sub    $0x70,%eax
je     11f0 <main+0xb0>
jmp    1225 <main+0xe5>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x8,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
jmp    122a <main+0xea>
movl   $0x1,-0x1c(%rbp)
jmp    122a <main+0xea>
lea    0xe02(%rip),%rdi
xor    %esi,%esi
call   1060 <mkdir_exit@plt>
jmp    122a <main+0xea>
lea    0xe01(%rip),%rdi
mov    $0x1,%esi
call   1060 <mkdir_exit@plt>
jmp    122a <main+0xea>
jmp    122a <main+0xea>
jmp    116b <main+0x2b>
mov    0x2daa(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2d94(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <drmake@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
mov    %rax,(%rsp)
mov    $0x1ed,%r15d
lea    0xe9d(%rip),%r12
lea    0xead(%rip),%r13
lea    0xe94(%rip),%r14
jmp    118f <main+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x68,%eax
jne    11b5 <main+0x75>
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <mkdir_exit@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
cmp    $0x67,%eax
jg     1180 <main+0x40>
cmp    $0x3f,%eax
jne    11d9 <main+0x99>
mov    %r13,%rdi
mov    $0x1,%esi
call   1060 <mkdir_exit@plt>
jmp    118f <main+0x4f>
cmp    $0x70,%eax
je     11e0 <main+0xa0>
cmp    $0x6d,%eax
jne    118f <main+0x4f>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <strtol@plt>
mov    %eax,%r15d
jmp    118f <main+0x4f>
cmp    $0xffffffff,%eax
jne    118f <main+0x4f>
jmp    11eb <main+0xab>
mov    $0x1,%eax
mov    %rax,(%rsp)
jmp    118f <main+0x4f>
mov    0x2dee(%rip),%rax
mov    (%rax),%rax
lea    (%rbx,%rax,8),%rsi
sub    %eax,%ebp
mov    %ebp,%edi
mov    %r15d,%edx
mov    (%rsp),%rcx
call   1030 <drmake@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"hpm:\00"
@optarg = global i32 0
@.str.1 = [19 x i8] c"Usage mkdir -pm:\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 493, i32* %6
store i32 0, i32* %8
store i32 0, i32* %7
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %7
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i32, i32* %7
switch i32 %15, label %24 [
i32 109, label %16
i32 112, label %19
i32 104, label %20
i32 63, label %22
]
16: ; preds = %14
%17 = load i32, i32* @optarg
%18 = call i32 @strtol(i32 %17, i32* null, i32 8)
store i32 %18, i32* %6
br label %25
19: ; preds = %14
store i32 1, i32* %8
br label %25
20: ; preds = %14
%21 = call i32 @mkdir_exit(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %25
22: ; preds = %14
%23 = call i32 @mkdir_exit(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %25
24: ; preds = %14
br label %25
25: ; preds = %24, %22, %20, %19, %16
br label %9
26: ; preds = %9
%27 = load i64, i64* @optind
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 %27
store i8** %29, i8*** %5
%30 = load i64, i64* @optind
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = sub nsw i64 %32, %30
%34 = trunc i64 %33 to i32
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = load i8**, i8*** %5
%37 = load i32, i32* %6
%38 = load i32, i32* %8
%39 = call i32 @drmake(i32 %35, i8** %36, i32 %37, i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"hpm:\00"
@optarg = global i32 0
@.str.1 = [19 x i8] c"Usage mkdir -pm:\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %11, %2
%4 = phi i32 [ %13, %11 ], [ 493, %2 ]
%5 = phi i32 [ %7, %11 ], [ 0, %2 ]
br label %6
6: ; preds = %8, %3
%7 = phi i32 [ %5, %3 ], [ 1, %8 ]
br label %8
8: ; preds = %10, %6
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %9, label %10 [
i32 -1, label %18
i32 109, label %11
i32 112, label %6
i32 104, label %14
i32 63, label %16
]
10: ; preds = %8, %16, %14
br label %8
11: ; preds = %8
%12 = load i32, i32* @optarg
%13 = tail call i32 @strtol(i32 %12, i32* null, i32 8)
br label %3
14: ; preds = %8
%15 = tail call i32 @mkdir_exit(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %10
16: ; preds = %8
%17 = tail call i32 @mkdir_exit(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %10
18: ; preds = %8
%19 = load i64, i64* @optind
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = trunc i64 %19 to i32
%22 = sub i32 %0, %21
%23 = tail call i32 @drmake(i32 %22, i8** %20, i32 %4, i32 %7)
ret i32 0
}