 program sample1
      implicit none
      
      integer N,M,A(1000),i,S,count
      read(*,*) N,M
      read(*,*) (A(i),i=1,N)
      count=0
      S=0
      do i=1,N
         S=A(i)+S
      end do
      do i=1,N   
         if (A(i)>=S/4.0/M) then
            count=count+1
         end if
      end do
      if (count>=M) then
          write(*,*) "Yes"
      else
          write(*,*)"No"
      end if
      
      stop 
      end program sample1



; 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 = internal global [1000 x i32] undef
@_QQcl.e121bf0194f18aa7ee4ae262d1fe598e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1875/source.f\00"
@_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: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e121bf0194f18aa7ee4ae262d1fe598e, i32 5)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e121bf0194f18aa7ee4ae262d1fe598e, i32 6)
  %8 = load i32, ptr %2, align 4, !tbaa !3
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %10 = zext i32 %8 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %11 = phi i64 [ %16, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %sext = shl i64 %11, 32
  %12 = ashr exact i64 %sext, 32
  %13 = add nsw i64 %12, -1
  %14 = getelementptr [1000 x i32], ptr @_QFEa, i64 0, i64 %13
  %15 = call i1 @_FortranAioInputInteger(ptr %7, ptr %14, i32 4)
  %16 = add nuw nsw i64 %11, 1
  %exitcond.not = icmp eq i64 %11, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %17 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %18 = load i32, ptr %2, align 4, !tbaa !3
  %19 = sext i32 %18 to i64
  %20 = icmp sgt i32 %18, 0
  br i1 %20, label %.lr.ph15.preheader, label %.preheader.._crit_edge18_crit_edge

.lr.ph15.preheader:                               ; preds = %._crit_edge
  %min.iters.check = icmp ult i32 %18, 8
  br i1 %min.iters.check, label %.lr.ph15.preheader55, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph15.preheader
  %n.vec = and i64 %19, -8
  %ind.end = or i64 %n.vec, 1
  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 ], [ %23, %vector.body ]
  %vec.phi30 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
  %21 = getelementptr [1000 x i32], ptr @_QFEa, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %21, align 16, !tbaa !3
  %22 = getelementptr i32, ptr %21, i64 4
  %wide.load31 = load <4 x i32>, ptr %22, align 16, !tbaa !3
  %23 = add <4 x i32> %wide.load, %vec.phi
  %24 = add <4 x i32> %wide.load31, %vec.phi30
  %index.next = add nuw i64 %index, 8
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %24, %23
  %26 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %19
  br i1 %cmp.n, label %.preheader, label %.lr.ph15.preheader55

.lr.ph15.preheader55:                             ; preds = %.lr.ph15.preheader, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph15.preheader ], [ %ind.end, %middle.block ]
  %.013.ph = phi i32 [ 0, %.lr.ph15.preheader ], [ %26, %middle.block ]
  br label %.lr.ph15

.preheader:                                       ; preds = %.lr.ph15, %middle.block
  %.lcssa = phi i32 [ %26, %middle.block ], [ %47, %.lr.ph15 ]
  br i1 %20, label %.lr.ph17, label %.preheader.._crit_edge18_crit_edge

.preheader.._crit_edge18_crit_edge:               ; preds = %._crit_edge, %.preheader
  %.pre = load i32, ptr %1, align 4, !tbaa !3
  br label %._crit_edge18

.lr.ph17:                                         ; preds = %.preheader
  %27 = sitofp i32 %.lcssa to float
  %28 = fmul contract float %27, 2.500000e-01
  %29 = load i32, ptr %1, align 4, !tbaa !3
  %30 = sitofp i32 %29 to float
  %31 = fdiv contract float %28, %30
  %min.iters.check34 = icmp ult i32 %18, 8
  br i1 %min.iters.check34, label %scalar.ph33.preheader, label %vector.ph35

vector.ph35:                                      ; preds = %.lr.ph17
  %n.vec37 = and i64 %19, -8
  %ind.end38 = or i64 %n.vec37, 1
  %broadcast.splatinsert = insertelement <4 x float> poison, float %31, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert48 = insertelement <4 x float> poison, float %31, i64 0
  %broadcast.splat49 = shufflevector <4 x float> %broadcast.splatinsert48, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body41

vector.body41:                                    ; preds = %vector.body41, %vector.ph35
  %index42 = phi i64 [ 0, %vector.ph35 ], [ %index.next50, %vector.body41 ]
  %vec.phi43 = phi <4 x i32> [ zeroinitializer, %vector.ph35 ], [ %40, %vector.body41 ]
  %vec.phi44 = phi <4 x i32> [ zeroinitializer, %vector.ph35 ], [ %41, %vector.body41 ]
  %32 = getelementptr [1000 x i32], ptr @_QFEa, i64 0, i64 %index42
  %wide.load46 = load <4 x i32>, ptr %32, align 16, !tbaa !3
  %33 = getelementptr i32, ptr %32, i64 4
  %wide.load47 = load <4 x i32>, ptr %33, align 16, !tbaa !3
  %34 = sitofp <4 x i32> %wide.load46 to <4 x float>
  %35 = sitofp <4 x i32> %wide.load47 to <4 x float>
  %36 = fcmp ole <4 x float> %broadcast.splat, %34
  %37 = fcmp ole <4 x float> %broadcast.splat49, %35
  %38 = zext <4 x i1> %36 to <4 x i32>
  %39 = zext <4 x i1> %37 to <4 x i32>
  %40 = add <4 x i32> %vec.phi43, %38
  %41 = add <4 x i32> %vec.phi44, %39
  %index.next50 = add nuw i64 %index42, 8
  %42 = icmp eq i64 %index.next50, %n.vec37
  br i1 %42, label %middle.block32, label %vector.body41, !llvm.loop !10

middle.block32:                                   ; preds = %vector.body41
  %bin.rdx51 = add <4 x i32> %41, %40
  %43 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx51)
  %cmp.n40 = icmp eq i64 %n.vec37, %19
  br i1 %cmp.n40, label %._crit_edge18, label %scalar.ph33.preheader

scalar.ph33.preheader:                            ; preds = %.lr.ph17, %middle.block32
  %indvars.iv22.ph = phi i64 [ 1, %.lr.ph17 ], [ %ind.end38, %middle.block32 ]
  %.0916.ph = phi i32 [ 0, %.lr.ph17 ], [ %43, %middle.block32 ]
  br label %scalar.ph33

.lr.ph15:                                         ; preds = %.lr.ph15.preheader55, %.lr.ph15
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph15 ], [ %indvars.iv.ph, %.lr.ph15.preheader55 ]
  %.013 = phi i32 [ %47, %.lr.ph15 ], [ %.013.ph, %.lr.ph15.preheader55 ]
  %44 = add nsw i64 %indvars.iv, -1
  %45 = getelementptr [1000 x i32], ptr @_QFEa, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !3
  %47 = add i32 %46, %.013
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond21.not = icmp eq i64 %indvars.iv, %19
  br i1 %exitcond21.not, label %.preheader, label %.lr.ph15, !llvm.loop !11

scalar.ph33:                                      ; preds = %scalar.ph33.preheader, %scalar.ph33
  %indvars.iv22 = phi i64 [ %indvars.iv.next23, %scalar.ph33 ], [ %indvars.iv22.ph, %scalar.ph33.preheader ]
  %.0916 = phi i32 [ %.1, %scalar.ph33 ], [ %.0916.ph, %scalar.ph33.preheader ]
  %48 = add nsw i64 %indvars.iv22, -1
  %49 = getelementptr [1000 x i32], ptr @_QFEa, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !3
  %51 = sitofp i32 %50 to float
  %52 = fcmp ole float %31, %51
  %53 = zext i1 %52 to i32
  %.1 = add i32 %.0916, %53
  %indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
  %exitcond25.not = icmp eq i64 %indvars.iv22, %19
  br i1 %exitcond25.not, label %._crit_edge18, label %scalar.ph33, !llvm.loop !12

._crit_edge18:                                    ; preds = %scalar.ph33, %middle.block32, %.preheader.._crit_edge18_crit_edge
  %54 = phi i32 [ %.pre, %.preheader.._crit_edge18_crit_edge ], [ %29, %middle.block32 ], [ %29, %scalar.ph33 ]
  %.09.lcssa = phi i32 [ 0, %.preheader.._crit_edge18_crit_edge ], [ %43, %middle.block32 ], [ %.1, %scalar.ph33 ]
  %.not = icmp slt i32 %.09.lcssa, %54
  %. = select i1 %.not, i32 20, i32 18
  %.29 = select i1 %.not, i64 2, i64 3
  %_QQcl.4E6F._QQcl.596573 = select i1 %.not, ptr @_QQcl.4E6F, ptr @_QQcl.596573
  %55 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e121bf0194f18aa7ee4ae262d1fe598e, i32 %.)
  %56 = call i1 @_FortranAioOutputAscii(ptr %55, ptr nonnull %_QQcl.4E6F._QQcl.596573, i64 %.29)
  %57 = call i32 @_FortranAioEndIoStatement(ptr %55)
  %58 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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 ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

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

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