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

/* Variables and functions */
char char_n(int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
long filelength(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ manasymbols(int /*<<< orphan*/ *, long, int *, char, char *,
                               char *, char, int);
int nth_delimiter(char *, char *, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rarities(int /*<<< orphan*/ *, long, int *, char, char *,
                            char *, char, int);
int /*<<< orphan*/ row_num(int /*<<< orphan*/ *, char, char *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ types(int /*<<< orphan*/ *, long, int *, char, char *,
                         char *, char, int);
void main() {
  int del_pos = 1;
  int del_count;
  int symbol_counts[6] = {0};
  int rarity_counts[6] = {0};
  int types_counts[7] = {0};
  int i;
  char header_row = 'H';
  char card_row = 'C';
  char buf[10000];
  char substring[10000];
  char delimiter;
  char *mana_heading = "manaCost";
  char *rarity_heading = "rarity";
  char *types_heading = "types";
  FILE *fp;
  long length;
  fp = fopen("../../test/sample.mc", "r");
  length = filelength(fp);
  delimiter = char_n(fp, del_pos, buf);
  row_num(fp, header_row, buf, 0);
  del_count = nth_delimiter(mana_heading, buf, delimiter);
  manasymbols(fp, length, symbol_counts, card_row, buf, substring, delimiter,
              del_count);
  printf("\nManasymbols:\n");
  for (i = 0; i < (sizeof(symbol_counts) / sizeof(int)); i++) {
    printf(" %d ", symbol_counts[i]);
  }
  printf("\n");
  row_num(fp, header_row, buf, 0);
  del_count = nth_delimiter(rarity_heading, buf, delimiter);
  rarities(fp, length, rarity_counts, card_row, buf, substring, delimiter,
           del_count);
  printf("\nRarities:\n");
  for (i = 0; i < (sizeof(rarity_counts) / sizeof(int)); i++) {
    printf(" %d ", rarity_counts[i]);
  }
  printf("\n");
  row_num(fp, header_row, buf, 0);
  del_count = nth_delimiter(types_heading, buf, delimiter);
  types(fp, length, types_counts, card_row, buf, substring, delimiter,
        del_count);
  printf("\nTypes:\n");
  for (i = 0; i < (sizeof(types_counts) / sizeof(int)); i++) {
    printf(" %d ", types_counts[i]);
  }
  printf("\n");
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4ed0,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1080 <memset@plt>
movb   $0x48,-0x65(%rbp)
movb   $0x43,-0x66(%rbp)
lea    0xdff(%rip),%rax
mov    %rax,-0x4ea0(%rbp)
lea    0xdfa(%rip),%rax
mov    %rax,-0x4ea8(%rbp)
lea    0xdf3(%rip),%rax
mov    %rax,-0x4eb0(%rbp)
lea    0xdeb(%rip),%rdi
lea    0xdf9(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x4eb8(%rbp)
mov    -0x4eb8(%rbp),%rdi
call   1030 <filelength@plt>
mov    %rax,-0x4ec0(%rbp)
mov    -0x4eb8(%rbp),%rdi
mov    -0x4(%rbp),%esi
lea    -0x2780(%rbp),%rdx
call   1090 <char_n@plt>
mov    %al,-0x4e91(%rbp)
mov    -0x4eb8(%rbp),%rdi
mov    -0x65(%rbp),%al
lea    -0x2780(%rbp),%rdx
xor    %ecx,%ecx
movsbl %al,%esi
call   10b0 <row_num@plt>
mov    -0x4ea0(%rbp),%rdi
lea    -0x2780(%rbp),%rsi
movsbl -0x4e91(%rbp),%edx
call   1070 <nth_delimiter@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4eb8(%rbp),%rdi
mov    -0x4ec0(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    -0x66(%rbp),%cl
lea    -0x2780(%rbp),%r8
lea    -0x4e90(%rbp),%r9
mov    -0x4e91(%rbp),%r10b
mov    -0x8(%rbp),%eax
movsbl %cl,%ecx
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <manasymbols@plt>
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rax
cmp    $0x6,%rax
jae    132d <main+0x17d>
movslq -0x64(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12fb <main+0x14b>
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4eb8(%rbp),%rdi
mov    -0x65(%rbp),%al
lea    -0x2780(%rbp),%rdx
xor    %ecx,%ecx
movsbl %al,%esi
call   10b0 <row_num@plt>
mov    -0x4ea8(%rbp),%rdi
lea    -0x2780(%rbp),%rsi
movsbl -0x4e91(%rbp),%edx
call   1070 <nth_delimiter@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4eb8(%rbp),%rdi
mov    -0x4ec0(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    -0x66(%rbp),%cl
lea    -0x2780(%rbp),%r8
lea    -0x4e90(%rbp),%r9
mov    -0x4e91(%rbp),%r10b
mov    -0x8(%rbp),%eax
movsbl %cl,%ecx
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   10d0 <rarities@plt>
lea    0xc86(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rax
cmp    $0x6,%rax
jae    13fb <main+0x24b>
movslq -0x64(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xc56(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    13c9 <main+0x219>
lea    0xc49(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4eb8(%rbp),%rdi
mov    -0x65(%rbp),%al
lea    -0x2780(%rbp),%rdx
xor    %ecx,%ecx
movsbl %al,%esi
call   10b0 <row_num@plt>
mov    -0x4eb0(%rbp),%rdi
lea    -0x2780(%rbp),%rsi
movsbl -0x4e91(%rbp),%edx
call   1070 <nth_delimiter@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4eb8(%rbp),%rdi
mov    -0x4ec0(%rbp),%rsi
lea    -0x60(%rbp),%rdx
mov    -0x66(%rbp),%cl
lea    -0x2780(%rbp),%r8
lea    -0x4e90(%rbp),%r9
mov    -0x4e91(%rbp),%r10b
mov    -0x8(%rbp),%eax
movsbl %cl,%ecx
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   10a0 <types@plt>
lea    0xbc4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rax
cmp    $0x7,%rax
jae    14c9 <main+0x319>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xb88(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1497 <main+0x2e7>
lea    0xb7b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4eb8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x4ed0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4e88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
movups %xmm0,0x4c(%rsp)
movaps %xmm0,0x40(%rsp)
lea    0xe16(%rip),%rdi
lea    0xe24(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <filelength@plt>
mov    %rax,%r15
lea    0x2770(%rsp),%r12
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r12,%rdx
call   10a0 <char_n@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    $0x48,%esi
mov    %r12,%rdx
xor    %ecx,%ecx
call   10c0 <row_num@plt>
movsbl %bl,%r13d
lea    0xdaf(%rip),%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1090 <nth_delimiter@plt>
lea    0x20(%rsp),%rdx
lea    0x60(%rsp),%rbp
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x43,%ecx
mov    %r12,%r8
mov    %rbp,%r9
push   %rax
push   %r13
call   1070 <manasymbols@plt>
add    $0x10,%rsp
lea    0xda8(%rip),%rdi
call   1050 <puts@plt>
mov    0x20(%rsp),%esi
lea    0xd93(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0x48,%esi
mov    %r12,%rdx
xor    %ecx,%ecx
call   10c0 <row_num@plt>
lea    0xcfc(%rip),%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1090 <nth_delimiter@plt>
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x43,%ecx
mov    %r12,%r8
mov    %rbp,%r9
push   %rax
push   %r13
call   10e0 <rarities@plt>
add    $0x10,%rsp
lea    0xd01(%rip),%rdi
call   1050 <puts@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0x48,%esi
mov    %r12,%rdx
xor    %ecx,%ecx
call   10c0 <row_num@plt>
lea    0xc56(%rip),%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1090 <nth_delimiter@plt>
lea    0x40(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x43,%ecx
mov    %r12,%r8
mov    %rbp,%r9
push   %rax
push   %r13
call   10b0 <types@plt>
add    $0x10,%rsp
lea    0xc5d(%rip),%rdi
call   1050 <puts@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x50(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x58(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
add    $0x4e88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"manaCost\00"
@.str.1 = [7 x i8] c"rarity\00"
@.str.2 = [6 x i8] c"types\00"
@.str.3 = [21 x i8] c"../../test/sample.mc\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [15 x i8] c"\0AManasymbols:\0A\00"
@.str.6 = [5 x i8] c" %d \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [12 x i8] c"\0ARarities:\0A\00"
@.str.9 = [9 x i8] c"\0ATypes:\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6 x i32]
%4 = alloca [6 x i32]
%5 = alloca [7 x i32]
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca [10000 x i8]
%10 = alloca [10000 x i8]
%11 = alloca i8
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32*
%16 = alloca i64
store i32 1, i32* %1
%17 = bitcast [6 x i32]* %3 to i8*
%18 = bitcast [6 x i32]* %4 to i8*
%19 = bitcast [7 x i32]* %5 to i8*
store i8 72, i8* %7
store i8 67, i8* %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %13
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %14
%20 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %20, i32** %15
%21 = load i32*, i32** %15
%22 = call i64 @filelength(i32* %21)
store i64 %22, i64* %16
%23 = load i32*, i32** %15
%24 = load i32, i32* %1
%25 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%26 = call signext i8 @char_n(i32* %23, i32 %24, i8* %25)
store i8 %26, i8* %11
%27 = load i32*, i32** %15
%28 = load i8, i8* %7
%29 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%30 = call i32 @row_num(i32* %27, i8 signext %28, i8* %29, i32 0)
%31 = load i8*, i8** %12
%32 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%33 = load i8, i8* %11
%34 = call i32 @nth_delimiter(i8* %31, i8* %32, i8 signext %33)
store i32 %34, i32* %2
%35 = load i32*, i32** %15
%36 = load i64, i64* %16
%37 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%38 = load i8, i8* %8
%39 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%40 = getelementptr inbounds [10000 x i8], [10000 x i8]* %10, i64 0, i64 0
%41 = load i8, i8* %11
%42 = load i32, i32* %2
%43 = call i32 @manasymbols(i32* %35, i64 %36, i32* %37, i8 signext %38, i8* %39, i8* %40, i8 signext %41, i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %6
br label %45
45: ; preds = %55, %0
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = icmp ult i64 %47, 6
br i1 %48, label %49, label %58
49: ; preds = %45
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %49
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %45
58: ; preds = %45
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%60 = load i32*, i32** %15
%61 = load i8, i8* %7
%62 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%63 = call i32 @row_num(i32* %60, i8 signext %61, i8* %62, i32 0)
%64 = load i8*, i8** %13
%65 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%66 = load i8, i8* %11
%67 = call i32 @nth_delimiter(i8* %64, i8* %65, i8 signext %66)
store i32 %67, i32* %2
%68 = load i32*, i32** %15
%69 = load i64, i64* %16
%70 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%71 = load i8, i8* %8
%72 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%73 = getelementptr inbounds [10000 x i8], [10000 x i8]* %10, i64 0, i64 0
%74 = load i8, i8* %11
%75 = load i32, i32* %2
%76 = call i32 @rarities(i32* %68, i64 %69, i32* %70, i8 signext %71, i8* %72, i8* %73, i8 signext %74, i32 %75)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %6
br label %78
78: ; preds = %88, %58
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = icmp ult i64 %80, 6
br i1 %81, label %82, label %91
82: ; preds = %78
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %82
%89 = load i32, i32* %6
%90 = add nsw i32 %89, 1
store i32 %90, i32* %6
br label %78
91: ; preds = %78
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%93 = load i32*, i32** %15
%94 = load i8, i8* %7
%95 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%96 = call i32 @row_num(i32* %93, i8 signext %94, i8* %95, i32 0)
%97 = load i8*, i8** %14
%98 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%99 = load i8, i8* %11
%100 = call i32 @nth_delimiter(i8* %97, i8* %98, i8 signext %99)
store i32 %100, i32* %2
%101 = load i32*, i32** %15
%102 = load i64, i64* %16
%103 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%104 = load i8, i8* %8
%105 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%106 = getelementptr inbounds [10000 x i8], [10000 x i8]* %10, i64 0, i64 0
%107 = load i8, i8* %11
%108 = load i32, i32* %2
%109 = call i32 @types(i32* %101, i64 %102, i32* %103, i8 signext %104, i8* %105, i8* %106, i8 signext %107, i32 %108)
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %6
br label %111
111: ; preds = %121, %91
%112 = load i32, i32* %6
%113 = sext i32 %112 to i64
%114 = icmp ult i64 %113, 7
br i1 %114, label %115, label %124
115: ; preds = %111
%116 = load i32, i32* %6
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 %117
%119 = load i32, i32* %118
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %119)
br label %121
121: ; preds = %115
%122 = load i32, i32* %6
%123 = add nsw i32 %122, 1
store i32 %123, i32* %6
br label %111
124: ; preds = %111
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%126 = load i32*, i32** %15
%127 = call i32 @fclose(i32* %126)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"manaCost\00"
@.str.1 = [7 x i8] c"rarity\00"
@.str.2 = [6 x i8] c"types\00"
@.str.3 = [21 x i8] c"../../test/sample.mc\00"
@.str.4 = [2 x i8] c"r\00"
@.str.6 = [5 x i8] c" %d \00"
@str = [14 x i8] c"\0AManasymbols:\00"
@str.10 = [11 x i8] c"\0ARarities:\00"
@str.11 = [8 x i8] c"\0ATypes:\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = alloca [7 x i32]
%4 = alloca [10000 x i8]
%5 = alloca [10000 x i8]
%6 = bitcast [6 x i32]* %1 to i8*
%7 = bitcast [6 x i32]* %2 to i8*
%8 = bitcast [7 x i32]* %3 to i8*
%9 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i64 @filelength(i32* %11)
%13 = call signext i8 @char_n(i32* %11, i32 1, i8* %9)
%14 = call i32 @row_num(i32* %11, i8 signext 72, i8* %9, i32 0)
%15 = call i32 @nth_delimiter(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %9, i8 signext %13)
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%17 = call i32 @manasymbols(i32* %11, i64 %12, i32* %16, i8 signext 67, i8* %9, i8* %10, i8 signext %13, i32 %15)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%19 = load i32, i32* %16
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %34)
%36 = call i32 @putchar(i32 10)
%37 = call i32 @row_num(i32* %11, i8 signext 72, i8* %9, i32 0)
%38 = call i32 @nth_delimiter(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8 signext %13)
%39 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%40 = call i32 @rarities(i32* %11, i64 %12, i32* %39, i8 signext 67, i8* %9, i8* %10, i8 signext %13, i32 %38)
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.10, i64 0, i64 0))
%42 = load i32, i32* %39
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 1
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 2
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 3
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 4
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 5
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %57)
%59 = call i32 @putchar(i32 10)
%60 = call i32 @row_num(i32* %11, i8 signext 72, i8* %9, i32 0)
%61 = call i32 @nth_delimiter(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8 signext %13)
%62 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%63 = call i32 @types(i32* %11, i64 %12, i32* %62, i8 signext 67, i8* %9, i8* %10, i8 signext %13, i32 %61)
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.11, i64 0, i64 0))
%65 = load i32, i32* %62
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 1
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 2
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %71)
%73 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 3
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 4
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 5
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 6
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %83)
%85 = call i32 @putchar(i32 10)
%86 = call i32 @fclose(i32* %11)
ret void
}