program palace
	implicit none
    integer :: N,T,A,i,pt
    integer,allocatable :: H(:)
	real :: temp,dt
    dt=10000.0
	read(*,*) N
    read(*,*) T,A
    allocate(H(N))
    read(*,*) H
    do i=1,N
    	temp=ABS(T-0.006*H(i)-A)
        !write(*,*) temp
        if(temp.lt.dt) then
        	dt=temp
            pt=i
        endif
    end do
    write(*,'(i0)') pt
    deallocate(H)


end program palace
; 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"

@_QFEh.0 = internal unnamed_addr global ptr null
@_QFEh.8 = internal unnamed_addr global i64 0
@_QQcl.1b6da8011ef8c1c6f4000b143cca9118 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5383/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.1b6da8011ef8c1c6f4000b143cca9118, i32 7)
  %6 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %3, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %8 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.1b6da8011ef8c1c6f4000b143cca9118, i32 8)
  %9 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %4, i32 4)
  %10 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %2, i32 4)
  %11 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %12 = load i32, ptr %3, align 4, !tbaa !3
  %13 = call i32 @llvm.smax.i32(i32 %12, i32 0)
  %14 = zext i32 %13 to i64
  %15 = shl nuw nsw i64 %14, 2
  %16 = call ptr @malloc(i64 %15)
  store ptr %16, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 %14, ptr @_QFEh.8, align 8, !tbaa !7
  %17 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.1b6da8011ef8c1c6f4000b143cca9118, i32 10)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack161.unpack.unpack163 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  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 9, 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 %.unpack161.unpack.unpack163, 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
  %18 = call i1 @_FortranAioInputDescriptor(ptr %17, ptr nonnull %1)
  %19 = call i32 @_FortranAioEndIoStatement(ptr %17)
  %20 = load i32, ptr %3, align 4, !tbaa !3
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %22 = zext i32 %20 to i64
  %23 = load i32, ptr %4, align 4, !tbaa !3
  %24 = sitofp i32 %23 to float
  %.unpack178 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %25 = load i32, ptr %2, align 4, !tbaa !3
  %26 = sitofp i32 %25 to float
  br label %27

27:                                               ; preds = %.lr.ph, %27
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %27 ]
  %.0191 = phi float [ 1.000000e+04, %.lr.ph ], [ %.1, %27 ]
  %.0142190 = phi i32 [ undef, %.lr.ph ], [ %.1143, %27 ]
  %28 = add nsw i64 %indvars.iv, -1
  %29 = getelementptr i32, ptr %.unpack178, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !3
  %31 = sitofp i32 %30 to float
  %32 = fmul contract float %31, 0x3F789374C0000000
  %33 = fsub contract float %24, %32
  %34 = fsub contract float %33, %26
  %35 = call contract float @llvm.fabs.f32(float %34)
  %36 = fcmp olt float %35, %.0191
  %37 = trunc i64 %indvars.iv to i32
  %.1143 = select i1 %36, i32 %37, i32 %.0142190
  %.1 = select i1 %36, float %35, float %.0191
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %22
  br i1 %exitcond.not, label %._crit_edge, label %27

._crit_edge:                                      ; preds = %27, %0
  %.0142.lcssa = phi i32 [ undef, %0 ], [ %.1143, %27 ]
  %38 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.1b6da8011ef8c1c6f4000b143cca9118, i32 19)
  %39 = call i1 @_FortranAioOutputInteger32(ptr %38, i32 %.0142.lcssa)
  %40 = call i32 @_FortranAioEndIoStatement(ptr %38)
  %.unpack166 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  call void @free(ptr %.unpack166)
  store ptr null, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 0, ptr @_QFEh.8, align 8, !tbaa !7
  ret void
}

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

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, 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) #2

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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}
