#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, char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int n, t, i, a, b, sa, sb;
  t = 0;
  scanf("%d", &n);
  while (n != 0) {
    a = b = 0;
    for (i = 0; i < n; i++) {
      scanf("%d %d", &sa, &sb);
      a += sa;
      b += sb;
    }
    printf("Teste %d\n%s\n\n", ++t, a > b ? "Aldo" : "Beto");
    scanf("%d", &n);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec6(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11ef <main+0xcf>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a9 <main+0x89>
lea    0xe86(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1167 <main+0x47>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%edi
lea    0xe5a(%rip),%rdx
lea    0xe4e(%rip),%rax
cmp    %edi,%ecx
cmovg  %rax,%rdx
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1148 <main+0x28>
mov    -0x4(%rbp),%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    0xece(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     11f9 <main+0xd9>
lea    0xeac(%rip),%r15
lea    0x14(%rsp),%r14
lea    0x10(%rsp),%rbx
xor    %r12d,%r12d
jmp    11bd <main+0x9d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %r13d,%r13d
xor    %ebp,%ebp
mov    0xc(%rsp),%r12d
add    $0x1,%r12d
cmp    %ebp,%r13d
lea    0xe91(%rip),%rdx
lea    0xe85(%rip),%rax
cmovg  %rax,%rdx
lea    0xe6c(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     11f9 <main+0xd9>
test   %eax,%eax
mov    %r12d,0xc(%rsp)
jle    1170 <main+0x50>
xor    %ebp,%ebp
xor    %r13d,%r13d
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
add    0x14(%rsp),%r13d
add    0x10(%rsp),%ebp
add    $0x1,%r12d
cmp    0x8(%rsp),%r12d
jl     11d0 <main+0xb0>
jmp    1175 <main+0x55>
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 = [6 x i8] c"%d %d\00"
@.str.2 = [14 x i8] c"Teste %d\0A%s\0A\0A\00"
@.str.3 = [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 i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %29, %0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %39
13: ; preds = %10
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
br label %14
14: ; preds = %26, %13
%15 = load i32, i32* %4
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8)
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = add nsw i32 %21, %20
store i32 %22, i32* %5
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = add nsw i32 %24, %23
store i32 %25, i32* %6
br label %26
26: ; preds = %18
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %14
29: ; preds = %14
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = icmp sgt i32 %32, %33
%35 = zext i1 %34 to i64
%36 = select i1 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%37 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %31, i8* %36)
%38 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %10
39: ; preds = %10
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [14 x i8] c"Teste %d\0A%s\0A\0A\00"
@.str.3 = [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 = 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 %36, label %10
10: ; preds = %0, %26
%11 = phi i32 [ %34, %26 ], [ %8, %0 ]
%12 = phi i32 [ %29, %26 ], [ 0, %0 ]
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %26
14: ; preds = %10, %14
%15 = phi i32 [ %22, %14 ], [ 0, %10 ]
%16 = phi i32 [ %20, %14 ], [ 0, %10 ]
%17 = phi i32 [ %23, %14 ], [ 0, %10 ]
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%19 = load i32, i32* %2
%20 = add nsw i32 %19, %16
%21 = load i32, i32* %3
%22 = add nsw i32 %21, %15
%23 = add nuw nsw i32 %17, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %23, %24
br i1 %25, label %14, label %26
26: ; preds = %14, %10
%27 = phi i32 [ 0, %10 ], [ %20, %14 ]
%28 = phi i32 [ 0, %10 ], [ %22, %14 ]
%29 = add nuw nsw i32 %12, 1
%30 = icmp sgt i32 %27, %28
%31 = select i1 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%32 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %29, i8* %31)
%33 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%34 = load i32, i32* %1
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %10
36: ; preds = %26, %0
ret i32 0
}