#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 find_index(char **, char *, int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  FILE *fin = fopen("gift1.in", "r");
  FILE *fout = fopen("gift1.out", "w");
  int np, total, div, give, left;
  char **name;
  int *money;
  char tmp[15];
  fscanf(fin, "%d", &np);
  name = (char **)malloc(sizeof(char *) * np);
  money = (int *)malloc(sizeof(int) * np);
  for (int i = 0; i < np; i++) {
    fscanf(fin, "%s", tmp);
    name[i] = (char *)malloc(sizeof(char) * (strlen(tmp) + 1));
    strcpy(name[i], tmp);
    money[i] = 0;
  }
  for (int i = 0; i < np; i++) {
    fscanf(fin, "%s", tmp);
    int index = find_index(name, tmp, np);
    fscanf(fin, "%d %d", &total, &div);
    if (div) {
      give = total / div;
      left = total % div;
    } else {
      give = 0;
      left = total;
    }
    money[index] -= (total - left);
    for (int j = 0; j < div; j++) {
      fscanf(fin, "%s", tmp);
      index = find_index(name, tmp, np);
      money[index] += give;
    }
  }
  for (int i = 0; i < np; i++) {
    fprintf(fout, "%s %d\n", name[i], money[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe6e(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    126c <main+0xfc>
mov    -0x10(%rbp),%rdi
lea    -0x4f(%rbp),%rdx
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
lea    -0x4f(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x4f(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11f0 <main+0x80>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1376 <main+0x206>
mov    -0x10(%rbp),%rdi
lea    -0x4f(%rbp),%rdx
lea    0xd89(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x38(%rbp),%rdi
lea    -0x4f(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1080 <find_index@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd67(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
mov    $0x0,%al
call   1050 <fscanf@plt>
cmpl   $0x0,-0x24(%rbp)
je     12e5 <main+0x175>
mov    -0x20(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %edx,-0x2c(%rbp)
jmp    12f2 <main+0x182>
movl   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%esi
sub    -0x2c(%rbp),%esi
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
sub    %esi,%edx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1363 <main+0x1f3>
mov    -0x10(%rbp),%rdi
lea    -0x4f(%rbp),%rdx
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x38(%rbp),%rdi
lea    -0x4f(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1080 <find_index@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%edx
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    130f <main+0x19f>
jmp    1368 <main+0x1f8>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1273 <main+0x103>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    13be <main+0x24e>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xc75(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    137d <main+0x20d>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe7b(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
lea    0xe70(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbp
lea    0xe6c(%rip),%rsi
mov    %rsp,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    (%rsp),%edi
shl    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    (%rsp),%edi
shl    $0x2,%edi
call   1070 <malloc@plt>
cmpl   $0x0,(%rsp)
jle    138f <main+0x21f>
mov    %rax,%rbx
mov    %rbp,0x20(%rsp)
lea    0xe27(%rip),%r14
lea    0x29(%rsp),%r13
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,(%r15,%rbp,8)
mov    %rax,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
movl   $0x0,(%rbx,%rbp,4)
add    $0x1,%rbp
movslq (%rsp),%rax
cmp    %rax,%rbp
jl     1200 <main+0x90>
test   %eax,%eax
jle    138f <main+0x21f>
mov    %rbx,0x18(%rsp)
mov    %r15,0x8(%rsp)
lea    0xdbb(%rip),%rsi
lea    0x29(%rsp),%r14
xor    %ecx,%ecx
jmp    1282 <main+0x112>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp),%ecx
add    $0x1,%ecx
mov    (%rsp),%eax
cmp    %eax,%ecx
jge    1350 <main+0x1e0>
mov    %ecx,0x10(%rsp)
mov    %r12,%rdi
mov    %rsi,%r15
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    (%rsp),%edx
mov    0x8(%rsp),%rdi
mov    %r14,%r13
mov    %r14,%rsi
call   1080 <find_index@plt>
mov    %eax,%ebp
mov    %r12,%rbx
mov    %r12,%rdi
lea    0xd62(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x4(%rsp),%rcx
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    0x4(%rsp),%esi
mov    0x14(%rsp),%ecx
mov    %ecx,%edx
mov    $0x0,%edi
test   %esi,%esi
je     12e3 <main+0x173>
mov    %ecx,%eax
cltd
idiv   %esi
mov    %eax,%edi
sub    %ecx,%edx
movslq %ebp,%rax
mov    0x18(%rsp),%rbp
add    %edx,0x0(%rbp,%rax,4)
cmpl   $0x0,0x4(%rsp)
mov    %r15,%rsi
mov    %rbx,%r12
mov    %r13,%r14
jle    1270 <main+0x100>
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    %edi,%r15d
mov    %r12,%rdi
mov    %rsi,%rbx
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
mov    (%rsp),%edx
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1080 <find_index@plt>
mov    %rbx,%rsi
mov    %r15d,%edi
cltq
add    %r15d,0x0(%rbp,%rax,4)
add    $0x1,%r13d
cmp    0x4(%rsp),%r13d
jl     1310 <main+0x1a0>
jmp    1270 <main+0x100>
test   %eax,%eax
mov    0x20(%rsp),%r12
mov    0x8(%rsp),%r15
mov    0x18(%rsp),%rbx
jle    138f <main+0x21f>
xor    %ebp,%ebp
lea    0xcb4(%rip),%r14
nopl   0x0(%rax)
mov    (%r15,%rbp,8),%rdx
mov    (%rbx,%rbp,4),%ecx
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <fprintf@plt>
add    $0x1,%rbp
movslq (%rsp),%rax
cmp    %rax,%rbp
jl     1370 <main+0x200>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"gift1.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"gift1.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [6 x i8] c"%d %d\00"
@.str.7 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca [15 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %1
%17 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %2
%18 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %18, i32** %3
%19 = load i32*, i32** %2
%20 = call i32 (i32*, i8*, ...) @fscanf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = mul i64 8, %22
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to i8**
store i8** %26, i8*** %9
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = mul i64 4, %28
%30 = trunc i64 %29 to i32
%31 = call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to i32*
store i32* %32, i32** %10
store i32 0, i32* %12
br label %33
33: ; preds = %64, %0
%34 = load i32, i32* %12
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %67
37: ; preds = %33
%38 = load i32*, i32** %2
%39 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%40 = call i32 (i32*, i8*, ...) @fscanf(i32* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%42 = call i32 @strlen(i8* %41)
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = mul i64 1, %44
%46 = trunc i64 %45 to i32
%47 = call i64 @malloc(i32 %46)
%48 = inttoptr i64 %47 to i8*
%49 = load i8**, i8*** %9
%50 = load i32, i32* %12
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
store i8* %48, i8** %52
%53 = load i8**, i8*** %9
%54 = load i32, i32* %12
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%59 = call i32 @strcpy(i8* %57, i8* %58)
%60 = load i32*, i32** %10
%61 = load i32, i32* %12
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
store i32 0, i32* %63
br label %64
64: ; preds = %37
%65 = load i32, i32* %12
%66 = add nsw i32 %65, 1
store i32 %66, i32* %12
br label %33
67: ; preds = %33
store i32 0, i32* %13
br label %68
68: ; preds = %126, %67
%69 = load i32, i32* %13
%70 = load i32, i32* %4
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %129
72: ; preds = %68
%73 = load i32*, i32** %2
%74 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%75 = call i32 (i32*, i8*, ...) @fscanf(i32* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %74)
%76 = load i8**, i8*** %9
%77 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%78 = load i32, i32* %4
%79 = call i32 @find_index(i8** %76, i8* %77, i32 %78)
store i32 %79, i32* %14
%80 = load i32*, i32** %2
%81 = call i32 (i32*, i8*, ...) @fscanf(i32* %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32* %5, i32* %6)
%82 = load i32, i32* %6
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %91
84: ; preds = %72
%85 = load i32, i32* %5
%86 = load i32, i32* %6
%87 = sdiv i32 %85, %86
store i32 %87, i32* %7
%88 = load i32, i32* %5
%89 = load i32, i32* %6
%90 = srem i32 %88, %89
store i32 %90, i32* %8
br label %93
91: ; preds = %72
store i32 0, i32* %7
%92 = load i32, i32* %5
store i32 %92, i32* %8
br label %93
93: ; preds = %91, %84
%94 = load i32, i32* %5
%95 = load i32, i32* %8
%96 = sub nsw i32 %94, %95
%97 = load i32*, i32** %10
%98 = load i32, i32* %14
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32, i32* %97, i64 %99
%101 = load i32, i32* %100
%102 = sub nsw i32 %101, %96
store i32 %102, i32* %100
store i32 0, i32* %15
br label %103
103: ; preds = %122, %93
%104 = load i32, i32* %15
%105 = load i32, i32* %6
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %125
107: ; preds = %103
%108 = load i32*, i32** %2
%109 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%110 = call i32 (i32*, i8*, ...) @fscanf(i32* %108, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %109)
%111 = load i8**, i8*** %9
%112 = getelementptr inbounds [15 x i8], [15 x i8]* %11, i64 0, i64 0
%113 = load i32, i32* %4
%114 = call i32 @find_index(i8** %111, i8* %112, i32 %113)
store i32 %114, i32* %14
%115 = load i32, i32* %7
%116 = load i32*, i32** %10
%117 = load i32, i32* %14
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %116, i64 %118
%120 = load i32, i32* %119
%121 = add nsw i32 %120, %115
store i32 %121, i32* %119
br label %122
122: ; preds = %107
%123 = load i32, i32* %15
%124 = add nsw i32 %123, 1
store i32 %124, i32* %15
br label %103
125: ; preds = %103
br label %126
126: ; preds = %125
%127 = load i32, i32* %13
%128 = add nsw i32 %127, 1
store i32 %128, i32* %13
br label %68
129: ; preds = %68
store i32 0, i32* %16
br label %130
130: ; preds = %147, %129
%131 = load i32, i32* %16
%132 = load i32, i32* %4
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %150
134: ; preds = %130
%135 = load i32*, i32** %3
%136 = load i8**, i8*** %9
%137 = load i32, i32* %16
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i8*, i8** %136, i64 %138
%140 = load i8*, i8** %139
%141 = load i32*, i32** %10
%142 = load i32, i32* %16
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i32, i32* %141, i64 %143
%145 = load i32, i32* %144
%146 = call i32 @fprintf(i32* %135, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %140, i32 %145)
br label %147
147: ; preds = %134
%148 = load i32, i32* %16
%149 = add nsw i32 %148, 1
store i32 %149, i32* %16
br label %130
150: ; preds = %130
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"gift1.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"gift1.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [6 x i8] c"%d %d\00"
@.str.7 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [15 x i8]
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%11 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = shl i32 %12, 3
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8**
%16 = load i32, i32* %1
%17 = shl i32 %16, 2
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i32*
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 0
br i1 %21, label %24, label %78
22: ; preds = %24
%23 = icmp sgt i32 %35, 0
br i1 %23, label %40, label %78
24: ; preds = %0, %24
%25 = phi i64 [ %34, %24 ], [ 0, %0 ]
%26 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%27 = call i32 @strlen(i8* %10)
%28 = add nsw i32 %27, 1
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to i8*
%31 = getelementptr inbounds i8*, i8** %15, i64 %25
store i8* %30, i8** %31
%32 = call i32 @strcpy(i8* %30, i8* %10)
%33 = getelementptr inbounds i32, i32* %19, i64 %25
store i32 0, i32* %33
%34 = add nuw nsw i64 %25, 1
%35 = load i32, i32* %1
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %24, label %22
38: ; preds = %62
%39 = icmp sgt i32 %64, 0
br i1 %39, label %79, label %78
40: ; preds = %22, %62
%41 = phi i32 [ %63, %62 ], [ 0, %22 ]
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%43 = load i32, i32* %1
%44 = call i32 @find_index(i8** %15, i8* %10, i32 %43)
%45 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32* %2, i32* %3)
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, 0
%48 = load i32, i32* %2
br i1 %47, label %52, label %49
49: ; preds = %40
%50 = sdiv i32 %48, %46
%51 = srem i32 %48, %46
br label %52
52: ; preds = %40, %49
%53 = phi i32 [ %51, %49 ], [ %48, %40 ]
%54 = phi i32 [ %50, %49 ], [ 0, %40 ]
%55 = sub i32 %53, %48
%56 = sext i32 %44 to i64
%57 = getelementptr inbounds i32, i32* %19, i64 %56
%58 = load i32, i32* %57
%59 = add i32 %55, %58
store i32 %59, i32* %57
%60 = load i32, i32* %3
%61 = icmp sgt i32 %60, 0
br i1 %61, label %66, label %62
62: ; preds = %66, %52
%63 = add nuw nsw i32 %41, 1
%64 = load i32, i32* %1
%65 = icmp slt i32 %63, %64
br i1 %65, label %40, label %38
66: ; preds = %52, %66
%67 = phi i32 [ %75, %66 ], [ 0, %52 ]
%68 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%69 = load i32, i32* %1
%70 = call i32 @find_index(i8** %15, i8* %10, i32 %69)
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %19, i64 %71
%73 = load i32, i32* %72
%74 = add nsw i32 %73, %54
store i32 %74, i32* %72
%75 = add nuw nsw i32 %67, 1
%76 = load i32, i32* %3
%77 = icmp slt i32 %75, %76
br i1 %77, label %66, label %62
78: ; preds = %79, %0, %22, %38
ret i32 0
79: ; preds = %38, %79
%80 = phi i64 [ %86, %79 ], [ 0, %38 ]
%81 = getelementptr inbounds i8*, i8** %15, i64 %80
%82 = load i8*, i8** %81
%83 = getelementptr inbounds i32, i32* %19, i64 %80
%84 = load i32, i32* %83
%85 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %82, i32 %84)
%86 = add nuw nsw i64 %80, 1
%87 = load i32, i32* %1
%88 = sext i32 %87 to i64
%89 = icmp slt i64 %86, %88
br i1 %89, label %79, label %78
}