#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 */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int partidas, dedos_a, dedos_b, teste = 1;
  char jogador_a[11], jogador_b[11];
  while (1) {
    scanf("%d", &partidas);
    if (partidas == 0)
      break;
    printf("\nTeste %d\n", teste++);
    scanf("%s%s", &jogador_a, &jogador_b);
    while (partidas-- > 0) {
      scanf("%d%d", &dedos_a, &dedos_b);
      if ((dedos_a + dedos_b) % 2 == 0) {
        printf("%s\n", jogador_a);
      } else {
        printf("%s\n", jogador_b);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1157 <main+0x37>
jmp    11f7 <main+0xd7>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %eax,%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x1f(%rbp),%rsi
lea    -0x2a(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11f2 <main+0xd2>
lea    0xe6e(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11dd <main+0xbd>
lea    -0x1f(%rbp),%rsi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
lea    -0x2a(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
jmp    1187 <main+0x67>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     120d <main+0xed>
mov    $0x1,%r12d
lea    0x1d(%rsp),%rbx
lea    0xeb2(%rip),%rbp
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0xea6(%rip),%r13
jmp    119e <main+0x7e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
lea    0xe87(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     120d <main+0xed>
lea    0xe5b(%rip),%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
lea    0xe57(%rip),%rdi
mov    %rbx,%rsi
lea    0x12(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
jmp    11d8 <main+0xb8>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
test   %eax,%eax
jle    1180 <main+0x60>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
add    0xc(%rsp),%eax
mov    %rbx,%rsi
test   $0x1,%al
je     11d0 <main+0xb0>
lea    0x12(%rsp),%rsi
jmp    11d0 <main+0xb0>
xor    %eax,%eax
add    $0x28,%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 = [11 x i8] c"\0ATeste %d\0A\00"
@.str.2 = [5 x i8] c"%s%s\00"
@.str.3 = [5 x i8] c"%d%d\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [11 x i8]
%7 = alloca [11 x i8]
store i32 0, i32* %1
store i32 1, i32* %5
br label %8
8: ; preds = %0, %38
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %39
13: ; preds = %8
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
%16 = sext i32 %14 to i64
%17 = inttoptr i64 %16 to i8*
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), [11 x i8]* %6, [11 x i8]* %7)
br label %20
20: ; preds = %37, %13
%21 = load i32, i32* %2
%22 = add nsw i32 %21, -1
store i32 %22, i32* %2
%23 = icmp sgt i32 %21, 0
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = add nsw i32 %26, %27
%29 = srem i32 %28, 2
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %32)
br label %37
34: ; preds = %24
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %34, %31
br label %20
38: ; preds = %20
br label %8
39: ; preds = %12
ret i32 0
}

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