#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 my_array[] = {23, 54, 23, 564, 12, -23, 54, -23, -542, 0};
  int size = 10;
  int n;
  int i;
  scanf("%d", &n);
  for (i = 0; i < size; i++) {
    if (my_array[i] == n) {
      printf("Index: %d\n", i);
      printf("Value: %d\n", n);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    0xec6(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11c5 <main+0x95>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jne    11b2 <main+0x82>
mov    -0x3c(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <main+0x95>
jmp    11b7 <main+0x87>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1172 <main+0x42>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xb,%eax
jle    114e <main+0x2e>
cmp    $0x35,%eax
jg     1165 <main+0x45>
cmp    $0xc,%eax
je     1178 <main+0x58>
xor    %esi,%esi
cmp    $0x17,%eax
je     1192 <main+0x72>
jmp    11ae <main+0x8e>
cmp    $0xfffffde2,%eax
je     117f <main+0x5f>
cmp    $0xffffffe9,%eax
je     118d <main+0x6d>
test   %eax,%eax
jne    11ae <main+0x8e>
mov    $0x9,%esi
jmp    1192 <main+0x72>
cmp    $0x234,%eax
je     1186 <main+0x66>
cmp    $0x36,%eax
jne    11ae <main+0x8e>
mov    $0x1,%esi
jmp    1192 <main+0x72>
mov    $0x4,%esi
jmp    1192 <main+0x72>
mov    $0x8,%esi
jmp    1192 <main+0x72>
mov    $0x3,%esi
jmp    1192 <main+0x72>
mov    $0x5,%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.my_array = [10 x i32] [i32 23, i32 54, i32 23, i32 564, i32 12, i32 -23, i32 54, i32 -23, i32 -542, i32 0]
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"Index: %d\0A\00"
@.str.2 = [11 x i8] c"Value: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %2 to i8*
store i32 10, i32* %3
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %8
8: ; preds = %25, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %28
12: ; preds = %8
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %4
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %12
%20 = load i32, i32* %5
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %28
24: ; preds = %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %8
28: ; preds = %19, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"Index: %d\0A\00"
@.str.2 = [11 x i8] c"Value: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
switch i32 %4, label %16 [
i32 23, label %11
i32 54, label %5
i32 564, label %6
i32 12, label %7
i32 -23, label %8
i32 -542, label %9
i32 0, label %10
]
5: ; preds = %0
br label %11
6: ; preds = %0
br label %11
7: ; preds = %0
br label %11
8: ; preds = %0
br label %11
9: ; preds = %0
br label %11
10: ; preds = %0
br label %11
11: ; preds = %0, %10, %9, %8, %7, %6, %5
%12 = phi i32 [ 0, %0 ], [ 1, %5 ], [ 3, %6 ], [ 4, %7 ], [ 5, %8 ], [ 8, %9 ], [ 9, %10 ]
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %1
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %0, %11
ret i32 0
}