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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
size_t strlen(char *);
int main(int argc, char **argv) {
  char line[256];
  size_t len;
  FILE *in;
  int i;
  for (i = 1; i < argc; i++) {
    in = fopen(argv[i], "rb");
    if (in != NULL) {
      while (fgets(line, sizeof(line), in) != NULL) {
        len = strlen(line);
        while (len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r'))
          line[--len] = '\0';
        printf("%s\n", line);
      }
      fclose(in);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x124(%rbp)
mov    -0x124(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c3 <main+0x173>
mov    -0x10(%rbp),%rax
movslq -0x124(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe68(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x120(%rbp)
cmpq   $0x0,-0x120(%rbp)
je     12aa <main+0x15a>
jmp    11b7 <main+0x67>
lea    -0x110(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     129e <main+0x14e>
lea    -0x110(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x118(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x118(%rbp)
mov    %al,-0x125(%rbp)
jbe    1251 <main+0x101>
mov    -0x118(%rbp),%rax
sub    $0x1,%rax
movsbl -0x110(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x126(%rbp)
je     1245 <main+0xf5>
mov    -0x118(%rbp),%rax
sub    $0x1,%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
sete   %al
mov    %al,-0x126(%rbp)
mov    -0x126(%rbp),%al
mov    %al,-0x125(%rbp)
mov    -0x125(%rbp),%al
test   $0x1,%al
jne    1264 <main+0x114>
jmp    1286 <main+0x136>
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x118(%rbp)
movb   $0x0,-0x111(%rbp,%rax,1)
jmp    11ec <main+0x9c>
lea    -0x110(%rbp),%rsi
lea    0xd6f(%rip),%rdi
call   1050 <printf@plt>
jmp    11b7 <main+0x67>
mov    -0x120(%rbp),%rdi
call   1030 <fclose@plt>
jmp    12af <main+0x15f>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    1173 <main+0x23>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
cmp    $0x2,%edi
jl     120c <main+0xbc>
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x1,%r14d
mov    %rsp,%r13
lea    0xe84(%rip),%r12
jmp    11a1 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x1,%r14
cmp    %rbp,%r14
je     120c <main+0xbc>
mov    (%r15,%r14,8),%rdi
lea    0xe54(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1198 <main+0x48>
mov    %rax,%rbx
jmp    11cb <main+0x7b>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <printf@plt>
mov    %r13,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1190 <main+0x40>
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jne    11fb <main+0xab>
jmp    11c0 <main+0x70>
nop
movb   $0x0,-0x1(%rsp,%rax,1)
add    $0xffffffffffffffff,%rax
je     11c0 <main+0x70>
movzbl -0x1(%rsp,%rax,1),%ecx
cmp    $0xd,%cl
je     11f0 <main+0xa0>
cmp    $0xa,%cl
je     11f0 <main+0xa0>
jmp    11c0 <main+0x70>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %9
br label %10
10: ; preds = %64, %2
%11 = load i32, i32* %9
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %67
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %20, i32** %8
%21 = load i32*, i32** %8
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %63
23: ; preds = %14
br label %24
24: ; preds = %57, %23
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%26 = load i32*, i32** %8
%27 = call i32* @fgets(i8* %25, i32 256, i32* %26)
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %60
29: ; preds = %24
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%31 = call i64 @strlen(i8* %30)
store i64 %31, i64* %7
br label %32
32: ; preds = %53, %29
%33 = load i64, i64* %7
%34 = icmp ugt i64 %33, 0
br i1 %34, label %35, label %51
35: ; preds = %32
%36 = load i64, i64* %7
%37 = sub i64 %36, 1
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 10
br i1 %41, label %49, label %42
42: ; preds = %35
%43 = load i64, i64* %7
%44 = sub i64 %43, 1
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 13
br label %49
49: ; preds = %42, %35
%50 = phi i1 [ true, %35 ], [ %48, %42 ]
br label %51
51: ; preds = %49, %32
%52 = phi i1 [ false, %32 ], [ %50, %49 ]
br i1 %52, label %53, label %57
53: ; preds = %51
%54 = load i64, i64* %7
%55 = add i64 %54, -1
store i64 %55, i64* %7
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %55
store i8 0, i8* %56
br label %32
57: ; preds = %51
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %58)
br label %24
60: ; preds = %24
%61 = load i32*, i32** %8
%62 = call i32 @fclose(i32* %61)
br label %63
63: ; preds = %60, %14
br label %64
64: ; preds = %63
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
br label %10
67: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %36
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %33
%9 = phi i64 [ 1, %6 ], [ %34, %33 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %33, label %14
14: ; preds = %8
%15 = call i32* @fgets(i8* %4, i32 256, i32* %12)
%16 = icmp eq i32* %15, null
br i1 %16, label %31, label %17
17: ; preds = %14, %27
%18 = call i64 @strlen(i8* %4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %17, %25
%21 = phi i64 [ %22, %25 ], [ %18, %17 ]
%22 = add i64 %21, -1
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
switch i8 %24, label %27 [
i8 10, label %25
i8 13, label %25
]
25: ; preds = %20, %20
store i8 0, i8* %23
%26 = icmp eq i64 %22, 0
br i1 %26, label %27, label %20
27: ; preds = %25, %20, %17
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%29 = call i32* @fgets(i8* %4, i32 256, i32* %12)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %17
31: ; preds = %27, %14
%32 = call i32 @fclose(i32* %12)
br label %33
33: ; preds = %8, %31
%34 = add nuw nsw i64 %9, 1
%35 = icmp eq i64 %34, %7
br i1 %35, label %36, label %8
36: ; preds = %33, %2
ret i32 0
}