#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int key, n, i, a[1000];
  scanf("%d", &key);
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    if (key == a[i]) {
      printf("%d", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1191 <main+0x71>
movslq -0x10(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe82(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <main+0x39>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11da <main+0xba>
mov    -0x8(%rbp),%eax
movslq -0x10(%rbp),%rcx
cmp    -0xfb0(%rbp,%rcx,4),%eax
jne    11c7 <main+0xa7>
mov    -0x10(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    11cc <main+0xac>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1198 <main+0x78>
xor    %eax,%eax
add    $0xfb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xfb0,%rsp
lea    0xecd(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11c6 <main+0xa6>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe9e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1170 <main+0x50>
test   %eax,%eax
jle    11c6 <main+0xa6>
xor    %ebx,%ebx
lea    0xe66(%rip),%r14
jmp    11ac <main+0x8c>
nopl   0x0(%rax)
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    11c6 <main+0xa6>
mov    0xc(%rsp),%ecx
cmp    0x10(%rsp,%rbx,4),%ecx
jne    11a0 <main+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
jmp    11a0 <main+0x80>
xor    %eax,%eax
add    $0xfb0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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