#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*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
char *get_filename_ext(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  if (argc >= 2) {
    FILE *fin = fopen(argv[1], "r");
    if (fin) {
      char line[2000000];
      int lines = 0;
      while (fgets(line, sizeof(line), fin)) {
        lines++;
      }
      printf("Number of lines in %s is %d\n", argv[1], lines);
      rewind(fin);
      int split = 2;
      if (argc >= 3) {
        split = strtoul(argv[2], NULL, 10);
      }
      if (split > lines) {
        split = lines;
        printf("You can't split more then the number of lines in input file.");
      }
      int i;
      int separate = lines / split;
      char defaultOutputFile[] = "output";
      for (i = 0; i < split; ++i) {
        char fileOutput[200] = "";
        if (argc >= 4) {
          strcat(fileOutput, argv[3]);
        } else {
          strcat(fileOutput, defaultOutputFile);
        }
        char numString[20];
        sprintf(numString, "%d", i);
        strcat(fileOutput, numString);
        strcat(fileOutput, get_filename_ext(argv[1]));
        FILE *fout = fopen(fileOutput, "w");
        int j;
        if (i + 1 >= split) {
          separate += (lines % split);
        }
        for (j = 0; j < separate; ++j) {
          fgets(line, sizeof(line), fin);
          fprintf(fout, "%s", line);
        }
        memset(fileOutput, 0, 200);
        fclose(fout);
      }
      printf("File %s have been separated into %d file(s).", argv[1], split);
      fclose(fin);
    } else {
      printf("File not found.");
    }
  } else {
    printf("No arguement supplied");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e85c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     14bf <main+0x30f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     14ac <main+0x2fc>
movl   $0x0,-0x1e84a4(%rbp)
lea    -0x1e84a0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1e8480,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1233 <main+0x83>
mov    -0x1e84a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e84a4(%rbp)
jmp    1200 <main+0x50>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x1e84a4(%rbp),%edx
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <rewind@plt>
movl   $0x2,-0x1e84a8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1288 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10b0 <strtoul@plt>
mov    %eax,-0x1e84a8(%rbp)
mov    -0x1e84a8(%rbp),%eax
cmp    -0x1e84a4(%rbp),%eax
jle    12b4 <main+0x104>
mov    -0x1e84a4(%rbp),%eax
mov    %eax,-0x1e84a8(%rbp)
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1e84a4(%rbp),%eax
cltd
idivl  -0x1e84a8(%rbp)
mov    %eax,-0x1e84b0(%rbp)
mov    0xd8f(%rip),%eax
mov    %eax,-0x1e84b7(%rbp)
mov    0xd86(%rip),%ax
mov    %ax,-0x1e84b3(%rbp)
mov    0xd7b(%rip),%al
mov    %al,-0x1e84b1(%rbp)
movl   $0x0,-0x1e84ac(%rbp)
mov    -0x1e84ac(%rbp),%eax
cmp    -0x1e84a8(%rbp),%eax
jge    1482 <main+0x2d2>
lea    -0x1e8580(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1060 <memset@plt>
cmpl   $0x4,-0x8(%rbp)
jl     133f <main+0x18f>
lea    -0x1e8580(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   10c0 <strcat@plt>
jmp    1352 <main+0x1a2>
lea    -0x1e8580(%rbp),%rdi
lea    -0x1e84b7(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0x1e85a0(%rbp),%rdi
mov    -0x1e84ac(%rbp),%edx
lea    0xcfd(%rip),%rsi
call   10d0 <sprintf@plt>
lea    -0x1e8580(%rbp),%rdi
lea    -0x1e85a0(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0x1e8580(%rbp),%rax
mov    %rax,-0x1e85b8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <get_filename_ext@plt>
mov    -0x1e85b8(%rbp),%rdi
mov    %rax,%rsi
call   10c0 <strcat@plt>
lea    -0x1e8580(%rbp),%rdi
lea    0xcb0(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x1e85a8(%rbp)
mov    -0x1e84ac(%rbp),%eax
add    $0x1,%eax
cmp    -0x1e84a8(%rbp),%eax
jl     13f0 <main+0x240>
mov    -0x1e84a4(%rbp),%eax
cltd
idivl  -0x1e84a8(%rbp)
add    -0x1e84b0(%rbp),%edx
mov    %edx,-0x1e84b0(%rbp)
movl   $0x0,-0x1e85ac(%rbp)
mov    -0x1e85ac(%rbp),%eax
cmp    -0x1e84b0(%rbp),%eax
jge    144f <main+0x29f>
lea    -0x1e84a0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1e8480,%esi
call   1070 <fgets@plt>
mov    -0x1e85a8(%rbp),%rdi
lea    -0x1e84a0(%rbp),%rdx
lea    0xc32(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x1e85ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e85ac(%rbp)
jmp    13fa <main+0x24a>
lea    -0x1e8580(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1060 <memset@plt>
mov    -0x1e85a8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1e84ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e84ac(%rbp)
jmp    12f7 <main+0x147>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x1e84a8(%rbp),%edx
lea    0xbd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    14ba <main+0x30a>
lea    0xbe5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14cd <main+0x31d>
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1e85c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e85a8,%rsp
cmp    $0x2,%edi
jl     1416 <main+0x266>
mov    %rsi,%r12
mov    %edi,%r13d
mov    0x8(%rsi),%rdi
lea    0xe25(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     143e <main+0x28e>
mov    %rax,%rbx
mov    $0xffffffff,%ebp
lea    0x120(%rsp),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x1e8480,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    1200 <main+0x50>
mov    0x8(%r12),%rsi
lea    0xdde(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <rewind@plt>
mov    $0x2,%ecx
cmp    $0x3,%r13d
jl     1253 <main+0xa3>
mov    0x10(%r12),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtoul@plt>
mov    %eax,%ecx
cmp    %ebp,%ecx
jle    1267 <main+0xb7>
lea    0xdc1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%ecx
movl   $0x747570,0x13(%rsp)
movl   $0x7074756f,0x10(%rsp)
70
test   %ecx,%ecx
jle    141f <main+0x26f>
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%ebp
mov    %rdx,0x18(%rsp)
xor    %r15d,%r15d
lea    0x120(%rsp),%r14
mov    %r13d,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %r12,0x20(%rsp)
jmp    12e0 <main+0x130>
cs nopw 0x0(%rax,%rax,1)
lea    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1070 <memset@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    0x8(%rsp),%ecx
cmp    %ecx,%r15d
mov    0x20(%rsp),%r12
mov    0xc(%rsp),%r13d
je     141f <main+0x26f>
xorps  %xmm0,%xmm0
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movq   $0x0,0xf0(%rsp)
cmp    $0x4,%r13d
mov    %rbp,0x28(%rsp)
jl     1360 <main+0x1b0>
mov    0x18(%r12),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
jmp    136d <main+0x1bd>
nopw   0x0(%rax,%rax,1)
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
call   10c0 <strcat@plt>
lea    0x100(%rsp),%r13
mov    %r13,%rdi
lea    0xcdf(%rip),%rsi
mov    %r15d,%edx
call   10d0 <sprintf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10c0 <strcat@plt>
mov    0x8(%r12),%rdi
call   10a0 <get_filename_ext@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   10c0 <strcat@plt>
mov    %rbp,%rdi
lea    0xcb0(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
add    $0x1,%r15d
mov    0x18(%rsp),%rax
mov    0x28(%rsp),%rbp
add    %ebp,%eax
cmp    0x8(%rsp),%r15d
cmovge %eax,%ebp
test   %ebp,%ebp
jle    12b0 <main+0x100>
mov    %ebp,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x1e8480,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1060 <fputs@plt>
add    $0xffffffff,%r13d
jne    13f0 <main+0x240>
jmp    12b0 <main+0x100>
lea    0xc88(%rip),%rdi
jmp    1445 <main+0x295>
mov    0x8(%r12),%rsi
lea    0xc3d(%rip),%rdi
mov    %ecx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    144c <main+0x29c>
lea    0xc50(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1e85a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [29 x i8] c"Number of lines in %s is %d\0A\00"
@.str.2 = [61 x i8] c"You can't split more then the number of lines in input file.\00"
@__const.main.defaultOutputFile = [7 x i8] c"output\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [45 x i8] c"File %s have been separated into %d file(s).\00"
@.str.7 = [16 x i8] c"File not found.\00"
@.str.8 = [22 x i8] c"No arguement supplied\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [2000000 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [7 x i8]
%13 = alloca [200 x i8]
%14 = alloca [20 x i8]
%15 = alloca i32*
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp sge i32 %17, 2
br i1 %18, label %19, label %139
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %6
%24 = load i32*, i32** %6
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %136
26: ; preds = %19
store i32 0, i32* %8
br label %27
27: ; preds = %32, %26
%28 = getelementptr inbounds [2000000 x i8], [2000000 x i8]* %7, i64 0, i64 0
%29 = load i32*, i32** %6
%30 = call i64 @fgets(i8* %28, i32 2000000, i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %27
35: ; preds = %27
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = load i32, i32* %8
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %38, i32 %39)
%41 = load i32*, i32** %6
%42 = call i32 @rewind(i32* %41)
store i32 2, i32* %9
%43 = load i32, i32* %4
%44 = icmp sge i32 %43, 3
br i1 %44, label %45, label %50
45: ; preds = %35
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i32 @strtoul(i8* %48, i32* null, i32 10)
store i32 %49, i32* %9
br label %50
50: ; preds = %45, %35
%51 = load i32, i32* %9
%52 = load i32, i32* %8
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i32, i32* %8
store i32 %55, i32* %9
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
br label %57
57: ; preds = %54, %50
%58 = load i32, i32* %8
%59 = load i32, i32* %9
%60 = sdiv i32 %58, %59
store i32 %60, i32* %11
%61 = bitcast [7 x i8]* %12 to i8*
store i32 0, i32* %10
br label %62
62: ; preds = %125, %57
%63 = load i32, i32* %10
%64 = load i32, i32* %9
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %128
66: ; preds = %62
%67 = bitcast [200 x i8]* %13 to i8*
%68 = load i32, i32* %4
%69 = icmp sge i32 %68, 4
br i1 %69, label %70, label %76
70: ; preds = %66
%71 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 3
%74 = load i8*, i8** %73
%75 = call i32 @strcat(i8* %71, i8* %74)
br label %80
76: ; preds = %66
%77 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%78 = getelementptr inbounds [7 x i8], [7 x i8]* %12, i64 0, i64 0
%79 = call i32 @strcat(i8* %77, i8* %78)
br label %80
80: ; preds = %76, %70
%81 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%82 = load i32, i32* %10
%83 = call i32 @sprintf(i8* %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %82)
%84 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%85 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%86 = call i32 @strcat(i8* %84, i8* %85)
%87 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 1
%90 = load i8*, i8** %89
%91 = call i8* @get_filename_ext(i8* %90)
%92 = call i32 @strcat(i8* %87, i8* %91)
%93 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%94 = call i32* @fopen(i8* %93, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %94, i32** %15
%95 = load i32, i32* %10
%96 = add nsw i32 %95, 1
%97 = load i32, i32* %9
%98 = icmp sge i32 %96, %97
br i1 %98, label %99, label %105
99: ; preds = %80
%100 = load i32, i32* %8
%101 = load i32, i32* %9
%102 = srem i32 %100, %101
%103 = load i32, i32* %11
%104 = add nsw i32 %103, %102
store i32 %104, i32* %11
br label %105
105: ; preds = %99, %80
store i32 0, i32* %16
br label %106
106: ; preds = %117, %105
%107 = load i32, i32* %16
%108 = load i32, i32* %11
%109 = icmp slt i32 %107, %108
br i1 %109, label %110, label %120
110: ; preds = %106
%111 = getelementptr inbounds [2000000 x i8], [2000000 x i8]* %7, i64 0, i64 0
%112 = load i32*, i32** %6
%113 = call i64 @fgets(i8* %111, i32 2000000, i32* %112)
%114 = load i32*, i32** %15
%115 = getelementptr inbounds [2000000 x i8], [2000000 x i8]* %7, i64 0, i64 0
%116 = call i32 @fprintf(i32* %114, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %115)
br label %117
117: ; preds = %110
%118 = load i32, i32* %16
%119 = add nsw i32 %118, 1
store i32 %119, i32* %16
br label %106
120: ; preds = %106
%121 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%122 = call i32 @memset(i8* %121, i32 0, i32 200)
%123 = load i32*, i32** %15
%124 = call i32 @fclose(i32* %123)
br label %125
125: ; preds = %120
%126 = load i32, i32* %10
%127 = add nsw i32 %126, 1
store i32 %127, i32* %10
br label %62
128: ; preds = %62
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = load i32, i32* %9
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %131, i32 %132)
%134 = load i32*, i32** %6
%135 = call i32 @fclose(i32* %134)
br label %138
136: ; preds = %19
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %138
138: ; preds = %136, %128
br label %141
139: ; preds = %2
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %141
141: ; preds = %139, %138
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [29 x i8] c"Number of lines in %s is %d\0A\00"
@.str.2 = [61 x i8] c"You can't split more then the number of lines in input file.\00"
@__const.main.defaultOutputFile = [7 x i8] c"output\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [2 x i8] c"w\00"
@.str.6 = [45 x i8] c"File %s have been separated into %d file(s).\00"
@.str.7 = [16 x i8] c"File not found.\00"
@.str.8 = [22 x i8] c"No arguement supplied\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2000000 x i8]
%4 = alloca [7 x i8]
%5 = alloca [200 x i8]
%6 = alloca [20 x i8]
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %81
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %79, label %13
13: ; preds = %8
%14 = getelementptr inbounds [2000000 x i8], [2000000 x i8]* %3, i64 0, i64 0
br label %15
15: ; preds = %15, %13
%16 = phi i32 [ 0, %13 ], [ %19, %15 ]
%17 = call i64 @fgets(i8* %14, i32 2000000, i32* %11)
%18 = icmp eq i64 %17, 0
%19 = add nuw nsw i32 %16, 1
br i1 %18, label %20, label %15
20: ; preds = %15
%21 = load i8*, i8** %9
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %16)
%23 = call i32 @rewind(i32* %11)
%24 = icmp sgt i32 %0, 2
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @strtoul(i8* nocapture %27, i32* null, i32 10)
br label %29
29: ; preds = %25, %20
%30 = phi i32 [ %28, %25 ], [ 2, %20 ]
%31 = icmp sgt i32 %30, %16
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = phi i32 [ %16, %32 ], [ %30, %29 ]
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%37 = icmp sgt i32 %35, 0
br i1 %37, label %38, label %75
38: ; preds = %34
%39 = sdiv i32 %16, %35
%40 = srem i32 %16, %35
%41 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%42 = icmp sgt i32 %0, 3
%43 = getelementptr inbounds i8*, i8** %1, i64 3
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
br label %45
45: ; preds = %38, %71
%46 = phi i32 [ %39, %38 ], [ %63, %71 ]
%47 = phi i32 [ 0, %38 ], [ %60, %71 ]
br i1 %42, label %48, label %51
48: ; preds = %45
%49 = load i8*, i8** %43
%50 = call i32 @strcat(i8* %41, i8* %49)
br label %53
51: ; preds = %45
%52 = call i32 @strcat(i8* %41, i8* %36)
br label %53
53: ; preds = %51, %48
%54 = call i32 @sprintf(i8* %44, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%55 = call i32 @strcat(i8* %41, i8* %44)
%56 = load i8*, i8** %9
%57 = call i8* @get_filename_ext(i8* %56)
%58 = call i32 @strcat(i8* %41, i8* %57)
%59 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%60 = add nuw nsw i32 %47, 1
%61 = icmp slt i32 %60, %35
%62 = add nsw i32 %40, %46
%63 = select i1 %61, i32 %46, i32 %62
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %53, %65
%66 = phi i32 [ %69, %65 ], [ 0, %53 ]
%67 = call i64 @fgets(i8* %14, i32 2000000, i32* %11)
%68 = call i32 @fputs(i8* %14, i32* %59)
%69 = add nuw nsw i32 %66, 1
%70 = icmp eq i32 %69, %63
br i1 %70, label %71, label %65
71: ; preds = %65, %53
%72 = call i32 @memset(i8* %41, i32 0, i32 200)
%73 = call i32 @fclose(i32* %59)
%74 = icmp eq i32 %60, %35
br i1 %74, label %75, label %45
75: ; preds = %71, %34
%76 = load i8*, i8** %9
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %76, i32 %35)
%78 = call i32 @fclose(i32* %11)
br label %83
79: ; preds = %8
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %83
81: ; preds = %2
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %83
83: ; preds = %75, %79, %81
ret i32 0
}