#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 EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(void) {
  FILE *fp;
  fp = fopen("best.in", "r");
  char inputHolder[42];
  int numBattles;
  int i, j, k;
  fgets(inputHolder, 43, fp);
  sscanf(inputHolder, "%d", &numBattles);
  for (i = 0; i < numBattles; i++) {
    printf("Battle #%d! BEGIN!!!\n", i + 1);
    char personA[43];
    fgets(personA, 43, fp);
    char personB[43];
    fgets(personB, 43, fp);
    k = 0;
    while (personA[++k] != '\n')
      ;
    personA[k] = '\0';
    k = 0;
    while (personB[++k] != '\n')
      ;
    personB[k] = '\0';
    int personAmoves;
    fgets(inputHolder, 43, fp);
    sscanf(inputHolder, "%d", &personAmoves);
    char movesListA[personAmoves][43];
    for (j = 0; j < personAmoves; j++) {
      fgets(movesListA[j], 43, fp);
      k = 0;
      while (movesListA[j][++k] != '\n')
        ;
      movesListA[j][k] = '\0';
    }
    int personBmoves;
    fgets(inputHolder, 43, fp);
    sscanf(inputHolder, "%d", &personBmoves);
    char movesListB[personBmoves][43];
    for (j = 0; j < personBmoves; j++) {
      fgets(movesListB[j], 43, fp);
      k = 0;
      while (movesListB[j][++k] != '\n')
        ;
      movesListB[j][k] = '\0';
    }
    j = 0;
    while (1) {
      if (j == personAmoves) {
        printf("%s is defeated by %s's %s!!!\n\n", personA, personB,
               movesListB[j - 1]);
        break;
      }
      printf("%s uses %s!\n", personA, movesListA[j]);
      if (j == personBmoves) {
        printf("%s is defeated by %s's %s!!!\n\n", personB, personA,
               movesListA[j]);
        break;
      }
      printf("%s uses %s!\n", personB, movesListB[j]);
      j++;
    }
  }
  fclose(fp);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2b,%esi
call   1050 <fgets@plt>
lea    -0x40(%rbp),%rdi
lea    0xe74(%rip),%rsi
lea    -0x44(%rbp),%rdx
call   1060 <sscanf@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    153a <main+0x3ea>
mov    -0x48(%rbp),%esi
add    $0x1,%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2b,%esi
call   1050 <fgets@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2b,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0xa,%eax
je     1212 <main+0xc2>
jmp    11f4 <main+0xa4>
movslq -0x50(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
cltq
movsbl -0xb0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     1243 <main+0xf3>
jmp    1222 <main+0xd2>
movslq -0x50(%rbp),%rax
movb   $0x0,-0xb0(%rbp,%rax,1)
mov    -0x10(%rbp),%rdx
lea    -0x40(%rbp),%rdi
mov    %rdi,-0xe8(%rbp)
mov    $0x2b,%esi
call   1050 <fgets@plt>
mov    -0xe8(%rbp),%rdi
lea    0xd94(%rip),%rsi
lea    -0xb4(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0xb4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0xc0(%rbp)
imul   $0x2b,%rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    134a <main+0x1fa>
mov    -0xe0(%rbp),%rdi
movslq -0x4c(%rbp),%rax
imul   $0x2b,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2b,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x50(%rbp)
mov    -0xe0(%rbp),%rax
movslq -0x4c(%rbp),%rcx
imul   $0x2b,%rcx,%rcx
add    %rcx,%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1322 <main+0x1d2>
jmp    12f2 <main+0x1a2>
mov    -0xe0(%rbp),%rax
movslq -0x4c(%rbp),%rcx
imul   $0x2b,%rcx,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12bc <main+0x16c>
mov    -0x10(%rbp),%rdx
lea    -0x40(%rbp),%rdi
mov    %rdi,-0xf8(%rbp)
mov    $0x2b,%esi
call   1050 <fgets@plt>
mov    -0xf8(%rbp),%rdi
lea    0xc99(%rip),%rsi
lea    -0xcc(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0xcc(%rbp),%eax
imul   $0x2b,%rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jge    143b <main+0x2eb>
mov    -0xf0(%rbp),%rdi
movslq -0x4c(%rbp),%rax
imul   $0x2b,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2b,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x50(%rbp)
mov    -0xf0(%rbp),%rax
movslq -0x4c(%rbp),%rcx
imul   $0x2b,%rcx,%rcx
add    %rcx,%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1413 <main+0x2c3>
jmp    13e3 <main+0x293>
mov    -0xf0(%rbp),%rax
movslq -0x4c(%rbp),%rcx
imul   $0x2b,%rcx,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13ad <main+0x25d>
movl   $0x0,-0x4c(%rbp)
jmp    1447 <main+0x2f7>
mov    -0x4c(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jne    148a <main+0x33a>
mov    -0xf0(%rbp),%rcx
lea    -0x80(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
cltq
imul   $0x2b,%rax,%rax
add    %rax,%rcx
lea    0xba5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1522 <main+0x3d2>
mov    -0xe0(%rbp),%rdx
lea    -0x80(%rbp),%rsi
movslq -0x4c(%rbp),%rax
imul   $0x2b,%rax,%rax
add    %rax,%rdx
lea    0xb9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jne    14ed <main+0x39d>
mov    -0xe0(%rbp),%rcx
lea    -0xb0(%rbp),%rsi
lea    -0x80(%rbp),%rdx
movslq -0x4c(%rbp),%rax
imul   $0x2b,%rax,%rax
add    %rax,%rcx
lea    0xb42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1522 <main+0x3d2>
mov    -0xf0(%rbp),%rdx
lea    -0xb0(%rbp),%rsi
movslq -0x4c(%rbp),%rax
imul   $0x2b,%rax,%rax
add    %rax,%rdx
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1442 <main+0x2f2>
mov    -0xc0(%rbp),%rax
mov    %rax,%rsp
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11a6 <main+0x56>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2a96(%rip),%rax
mov    (%rax),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
lea    0xe95(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
lea    -0xe0(%rbp),%r14
mov    %r14,%rdi
mov    $0x2b,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
lea    0xe72(%rip),%rsi
lea    -0x34(%rbp),%rdx
mov    %r14,%rdi
call   1060 <sscanf@plt>
cmpl   $0x0,-0x34(%rbp)
jle    142b <main+0x2db>
lea    -0xe0(%rbp),%r15
xor    %esi,%esi
mov    %r12,-0x40(%rbp)
jmp    11f7 <main+0xa7>
nopl   (%rax)
lea    0xe5c(%rip),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x48(%rbp),%rsp
mov    -0x38(%rbp),%esi
cmp    -0x34(%rbp),%esi
mov    -0x40(%rbp),%r12
lea    -0xe0(%rbp),%r15
jge    142b <main+0x2db>
add    $0x1,%esi
lea    0xe0c(%rip),%rdi
mov    %esi,-0x38(%rbp)
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x2b,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
lea    -0x80(%rbp),%rdi
mov    $0x2b,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0xa,-0xaf(%rbp,%rax,1)
0a
lea    0x1(%rax),%rax
jne    1240 <main+0xf0>
mov    %eax,%eax
movb   $0x0,-0xb0(%rbp,%rax,1)
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0xa,-0x7f(%rbp,%rax,1)
lea    0x1(%rax),%rax
jne    1260 <main+0x110>
mov    %eax,%eax
movb   $0x0,-0x80(%rbp,%rax,1)
mov    %r15,%rdi
mov    $0x2b,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %r15,%rdi
lea    0xd7e(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1060 <sscanf@plt>
mov    %rsp,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
imul   $0x2b,%rax,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    12fe <main+0x1ae>
lea    0x1(%r13),%r14
xor    %ebx,%ebx
nopl   (%rax)
imul   $0x2b,%rbx,%rdi
add    %r13,%rdi
mov    $0x2b,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %r14,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0xa,(%rax)
lea    0x1(%rax),%rax
jne    12e0 <main+0x190>
movb   $0x0,-0x1(%rax)
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x2b,%r14
cmp    %rax,%rbx
jl     12c0 <main+0x170>
mov    %r15,%rdi
mov    $0x2b,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %r15,%rdi
lea    0xcf2(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x30(%rbp),%eax
mov    %rsp,%r15
imul   $0x2b,%rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
test   %eax,%eax
jle    138e <main+0x23e>
lea    0x1(%r15),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   $0x2b,%rbx,%rdi
add    %r15,%rdi
mov    $0x2b,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %r14,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0xa,(%rax)
lea    0x1(%rax),%rax
jne    1370 <main+0x220>
movb   $0x0,-0x1(%rax)
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
add    $0x2b,%r14
cmp    %rax,%rbx
jl     1350 <main+0x200>
cmpl   $0x0,-0x2c(%rbp)
je     1400 <main+0x2b0>
mov    %r15,%r12
xor    %r14d,%r14d
lea    0xca1(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    -0xb0(%rbp),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
cmp    %rax,%r14
je     11c0 <main+0x70>
mov    %rbx,%rdi
lea    -0x80(%rbp),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
mov    -0x2c(%rbp),%eax
add    $0x2b,%r13
add    $0x2b,%r12
cmp    %rax,%r14
jne    13b0 <main+0x260>
jmp    1403 <main+0x2b3>
nopw   0x0(%rax,%rax,1)
xor    %r14d,%r14d
add    $0xffffffff,%r14d
movslq %r14d,%rax
imul   $0x2b,%rax,%rax
add    %rax,%r15
lea    0xc0b(%rip),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0x80(%rbp),%rdx
mov    %r15,%rcx
jmp    11d5 <main+0x85>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    0x2ba6(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"best.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"Battle #%d! BEGIN!!!\0A\00"
@.str.4 = [31 x i8] c"%s is defeated by %s's %s!!!\0A\0A\00"
@.str.5 = [13 x i8] c"%s uses %s!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [42 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [43 x i8]
%9 = alloca [43 x i8]
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i64
store i32 0, i32* %1
%15 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %2
%16 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%17 = load i32*, i32** %2
%18 = call i32 @fgets(i8* %16, i32 43, i32* %17)
%19 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %21
21: ; preds = %189, %0
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %192
25: ; preds = %21
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [43 x i8], [43 x i8]* %8, i64 0, i64 0
%30 = load i32*, i32** %2
%31 = call i32 @fgets(i8* %29, i32 43, i32* %30)
%32 = getelementptr inbounds [43 x i8], [43 x i8]* %9, i64 0, i64 0
%33 = load i32*, i32** %2
%34 = call i32 @fgets(i8* %32, i32 43, i32* %33)
store i32 0, i32* %7
br label %35
35: ; preds = %43, %25
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [43 x i8], [43 x i8]* %8, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 10
br i1 %42, label %43, label %44
43: ; preds = %35
br label %35
44: ; preds = %35
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [43 x i8], [43 x i8]* %8, i64 0, i64 %46
store i8 0, i8* %47
store i32 0, i32* %7
br label %48
48: ; preds = %56, %44
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [43 x i8], [43 x i8]* %9, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 10
br i1 %55, label %56, label %57
56: ; preds = %48
br label %48
57: ; preds = %48
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [43 x i8], [43 x i8]* %9, i64 0, i64 %59
store i8 0, i8* %60
%61 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%62 = load i32*, i32** %2
%63 = call i32 @fgets(i8* %61, i32 43, i32* %62)
%64 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%65 = call i32 @sscanf(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%66 = load i32, i32* %10
%67 = zext i32 %66 to i64
%68 = call i8* @llvm.stacksave()
store i8* %68, i8** %11
%69 = alloca [43 x i8], i64 %67
store i64 %67, i64* %12
store i32 0, i32* %6
br label %70
70: ; preds = %100, %57
%71 = load i32, i32* %6
%72 = load i32, i32* %10
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %103
74: ; preds = %70
%75 = load i32, i32* %6
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [43 x i8], [43 x i8]* %69, i64 %76
%78 = getelementptr inbounds [43 x i8], [43 x i8]* %77, i64 0, i64 0
%79 = load i32*, i32** %2
%80 = call i32 @fgets(i8* %78, i32 43, i32* %79)
store i32 0, i32* %7
br label %81
81: ; preds = %92, %74
%82 = load i32, i32* %6
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [43 x i8], [43 x i8]* %69, i64 %83
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 1
store i32 %86, i32* %7
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [43 x i8], [43 x i8]* %84, i64 0, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp ne i32 %90, 10
br i1 %91, label %92, label %93
92: ; preds = %81
br label %81
93: ; preds = %81
%94 = load i32, i32* %6
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [43 x i8], [43 x i8]* %69, i64 %95
%97 = load i32, i32* %7
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [43 x i8], [43 x i8]* %96, i64 0, i64 %98
store i8 0, i8* %99
br label %100
100: ; preds = %93
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
store i32 %102, i32* %6
br label %70
103: ; preds = %70
%104 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%105 = load i32*, i32** %2
%106 = call i32 @fgets(i8* %104, i32 43, i32* %105)
%107 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%108 = call i32 @sscanf(i8* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %13)
%109 = load i32, i32* %13
%110 = zext i32 %109 to i64
%111 = alloca [43 x i8], i64 %110
store i64 %110, i64* %14
store i32 0, i32* %6
br label %112
112: ; preds = %142, %103
%113 = load i32, i32* %6
%114 = load i32, i32* %13
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %145
116: ; preds = %112
%117 = load i32, i32* %6
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [43 x i8], [43 x i8]* %111, i64 %118
%120 = getelementptr inbounds [43 x i8], [43 x i8]* %119, i64 0, i64 0
%121 = load i32*, i32** %2
%122 = call i32 @fgets(i8* %120, i32 43, i32* %121)
store i32 0, i32* %7
br label %123
123: ; preds = %134, %116
%124 = load i32, i32* %6
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [43 x i8], [43 x i8]* %111, i64 %125
%127 = load i32, i32* %7
%128 = add nsw i32 %127, 1
store i32 %128, i32* %7
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [43 x i8], [43 x i8]* %126, i64 0, i64 %129
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = icmp ne i32 %132, 10
br i1 %133, label %134, label %135
134: ; preds = %123
br label %123
135: ; preds = %123
%136 = load i32, i32* %6
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [43 x i8], [43 x i8]* %111, i64 %137
%139 = load i32, i32* %7
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [43 x i8], [43 x i8]* %138, i64 0, i64 %140
store i8 0, i8* %141
br label %142
142: ; preds = %135
%143 = load i32, i32* %6
%144 = add nsw i32 %143, 1
store i32 %144, i32* %6
br label %112
145: ; preds = %112
store i32 0, i32* %6
br label %146
146: ; preds = %178, %145
br label %147
147: ; preds = %146
%148 = load i32, i32* %6
%149 = load i32, i32* %10
%150 = icmp eq i32 %148, %149
br i1 %150, label %151, label %160
151: ; preds = %147
%152 = getelementptr inbounds [43 x i8], [43 x i8]* %8, i64 0, i64 0
%153 = getelementptr inbounds [43 x i8], [43 x i8]* %9, i64 0, i64 0
%154 = load i32, i32* %6
%155 = sub nsw i32 %154, 1
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [43 x i8], [43 x i8]* %111, i64 %156
%158 = getelementptr inbounds [43 x i8], [43 x i8]* %157, i64 0, i64 0
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %152, i8* %153, i8* %158)
br label %187
160: ; preds = %147
%161 = getelementptr inbounds [43 x i8], [43 x i8]* %8, i64 0, i64 0
%162 = load i32, i32* %6
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [43 x i8], [43 x i8]* %69, i64 %163
%165 = getelementptr inbounds [43 x i8], [43 x i8]* %164, i64 0, i64 0
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %161, i8* %165)
%167 = load i32, i32* %6
%168 = load i32, i32* %13
%169 = icmp eq i32 %167, %168
br i1 %169, label %170, label %178
170: ; preds = %160
%171 = getelementptr inbounds [43 x i8], [43 x i8]* %9, i64 0, i64 0
%172 = getelementptr inbounds [43 x i8], [43 x i8]* %8, i64 0, i64 0
%173 = load i32, i32* %6
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [43 x i8], [43 x i8]* %69, i64 %174
%176 = getelementptr inbounds [43 x i8], [43 x i8]* %175, i64 0, i64 0
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %171, i8* %172, i8* %176)
br label %187
178: ; preds = %160
%179 = getelementptr inbounds [43 x i8], [43 x i8]* %9, i64 0, i64 0
%180 = load i32, i32* %6
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [43 x i8], [43 x i8]* %111, i64 %181
%183 = getelementptr inbounds [43 x i8], [43 x i8]* %182, i64 0, i64 0
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %179, i8* %183)
%185 = load i32, i32* %6
%186 = add nsw i32 %185, 1
store i32 %186, i32* %6
br label %146
187: ; preds = %170, %151
%188 = load i8*, i8** %11
br label %189
189: ; preds = %187
%190 = load i32, i32* %5
%191 = add nsw i32 %190, 1
store i32 %191, i32* %5
br label %21
192: ; preds = %21
%193 = load i32*, i32** %2
%194 = call i32 @fclose(i32* %193)
%195 = load i32, i32* @EXIT_SUCCESS
ret i32 %195
}

LLVM IR (-O2):
@.str = [8 x i8] c"best.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"Battle #%d! BEGIN!!!\0A\00"
@.str.4 = [31 x i8] c"%s is defeated by %s's %s!!!\0A\0A\00"
@.str.5 = [13 x i8] c"%s uses %s!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [42 x i8]
%2 = alloca i32
%3 = alloca [43 x i8]
%4 = alloca [43 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [42 x i8], [42 x i8]* %1, i64 0, i64 0
%9 = bitcast i32* %2 to i8*
%10 = call i32 @fgets(i8* %8, i32 43, i32* %7)
%11 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %117
14: ; preds = %0
%15 = getelementptr inbounds [43 x i8], [43 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [43 x i8], [43 x i8]* %4, i64 0, i64 0
%17 = bitcast i32* %5 to i8*
%18 = bitcast i32* %6 to i8*
br label %19
19: ; preds = %14, %114
%20 = phi i32 [ 0, %14 ], [ %21, %114 ]
%21 = add nuw nsw i32 %20, 1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = call i32 @fgets(i8* %15, i32 43, i32* %7)
%24 = call i32 @fgets(i8* %16, i32 43, i32* %7)
br label %25
25: ; preds = %25, %19
%26 = phi i64 [ %27, %25 ], [ 0, %19 ]
%27 = add nuw nsw i64 %26, 1
%28 = getelementptr inbounds [43 x i8], [43 x i8]* %3, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 10
br i1 %30, label %31, label %25
31: ; preds = %25
%32 = and i64 %27, 4294967295
%33 = getelementptr inbounds [43 x i8], [43 x i8]* %3, i64 0, i64 %32
store i8 0, i8* %33
br label %34
34: ; preds = %34, %31
%35 = phi i64 [ %36, %34 ], [ 0, %31 ]
%36 = add nuw nsw i64 %35, 1
%37 = getelementptr inbounds [43 x i8], [43 x i8]* %4, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 10
br i1 %39, label %40, label %34
40: ; preds = %34
%41 = and i64 %36, 4294967295
%42 = getelementptr inbounds [43 x i8], [43 x i8]* %4, i64 0, i64 %41
store i8 0, i8* %42
%43 = call i32 @fgets(i8* %8, i32 43, i32* %7)
%44 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%45 = load i32, i32* %5
%46 = zext i32 %45 to i64
%47 = call i8* @llvm.stacksave()
%48 = alloca [43 x i8], i64 %46
%49 = load i32, i32* %5
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %66
51: ; preds = %40, %61
%52 = phi i64 [ %62, %61 ], [ 0, %40 ]
%53 = getelementptr inbounds [43 x i8], [43 x i8]* %48, i64 %52, i64 0
%54 = call i32 @fgets(i8* %53, i32 43, i32* %7)
br label %55
55: ; preds = %55, %51
%56 = phi i64 [ %57, %55 ], [ 0, %51 ]
%57 = add nuw nsw i64 %56, 1
%58 = getelementptr inbounds [43 x i8], [43 x i8]* %48, i64 %52, i64 %57
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 10
br i1 %60, label %61, label %55
61: ; preds = %55
store i8 0, i8* %58
%62 = add nuw nsw i64 %52, 1
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = icmp slt i64 %62, %64
br i1 %65, label %51, label %66
66: ; preds = %61, %40
%67 = call i32 @fgets(i8* %8, i32 43, i32* %7)
%68 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%69 = load i32, i32* %6
%70 = zext i32 %69 to i64
%71 = alloca [43 x i8], i64 %70
%72 = icmp sgt i32 %69, 0
br i1 %72, label %76, label %73
73: ; preds = %86, %66
%74 = load i32, i32* %5
%75 = icmp eq i32 %74, 0
br i1 %75, label %91, label %98
76: ; preds = %66, %86
%77 = phi i64 [ %87, %86 ], [ 0, %66 ]
%78 = getelementptr inbounds [43 x i8], [43 x i8]* %71, i64 %77, i64 0
%79 = call i32 @fgets(i8* %78, i32 43, i32* %7)
br label %80
80: ; preds = %80, %76
%81 = phi i64 [ %82, %80 ], [ 0, %76 ]
%82 = add nuw nsw i64 %81, 1
%83 = getelementptr inbounds [43 x i8], [43 x i8]* %71, i64 %77, i64 %82
%84 = load i8, i8* %83
%85 = icmp eq i8 %84, 10
br i1 %85, label %86, label %80
86: ; preds = %80
store i8 0, i8* %83
%87 = add nuw nsw i64 %77, 1
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = icmp slt i64 %87, %89
br i1 %90, label %76, label %73
91: ; preds = %107, %73
%92 = phi i64 [ 0, %73 ], [ %110, %107 ]
%93 = shl i64 %92, 32
%94 = add i64 %93, -4294967296
%95 = ashr exact i64 %94, 32
%96 = getelementptr inbounds [43 x i8], [43 x i8]* %71, i64 %95, i64 0
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %15, i8* %16, i8* %96)
br label %114
98: ; preds = %73, %107
%99 = phi i64 [ %110, %107 ], [ 0, %73 ]
%100 = getelementptr inbounds [43 x i8], [43 x i8]* %48, i64 %99, i64 0
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %15, i8* %100)
%102 = load i32, i32* %6
%103 = zext i32 %102 to i64
%104 = icmp eq i64 %99, %103
br i1 %104, label %105, label %107
105: ; preds = %98
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %16, i8* %15, i8* %100)
br label %114
107: ; preds = %98
%108 = getelementptr inbounds [43 x i8], [43 x i8]* %71, i64 %99, i64 0
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %16, i8* %108)
%110 = add nuw i64 %99, 1
%111 = load i32, i32* %5
%112 = zext i32 %111 to i64
%113 = icmp eq i64 %110, %112
br i1 %113, label %91, label %98
114: ; preds = %105, %91
%115 = load i32, i32* %2
%116 = icmp slt i32 %21, %115
br i1 %116, label %19, label %117
117: ; preds = %114, %0
%118 = call i32 @fclose(i32* %7)
%119 = load i32, i32* @EXIT_SUCCESS
ret i32 %119
}