#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int list_file(char const *);
int /*<<< orphan*/ stderr;
int main(int argc, const char *argv[]) {
  int rc;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <file>\n", argv[0]);
    return 1;
  }
  for (int i = 1; i < argc; ++i)
    if ((rc = list_file(argv[i])) != 0)
      return rc;
  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    1168 <main+0x48>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bd <main+0x9d>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b6 <main+0x96>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <list_file@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11a3 <main+0x83>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bd <main+0x9d>
jmp    11a8 <main+0x88>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116f <main+0x4f>
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
mov    %rsi,%r14
cmp    $0x2,%edi
jge    114c <main+0x2c>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    1178 <main+0x58>
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rdi
call   1030 <list_file@plt>
test   %eax,%eax
jne    1178 <main+0x58>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <file>\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 %12
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %19
10: ; preds = %12
%11 = icmp eq i64 %18, %5
br i1 %11, label %19, label %12
12: ; preds = %4, %10
%13 = phi i64 [ 1, %4 ], [ %18, %10 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32 @list_file(i8* %15)
%17 = icmp eq i32 %16, 0
%18 = add nuw nsw i64 %13, 1
br i1 %17, label %10, label %19
19: ; preds = %12, %10, %6
%20 = phi i32 [ 1, %6 ], [ %16, %12 ], [ 0, %10 ]
ret i32 %20
}