#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 rodadas, aldo, beto, total_aldo, total_beto, teste = 1;
  while (1) {
    scanf("%d", &rodadas);
    if (rodadas == 0)
      break;
    total_aldo = total_beto = 0;
    while (rodadas-- > 0) {
      scanf("%d%d", &aldo, &beto);
      total_aldo += aldo;
      total_beto += beto;
    }
    printf("\nTeste %d\n", teste++);
    if (total_aldo > total_beto) {
      printf("Aldo\n");
    } else {
      printf("Beto\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1157 <main+0x37>
jmp    11f1 <main+0xd1>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11a6 <main+0x86>
lea    0xe80(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
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)
jmp    1165 <main+0x45>
mov    -0x1c(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11de <main+0xbe>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <main+0xcc>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1235 <main+0x105>
mov    $0x1,%r12d
lea    0xe96(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
jmp    11c2 <main+0x92>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rsi
add    $0x1,%r12d
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe74(%rip),%rdi
mov    %r12d,%eax
mov    %rax,%r12
call   1030 <puts@plt>
lea    0xe54(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1235 <main+0x105>
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    1180 <main+0x50>
xor    %r13d,%r13d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
add    0x14(%rsp),%ebp
add    0x10(%rsp),%r13d
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jg     11e0 <main+0xb0>
mov    %r12,%rsi
add    $0x1,%r12d
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdf1(%rip),%rdi
mov    %r12d,%eax
cmp    %r13d,%ebp
jle    1195 <main+0x65>
jmp    119f <main+0x6f>
xor    %eax,%eax
add    $0x18,%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 = [5 x i8] c"%d%d\00"
@.str.2 = [11 x i8] c"\0ATeste %d\0A\00"
@.str.3 = [6 x i8] c"Aldo\0A\00"
@.str.4 = [6 x i8] c"Beto\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
store i32 0, i32* %1
store i32 1, i32* %7
br label %8
8: ; preds = %0, %37
%9 = call i32 (i8*, i32*, ...) @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 %38
13: ; preds = %8
store i32 0, i32* %6
store i32 0, i32* %5
br label %14
14: ; preds = %18, %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, -1
store i32 %16, i32* %2
%17 = icmp sgt i32 %15, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%20 = load i32, i32* %3
%21 = load i32, i32* %5
%22 = add nsw i32 %21, %20
store i32 %22, i32* %5
%23 = load i32, i32* %4
%24 = load i32, i32* %6
%25 = add nsw i32 %24, %23
store i32 %25, i32* %6
br label %14
26: ; preds = %14
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %37
35: ; preds = %26
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
br label %8
38: ; preds = %12
ret i32 0
}

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