#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ list_files(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc > 1 && strcmp(argv[1], "--help") == 0) {
    printf("%s [dir-path...]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (argc == 1) {
    list_files(".");
  } else {
    for (argv++; *argv; argv++) {
      list_files(*argv);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    119f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe91(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11ba <main+0x7a>
lea    0xe69(%rip),%rdi
call   1050 <list_files@plt>
jmp    11f6 <main+0xb6>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11f1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <list_files@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11c6 <main+0x86>
jmp    11f6 <main+0xb6>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     117b <main+0x3b>
mov    0x8(%rbx),%rdi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    118e <main+0x4e>
mov    (%rbx),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
cmp    $0x1,%edi
jne    118e <main+0x4e>
lea    0xe92(%rip),%rdi
call   1050 <list_files@plt>
jmp    11b1 <main+0x71>
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     11b1 <main+0x71>
add    $0x10,%rbx
nopl   0x0(%rax,%rax,1)
call   1050 <list_files@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    11a0 <main+0x60>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [18 x i8] c"%s [dir-path...]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %8, %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @list_files(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %41
26: ; preds = %21
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i32 1
store i8** %28, i8*** %5
br label %29
29: ; preds = %37, %26
%30 = load i8**, i8*** %5
%31 = load i8*, i8** %30
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = load i8**, i8*** %5
%35 = load i8*, i8** %34
%36 = call i32 @list_files(i8* %35)
br label %37
37: ; preds = %33
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %5
br label %29
40: ; preds = %29
br label %41
41: ; preds = %40, %24
ret i32 0
}

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