#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 */
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Usage: mkdir files\n");
    return 1;
  }
  int i;
  for (i = 1; i < argc; i++) {
    if (mkdir(argv[i], 0755) < 0) {
      printf("mkdir: cannot create %s\n", argv[i]);
      return 1;
    }
  }
  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)
cmpl   $0x2,-0x8(%rbp)
jge    115a <main+0x3a>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cd <main+0xad>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c6 <main+0xa6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jge    11b3 <main+0x93>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cd <main+0xad>
jmp    11b8 <main+0x98>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jge    1148 <main+0x18>
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
jmp    1192 <main+0x62>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbx,8),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
js     1180 <main+0x50>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <main+0x30>
xor    %eax,%eax
jmp    1197 <main+0x67>
mov    (%r14,%rbx,8),%rsi
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: mkdir files\0A\00"
@.str.1 = [25 x i8] c"mkdir: cannot create %s\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 %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %36
11: ; preds = %2
store i32 1, i32* %6
br label %12
12: ; preds = %32, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %12
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i64 @mkdir(i8* %21, i32 493)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %29)
store i32 1, i32* %3
br label %36
31: ; preds = %16
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %12
35: ; preds = %12
store i32 0, i32* %3
br label %36
36: ; preds = %35, %24, %9
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"mkdir: cannot create %s\0A\00"
@str = [19 x i8] c"Usage: mkdir files\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 %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %22
8: ; preds = %4, %19
%9 = phi i64 [ 1, %4 ], [ %20, %19 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @mkdir(i8* %11, i32 493)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = and i64 %9, 4294967295
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %22
19: ; preds = %8
%20 = add nuw nsw i64 %9, 1
%21 = icmp eq i64 %20, %5
br i1 %21, label %22, label %8
22: ; preds = %19, %14, %6
%23 = phi i32 [ 1, %6 ], [ 1, %14 ], [ 0, %19 ]
ret i32 %23
}