#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 /*<<< orphan*/ EXIT_FAILURE;
int atoi(int /*<<< orphan*/);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, size_t, int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int);
int main(int argc, char **argv) {
  FILE *file;
  int i, numlines = 10, newlinescount, exitcode = 0, opt;
  while ((opt = getopt(argc, argv, "n:")) != -1) {
    switch (opt) {
    case 'n':
      numlines = atoi(optarg);
      break;
    default:
      fprintf(stderr, "Usage: %s [−n number] [file...]\n", argv[0]);
      exit(EXIT_FAILURE);
    }
  }
  char buffer[4096];
  size_t numbytes, tmpcount;
  bool multiple;
  if (optind == argc) {
    optind--;
    strcpy(argv[optind], "-");
  } else if (optind > argc - 1) {
    multiple = true;
  }
  for (i = optind; i < argc; i++) {
    if (strcmp(argv[i], "-") == 0)
      file = stdin;
    else
      file = fopen(argv[i], "r");
    if (!file) {
      fprintf(stderr, "%s: Error %d: %s\n", argv[0], errno, strerror(errno));
      exitcode = 1;
      continue;
    }
    if (multiple) {
      if (i == optind)
        printf("==> %s <==\n", argv[i]);
      else
        printf("\n==> %s <==\n", argv[i]);
    }
    for (newlinescount = 0; newlinescount < numlines;) {
      numbytes = fread(buffer, sizeof(unsigned char), 4096, file);
      for (tmpcount = 0; tmpcount < numbytes; tmpcount++) {
        if (buffer[tmpcount] == '\n')
          newlinescount++;
        if (newlinescount == numlines)
          numbytes = tmpcount + 1;
      }
      fwrite(buffer, sizeof(unsigned char), numbytes, stdout);
      if (numbytes < 4096)
        break;
    }
    if (strcmp(argv[i], "-") != 0)
      fclose(file);
  }
  return exitcode;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1060,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe0b(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     125e <main+0x9e>
mov    -0x2c(%rbp),%eax
sub    $0x6e,%eax
jne    122d <main+0x6d>
jmp    1217 <main+0x57>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   10b0 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    1259 <main+0x99>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
jmp    11e7 <main+0x27>
mov    0x2d73(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    12a8 <main+0xe8>
mov    0x2d61(%rip),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    0x2d55(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x2d48(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd88(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ce <main+0x10e>
mov    0x2d29(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    12c9 <main+0x109>
movl   $0x1,-0x1044(%rbp)
jmp    12ce <main+0x10e>
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    152d <main+0x36d>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd2d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    131b <main+0x15b>
mov    0x2cd1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1337 <main+0x177>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcfa(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13ac <main+0x1ec>
mov    0x2c7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1054(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x1050(%rbp)
mov    0x2c5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1048(%rbp)
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x1054(%rbp),%edi
mov    -0x1050(%rbp),%rdx
mov    -0x1048(%rbp),%ecx
mov    %rax,%r8
lea    0xc91(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x28(%rbp)
jmp    151f <main+0x35f>
cmpl   $0x0,-0x1044(%rbp)
je     1405 <main+0x245>
mov    -0x1c(%rbp),%eax
mov    0x2c15(%rip),%rcx
cmp    (%rcx),%eax
jne    13e8 <main+0x228>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc5f(%rip),%rdi
call   1060 <printf@plt>
jmp    1400 <main+0x240>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc41(%rip),%rdi
call   1060 <printf@plt>
jmp    1405 <main+0x245>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    14ef <main+0x32f>
lea    -0x1030(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1040 <fread@plt>
mov    %rax,-0x1038(%rbp)
movq   $0x0,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
cmp    -0x1038(%rbp),%rax
jae    14b3 <main+0x2f3>
mov    -0x1040(%rbp),%rax
movsbl -0x1030(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1479 <main+0x2b9>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1497 <main+0x2d7>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1038(%rbp)
jmp    149c <main+0x2dc>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
jmp    1444 <main+0x284>
lea    -0x1030(%rbp),%rdi
mov    -0x1038(%rbp),%rdx
mov    0x2ae8(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
cmpq   $0x1000,-0x1038(%rbp)
jae    14ea <main+0x32a>
jmp    14ef <main+0x32f>
jmp    140c <main+0x24c>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xb24(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     151a <main+0x35a>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
jmp    151f <main+0x35f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12da <main+0x11a>
mov    -0x28(%rbp),%eax
add    $0x1060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
mov    $0xa,%ebp
lea    0xe1e(%rip),%r12
mov    0x2e0f(%rip),%r14
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   10a0 <getopt@plt>
cmp    $0x6e,%eax
jne    120e <main+0x4e>
mov    (%r14),%edi
call   10b0 <atoi@plt>
mov    %eax,%ebp
jmp    11f0 <main+0x30>
cmp    $0xffffffff,%eax
jne    1419 <main+0x259>
mov    0x2dba(%rip),%rax
mov    (%rax),%eax
cmp    %ebx,%eax
jne    1248 <main+0x88>
lea    -0x1(%rbx),%eax
mov    0x2daa(%rip),%r14
mov    %eax,(%r14)
movslq %ebx,%rax
mov    -0x8(%r15,%rax,8),%rdi
lea    0xde6(%rip),%rsi
call   1030 <strcpy@plt>
mov    (%r14),%eax
movl   $0x0,0xc(%rsp)
cmp    %ebx,%eax
jge    1403 <main+0x243>
movslq %eax,%r13
lea    0x20(%rsp),%r14
movl   $0x0,0xc(%rsp)
mov    %r15,0x10(%rsp)
mov    %rbx,0x18(%rsp)
jmp    12dd <main+0x11d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2d41(%rip),%rax
mov    (%rax),%r15d
mov    0x10(%rsp),%rax
mov    (%rax),%rbx
mov    0x2d27(%rip),%rax
mov    (%rax),%r12d
mov    %r12d,%edi
call   10e0 <strerror@plt>
mov    %r15d,%edi
mov    0x10(%rsp),%r15
lea    0xd77(%rip),%rsi
mov    %rbx,%rdx
mov    %r12d,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
movl   $0x1,0xc(%rsp)
add    $0x1,%r13
mov    0x18(%rsp),%rbx
cmp    %ebx,%r13d
je     1403 <main+0x243>
mov    (%r15,%r13,8),%rdi
lea    0xd3e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0x150>
mov    (%r15,%r13,8),%rdi
lea    0xd2b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
test   %r12,%r12
jne    1323 <main+0x163>
jmp    1280 <main+0xc0>
nop
mov    0x2cc9(%rip),%rax
mov    (%rax),%r12
test   %r12,%r12
je     1280 <main+0xc0>
mov    0x2cae(%rip),%rax
cmp    %r13d,(%rax)
mov    (%r15,%r13,8),%rsi
lea    0xd04(%rip),%rdi
lea    0xcfe(%rip),%rax
cmove  %rax,%rdi
call   1060 <printf@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
cmp    %ebp,%ebx
jge    13d8 <main+0x218>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
test   %rax,%rax
je     13c0 <main+0x200>
mov    %rax,%r15
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmpb   $0xa,0x20(%rsp,%rax,1)
sete   %cl
add    %ecx,%ebx
add    $0x1,%rax
cmp    %ebp,%ebx
cmove  %rax,%r15
cmp    %r15,%rax
jb     1380 <main+0x1c0>
mov    0x2c0e(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   10d0 <fwrite@plt>
cmp    $0xfff,%r15
ja     1350 <main+0x190>
jmp    13d8 <main+0x218>
nop
mov    0x2be9(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <fwrite@plt>
mov    0x10(%rsp),%r15
mov    (%r15,%r13,8),%rdi
lea    0xc3e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12cb <main+0x10b>
mov    %r12,%rdi
call   1050 <fclose@plt>
jmp    12cb <main+0x10b>
mov    0xc(%rsp),%eax
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xbd7(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2b7e(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"n:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [35 x i8] c"Usage: %s [\E2\88\92n number] [file...]\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@.str.2 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [18 x i8] c"%s: Error %d: %s\0A\00"
@errno = global i32 0
@.str.5 = [12 x i8] c"==> %s <==\0A\00"
@.str.6 = [13 x i8] c"\0A==> %s <==\0A\00"
@stdout = 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
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [4096 x i8]
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %8
store i32 0, i32* %10
br label %16
16: ; preds = %34, %2
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i32 @getopt(i32 %17, i8** %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* %11
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %35
21: ; preds = %16
%22 = load i32, i32* %11
switch i32 %22, label %26 [
i32 110, label %23
]
23: ; preds = %21
%24 = load i32, i32* @optarg
%25 = call i32 @atoi(i32 %24)
store i32 %25, i32* %8
br label %34
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %23
br label %16
35: ; preds = %16
%36 = load i32, i32* @optind
%37 = load i32, i32* %4
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* @optind
%41 = add nsw i32 %40, -1
store i32 %41, i32* @optind
%42 = load i8**, i8*** %5
%43 = load i32, i32* @optind
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %55
48: ; preds = %35
%49 = load i32, i32* @optind
%50 = load i32, i32* %4
%51 = sub nsw i32 %50, 1
%52 = icmp sgt i32 %49, %51
br i1 %52, label %53, label %54
53: ; preds = %48
store i32 1, i32* %15
br label %54
54: ; preds = %53, %48
br label %55
55: ; preds = %54, %39
%56 = load i32, i32* @optind
store i32 %56, i32* %7
br label %57
57: ; preds = %166, %55
%58 = load i32, i32* %7
%59 = load i32, i32* %4
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %169
61: ; preds = %57
%62 = load i8**, i8*** %5
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
%66 = load i8*, i8** %65
%67 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %61
%70 = load i32*, i32** @stdin
store i32* %70, i32** %6
br label %78
71: ; preds = %61
%72 = load i8**, i8*** %5
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %77, i32** %6
br label %78
78: ; preds = %71, %69
%79 = load i32*, i32** %6
%80 = icmp ne i32* %79, null
br i1 %80, label %90, label %81
81: ; preds = %78
%82 = load i32, i32* @stderr
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 0
%85 = load i8*, i8** %84
%86 = load i32, i32* @errno
%87 = load i32, i32* @errno
%88 = call i8* @strerror(i32 %87)
%89 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %85, i32 %86, i8* %88)
store i32 1, i32* %10
br label %166
90: ; preds = %78
%91 = load i32, i32* %15
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %112
93: ; preds = %90
%94 = load i32, i32* %7
%95 = load i32, i32* @optind
%96 = icmp eq i32 %94, %95
br i1 %96, label %97, label %104
97: ; preds = %93
%98 = load i8**, i8*** %5
%99 = load i32, i32* %7
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8*, i8** %98, i64 %100
%102 = load i8*, i8** %101
%103 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %102)
br label %111
104: ; preds = %93
%105 = load i8**, i8*** %5
%106 = load i32, i32* %7
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8*, i8** %105, i64 %107
%109 = load i8*, i8** %108
%110 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %109)
br label %111
111: ; preds = %104, %97
br label %112
112: ; preds = %111, %90
store i32 0, i32* %9
br label %113
113: ; preds = %153, %112
%114 = load i32, i32* %9
%115 = load i32, i32* %8
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %154
117: ; preds = %113
%118 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%119 = load i32*, i32** %6
%120 = call i64 @fread(i8* %118, i32 1, i32 4096, i32* %119)
store i64 %120, i64* %13
store i64 0, i64* %14
br label %121
121: ; preds = %142, %117
%122 = load i64, i64* %14
%123 = load i64, i64* %13
%124 = icmp ult i64 %122, %123
br i1 %124, label %125, label %145
125: ; preds = %121
%126 = load i64, i64* %14
%127 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 %126
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp eq i32 %129, 10
br i1 %130, label %131, label %134
131: ; preds = %125
%132 = load i32, i32* %9
%133 = add nsw i32 %132, 1
store i32 %133, i32* %9
br label %134
134: ; preds = %131, %125
%135 = load i32, i32* %9
%136 = load i32, i32* %8
%137 = icmp eq i32 %135, %136
br i1 %137, label %138, label %141
138: ; preds = %134
%139 = load i64, i64* %14
%140 = add i64 %139, 1
store i64 %140, i64* %13
br label %141
141: ; preds = %138, %134
br label %142
142: ; preds = %141
%143 = load i64, i64* %14
%144 = add i64 %143, 1
store i64 %144, i64* %14
br label %121
145: ; preds = %121
%146 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%147 = load i64, i64* %13
%148 = load i32, i32* @stdout
%149 = call i32 @fwrite(i8* %146, i32 1, i64 %147, i32 %148)
%150 = load i64, i64* %13
%151 = icmp ult i64 %150, 4096
br i1 %151, label %152, label %153
152: ; preds = %145
br label %154
153: ; preds = %145
br label %113
154: ; preds = %152, %113
%155 = load i8**, i8*** %5
%156 = load i32, i32* %7
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8*, i8** %155, i64 %157
%159 = load i8*, i8** %158
%160 = call i64 @strcmp(i8* %159, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%161 = icmp ne i64 %160, 0
br i1 %161, label %162, label %165
162: ; preds = %154
%163 = load i32*, i32** %6
%164 = call i32 @fclose(i32* %163)
br label %165
165: ; preds = %162, %154
br label %166
166: ; preds = %165, %81
%167 = load i32, i32* %7
%168 = add nsw i32 %167, 1
store i32 %168, i32* %7
br label %57
169: ; preds = %57
%170 = load i32, i32* %10
ret i32 %170
}

LLVM IR (-O2):
@.str = [3 x i8] c"n:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [35 x i8] c"Usage: %s [\E2\88\92n number] [file...]\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@.str.2 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [18 x i8] c"%s: Error %d: %s\0A\00"
@errno = global i32 0
@.str.5 = [12 x i8] c"==> %s <==\0A\00"
@.str.6 = [13 x i8] c"\0A==> %s <==\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
br label %4
4: ; preds = %7, %2
%5 = phi i32 [ 10, %2 ], [ %9, %7 ]
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %10 [
i32 -1, label %16
i32 110, label %7
]
7: ; preds = %4
%8 = load i32, i32* @optarg
%9 = tail call i32 @atoi(i32 %8)
br label %4
10: ; preds = %4
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %4
%17 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%18 = load i32, i32* @optind
%19 = icmp eq i32 %18, %0
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = add nsw i32 %0, -1
store i32 %21, i32* @optind
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* @optind
br label %27
27: ; preds = %16, %20
%28 = phi i32 [ %18, %16 ], [ %26, %20 ]
%29 = icmp slt i32 %28, %0
br i1 %29, label %30, label %97
30: ; preds = %27
%31 = sext i32 %28 to i64
br label %32
32: ; preds = %30, %92
%33 = phi i64 [ %31, %30 ], [ %94, %92 ]
%34 = phi i32 [ 0, %30 ], [ %93, %92 ]
%35 = getelementptr inbounds i8*, i8** %1, i64 %33
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %32
%40 = load i32*, i32** @stdin
br label %44
41: ; preds = %32
%42 = load i8*, i8** %35
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %41, %39
%45 = phi i32* [ %40, %39 ], [ %43, %41 ]
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %53
47: ; preds = %44
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %1
%50 = load i32, i32* @errno
%51 = call i8* @strerror(i32 %50)
%52 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %49, i32 %50, i8* %51)
br label %92
53: ; preds = %44
%54 = load i32, i32* @optind
%55 = trunc i64 %33 to i32
%56 = icmp eq i32 %54, %55
%57 = load i8*, i8** %35
%58 = select i1 %56, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0)
%59 = call i32 @printf(i8* %58, i8* %57)
br label %60
60: ; preds = %82, %53
%61 = phi i32 [ 0, %53 ], [ %77, %82 ]
%62 = icmp slt i32 %61, %5
br i1 %62, label %63, label %86
63: ; preds = %60
%64 = call i64 @fread(i8* %17, i32 1, i32 4096, i32* %45)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i32, i32* @stdout
%68 = call i32 @fwrite(i8* %17, i32 1, i64 0, i32 %67)
br label %86
69: ; preds = %63, %69
%70 = phi i64 [ %79, %69 ], [ 0, %63 ]
%71 = phi i64 [ %80, %69 ], [ %64, %63 ]
%72 = phi i32 [ %77, %69 ], [ %61, %63 ]
%73 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %70
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 10
%76 = zext i1 %75 to i32
%77 = add nsw i32 %72, %76
%78 = icmp eq i32 %77, %5
%79 = add nuw i64 %70, 1
%80 = select i1 %78, i64 %79, i64 %71
%81 = icmp ult i64 %79, %80
br i1 %81, label %69, label %82
82: ; preds = %69
%83 = load i32, i32* @stdout
%84 = call i32 @fwrite(i8* %17, i32 1, i64 %80, i32 %83)
%85 = icmp ult i64 %80, 4096
br i1 %85, label %86, label %60
86: ; preds = %82, %60, %66
%87 = load i8*, i8** %35
%88 = call i64 @strcmp(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
br i1 %89, label %92, label %90
90: ; preds = %86
%91 = call i32 @fclose(i32* %45)
br label %92
92: ; preds = %86, %90, %47
%93 = phi i32 [ %34, %90 ], [ %34, %86 ], [ 1, %47 ]
%94 = add nsw i64 %33, 1
%95 = trunc i64 %94 to i32
%96 = icmp eq i32 %95, %0
br i1 %96, label %97, label %32
97: ; preds = %92, %27
%98 = phi i32 [ 0, %27 ], [ %93, %92 ]
ret i32 %98
}