program main
   implicit none
   integer n,i,j
   real:: t,a,d=10000,re
   real,allocatable,dimension(:)::h
   reaD(*,*)n,t,a
   allocate(h(1:n))
   read(*,*)h(1:n)
   do i=1,n
      re=t-h(i)*0.006
      if(abs(re-a)<d)then
        d=abs(re-a)
        j=i
      endif
   enddo
   write(*,*)j
end program main

; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEd = internal unnamed_addr global float 1.000000e+04
@_QFEh.0 = internal unnamed_addr global ptr null
@_QQcl.8d4f9fb5df37ad7f2a21ba9b18829062 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5377/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca float, align 4
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.8d4f9fb5df37ad7f2a21ba9b18829062, i32 6)
  %6 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %3, i32 4)
  %7 = call i1 @_FortranAioInputReal32(ptr %5, ptr nonnull %4)
  %8 = call i1 @_FortranAioInputReal32(ptr %5, ptr nonnull %2)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %10 = load i32, ptr %3, align 4, !tbaa !3
  %11 = call i32 @llvm.smax.i32(i32 %10, i32 0)
  %12 = zext i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 2
  %14 = call ptr @malloc(i64 %13)
  store ptr %14, ptr @_QFEh.0, align 8, !tbaa !7
  %15 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.8d4f9fb5df37ad7f2a21ba9b18829062, i32 8)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %16 = load i32, ptr %3, align 4, !tbaa !3
  %17 = call i32 @llvm.smax.i32(i32 %16, i32 0)
  %18 = zext i32 %17 to i64
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 27, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %18, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %19 = call i1 @_FortranAioInputDescriptor(ptr %15, ptr nonnull %1)
  %20 = call i32 @_FortranAioEndIoStatement(ptr %15)
  %21 = load i32, ptr %3, align 4, !tbaa !3
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %23 = zext i32 %21 to i64
  %_QFEd.promoted = load float, ptr @_QFEd, align 4, !tbaa !3
  %24 = load float, ptr %4, align 4, !tbaa !3
  %.unpack94 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %25 = load float, ptr %2, align 4, !tbaa !3
  %xtraiter = and i64 %23, 1
  %26 = icmp eq i32 %21, 1
  br i1 %26, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %23, 4294967294
  br label %27

27:                                               ; preds = %51, %.lr.ph.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.1, %51 ]
  %.0106 = phi i32 [ undef, %.lr.ph.new ], [ %.1.1, %51 ]
  %28 = phi float [ %_QFEd.promoted, %.lr.ph.new ], [ %52, %51 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %51 ]
  %29 = add nsw i64 %indvars.iv, -1
  %30 = getelementptr float, ptr %.unpack94, i64 %29
  %31 = load float, ptr %30, align 4, !tbaa !3
  %32 = fmul contract float %31, 0x3F789374C0000000
  %33 = fsub contract float %24, %32
  %34 = fsub contract float %33, %25
  %35 = call contract float @llvm.fabs.f32(float %34)
  %36 = fcmp olt float %35, %28
  br i1 %36, label %37, label %39

37:                                               ; preds = %27
  store float %35, ptr @_QFEd, align 4, !tbaa !3
  %38 = trunc i64 %indvars.iv to i32
  br label %39

39:                                               ; preds = %37, %27
  %40 = phi float [ %35, %37 ], [ %28, %27 ]
  %.1 = phi i32 [ %38, %37 ], [ %.0106, %27 ]
  %41 = getelementptr float, ptr %.unpack94, i64 %indvars.iv
  %42 = load float, ptr %41, align 4, !tbaa !3
  %43 = fmul contract float %42, 0x3F789374C0000000
  %44 = fsub contract float %24, %43
  %45 = fsub contract float %44, %25
  %46 = call contract float @llvm.fabs.f32(float %45)
  %47 = fcmp olt float %46, %40
  br i1 %47, label %48, label %51

48:                                               ; preds = %39
  store float %46, ptr @_QFEd, align 4, !tbaa !3
  %49 = trunc i64 %indvars.iv to i32
  %50 = add i32 %49, 1
  br label %51

51:                                               ; preds = %48, %39
  %52 = phi float [ %46, %48 ], [ %40, %39 ]
  %.1.1 = phi i32 [ %50, %48 ], [ %.1, %39 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %27

._crit_edge.loopexit.unr-lcssa:                   ; preds = %51, %.lr.ph
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next.1, %51 ]
  %.0106.unr = phi i32 [ undef, %.lr.ph ], [ %.1.1, %51 ]
  %.unr = phi float [ %_QFEd.promoted, %.lr.ph ], [ %52, %51 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa
  %53 = add nsw i64 %indvars.iv.unr, -1
  %54 = getelementptr float, ptr %.unpack94, i64 %53
  %55 = load float, ptr %54, align 4, !tbaa !3
  %56 = fmul contract float %55, 0x3F789374C0000000
  %57 = fsub contract float %24, %56
  %58 = fsub contract float %57, %25
  %59 = call contract float @llvm.fabs.f32(float %58)
  %60 = fcmp olt float %59, %.unr
  br i1 %60, label %61, label %._crit_edge

61:                                               ; preds = %.epil.preheader
  store float %59, ptr @_QFEd, align 4, !tbaa !3
  %62 = trunc i64 %indvars.iv.unr to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %61, %.epil.preheader, %0
  %.0.lcssa = phi i32 [ undef, %0 ], [ %.0106.unr, %._crit_edge.loopexit.unr-lcssa ], [ %62, %61 ], [ %.0106.unr, %.epil.preheader ]
  %63 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.8d4f9fb5df37ad7f2a21ba9b18829062, i32 16)
  %64 = call i1 @_FortranAioOutputInteger32(ptr %63, i32 %.0.lcssa)
  %65 = call i32 @_FortranAioEndIoStatement(ptr %63)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputReal32(ptr, ptr) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
