#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fopen_directory(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  if (argc > 1) {
    for (i = 1; i < argc; i++)
      fopen_directory(argv[i]);
    return EXIT_SUCCESS;
  } else {
    printf("usage: %s directory\n", argv[0]);
    return EXIT_FAILURE;
  }
}


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   $0x1,-0x8(%rbp)
jle    1183 <main+0x63>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1172 <main+0x52>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <fopen_directory@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <main+0x27>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <main+0x82>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
cmp    $0x2,%edi
jl     1154 <main+0x34>
mov    %edi,%r12d
mov    $0x1,%ebx
mov    0x2e99(%rip),%r14
nop
mov    (%r15,%rbx,8),%rdi
call   1040 <fopen_directory@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <main+0x20>
jmp    116a <main+0x4a>
mov    (%r15),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e76(%rip),%r14
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [21 x i8] c"usage: %s directory\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @fopen_directory(i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %16, label %6
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %6, %13
%17 = phi i32* [ @EXIT_FAILURE, %13 ], [ @EXIT_SUCCESS, %6 ]
%18 = load i32, i32* %17
ret i32 %18
}