#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 alternativa(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, n, p, preto = 0, resp = 0;
  scanf("%d", &n);
  while (n != 0) {
    for (i = 0; i < n; ++i) {
      for (j = 0; j < 5; ++j) {
        scanf("%d", &resp);
        if (resp >= 0 && resp <= 127) {
          ++preto;
          p = j;
        }
      }
      if (preto == 1)
        printf("%c\n", alternativa(p));
      else
        printf("*\n");
      preto = 0;
    }
    scanf("%d", &n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
je     1230 <main+0x100>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    121b <main+0xeb>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11d1 <main+0xa1>
lea    0xe6e(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x1c(%rbp)
jl     11be <main+0x8e>
cmpl   $0x7f,-0x1c(%rbp)
jg     11be <main+0x8e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11c3 <main+0x93>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1181 <main+0x51>
cmpl   $0x1,-0x18(%rbp)
jne    11f8 <main+0xc8>
mov    -0x14(%rbp),%edi
call   1050 <alternativa@plt>
mov    %eax,%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xd6>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x3e>
lea    0xdde(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
jmp    115d <main+0x2d>
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
push   %rax
movl   $0x0,(%rsp)
lea    0xea7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1292 <main+0x152>
lea    0xe8a(%rip),%rbx
mov    %rsp,%r14
mov    $0x4,%r15d
jmp    11a9 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1292 <main+0x152>
test   %eax,%eax
jle    1190 <main+0x50>
xor    %r12d,%r12d
jmp    11d7 <main+0x97>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r12d
cmp    0x4(%rsp),%r12d
jge    1190 <main+0x50>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
xor    %r13d,%r13d
cmpl   $0x80,(%rsp)
setb   %r13b
mov    $0x0,%eax
cmovb  %eax,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x80,(%rsp)
mov    $0x1,%eax
cmovb  %eax,%ebp
adc    $0x0,%r13d
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x80,(%rsp)
mov    $0x2,%eax
cmovb  %eax,%ebp
adc    $0x0,%r13d
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x80,(%rsp)
mov    $0x3,%eax
cmovb  %eax,%ebp
adc    $0x0,%r13d
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x80,(%rsp)
cmovb  %r15d,%ebp
adc    $0x0,%r13d
cmp    $0x1,%r13d
jne    11c0 <main+0x80>
mov    %ebp,%edi
call   1060 <alternativa@plt>
lea    0xd7f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11cc <main+0x8c>
xor    %eax,%eax
add    $0x8,%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"
@.str.2 = [3 x i8] c"*\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 0, i32* %6
store i32 0, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %9
9: ; preds = %49, %0
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %51
12: ; preds = %9
store i32 0, i32* %2
br label %13
13: ; preds = %46, %12
%14 = load i32, i32* %2
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %49
17: ; preds = %13
store i32 0, i32* %3
br label %18
18: ; preds = %33, %17
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 5
br i1 %20, label %21, label %36
21: ; preds = %18
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%23 = load i32, i32* %7
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i32, i32* %7
%27 = icmp sle i32 %26, 127
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
%31 = load i32, i32* %3
store i32 %31, i32* %5
br label %32
32: ; preds = %28, %25, %21
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %18
36: ; preds = %18
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* %5
%41 = call i32 @alternativa(i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
br label %45
43: ; preds = %36
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %39
store i32 0, i32* %6
br label %46
46: ; preds = %45
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %13
49: ; preds = %13
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %9
51: ; preds = %9
ret i32 0
}

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