#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Missing input files\n");
    return 1;
  }
  int i;
  FILE *in;
  char ch;
  int line;
  for (i = 1; i < argc; i++) {
    in = fopen(argv[i], "r");
    if (in == NULL) {
      perror(argv[i]);
      continue;
    }
    line = 0;
    while ((ch = fgetc(in)) != EOF) {
      putchar(ch);
      if (ch == '\n') {
        line++;
      }
      if (line > 21) {
        printf("\n Press Enter to continue...");
        getchar();
        line = 0;
        putchar('\n');
      }
    }
    fclose(in);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a8 <main+0x38>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1290 <main+0x120>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1289 <main+0x119>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe47(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f8 <main+0x88>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <perror@plt>
jmp    127b <main+0x10b>
movl   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%eax
mov    0x2dd3(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1272 <main+0x102>
movsbl -0x21(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x21(%rbp),%eax
cmp    $0xa,%eax
jne    123f <main+0xcf>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x15,-0x28(%rbp)
jle    126d <main+0xfd>
lea    0xdc7(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
movl   $0x0,-0x28(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11ff <main+0x8f>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <main+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
cmp    $0x2,%edi
jge    11ae <main+0x2e>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    1296 <main+0x116>
mov    %edi,%eax
mov    %rax,0x10(%rsp)
mov    $0x1,%r14d
mov    0x2e26(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
mov    (%rax,%r14,8),%rdi
lea    0xe20(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1281 <main+0x101>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <fgetc@plt>
cmp    0x0(%r13),%al
jne    1220 <main+0xa0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
add    $0x1,%r14
cmp    0x10(%rsp),%r14
jne    11d0 <main+0x50>
jmp    1294 <main+0x114>
nopw   0x0(%rax,%rax,1)
xor    %r12d,%r12d
jmp    1241 <main+0xc1>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %r15d,%r12d
cmp    0x0(%r13),%al
je     11ff <main+0x7f>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
cmp    $0xa,%bpl
sete   %r15b
add    %r12d,%r15d
cmp    $0x16,%r15d
jl     1230 <main+0xb0>
lea    0xd9c(%rip),%rdi
call   1060 <printf@plt>
xor    %r15d,%r15d
xor    %eax,%eax
call   1080 <getchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1230 <main+0xb0>
mov    0x8(%rsp),%rax
mov    (%rax,%r14,8),%rdi
call   10a0 <perror@plt>
jmp    1207 <main+0x87>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.2 = [29 x i8] c"\0A Press Enter to continue...\00"
@str = [20 x i8] c"Missing input files\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %43
8: ; preds = %4, %40
%9 = phi i64 [ 1, %4 ], [ %41, %40 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %18, label %14
14: ; preds = %8
%15 = tail call signext i8 @fgetc(i32* %12)
%16 = load i8, i8* @EOF
%17 = icmp eq i8 %15, %16
br i1 %17, label %38, label %21
18: ; preds = %8
%19 = load i8*, i8** %10
%20 = tail call i32 @perror(i8* %19)
br label %40
21: ; preds = %14, %33
%22 = phi i8 [ %35, %33 ], [ %15, %14 ]
%23 = phi i32 [ %34, %33 ], [ 0, %14 ]
%24 = tail call i32 @putchar(i8 signext %22)
%25 = icmp eq i8 %22, 10
%26 = zext i1 %25 to i32
%27 = add nsw i32 %23, %26
%28 = icmp sgt i32 %27, 21
br i1 %28, label %29, label %33
29: ; preds = %21
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%31 = tail call i32 (...) @getchar()
%32 = tail call i32 @putchar(i8 signext 10)
br label %33
33: ; preds = %29, %21
%34 = phi i32 [ 0, %29 ], [ %27, %21 ]
%35 = tail call signext i8 @fgetc(i32* %12)
%36 = load i8, i8* @EOF
%37 = icmp eq i8 %35, %36
br i1 %37, label %38, label %21
38: ; preds = %33, %14
%39 = tail call i32 @fclose(i32* %12)
br label %40
40: ; preds = %38, %18
%41 = add nuw nsw i64 %9, 1
%42 = icmp eq i64 %41, %5
br i1 %42, label %43, label %8
43: ; preds = %40, %6
%44 = phi i32 [ 1, %6 ], [ 0, %40 ]
ret i32 %44
}