#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 /*<<< orphan*/ scanf(char *, int *);
void main() {
  int i, j, a[10], n, src, flg = 1;
  printf("Enter the how mny nos......\n");
  scanf("%d", &n);
  printf("Enter the element .......\n");
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);
  printf("Enter the searching element......\n");
  scanf("%d", &src);
  for (i = 0; i < n; i++) {
    if (a[i] == src) {
      printf("%d is in %d position\n", src, i + 1);
      flg = 0;
    }
  }
  if (flg)
    printf("Not found");
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x1,-0x3c(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1197 <main+0x77>
movslq -0x4(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe99(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <main+0x42>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    120a <main+0xea>
movslq -0x4(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jne    11f7 <main+0xd7>
mov    -0x38(%rbp),%esi
mov    -0x4(%rbp),%edx
add    $0x1,%edx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    11fc <main+0xdc>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <main+0x9c>
cmpl   $0x0,-0x3c(%rbp)
je     1222 <main+0x102>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xed4(%rip),%rdi
call   1040 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    11ad <main+0x6d>
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
lea    0xe7a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     1190 <main+0x50>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
lea    0xe40(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1222 <main+0xe2>
mov    $0x1,%ebp
xor    %edx,%edx
lea    0xe23(%rip),%r14
jmp    11fb <main+0xbb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %eax,%rcx
mov    %rbx,%rdx
cmp    %rcx,%rbx
jge    121e <main+0xde>
mov    0x10(%rsp,%rdx,4),%esi
lea    0x1(%rdx),%rbx
cmp    0xc(%rsp),%esi
jne    11f0 <main+0xb0>
add    $0x1,%edx
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%eax
jmp    11f0 <main+0xb0>
test   %ebp,%ebp
je     1230 <main+0xf0>
lea    0xdf0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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