#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 */
scalar_t__ EOF;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main() {
  int A[200];
  int n;
  int i;
  int x;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++)
      scanf("%d", A + i);
    scanf("%d", &x);
    for (i = 0; i < n; i++) {
      if (x == A[i]) {
        printf("%d\n", i);
        break;
      }
    }
    if (i == n)
      printf("-1\n");
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x334(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%rax
je     1256 <main+0x126>
movl   $0x0,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    11b6 <main+0x86>
lea    -0x330(%rbp),%rsi
movslq -0x338(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe63(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    116f <main+0x3f>
lea    0xe43(%rip),%rdi
lea    -0x33c(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    1231 <main+0x101>
mov    -0x33c(%rbp),%eax
movslq -0x338(%rbp),%rcx
cmp    -0x330(%rbp,%rcx,4),%eax
jne    1218 <main+0xe8>
mov    -0x338(%rbp),%esi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x101>
jmp    121d <main+0xed>
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    11d3 <main+0xa3>
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jne    1251 <main+0x121>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x338,%rsp
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e7f(%rip),%r15
cmp    (%r15),%rax
jne    1175 <main+0x35>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe84(%rip),%rbx
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r13
jmp    11ac <main+0x6c>
nopl   0x0(%rax,%rax,1)
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
cmp    (%r15),%rax
je     116e <main+0x2e>
cmpl   $0x0,0x8(%rsp)
jle    11dd <main+0x9d>
lea    0x10(%rsp),%rbp
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
add    $0x1,%r12
movslq 0x8(%rsp),%rax
add    $0x4,%rbp
cmp    %rax,%r12
jl     11c0 <main+0x80>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1220 <main+0xe0>
mov    0xc(%rsp),%ecx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
cmp    0x10(%rsp,%rbp,4),%ecx
je     1230 <main+0xf0>
add    $0x1,%rbp
cmp    %rbp,%rax
jne    1200 <main+0xc0>
jmp    1190 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %ebp,%ebp
cmp    %eax,%ebp
je     1190 <main+0x50>
jmp    119c <main+0x5c>
nop
lea    0xdcc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
cmp    %eax,%ebp
je     1190 <main+0x50>
jmp    119c <main+0x5c>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [4 x i8] c"-1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %50, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %51
10: ; preds = %6
store i32 0, i32* %4
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 0
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %11
24: ; preds = %11
%25 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %4
br label %26
26: ; preds = %41, %24
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %44
30: ; preds = %26
%31 = load i32, i32* %5
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = icmp eq i32 %31, %35
br i1 %36, label %37, label %40
37: ; preds = %30
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
br label %44
40: ; preds = %30
br label %41
41: ; preds = %40
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %26
44: ; preds = %37, %26
%45 = load i32, i32* %4
%46 = load i32, i32* %3
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
br label %6
51: ; preds = %6
%52 = call i32 @exit(i32 0)
unreachable
}

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