#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;
char *basename(char *);
int checkfile(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "usage: %s <file|-> [...]\n", basename(argv[0]));
    return EXIT_FAILURE;
  }
  int rc = 0;
  for (int i = 1; i < argc; i++)
    rc |= checkfile(argv[i]);
  return rc;
}


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    118b <main+0x5b>
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <basename@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe8b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d0 <main+0xa0>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ca <main+0x9a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <checkfile@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <main+0x69>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x2,%edi
jge    116c <main+0x3c>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ebp
mov    (%r14),%rdi
call   1050 <basename@plt>
lea    0xea9(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%ebp
jmp    1194 <main+0x64>
mov    %edi,%r15d
xor    %ebp,%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <checkfile@plt>
or     %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x50>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"usage: %s <file|-> [...]\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
%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 %18
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 i8* @basename(i8* %14)
%16 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
store i32 %17, i32* %3
br label %37
18: ; preds = %2
store i32 0, i32* %6
store i32 1, i32* %7
br label %19
19: ; preds = %32, %18
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %35
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @checkfile(i8* %28)
%30 = load i32, i32* %6
%31 = or i32 %30, %29
store i32 %31, i32* %6
br label %32
32: ; preds = %23
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %19
35: ; preds = %19
%36 = load i32, i32* %6
store i32 %36, i32* %3
br label %37
37: ; preds = %35, %10
%38 = load i32, i32* %3
ret i32 %38
}

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