#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, times, i;
  char playera[5][20];
  char playerb[5][20];
  scanf("%d", &ROUND);
  for (times = 0; times < ROUND; times++) {
    for (i = 0; i < 5; i++) {
      scanf("%s", playera[i]);
    }
    for (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,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1241 <main+0x111>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    11a3 <main+0x73>
movslq -0x10(%rbp),%rax
lea    -0x80(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116e <main+0x3e>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    11e2 <main+0xb2>
movslq -0x10(%rbp),%rax
lea    -0xf0(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <main+0x7a>
lea    -0x80(%rbp),%rdi
call   1050 <getscore@plt>
mov    %rax,-0xf8(%rbp)
lea    -0xf0(%rbp),%rdi
call   1050 <getscore@plt>
mov    %rax,%rcx
mov    -0xf8(%rbp),%rax
cmp    %rcx,%rax
jle    1222 <main+0xf2>
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0xfe>
lea    0xde0(%rip),%rdi
call   1030 <printf@plt>
jmp    1233 <main+0x103>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <main+0x2b>
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 i32
%4 = alloca i32
%5 = alloca [5 x [20 x i8]]
%6 = alloca [5 x [20 x i8]]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %8
8: ; preds = %51, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %54
12: ; preds = %8
store i32 0, i32* %4
br label %13
13: ; preds = %22, %12
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %5, i64 0, i64 %18
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %19, i64 0, i64 0
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %13
25: ; preds = %13
store i32 0, i32* %4
br label %26
26: ; preds = %35, %25
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 5
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %6, i64 0, i64 %31
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %32, i64 0, i64 0
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %26
38: ; preds = %26
%39 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %5, i64 0, i64 0
%40 = bitcast [20 x i8]* %39 to i8**
%41 = call i64 @getscore(i8** %40)
%42 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %6, i64 0, i64 0
%43 = bitcast [20 x i8]* %42 to i8**
%44 = call i64 @getscore(i8** %43)
%45 = icmp sgt i64 %41, %44
br i1 %45, label %46, label %48
46: ; preds = %38
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %50
48: ; preds = %38
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %8
54: ; preds = %8
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
}