#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, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N, X, gan[3], i = 0, jog = -1;
  scanf(" %d", &N);
  while (N != 0) {
    jog++;
    i = 0;
    while (i < N) {
      scanf(" %d", &X);
      if (X == i + 1) {
        gan[jog] = i + 1;
      }
      i++;
    }
    scanf(" %d", &N);
  }
  i = 0;
  while (i <= jog) {
    printf("\nTeste %d\n%d\n", i + 1, gan[i]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11c5 <main+0xa5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x90>
lea    0xe86(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11a2 <main+0x82>
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq -0x20(%rbp),%rax
mov    %ecx,-0x18(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1167 <main+0x47>
lea    0xe49(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1200 <main+0xe0>
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
movslq -0x1c(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%edx
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cc <main+0xac>
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    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11f7 <main+0xd7>
mov    $0xffffffffffffffff,%rbx
mov    $0x1,%ecx
lea    0xea2(%rip),%r12
lea    0x8(%rsp),%r14
lea    0x4(%rsp),%r15
jmp    1187 <main+0x67>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    0x1(%r13),%ecx
test   %eax,%eax
je     11c2 <main+0xa2>
mov    %ecx,%r13d
add    $0x1,%rbx
test   %eax,%eax
jle    1170 <main+0x50>
xor    %ebp,%ebp
jmp    11a6 <main+0x86>
cs nopw 0x0(%rax,%rax,1)
cmp    0x4(%rsp),%ebp
jge    1170 <main+0x50>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jne    11a0 <main+0x80>
mov    %eax,0xc(%rsp,%rbx,4)
jmp    11a0 <main+0x80>
test   $0x80000000,%ebx
jne    11f7 <main+0xd7>
mov    %r13d,%r15d
xor    %ebx,%ebx
lea    0xe2e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp,%rbx,4),%edx
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    %rbx,%r15
jne    11e0 <main+0xc0>
xor    %eax,%eax
add    $0x18,%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 = [14 x i8] c"\0ATeste %d\0A%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 -1, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %33, %0
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %35
11: ; preds = %8
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
store i32 0, i32* %5
br label %14
14: ; preds = %30, %11
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %30
24: ; preds = %18
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %24, %18
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %14
33: ; preds = %14
%34 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
35: ; preds = %8
store i32 0, i32* %5
br label %36
36: ; preds = %40, %35
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = icmp sle i32 %37, %38
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %46)
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %36
50: ; preds = %36
ret i32 0
}

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