#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ mkdir(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int i;
  if (argc < 2) {
    fprintf(stderr, "Usage: mkdir files...\n");
    exit(1);
  }
  for (i = 1; i < argc; i++) {
    if (mkdir(argv[i]) < 0) {
      fprintf(stderr, "mkdir: %s failed to create\n", argv[i]);
      break;
    }
  }
  exit(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)
cmpl   $0x2,-0x8(%rbp)
jge    1171 <main+0x41>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11da <main+0xaa>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jge    11c7 <main+0x97>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11da <main+0xaa>
jmp    11cc <main+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <main+0x48>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jge    115b <main+0x2b>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <mkdir@plt>
test   %rax,%rax
js     118e <main+0x5e>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <main+0x40>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%rbx,8),%rdx
lea    0xe75(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: mkdir files...\0A\00"
@.str.1 = [28 x i8] c"mkdir: %s failed to create\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
store i32 1, i32* %6
br label %14
14: ; preds = %35, %13
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %38
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i64 @mkdir(i8* %23)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %18
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %38
34: ; preds = %18
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %14
38: ; preds = %26, %14
%39 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: mkdir files...\0A\00"
@.str.1 = [28 x i8] c"mkdir: %s failed to create\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4, %22
%11 = phi i64 [ 1, %4 ], [ %23, %22 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i64 @mkdir(i8* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = and i64 %11, 4294967295
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %18
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %25
22: ; preds = %10
%23 = add nuw nsw i64 %11, 1
%24 = icmp eq i64 %23, %5
br i1 %24, label %25, label %10
25: ; preds = %22, %16
%26 = tail call i32 @exit(i32 0)
unreachable
}