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

/* Variables and functions */
int EOF;
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ atoi(char *);
scalar_t__ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
char *strerror(scalar_t__);
int /*<<< orphan*/ usage(int, char **);
int main(int argc, char **argv) {
  uint64_t nLines = 10;
  int c;
  uint64_t count = 0UL;
  FILE *out = NULL;
  int optind = 1;
  while (optind < argc) {
    if (strcmp(argv[optind], "-h") == 0) {
      usage(argc, argv);
      return (EXIT_FAILURE);
    } else if (strcmp(argv[optind], "-n") == 0) {
      nLines = atoi(argv[++optind]);
      if (nLines < 0) {
        fprintf(stderr, " Bad number of lines %s.\n", argv[optind]);
        return EXIT_FAILURE;
      }
    } else if (strcmp(argv[optind], "--") == 0) {
      ++optind;
      break;
    } else if (argv[optind][0] == '-') {
      fprintf(stderr, "unknown option '%s'\n", argv[optind]);
      usage(argc, argv);
      return EXIT_FAILURE;
    } else {
      break;
    }
    ++optind;
  }
  if (optind == argc) {
  } else if (optind + 1 == argc) {
    errno = 0;
    out = fopen(argv[optind], "w");
    if (out == NULL) {
      fprintf(stderr, "Cannot open %s %s\n", argv[optind], strerror(errno));
      return EXIT_FAILURE;
    }
  } else {
    usage(argc, argv);
    return EXIT_FAILURE;
  }
  while ((c = fgetc(stdin)) != EOF) {
    if (count < nLines && out != NULL)
      fputc(c, out);
    if (c == '\n') {
      ++count;
    }
    fputc(c, stdout);
  }
  if (out != NULL) {
    fflush(out);
    fclose(out);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xa,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1343 <main+0x1a3>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1220 <main+0x80>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <usage@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14b3 <main+0x313>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdd0(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12a3 <main+0x103>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10b0 <atoi@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    129e <main+0xfe>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14b3 <main+0x313>
jmp    1330 <main+0x190>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd6a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12d3 <main+0x133>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1343 <main+0x1a3>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    132b <main+0x18b>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd1c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <usage@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14b3 <main+0x313>
jmp    1343 <main+0x1a3>
jmp    1335 <main+0x195>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d5 <main+0x35>
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1354 <main+0x1b4>
jmp    1413 <main+0x273>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    13f1 <main+0x251>
mov    0x2c5e(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcb4(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    13ec <main+0x24c>
mov    0x2c31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c0d(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    %rax,%rcx
lea    0xc66(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2bde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14b3 <main+0x313>
jmp    140e <main+0x26e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <usage@plt>
mov    0x2bbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14b3 <main+0x313>
jmp    1413 <main+0x273>
jmp    1418 <main+0x278>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2bb0(%rip),%rcx
cmp    (%rcx),%eax
je     148a <main+0x2ea>
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    145d <main+0x2bd>
cmpq   $0x0,-0x30(%rbp)
je     145d <main+0x2bd>
mov    -0x1c(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   1050 <fputc@plt>
cmpl   $0xa,-0x1c(%rbp)
jne    1473 <main+0x2d3>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    0x2b3b(%rip),%rax
mov    (%rax),%rsi
call   1050 <fputc@plt>
jmp    1418 <main+0x278>
cmpq   $0x0,-0x30(%rbp)
je     14a7 <main+0x307>
mov    -0x30(%rbp),%rdi
call   1080 <fflush@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2b02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x2,%edi
jl     1226 <main+0x86>
mov    %edi,0x4(%rsp)
mov    %edi,%ebp
mov    $0xa,%r13d
mov    $0x1,%r12d
mov    $0x2,%r15d
nopl   0x0(%rax,%rax,1)
mov    (%r14,%r12,8),%rdi
lea    0xe25(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1274 <main+0xd4>
mov    (%r14,%r12,8),%rdi
lea    0xe0f(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    123f <main+0x9f>
mov    0x8(%r14,%r12,8),%rbx
mov    %rbx,%rdi
call   10b0 <atoi@plt>
test   %rax,%rax
js     1360 <main+0x1c0>
mov    %rax,%r13
add    $0x2,%r12
add    $0x2,%r15d
cmp    %rbp,%r12
jb     11d0 <main+0x30>
jmp    127d <main+0xdd>
mov    $0x1,%r15d
mov    $0xa,%r13d
cmp    %edi,%r15d
jne    128a <main+0xea>
xor    %r12d,%r12d
jmp    12c0 <main+0x120>
mov    (%r14,%r12,8),%rdi
lea    0xdd6(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1281 <main+0xe1>
mov    (%r14,%r12,8),%rdx
cmpb   $0x2d,(%rdx)
jne    127d <main+0xdd>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
lea    0xdb6(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x4(%rsp),%edi
jmp    12ff <main+0x15f>
add    $0xffffffff,%r15d
mov    0x4(%rsp),%edi
cmp    %edi,%r15d
je     1237 <main+0x97>
lea    0x1(%r15),%eax
cmp    %edi,%eax
jne    12ff <main+0x15f>
mov    0x2d2f(%rip),%rbp
movq   $0x0,0x0(%rbp)
movslq %r15d,%rbx
mov    (%r14,%rbx,8),%rdi
lea    0xd89(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
je     137c <main+0x1dc>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    0x2d0b(%rip),%r15
cmp    (%r15),%eax
jne    130c <main+0x16c>
mov    0x2ccf(%rip),%rbx
test   %r12,%r12
je     13b1 <main+0x211>
mov    %r12,%rdi
call   1080 <fflush@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
jmp    13b1 <main+0x211>
mov    %r14,%rsi
call   1090 <usage@plt>
jmp    13aa <main+0x20a>
mov    %eax,%ebx
xor    %ebp,%ebp
mov    0x2ca1(%rip),%r14
jmp    134a <main+0x1aa>
nopl   0x0(%rax)
xor    %eax,%eax
cmp    $0xa,%ebx
sete   %al
add    %rax,%rbp
mov    (%r14),%rsi
mov    %ebx,%edi
call   1050 <fputc@plt>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     12da <main+0x13a>
test   %r12,%r12
je     1320 <main+0x180>
cmp    %r13,%rbp
jge    1320 <main+0x180>
mov    %ebx,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
jmp    1320 <main+0x180>
mov    0x2c69(%rip),%rax
mov    (%rax),%edi
lea    0xc96(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13aa <main+0x20a>
mov    0x2c4d(%rip),%rax
mov    (%rax),%r15d
mov    (%r14,%rbx,8),%r14
mov    0x0(%rbp),%rdi
call   10c0 <strerror@plt>
lea    0xca0(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2c0f(%rip),%rbx
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"-n\00"
@stderr = global i32 0
@.str.2 = [26 x i8] c" Bad number of lines %s.\0A\00"
@.str.3 = [3 x i8] c"--\00"
@.str.4 = [21 x i8] c"unknown option '%s'\0A\00"
@errno = global i64 0
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [19 x i8] c"Cannot open %s %s\0A\00"
@stdin = global i32 0
@EOF = global i32 0
@stdout = global i32* null
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %48
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %43
%7 = phi i64 [ 1, %4 ], [ %44, %43 ]
%8 = phi i64 [ 10, %4 ], [ %23, %43 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = tail call i32 @usage(i32 %0, i8** %1)
br label %99
15: ; preds = %6
%16 = load i8*, i8** %9
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = add nuw nsw i64 %7, 1
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = tail call i64 @atoi(i8* %22)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %43
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %99
28: ; preds = %15
%29 = trunc i64 %7 to i32
%30 = load i8*, i8** %9
%31 = tail call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = add nuw nsw i32 %29, 1
br label %48
35: ; preds = %28
%36 = load i8*, i8** %9
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 45
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* @stderr
%41 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%42 = tail call i32 @usage(i32 %0, i8** %1)
br label %99
43: ; preds = %19
%44 = add nuw nsw i64 %7, 2
%45 = icmp ult i64 %44, %5
br i1 %45, label %6, label %46
46: ; preds = %43
%47 = trunc i64 %44 to i32
br label %48
48: ; preds = %46, %2, %35, %33
%49 = phi i64 [ %8, %33 ], [ %8, %35 ], [ 10, %2 ], [ %23, %46 ]
%50 = phi i32 [ %34, %33 ], [ %29, %35 ], [ 1, %2 ], [ %47, %46 ]
%51 = icmp eq i32 %50, %0
br i1 %51, label %69, label %52
52: ; preds = %48
%53 = add nsw i32 %50, 1
%54 = icmp eq i32 %53, %0
br i1 %54, label %55, label %67
55: ; preds = %52
store i64 0, i64* @errno
%56 = sext i32 %50 to i64
%57 = getelementptr inbounds i8*, i8** %1, i64 %56
%58 = load i8*, i8** %57
%59 = tail call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %69
61: ; preds = %55
%62 = load i32, i32* @stderr
%63 = load i8*, i8** %57
%64 = load i64, i64* @errno
%65 = tail call i8* @strerror(i64 %64)
%66 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %63, i8* %65)
br label %99
67: ; preds = %52
%68 = tail call i32 @usage(i32 %0, i8** %1)
br label %99
69: ; preds = %55, %48
%70 = phi i32* [ null, %48 ], [ %59, %55 ]
%71 = load i32, i32* @stdin
%72 = tail call i32 @fgetc(i32 %71)
%73 = load i32, i32* @EOF
%74 = icmp eq i32 %72, %73
br i1 %74, label %94, label %75
75: ; preds = %69
%76 = icmp ne i32* %70, null
br label %77
77: ; preds = %75, %84
%78 = phi i32 [ %72, %75 ], [ %91, %84 ]
%79 = phi i64 [ 0, %75 ], [ %87, %84 ]
%80 = icmp slt i64 %79, %49
%81 = and i1 %76, %80
br i1 %81, label %82, label %84
82: ; preds = %77
%83 = tail call i32 @fputc(i32 %78, i32* %70)
br label %84
84: ; preds = %82, %77
%85 = icmp eq i32 %78, 10
%86 = zext i1 %85 to i64
%87 = add nuw nsw i64 %79, %86
%88 = load i32*, i32** @stdout
%89 = tail call i32 @fputc(i32 %78, i32* %88)
%90 = load i32, i32* @stdin
%91 = tail call i32 @fgetc(i32 %90)
%92 = load i32, i32* @EOF
%93 = icmp eq i32 %91, %92
br i1 %93, label %94, label %77
94: ; preds = %84, %69
%95 = icmp eq i32* %70, null
br i1 %95, label %99, label %96
96: ; preds = %94
%97 = tail call i32 @fflush(i32* %70)
%98 = tail call i32 @fclose(i32* %70)
br label %99
99: ; preds = %94, %96, %67, %61, %39, %25, %13
%100 = phi i32* [ @EXIT_FAILURE, %13 ], [ @EXIT_FAILURE, %25 ], [ @EXIT_FAILURE, %61 ], [ @EXIT_FAILURE, %67 ], [ @EXIT_FAILURE, %39 ], [ @EXIT_SUCCESS, %96 ], [ @EXIT_SUCCESS, %94 ]
%101 = load i32, i32* %100
ret i32 %101
}