#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*/ parse(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  for (; *argv != NULL; ++argv) {
    if ((fp = fopen(*argv, "r")) == NULL) {
      perror(*argv);
      return (1);
    }
    parse(fp);
    (void)fclose(fp);
  }
  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    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11c0 <main+0x80>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe8e(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    119d <main+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c7 <main+0x87>
mov    -0x18(%rbp),%rdi
call   1060 <parse@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1156 <main+0x16>
movl   $0x0,-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),%rdi
xor    %r14d,%r14d
test   %rdi,%rdi
je     118c <main+0x4c>
mov    %rsi,%rbx
add    $0x8,%rbx
lea    0xea0(%rip),%r15
mov    %r15,%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     119a <main+0x5a>
mov    %rax,%rbp
mov    %rax,%rdi
call   1060 <parse@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1160 <main+0x20>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    -0x8(%rbx),%rdi
call   1050 <perror@plt>
mov    $0x1,%r14d
jmp    118c <main+0x4c>

LLVM IR (-O0):
@.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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %25, %2
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %6
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i8**, i8*** %5
%18 = load i8*, i8** %17
%19 = call i32 @perror(i8* %18)
store i32 1, i32* %3
br label %29
20: ; preds = %11
%21 = load i32*, i32** %6
%22 = call i32 @parse(i32* %21)
%23 = load i32*, i32** %6
%24 = call i32 @fclose(i32* %23)
br label %25
25: ; preds = %20
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %5
br label %7
28: ; preds = %7
store i32 0, i32* %3
br label %29
29: ; preds = %28, %16
%30 = load i32, i32* %3
ret i32 %30
}

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