program main
implicit None
	integer::n,i,t1,a1,k
	real::a,t
	real,allocatable::h(:)
	
	read *,n
	read *,t,a
	allocate(h(n))
	
	read *,h
	
	h = a - t + h*0.006
	
	k = 1
	do i = 1,n
		if(abs(h(i)) < abs(h(k))) k = i
	enddo
	
	print 101,k
	
101 format(i0)
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"

@_QFEh.0 = internal unnamed_addr global ptr null
@_QFEh.8 = internal unnamed_addr global i64 0
@_QQcl.0a0b90f9818510b9c8146397c7c58361 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5374/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 float, align 4
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0a0b90f9818510b9c8146397c7c58361, 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.0a0b90f9818510b9c8146397c7c58361, i32 8)
  %9 = call i1 @_FortranAioInputReal32(ptr %8, ptr nonnull %4)
  %10 = call i1 @_FortranAioInputReal32(ptr %8, ptr nonnull %2)
  %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.0a0b90f9818510b9c8146397c7c58361, i32 11)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack172.unpack.unpack174 = 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 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 %.unpack172.unpack.unpack174, 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 float, ptr %2, align 4, !tbaa !3
  %21 = load float, ptr %4, align 4, !tbaa !3
  %22 = fsub contract float %20, %21
  %.unpack177 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack177222 = ptrtoint ptr %.unpack177 to i64
  %.unpack184.unpack.unpack186 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  %.not = icmp eq ptr %.unpack177, null
  %23 = shl i64 %.unpack184.unpack.unpack186, 2
  %24 = call ptr @malloc(i64 %23)
  %25 = ptrtoint ptr %24 to i64
  %26 = icmp slt i64 %.unpack184.unpack.unpack186, 1
  br i1 %.not, label %._crit_edge, label %27

27:                                               ; preds = %0
  br i1 %26, label %.thread, label %.lr.ph211.preheader

.lr.ph211.preheader:                              ; preds = %27
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr nonnull align 4 %.unpack177, i64 %23, i1 false), !tbaa !3
  %min.iters.check = icmp ult i64 %.unpack184.unpack.unpack186, 8
  %28 = sub i64 %25, %.unpack177222
  %diff.check = icmp ult i64 %28, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %.lr.ph211.preheader226, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph211.preheader
  %n.vec = and i64 %.unpack184.unpack.unpack186, -8
  %broadcast.splatinsert = insertelement <4 x float> poison, float %22, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert224 = insertelement <4 x float> poison, float %22, i64 0
  %broadcast.splat225 = shufflevector <4 x float> %broadcast.splatinsert224, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %29 = getelementptr float, ptr %.unpack177, i64 %index
  %wide.load = load <4 x float>, ptr %29, align 4, !tbaa !3
  %30 = getelementptr float, ptr %29, i64 4
  %wide.load223 = load <4 x float>, ptr %30, align 4, !tbaa !3
  %31 = fmul contract <4 x float> %wide.load, <float 0x3F789374C0000000, float 0x3F789374C0000000, float 0x3F789374C0000000, float 0x3F789374C0000000>
  %32 = fmul contract <4 x float> %wide.load223, <float 0x3F789374C0000000, float 0x3F789374C0000000, float 0x3F789374C0000000, float 0x3F789374C0000000>
  %33 = fadd contract <4 x float> %broadcast.splat, %31
  %34 = fadd contract <4 x float> %broadcast.splat225, %32
  %35 = getelementptr float, ptr %24, i64 %index
  store <4 x float> %33, ptr %35, align 4, !tbaa !3
  %36 = getelementptr float, ptr %35, i64 4
  store <4 x float> %34, ptr %36, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %37 = icmp eq i64 %index.next, %n.vec
  br i1 %37, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %.unpack184.unpack.unpack186, %n.vec
  br i1 %cmp.n, label %.preheader, label %.lr.ph211.preheader226

.lr.ph211.preheader226:                           ; preds = %.lr.ph211.preheader, %middle.block
  %.ph = phi i64 [ 0, %.lr.ph211.preheader ], [ %n.vec, %middle.block ]
  %38 = xor i64 %.ph, -1
  %39 = add i64 %.unpack184.unpack.unpack186, %38
  %xtraiter = and i64 %.unpack184.unpack.unpack186, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph211.prol.loopexit, label %.lr.ph211.prol

.lr.ph211.prol:                                   ; preds = %.lr.ph211.preheader226, %.lr.ph211.prol
  %40 = phi i64 [ %45, %.lr.ph211.prol ], [ %.ph, %.lr.ph211.preheader226 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph211.prol ], [ 0, %.lr.ph211.preheader226 ]
  %41 = getelementptr float, ptr %.unpack177, i64 %40
  %42 = load float, ptr %41, align 4, !tbaa !3
  %43 = fmul contract float %42, 0x3F789374C0000000
  %44 = fadd contract float %22, %43
  %45 = add nuw nsw i64 %40, 1
  %46 = getelementptr float, ptr %24, i64 %40
  store float %44, ptr %46, align 4, !tbaa !3
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph211.prol.loopexit, label %.lr.ph211.prol, !llvm.loop !12

.lr.ph211.prol.loopexit:                          ; preds = %.lr.ph211.prol, %.lr.ph211.preheader226
  %.unr = phi i64 [ %.ph, %.lr.ph211.preheader226 ], [ %45, %.lr.ph211.prol ]
  %47 = icmp ult i64 %39, 3
  br i1 %47, label %.preheader, label %.lr.ph211

.preheader:                                       ; preds = %.lr.ph211.prol.loopexit, %.lr.ph211, %middle.block
  br i1 %26, label %.thread, label %.lr.ph212.preheader

.lr.ph212.preheader:                              ; preds = %.preheader
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %.unpack177, ptr nonnull align 4 %24, i64 %23, i1 false), !tbaa !3
  br label %.thread

.lr.ph211:                                        ; preds = %.lr.ph211.prol.loopexit, %.lr.ph211
  %48 = phi i64 [ %71, %.lr.ph211 ], [ %.unr, %.lr.ph211.prol.loopexit ]
  %49 = getelementptr float, ptr %.unpack177, i64 %48
  %50 = load float, ptr %49, align 4, !tbaa !3
  %51 = fmul contract float %50, 0x3F789374C0000000
  %52 = fadd contract float %22, %51
  %53 = add nuw nsw i64 %48, 1
  %54 = getelementptr float, ptr %24, i64 %48
  store float %52, ptr %54, align 4, !tbaa !3
  %55 = getelementptr float, ptr %.unpack177, i64 %53
  %56 = load float, ptr %55, align 4, !tbaa !3
  %57 = fmul contract float %56, 0x3F789374C0000000
  %58 = fadd contract float %22, %57
  %59 = add nuw nsw i64 %48, 2
  %60 = getelementptr float, ptr %24, i64 %53
  store float %58, ptr %60, align 4, !tbaa !3
  %61 = getelementptr float, ptr %.unpack177, i64 %59
  %62 = load float, ptr %61, align 4, !tbaa !3
  %63 = fmul contract float %62, 0x3F789374C0000000
  %64 = fadd contract float %22, %63
  %65 = add nuw nsw i64 %48, 3
  %66 = getelementptr float, ptr %24, i64 %59
  store float %64, ptr %66, align 4, !tbaa !3
  %67 = getelementptr float, ptr %.unpack177, i64 %65
  %68 = load float, ptr %67, align 4, !tbaa !3
  %69 = fmul contract float %68, 0x3F789374C0000000
  %70 = fadd contract float %22, %69
  %71 = add nuw nsw i64 %48, 4
  %72 = getelementptr float, ptr %24, i64 %65
  store float %70, ptr %72, align 4, !tbaa !3
  %exitcond.not.3 = icmp eq i64 %71, %.unpack184.unpack.unpack186
  br i1 %exitcond.not.3, label %.preheader, label %.lr.ph211, !llvm.loop !14

.thread:                                          ; preds = %27, %.lr.ph212.preheader, %.preheader
  call void @free(ptr %24)
  br label %73

._crit_edge:                                      ; preds = %0
  call void @llvm.assume(i1 %26)
  store ptr %24, ptr @_QFEh.0, align 8, !tbaa !7
  br label %73

73:                                               ; preds = %.thread, %._crit_edge
  %.unpack189 = phi ptr [ %.unpack177, %.thread ], [ %24, %._crit_edge ]
  %74 = load i32, ptr %3, align 4, !tbaa !3
  %75 = icmp sgt i32 %74, 0
  br i1 %75, label %.lr.ph216, label %._crit_edge217

.lr.ph216:                                        ; preds = %73
  %76 = zext i32 %74 to i64
  %xtraiter227 = and i64 %76, 1
  %77 = icmp eq i32 %74, 1
  br i1 %77, label %._crit_edge217.loopexit.unr-lcssa, label %.lr.ph216.new

.lr.ph216.new:                                    ; preds = %.lr.ph216
  %unroll_iter = and i64 %76, 4294967294
  br label %78

78:                                               ; preds = %78, %.lr.ph216.new
  %indvars.iv = phi i64 [ 1, %.lr.ph216.new ], [ %indvars.iv.next.1, %78 ]
  %.0214 = phi i32 [ 1, %.lr.ph216.new ], [ %.1.1, %78 ]
  %niter = phi i64 [ 0, %.lr.ph216.new ], [ %niter.next.1, %78 ]
  %79 = add nsw i64 %indvars.iv, -1
  %80 = getelementptr float, ptr %.unpack189, i64 %79
  %81 = load float, ptr %80, align 4, !tbaa !3
  %82 = call contract float @llvm.fabs.f32(float %81)
  %83 = sext i32 %.0214 to i64
  %84 = add nsw i64 %83, -1
  %85 = getelementptr float, ptr %.unpack189, i64 %84
  %86 = load float, ptr %85, align 4, !tbaa !3
  %87 = call contract float @llvm.fabs.f32(float %86)
  %88 = fcmp olt float %82, %87
  %89 = trunc i64 %indvars.iv to i32
  %.1 = select i1 %88, i32 %89, i32 %.0214
  %90 = getelementptr float, ptr %.unpack189, i64 %indvars.iv
  %91 = load float, ptr %90, align 4, !tbaa !3
  %92 = call contract float @llvm.fabs.f32(float %91)
  %93 = sext i32 %.1 to i64
  %94 = add nsw i64 %93, -1
  %95 = getelementptr float, ptr %.unpack189, i64 %94
  %96 = load float, ptr %95, align 4, !tbaa !3
  %97 = call contract float @llvm.fabs.f32(float %96)
  %98 = fcmp olt float %92, %97
  %99 = trunc i64 %indvars.iv to i32
  %100 = add i32 %99, 1
  %.1.1 = select i1 %98, i32 %100, i32 %.1
  %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_edge217.loopexit.unr-lcssa, label %78

._crit_edge217.loopexit.unr-lcssa:                ; preds = %78, %.lr.ph216
  %.1.lcssa.ph = phi i32 [ undef, %.lr.ph216 ], [ %.1.1, %78 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph216 ], [ %indvars.iv.next.1, %78 ]
  %.0214.unr = phi i32 [ 1, %.lr.ph216 ], [ %.1.1, %78 ]
  %lcmp.mod228.not = icmp eq i64 %xtraiter227, 0
  br i1 %lcmp.mod228.not, label %._crit_edge217, label %._crit_edge217.loopexit.epilog-lcssa

._crit_edge217.loopexit.epilog-lcssa:             ; preds = %._crit_edge217.loopexit.unr-lcssa
  %101 = add nsw i64 %indvars.iv.unr, -1
  %102 = getelementptr float, ptr %.unpack189, i64 %101
  %103 = load float, ptr %102, align 4, !tbaa !3
  %104 = call contract float @llvm.fabs.f32(float %103)
  %105 = sext i32 %.0214.unr to i64
  %106 = add nsw i64 %105, -1
  %107 = getelementptr float, ptr %.unpack189, i64 %106
  %108 = load float, ptr %107, align 4, !tbaa !3
  %109 = call contract float @llvm.fabs.f32(float %108)
  %110 = fcmp olt float %104, %109
  %111 = trunc i64 %indvars.iv.unr to i32
  %.1.epil = select i1 %110, i32 %111, i32 %.0214.unr
  br label %._crit_edge217

._crit_edge217:                                   ; preds = %._crit_edge217.loopexit.epilog-lcssa, %._crit_edge217.loopexit.unr-lcssa, %73
  %.0.lcssa = phi i32 [ 1, %73 ], [ %.1.lcssa.ph, %._crit_edge217.loopexit.unr-lcssa ], [ %.1.epil, %._crit_edge217.loopexit.epilog-lcssa ]
  %112 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.0a0b90f9818510b9c8146397c7c58361, i32 20)
  %113 = call i1 @_FortranAioOutputInteger32(ptr %112, i32 %.0.lcssa)
  %114 = call i32 @_FortranAioEndIoStatement(ptr %112)
  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 @_FortranAioInputReal32(ptr, 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
declare void @llvm.assume(i1 noundef) #5

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) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }

!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}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
