#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*/ free(float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, char **argv) {
  float *a, t;
  float eps = 1e-6;
  int n;
  int status = 0;
  scanf("%d", &n);
  a = (float *)malloc(sizeof(float) * n);
  for (size_t i = 0; i < n; i++)
    scanf(" %f", &a[i]);
  printf("\nEnter the target Value: ");
  scanf(" %f", &t);
  for (int i = 0; i < n; i++) {
    if (a[i] < t + eps && a[i] > t - eps) {
      printf("Target found at index : %d\n", i);
      status = 1;
    }
  }
  if (!status)
    puts("Target Not Found");
  free(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xe92(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xe83(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmp    %rcx,%rax
jae    11e6 <main+0x96>
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11a7 <main+0x57>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe0c(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1284 <main+0x134>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1271 <main+0x121>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  -0x1c(%rbp),%xmm1
subss  -0x20(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    1271 <main+0x121>
mov    -0x34(%rbp),%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x28(%rbp)
jmp    1276 <main+0x126>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120d <main+0xbd>
cmpl   $0x0,-0x28(%rbp)
jne    129a <main+0x14a>
lea    0xdac(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea9(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    (%rsp),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
cmpl   $0x0,(%rsp)
je     11ae <main+0x5e>
lea    0xe87(%rip),%r14
mov    %r15,%r12
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jb     1190 <main+0x40>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe48(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
jle    1257 <main+0x107>
movss  0xe1e(%rip),%xmm3
movss  0xe1a(%rip),%xmm4
lea    0xe38(%rip),%r14
xor    %ebx,%ebx
xor    %ecx,%ecx
jmp    120c <main+0xbc>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movslq %eax,%rdx
cmp    %rdx,%rbx
jge    1253 <main+0x103>
movss  (%r15,%rbx,4),%xmm0
movss  0x4(%rsp),%xmm1
movaps %xmm1,%xmm2
addss  %xmm3,%xmm2
ucomiss %xmm0,%xmm2
addss  %xmm4,%xmm1
jbe    1200 <main+0xb0>
ucomiss %xmm1,%xmm0
jbe    1200 <main+0xb0>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movss  0xdc3(%rip),%xmm4
movss  0xdb7(%rip),%xmm3
mov    $0x1,%ecx
mov    (%rsp),%eax
jmp    1200 <main+0xb0>
test   %ecx,%ecx
jne    1263 <main+0x113>
lea    0xde7(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c" %f\00"
@.str.2 = [26 x i8] c"\0AEnter the target Value: \00"
@.str.3 = [28 x i8] c"Target found at index : %d\0A\00"
@.str.4 = [17 x i8] c"Target Not Found\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0x3EB0C6F7A0000000, float* %8
store i32 0, i32* %10
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%14 = load i32, i32* %9
%15 = sext i32 %14 to i64
%16 = mul i64 4, %15
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to float*
store float* %19, float** %6
store i64 0, i64* %11
br label %20
20: ; preds = %30, %2
%21 = load i64, i64* %11
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = icmp ult i64 %21, %23
br i1 %24, label %25, label %33
25: ; preds = %20
%26 = load float*, float** %6
%27 = load i64, i64* %11
%28 = getelementptr inbounds float, float* %26, i64 %27
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %28)
br label %30
30: ; preds = %25
%31 = load i64, i64* %11
%32 = add i64 %31, 1
store i64 %32, i64* %11
br label %20
33: ; preds = %20
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %7)
store i32 0, i32* %12
br label %36
36: ; preds = %64, %33
%37 = load i32, i32* %12
%38 = load i32, i32* %9
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %67
40: ; preds = %36
%41 = load float*, float** %6
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds float, float* %41, i64 %43
%45 = load float, float* %44
%46 = load float, float* %7
%47 = load float, float* %8
%48 = fadd float %46, %47
%49 = fcmp olt float %45, %48
br i1 %49, label %50, label %63
50: ; preds = %40
%51 = load float*, float** %6
%52 = load i32, i32* %12
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds float, float* %51, i64 %53
%55 = load float, float* %54
%56 = load float, float* %7
%57 = load float, float* %8
%58 = fsub float %56, %57
%59 = fcmp ogt float %55, %58
br i1 %59, label %60, label %63
60: ; preds = %50
%61 = load i32, i32* %12
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %61)
store i32 1, i32* %10
br label %63
63: ; preds = %60, %50, %40
br label %64
64: ; preds = %63
%65 = load i32, i32* %12
%66 = add nsw i32 %65, 1
store i32 %66, i32* %12
br label %36
67: ; preds = %36
%68 = load i32, i32* %10
%69 = icmp ne i32 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %67
%71 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
%73 = load float*, float** %6
%74 = call i32 @free(float* %73)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c" %f\00"
@.str.2 = [26 x i8] c"\0AEnter the target Value: \00"
@.str.3 = [28 x i8] c"Target found at index : %d\0A\00"
@.str.4 = [17 x i8] c"Target Not Found\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca i32
%5 = bitcast float* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
%9 = shl i32 %8, 2
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to float*
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %19, %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %3)
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 0
br i1 %18, label %29, label %51
19: ; preds = %2, %19
%20 = phi i64 [ %23, %19 ], [ 0, %2 ]
%21 = getelementptr inbounds float, float* %11, i64 %20
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %21)
%23 = add nuw i64 %20, 1
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = icmp ult i64 %23, %25
br i1 %26, label %19, label %14
27: ; preds = %45
%28 = icmp eq i32 %47, 0
br i1 %28, label %51, label %53
29: ; preds = %14, %45
%30 = phi i32 [ %46, %45 ], [ %17, %14 ]
%31 = phi i64 [ %48, %45 ], [ 0, %14 ]
%32 = phi i32 [ %47, %45 ], [ 0, %14 ]
%33 = getelementptr inbounds float, float* %11, i64 %31
%34 = load float, float* %33
%35 = load float, float* %3
%36 = fadd float %35, 0x3EB0C6F7A0000000
%37 = fcmp olt float %34, %36
%38 = fadd float %35, 0xBEB0C6F7A0000000
%39 = fcmp ogt float %34, %38
%40 = and i1 %37, %39
br i1 %40, label %41, label %45
41: ; preds = %29
%42 = trunc i64 %31 to i32
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %4
br label %45
45: ; preds = %29, %41
%46 = phi i32 [ %44, %41 ], [ %30, %29 ]
%47 = phi i32 [ 1, %41 ], [ %32, %29 ]
%48 = add nuw nsw i64 %31, 1
%49 = sext i32 %46 to i64
%50 = icmp slt i64 %48, %49
br i1 %50, label %29, label %27
51: ; preds = %14, %27
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %27
%54 = call i32 @free(float* %11)
ret i32 0
}