program main
  implicit none
  integer :: M,N
  integer,allocatable :: A(:)
  integer :: i
  integer :: out, tot
  read(*,*) N, M
  allocate(A(N))
  read(*,*) A(:)
  out = 0
  tot = sum(A)
  do i = 1,N
     if (A(i) < tot/(4.e0*M) ) cycle
     out = out + 1
  end do
  if (out >= M ) then
     write(*,'(a)') 'Yes'
  else 
     write(*,'(a)') 'No'
  end if
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"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_QQcl.890093fe355a7ab0f1a79901b3b40703 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1867/source.f\00"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_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 i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.890093fe355a7ab0f1a79901b3b40703, i32 7)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i32, ptr %3, align 4, !tbaa !3
  %9 = call i32 @llvm.smax.i32(i32 %8, i32 0)
  %10 = zext i32 %9 to i64
  %11 = shl nuw nsw i64 %10, 2
  %12 = call ptr @malloc(i64 %11)
  store ptr %12, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %10, ptr @_QFEa.8, align 8, !tbaa !7
  %13 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.890093fe355a7ab0f1a79901b3b40703, i32 9)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack138.unpack.unpack140 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %14 = call i64 @llvm.smax.i64(i64 %.unpack138.unpack.unpack140, i64 0)
  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 %14, 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
  %15 = call i1 @_FortranAioInputDescriptor(ptr %13, ptr nonnull %1)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %.unpack143 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack150.unpack.unpack152 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %17 = icmp sgt i64 %.unpack150.unpack.unpack152, 0
  br i1 %17, label %.lr.ph.i.preheader, label %_FortranASumInteger4x1_contract_simplified.exit

.lr.ph.i.preheader:                               ; preds = %0
  %min.iters.check = icmp ult i64 %.unpack150.unpack.unpack152, 8
  br i1 %min.iters.check, label %.lr.ph.i.preheader192, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.i.preheader
  %n.vec = and i64 %.unpack150.unpack.unpack152, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
  %vec.phi169 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ]
  %18 = shl i64 %index, 2
  %19 = getelementptr i8, ptr %.unpack143, i64 %18
  %wide.load = load <4 x i32>, ptr %19, align 4, !tbaa !3
  %20 = getelementptr i32, ptr %19, i64 4
  %wide.load170 = load <4 x i32>, ptr %20, align 4, !tbaa !3
  %21 = add <4 x i32> %wide.load, %vec.phi
  %22 = add <4 x i32> %wide.load170, %vec.phi169
  %index.next = add nuw i64 %index, 8
  %23 = icmp eq i64 %index.next, %n.vec
  br i1 %23, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %22, %21
  %24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %.unpack150.unpack.unpack152, %n.vec
  br i1 %cmp.n, label %_FortranASumInteger4x1_contract_simplified.exit.loopexit, label %.lr.ph.i.preheader192

.lr.ph.i.preheader192:                            ; preds = %.lr.ph.i.preheader, %middle.block
  %.ph = phi i32 [ 0, %.lr.ph.i.preheader ], [ %24, %middle.block ]
  %.ph193 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader192, %.lr.ph.i
  %25 = phi i32 [ %30, %.lr.ph.i ], [ %.ph, %.lr.ph.i.preheader192 ]
  %26 = phi i64 [ %31, %.lr.ph.i ], [ %.ph193, %.lr.ph.i.preheader192 ]
  %27 = shl i64 %26, 2
  %28 = getelementptr i8, ptr %.unpack143, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !3
  %30 = add i32 %29, %25
  %31 = add nuw nsw i64 %26, 1
  %exitcond.not.i = icmp eq i64 %31, %.unpack150.unpack.unpack152
  br i1 %exitcond.not.i, label %_FortranASumInteger4x1_contract_simplified.exit.loopexit, label %.lr.ph.i, !llvm.loop !12

_FortranASumInteger4x1_contract_simplified.exit.loopexit: ; preds = %.lr.ph.i, %middle.block
  %.lcssa = phi i32 [ %24, %middle.block ], [ %30, %.lr.ph.i ]
  %32 = sitofp i32 %.lcssa to float
  br label %_FortranASumInteger4x1_contract_simplified.exit

_FortranASumInteger4x1_contract_simplified.exit:  ; preds = %_FortranASumInteger4x1_contract_simplified.exit.loopexit, %0
  %.lcssa.i = phi float [ 0.000000e+00, %0 ], [ %32, %_FortranASumInteger4x1_contract_simplified.exit.loopexit ]
  %33 = load i32, ptr %3, align 4, !tbaa !3
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph, label %_FortranASumInteger4x1_contract_simplified.exit.._crit_edge_crit_edge

_FortranASumInteger4x1_contract_simplified.exit.._crit_edge_crit_edge: ; preds = %_FortranASumInteger4x1_contract_simplified.exit
  %.pre = load i32, ptr %2, align 4, !tbaa !3
  br label %._crit_edge

.lr.ph:                                           ; preds = %_FortranASumInteger4x1_contract_simplified.exit
  %35 = zext i32 %33 to i64
  %36 = load i32, ptr %2, align 4, !tbaa !3
  %37 = sitofp i32 %36 to float
  %38 = fmul contract float %37, 4.000000e+00
  %39 = fdiv contract float %.lcssa.i, %38
  %min.iters.check173 = icmp ult i32 %33, 8
  br i1 %min.iters.check173, label %scalar.ph172.preheader, label %vector.ph174

vector.ph174:                                     ; preds = %.lr.ph
  %n.vec176 = and i64 %35, 4294967288
  %ind.end = or i64 %n.vec176, 1
  %broadcast.splatinsert = insertelement <4 x float> poison, float %39, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert185 = insertelement <4 x float> poison, float %39, i64 0
  %broadcast.splat186 = shufflevector <4 x float> %broadcast.splatinsert185, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body179

vector.body179:                                   ; preds = %vector.body179, %vector.ph174
  %index180 = phi i64 [ 0, %vector.ph174 ], [ %index.next187, %vector.body179 ]
  %vec.phi181 = phi <4 x i32> [ zeroinitializer, %vector.ph174 ], [ %48, %vector.body179 ]
  %vec.phi182 = phi <4 x i32> [ zeroinitializer, %vector.ph174 ], [ %49, %vector.body179 ]
  %40 = getelementptr i32, ptr %.unpack143, i64 %index180
  %wide.load183 = load <4 x i32>, ptr %40, align 4, !tbaa !3
  %41 = getelementptr i32, ptr %40, i64 4
  %wide.load184 = load <4 x i32>, ptr %41, align 4, !tbaa !3
  %42 = sitofp <4 x i32> %wide.load183 to <4 x float>
  %43 = sitofp <4 x i32> %wide.load184 to <4 x float>
  %44 = fcmp ule <4 x float> %broadcast.splat, %42
  %45 = fcmp ule <4 x float> %broadcast.splat186, %43
  %46 = zext <4 x i1> %44 to <4 x i32>
  %47 = zext <4 x i1> %45 to <4 x i32>
  %48 = add <4 x i32> %vec.phi181, %46
  %49 = add <4 x i32> %vec.phi182, %47
  %index.next187 = add nuw i64 %index180, 8
  %50 = icmp eq i64 %index.next187, %n.vec176
  br i1 %50, label %middle.block171, label %vector.body179, !llvm.loop !13

middle.block171:                                  ; preds = %vector.body179
  %bin.rdx188 = add <4 x i32> %49, %48
  %51 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx188)
  %cmp.n178 = icmp eq i64 %n.vec176, %35
  br i1 %cmp.n178, label %._crit_edge, label %scalar.ph172.preheader

scalar.ph172.preheader:                           ; preds = %.lr.ph, %middle.block171
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block171 ]
  %.0167.ph = phi i32 [ 0, %.lr.ph ], [ %51, %middle.block171 ]
  br label %scalar.ph172

scalar.ph172:                                     ; preds = %scalar.ph172.preheader, %scalar.ph172
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph172 ], [ %indvars.iv.ph, %scalar.ph172.preheader ]
  %.0167 = phi i32 [ %.1, %scalar.ph172 ], [ %.0167.ph, %scalar.ph172.preheader ]
  %52 = add i64 %indvars.iv, -1
  %53 = getelementptr i32, ptr %.unpack143, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !3
  %55 = sitofp i32 %54 to float
  %56 = fcmp ule float %39, %55
  %57 = zext i1 %56 to i32
  %.1 = add i32 %.0167, %57
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %35
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph172, !llvm.loop !14

._crit_edge:                                      ; preds = %scalar.ph172, %middle.block171, %_FortranASumInteger4x1_contract_simplified.exit.._crit_edge_crit_edge
  %58 = phi i32 [ %.pre, %_FortranASumInteger4x1_contract_simplified.exit.._crit_edge_crit_edge ], [ %36, %middle.block171 ], [ %36, %scalar.ph172 ]
  %.0.lcssa = phi i32 [ 0, %_FortranASumInteger4x1_contract_simplified.exit.._crit_edge_crit_edge ], [ %51, %middle.block171 ], [ %.1, %scalar.ph172 ]
  %.not = icmp slt i32 %.0.lcssa, %58
  br i1 %.not, label %62, label %59

59:                                               ; preds = %._crit_edge
  %60 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.890093fe355a7ab0f1a79901b3b40703, i32 17)
  %61 = call i1 @_FortranAioOutputAscii(ptr %60, ptr nonnull @_QQcl.596573, i64 3)
  br label %65

62:                                               ; preds = %._crit_edge
  %63 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.890093fe355a7ab0f1a79901b3b40703, i32 19)
  %64 = call i1 @_FortranAioOutputAscii(ptr %63, ptr nonnull @_QQcl.4E6F, i64 2)
  br label %65

65:                                               ; preds = %59, %62
  %.sink = phi ptr [ %60, %59 ], [ %63, %62 ]
  %66 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  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 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind 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}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
!13 = distinct !{!13, !10, !11}
!14 = distinct !{!14, !11, !10}
