#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 EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    int c;
    FILE *file;
    file = fopen(argv[i], "r");
    if (file) {
      while ((c = getc(file)) != EOF)
        putchar(c);
      fclose(file);
    }
  }
}


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)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <main+0x99>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe84(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11c6 <main+0x86>
jmp    1195 <main+0x55>
mov    -0x20(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e40(%rip),%rcx
cmp    (%rcx),%eax
je     11bd <main+0x7d>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
jmp    1195 <main+0x55>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
jmp    11cb <main+0x8b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11b6 <main+0x76>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%r13d
lea    0xe9d(%rip),%r14
mov    0x2e7e(%rip),%rbp
jmp    1181 <main+0x41>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x1,%r13
cmp    %r12,%r13
je     11b6 <main+0x76>
mov    (%r15,%r13,8),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1178 <main+0x38>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    0x0(%rbp),%eax
je     1170 <main+0x30>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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