#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 obterAlternativaSelecionada(int *, int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
int main(void) {
  int casos, i, alternativas[5];
  while (scanf("%d", &casos), casos != 0) {
    while (casos-- > 0) {
      for (i = 0; i < 5; i++) {
        scanf("%d", &alternativas[i]);
      }
      printf("%c\n", obterAlternativaSelecionada(alternativas, 5));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11d2 <main+0xa2>
jmp    115e <main+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11cd <main+0x9d>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11ac <main+0x7c>
movslq -0xc(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1179 <main+0x49>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <obterAlternativaSelecionada@plt>
mov    %eax,%esi
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
jmp    115e <main+0x2e>
jmp    113f <main+0xf>
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    $0x28,%rsp
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1214 <main+0xe4>
lea    0xe9e(%rip),%rbx
lea    0x10(%rsp),%rbp
jmp    1189 <main+0x59>
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1214 <main+0xe4>
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
lea    0x18(%rsp),%r12
lea    0x1c(%rsp),%r13
lea    0x20(%rsp),%r14
lea    0xe5b(%rip),%r15
jle    1170 <main+0x40>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
mov    $0x5,%esi
call   1040 <obterAlternativaSelecionada@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jg     11b0 <main+0x80>
jmp    1170 <main+0x40>
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 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x i32]
store i32 0, i32* %1
br label %5
5: ; preds = %30, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %31
9: ; preds = %5
br label %10
10: ; preds = %26, %9
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %30
14: ; preds = %10
store i32 0, i32* %3
br label %15
15: ; preds = %23, %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %20
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %15
26: ; preds = %15
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%28 = call i32 @obterAlternativaSelecionada(i32* %27, i32 5)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %10
30: ; preds = %10
br label %5
31: ; preds = %5
ret i32 0
}

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