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

/* Variables and functions */
int /*<<< orphan*/ display_info();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  char s[255 + 1];
  int i;
  FILE *fp;
  if (strcmp(argv[1], "-h") == 0) {
    display_info();
    exit(1);
  }
  for (i = 1; i < argc; i++) {
    if ((fp = fopen(argv[i], "r")) == NULL) {
      fprintf(stderr, "\nCould not open %s\n", argv[i]);
      continue;
    }
    while (!feof(fp)) {
      if (fgets(s, (int)sizeof(s), fp) == NULL) {
        if (ferror(fp) != 0) {
          fprintf(stderr, "*** Error reading %s.  Exiting.\n", argv[i]);
          exit(1);
        }
        break;
      }
      if (strncmp(s, "/*man-start*", 12) != 0)
        continue;
      for (;;) {
        if (fgets(s, (int)sizeof(s), fp) == NULL) {
          if (ferror(fp) != 0) {
            fprintf(stderr, "*** Error reading %s.  Exiting.\n", argv[i]);
            exit(1);
          }
          break;
        }
        if (strncmp(s, "**man-end", 9) == 0)
          break;
        printf("%s", s);
      }
      printf("\n\n-----------------------------------"
             "---------------------------------------\n\n");
    }
    fclose(fp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe28(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    11f8 <main+0x48>
mov    $0x0,%al
call   1070 <display_info@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x1,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1402 <main+0x252>
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xddc(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x120(%rbp)
cmp    $0x0,%rax
jne    1266 <main+0xb6>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xda9(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    13ee <main+0x23e>
jmp    126b <main+0xbb>
mov    -0x120(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    128c <main+0xdc>
jmp    13e2 <main+0x232>
lea    -0x110(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    $0x100,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    12f7 <main+0x147>
mov    -0x120(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     12f2 <main+0x142>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd36(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    13e2 <main+0x232>
lea    -0x110(%rbp),%rdi
lea    0xd35(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     131e <main+0x16e>
jmp    126b <main+0xbb>
jmp    1323 <main+0x173>
lea    -0x110(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    $0x100,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    138e <main+0x1de>
mov    -0x120(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     1389 <main+0x1d9>
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc9f(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    13cf <main+0x21f>
lea    -0x110(%rbp),%rdi
lea    0xcab(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    13b5 <main+0x205>
jmp    13cf <main+0x21f>
lea    -0x110(%rbp),%rsi
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1323 <main+0x173>
lea    0xc7e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    126b <main+0xbb>
mov    -0x120(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1202 <main+0x52>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%r13
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xe1f(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     137c <main+0x1bc>
cmp    $0x2,%ebx
jl     1341 <main+0x181>
mov    %ebx,%eax
mov    %rax,0x8(%rsp)
mov    $0x1,%r12d
lea    0x10(%rsp),%rbx
lea    0xe36(%rip),%r15
lea    0xe39(%rip),%r14
mov    %r13,(%rsp)
jmp    1249 <main+0x89>
xchg   %ax,%ax
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13,%r12,8),%rdx
lea    0xdd0(%rip),%rsi
call   10b0 <fprintf@plt>
add    $0x1,%r12
cmp    0x8(%rsp),%r12
je     1341 <main+0x181>
mov    0x0(%r13,%r12,8),%rdi
lea    0xdae(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1220 <main+0x60>
mov    %rax,%rbp
mov    %rax,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
lea    0xdc7(%rip),%r13
jne    1330 <main+0x170>
jmp    12ad <main+0xed>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1050 <ferror@plt>
test   %rax,%rax
jne    1355 <main+0x195>
lea    0xdbc(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    1330 <main+0x170>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1320 <main+0x160>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    129d <main+0xdd>
jmp    12ed <main+0x12d>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1280 <main+0xc0>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12e0 <main+0x120>
jmp    1291 <main+0xd1>
mov    %rbp,%rdi
call   1050 <ferror@plt>
test   %rax,%rax
jne    1355 <main+0x195>
nopl   (%rax)
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    (%rsp),%r13
jmp    123a <main+0x7a>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
mov    (%rsp),%rax
mov    (%rax,%r12,8),%rdx
lea    0xcac(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
xor    %eax,%eax
call   1080 <display_info@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"\0ACould not open %s\0A\00"
@.str.3 = [33 x i8] c"*** Error reading %s. Exiting.\0A\00"
@.str.4 = [13 x i8] c"/*man-start*\00"
@.str.5 = [10 x i8] c"**man-end\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [79 x i8] c"\0A\0A--------------------------------------------------------------------------\0A\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 i32
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 (...) @display_info()
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
store i32 1, i32* %7
br label %18
18: ; preds = %101, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %104
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %8
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %38
30: ; preds = %22
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %36)
br label %101
38: ; preds = %22
br label %39
39: ; preds = %96, %67, %38
%40 = load i32*, i32** %8
%41 = call i32 @feof(i32* %40)
%42 = icmp ne i32 %41, 0
%43 = xor i1 %42, true
br i1 %43, label %44, label %98
44: ; preds = %39
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%46 = load i32*, i32** %8
%47 = call i32* @fgets(i8* %45, i32 256, i32* %46)
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %63
49: ; preds = %44
%50 = load i32*, i32** %8
%51 = call i64 @ferror(i32* %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %62
53: ; preds = %49
%54 = load i32, i32* @stderr
%55 = load i8**, i8*** %5
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %59)
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %49
br label %98
63: ; preds = %44
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%65 = call i64 @strncmp(i8* %64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 12)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %63
br label %39
68: ; preds = %63
br label %69
69: ; preds = %93, %68
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%71 = load i32*, i32** %8
%72 = call i32* @fgets(i8* %70, i32 256, i32* %71)
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %88
74: ; preds = %69
%75 = load i32*, i32** %8
%76 = call i64 @ferror(i32* %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %87
78: ; preds = %74
%79 = load i32, i32* @stderr
%80 = load i8**, i8*** %5
%81 = load i32, i32* %7
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %80, i64 %82
%84 = load i8*, i8** %83
%85 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %84)
%86 = call i32 @exit(i32 1)
unreachable
87: ; preds = %74
br label %96
88: ; preds = %69
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%90 = call i64 @strncmp(i8* %89, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 9)
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %93
92: ; preds = %88
br label %96
93: ; preds = %88
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %94)
br label %69
96: ; preds = %92, %87
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.7, i64 0, i64 0))
br label %39
98: ; preds = %62, %39
%99 = load i32*, i32** %8
%100 = call i32 @fclose(i32* %99)
br label %101
101: ; preds = %98, %30
%102 = load i32, i32* %7
%103 = add nsw i32 %102, 1
store i32 %103, i32* %7
br label %18
104: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"\0ACould not open %s\0A\00"
@.str.3 = [33 x i8] c"*** Error reading %s. Exiting.\0A\00"
@.str.4 = [13 x i8] c"/*man-start*\00"
@.str.5 = [10 x i8] c"**man-end\00"
@.str.6 = [3 x i8] c"%s\00"
@str = [78 x i8] c"\0A\0A--------------------------------------------------------------------------\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 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %71
11: ; preds = %9
%12 = zext i32 %0 to i64
br label %16
13: ; preds = %2
%14 = tail call i32 (...) @display_info()
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %11, %68
%17 = phi i64 [ 1, %11 ], [ %69, %68 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %16
%23 = call i32 @feof(i32* %20)
%24 = icmp eq i32 %23, 0
br i1 %24, label %29, label %66
25: ; preds = %16
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %18
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %68
29: ; preds = %22, %63
%30 = call i32* @fgets(i8* %4, i32 256, i32* %20)
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %40
32: ; preds = %29
%33 = call i64 @ferror(i32* %20)
%34 = icmp eq i64 %33, 0
br i1 %34, label %66, label %35
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %18
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %29
%41 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 12)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %63
43: ; preds = %40
%44 = call i32* @fgets(i8* %4, i32 256, i32* %20)
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %54
46: ; preds = %57, %43
%47 = call i64 @ferror(i32* %20)
%48 = icmp eq i64 %47, 0
br i1 %48, label %61, label %49
49: ; preds = %46
%50 = load i32, i32* @stderr
%51 = load i8*, i8** %18
%52 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %43, %57
%55 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 9)
%56 = icmp eq i64 %55, 0
br i1 %56, label %61, label %57
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%59 = call i32* @fgets(i8* %4, i32 256, i32* %20)
%60 = icmp eq i32* %59, null
br i1 %60, label %46, label %54
61: ; preds = %54, %46
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
br label %63
63: ; preds = %61, %40
%64 = call i32 @feof(i32* %20)
%65 = icmp eq i32 %64, 0
br i1 %65, label %29, label %66
66: ; preds = %63, %22, %32
%67 = call i32 @fclose(i32* %20)
br label %68
68: ; preds = %66, %25
%69 = add nuw nsw i64 %17, 1
%70 = icmp eq i64 %69, %12
br i1 %70, label %71, label %16
71: ; preds = %68, %9
ret i32 0
}