#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*/ perror(char *, ...);
int /*<<< orphan*/ print_dir(char *);
int main(int argc, char *argv[], char *envp[]) {
  int i = 0;
  for (i = 1; i < argc; i++) {
    if (argc > 2)
      perror("%s:\n", argv[i]);
    print_dir(argv[i]);
    if (argc > 2)
      perror("\n");
  }
  if (i == 1) {
    print_dir(".");
  }
  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)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b4 <main+0x94>
cmpl   $0x2,-0x8(%rbp)
jle    1178 <main+0x58>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <print_dir@plt>
cmpl   $0x2,-0x8(%rbp)
jle    11a1 <main+0x81>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
jmp    11a6 <main+0x86>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <main+0x28>
cmpl   $0x1,-0x1c(%rbp)
jne    11ca <main+0xaa>
lea    0xe40(%rip),%rdi
call   1030 <print_dir@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
cmp    $0x2,%edi
jl     11a1 <main+0x81>
mov    %rsi,%r14
mov    %edi,%ebx
mov    %edi,%r13d
mov    $0x1,%ebp
lea    0xebc(%rip),%r15
lea    0xeb8(%rip),%r12
jmp    1180 <main+0x60>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <perror@plt>
mov    (%r14,%rbp,8),%rdi
call   1030 <print_dir@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <perror@plt>
add    $0x1,%rbp
cmp    %r13,%rbp
je     119c <main+0x7c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbp,8),%rsi
cmp    $0x2,%ebx
jne    114d <main+0x2d>
mov    %rsi,%rdi
call   1030 <print_dir@plt>
add    $0x1,%rbp
cmp    %r13,%rbp
jne    1180 <main+0x60>
jmp    11ad <main+0x8d>
cmp    $0x1,%ebx
jne    11ad <main+0x8d>
lea    0xe5d(%rip),%rdi
call   1030 <print_dir@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"%s:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %8
store i32 1, i32* %8
br label %9
9: ; preds = %35, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %38
13: ; preds = %9
%14 = load i32, i32* %5
%15 = icmp sgt i32 %14, 2
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i8**, i8*** %6
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %16, %13
%24 = load i8**, i8*** %6
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @print_dir(i8* %28)
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 2
br i1 %31, label %32, label %34
32: ; preds = %23
%33 = call i32 (i8*, ...) @perror(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %23
br label %35
35: ; preds = %34
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %9
38: ; preds = %9
%39 = load i32, i32* %8
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @print_dir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %27
5: ; preds = %3
%6 = icmp eq i32 %0, 2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %19, %5
%9 = phi i64 [ 1, %5 ], [ %20, %19 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
br i1 %6, label %21, label %12
12: ; preds = %8
%13 = tail call i32 (i8*, ...) @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11)
%14 = load i8*, i8** %10
%15 = tail call i32 @print_dir(i8* %14)
%16 = tail call i32 (i8*, ...) @perror(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %25, label %19
19: ; preds = %12, %21
%20 = phi i64 [ %17, %12 ], [ %23, %21 ]
br label %8
21: ; preds = %8
%22 = tail call i32 @print_dir(i8* %11)
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %29, label %19
25: ; preds = %12
%26 = icmp eq i32 %0, 1
br i1 %26, label %27, label %29
27: ; preds = %3, %25
%28 = tail call i32 @print_dir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %21, %27, %25
ret i32 0
}