#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int R, A, B, cont_a, cont_b, i = 0, resul[1000], j;
  scanf(" %d", &R);
  cont_a = 0;
  cont_b = 0;
  while (R != 0) {
    i++;
    j = 0;
    cont_a = 0;
    cont_b = 0;
    while (j < R) {
      scanf(" %d", &A);
      scanf(" %d", &B);
      cont_a += A;
      cont_b += B;
      j++;
    }
    resul[i - 1] = cont_a > cont_b ? 1 : 2;
    scanf(" %d", &R);
  }
  j = 0;
  while (j < i) {
    printf("\nTeste %d\n", j + 1);
    resul[j] == 2 ? printf("Beto\n") : printf("Aldo\n");
    j++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1210 <main+0xf0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0xfc4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0xfc4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d7 <main+0xb7>
lea    0xe68(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe58(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xfc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc4(%rbp)
jmp    1182 <main+0x62>
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%esi
mov    $0x2,%ecx
mov    $0x1,%eax
cmp    %esi,%edx
cmovg  %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0xfc0(%rbp,%rax,4)
lea    0xdfe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1157 <main+0x37>
movl   $0x0,-0xfc4(%rbp)
mov    -0xfc4(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    128a <main+0x16a>
mov    -0xfc4(%rbp),%esi
add    $0x1,%esi
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xfc4(%rbp),%rax
cmpl   $0x2,-0xfc0(%rbp,%rax,4)
02
jne    1268 <main+0x148>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1276 <main+0x156>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xfc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc4(%rbp)
jmp    121a <main+0xfa>
xor    %eax,%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfc8,%rsp
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1259 <main+0x129>
mov    $0x1,%ecx
xor    %esi,%esi
lea    0xe94(%rip),%rbx
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
jmp    11bc <main+0x8c>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rdx
lea    0x1(%rdx),%rbp
xor    %eax,%eax
cmp    %r13d,%r12d
setg   %al
mov    $0x2,%ecx
sub    %eax,%ecx
mov    %ecx,0x20(%rsp,%rdx,4)
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    0x18(%rsp),%rdx
lea    0x1(%rdx),%ecx
mov    %rbp,%rsi
test   %eax,%eax
je     120e <main+0xde>
mov    %rsi,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    $0x0,%r12d
mov    $0x0,%r13d
test   %eax,%eax
jle    1180 <main+0x50>
xor    %ebp,%ebp
xor    %r13d,%r13d
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    0xc(%rsp),%r12d
add    0x8(%rsp),%r13d
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11e0 <main+0xb0>
jmp    1180 <main+0x50>
test   %ebp,%ebp
je     1259 <main+0x129>
mov    %edx,%r13d
lea    0xde8(%rip),%r14
lea    0xdf1(%rip),%r15
lea    0xde5(%rip),%r12
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    0x1(%rbx),%rbp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x2,0x20(%rsp,%rbx,4)
mov    %r12,%rdi
cmove  %r15,%rdi
call   1030 <puts@plt>
mov    %rbp,%rbx
cmp    %rbp,%r13
jne    1230 <main+0x100>
xor    %eax,%eax
add    $0xfc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@.str.1 = [11 x i8] c"\0ATeste %d\0A\00"
@.str.2 = [6 x i8] c"Beto\0A\00"
@.str.3 = [6 x i8] c"Aldo\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 [1000 x i32]
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
store i32 0, i32* %6
br label %11
11: ; preds = %32, %0
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %43
14: ; preds = %11
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
store i32 0, i32* %9
store i32 0, i32* %5
store i32 0, i32* %6
br label %17
17: ; preds = %21, %14
%18 = load i32, i32* %9
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%23 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %4)
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = add nsw i32 %25, %24
store i32 %26, i32* %5
%27 = load i32, i32* %4
%28 = load i32, i32* %6
%29 = add nsw i32 %28, %27
store i32 %29, i32* %6
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %17
32: ; preds = %17
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = icmp sgt i32 %33, %34
%36 = zext i1 %35 to i64
%37 = select i1 %35, i32 1, i32 2
%38 = load i32, i32* %7
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 %40
store i32 %37, i32* %41
%42 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %11
43: ; preds = %11
store i32 0, i32* %9
br label %44
44: ; preds = %61, %43
%45 = load i32, i32* %9
%46 = load i32, i32* %7
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %65
48: ; preds = %44
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 2
br i1 %56, label %57, label %59
57: ; preds = %48
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %61
59: ; preds = %48
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %57
%62 = phi i32 [ %58, %57 ], [ %60, %59 ]
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %44
65: ; preds = %44
ret i32 0
}

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