#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 */

/* Variables and functions */
scalar_t__ getscore(char **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int ROUND;
  char playera[5][20];
  char playerb[5][20];
  scanf("%d", &ROUND);
  for (int times = 0; times < ROUND; times++) {
    for (int i = 0; i < 5; i++) {
      scanf("%s", playera[i]);
    }
    for (int i = 0; i < 5; i++) {
      scanf("%s", playerb[i]);
    }
    if (getscore(playera) > getscore(playerb))
      printf("A\n");
    else
      printf("B\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    126b <main+0x13b>
movl   $0x0,-0xe8(%rbp)
cmpl   $0x5,-0xe8(%rbp)
jge    11b8 <main+0x88>
movslq -0xe8(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    1177 <main+0x47>
movl   $0x0,-0xec(%rbp)
cmpl   $0x5,-0xec(%rbp)
jge    1206 <main+0xd6>
movslq -0xec(%rbp),%rax
lea    -0xe0(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    11c2 <main+0x92>
lea    -0x70(%rbp),%rdi
call   1050 <getscore@plt>
mov    %rax,-0xf8(%rbp)
lea    -0xe0(%rbp),%rdi
call   1050 <getscore@plt>
mov    %rax,%rcx
mov    -0xf8(%rbp),%rax
cmp    %rcx,%rax
jle    1246 <main+0x116>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
jmp    1252 <main+0x122>
lea    0xdbc(%rip),%rdi
call   1030 <printf@plt>
jmp    1257 <main+0x127>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    115e <main+0x2e>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1256 <main+0x126>
lea    0xe9d(%rip),%r12
lea    0x80(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xe8c(%rip),%r15
xor    %r14d,%r14d
nopl   (%rax)
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0x94(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0xa8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0xbc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0xd0(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0x24(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0x38(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0x4c(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0x60(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r13,%rdi
call   1050 <getscore@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <getscore@plt>
cmp    %rax,%rbp
mov    %r15,%rdi
lea    0xdca(%rip),%rax
cmovg  %rax,%rdi
call   1030 <puts@plt>
add    $0x1,%r14d
cmp    0xc(%rsp),%r14d
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"A\0A\00"
@.str.3 = [3 x i8] c"B\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x [20 x i8]]
%4 = alloca [5 x [20 x i8]]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %9
9: ; preds = %52, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %55
13: ; preds = %9
store i32 0, i32* %6
br label %14
14: ; preds = %23, %13
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 5
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 %19
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %20, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %14
26: ; preds = %14
store i32 0, i32* %7
br label %27
27: ; preds = %36, %26
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 5
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %4, i64 0, i64 %32
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %33, i64 0, i64 0
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %27
39: ; preds = %27
%40 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 0
%41 = bitcast [20 x i8]* %40 to i8**
%42 = call i64 @getscore(i8** %41)
%43 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %4, i64 0, i64 0
%44 = bitcast [20 x i8]* %43 to i8**
%45 = call i64 @getscore(i8** %44)
%46 = icmp sgt i64 %42, %45
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %51
49: ; preds = %39
%50 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49, %47
br label %52
52: ; preds = %51
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %9
55: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [2 x i8] c"B\00"
@str.4 = [2 x i8] c"A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [20 x i8]]
%3 = alloca [5 x [20 x i8]]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %2, i64 0, i64 0, i64 0
%6 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %41
10: ; preds = %0
%11 = bitcast [5 x [20 x i8]]* %2 to i8**
%12 = bitcast [5 x [20 x i8]]* %3 to i8**
%13 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %2, i64 0, i64 1, i64 0
%14 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %2, i64 0, i64 2, i64 0
%15 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %2, i64 0, i64 3, i64 0
%16 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %2, i64 0, i64 4, i64 0
%17 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 1, i64 0
%18 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 2, i64 0
%19 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 3, i64 0
%20 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %3, i64 0, i64 4, i64 0
br label %21
21: ; preds = %10, %21
%22 = phi i32 [ 0, %10 ], [ %38, %21 ]
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%33 = call i64 @getscore(i8** %11)
%34 = call i64 @getscore(i8** %12)
%35 = icmp sgt i64 %33, %34
%36 = select i1 %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0)
%37 = call i32 @puts(i8* dereferenceable(1) %36)
%38 = add nuw nsw i32 %22, 1
%39 = load i32, i32* %1
%40 = icmp slt i32 %38, %39
br i1 %40, label %21, label %41
41: ; preds = %21, %0
ret i32 0
}