#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ statify(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *stdin;
int main(int argc, char **argv) {
  if (argc == 1) {
    statify(stdin, NULL);
  } else {
    int i;
    for (i = 1; i < argc; i++) {
      FILE *file;
      file = fopen(argv[i], "r");
      if (file == NULL) {
        perror(argv[i]);
        continue;
      }
      statify(file, argv[i]);
      fclose(file);
    }
  }
  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   $0x1,-0x8(%rbp)
jne    1178 <main+0x38>
mov    0x2e81(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <statify@plt>
jmp    11f9 <main+0xb9>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f4 <main+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe62(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c8 <main+0x88>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <perror@plt>
jmp    11e6 <main+0xa6>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <statify@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117f <main+0x3f>
jmp    11f9 <main+0xb9>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x1,%edi
jne    1161 <main+0x21>
mov    0x2e93(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
call   1040 <statify@plt>
jmp    11bd <main+0x7d>
jle    11bd <main+0x7d>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xe8b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    (%r15,%rbx,8),%rsi
test   %rax,%rax
je     11b3 <main+0x73>
mov    %rax,%r13
mov    %rax,%rdi
call   1040 <statify@plt>
mov    %r13,%rdi
call   1030 <fclose@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1180 <main+0x40>
jmp    11bd <main+0x7d>
mov    %rsi,%rdi
call   1060 <perror@plt>
jmp    11a8 <main+0x68>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\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 eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32*, i32** @stdin
%12 = call i32 @statify(i32* %11, i8* null)
br label %48
13: ; preds = %2
store i32 1, i32* %6
br label %14
14: ; preds = %44, %13
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %47
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %24, i32** %7
%25 = load i32*, i32** %7
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %34
27: ; preds = %18
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @perror(i8* %32)
br label %44
34: ; preds = %18
%35 = load i32*, i32** %7
%36 = load i8**, i8*** %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @statify(i32* %35, i8* %40)
%42 = load i32*, i32** %7
%43 = call i32 @fclose(i32* %42)
br label %44
44: ; preds = %34, %27
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %14
47: ; preds = %14
br label %48
48: ; preds = %47, %10
ret i32 0
}

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