#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  int i, c;
  for (i = 1; i < argc; i++) {
    FILE *file = fopen(argv[i], "r");
    if (file) {
      while ((c = fgetc(file)) != EOF)
        putchar(c);
      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)
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   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11c6 <main+0x86>
jmp    1195 <main+0x55>
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@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>
xor    %eax,%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   1060 <fopen@plt>
test   %rax,%rax
je     1178 <main+0x38>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1050 <fgetc@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 @fgetc(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
ret i32 0
}

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 %27
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %24
%7 = phi i64 [ 1, %4 ], [ %25, %24 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %24, label %12
12: ; preds = %6
%13 = tail call i32 @fgetc(i32* %10)
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %22, label %16
16: ; preds = %12, %16
%17 = phi i32 [ %19, %16 ], [ %13, %12 ]
%18 = tail call i32 @putchar(i32 %17)
%19 = tail call i32 @fgetc(i32* %10)
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %16
22: ; preds = %16, %12
%23 = tail call i32 @fclose(i32* %10)
br label %24
24: ; preds = %22, %6
%25 = add nuw nsw i64 %7, 1
%26 = icmp eq i64 %25, %5
br i1 %26, label %27, label %6
27: ; preds = %24, %2
ret i32 0
}