program main
   implicit none
   integer n,a,b
   integer dat(3)
   integer,allocatable,dimension(:)::p
   integer i
   read(*,*)n
   read(*,*)a,b
   allocate(p(n))
   read(*,*)p
   dat=0
   do i=1,n
      if(p(i)<=a)dat(1)=dat(1)+1
            if(p(i)>a .and. p(i)<=b)dat(2)=dat(2)+1
                  if(p(i)>b)dat(3)=dat(3)+1
   enddo
   write(*,*)minval(dat)
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"

@_QFEp.0 = internal unnamed_addr global ptr null
@_QFEp.8 = internal unnamed_addr global i64 0
@_QQcl.d62cfee7f3ab6fd8395aeef25f85a9e1 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5141/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 { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [3 x i32], align 4
  %6 = alloca i32, align 4
  %7 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d62cfee7f3ab6fd8395aeef25f85a9e1, i32 7)
  %8 = call i1 @_FortranAioInputInteger(ptr %7, ptr nonnull %6, i32 4)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d62cfee7f3ab6fd8395aeef25f85a9e1, i32 8)
  %11 = call i1 @_FortranAioInputInteger(ptr %10, ptr nonnull %3, i32 4)
  %12 = call i1 @_FortranAioInputInteger(ptr %10, ptr nonnull %4, i32 4)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %14 = load i32, ptr %6, align 4, !tbaa !3
  %15 = call i32 @llvm.smax.i32(i32 %14, i32 0)
  %16 = zext i32 %15 to i64
  %17 = shl nuw nsw i64 %16, 2
  %18 = call ptr @malloc(i64 %17)
  store ptr %18, ptr @_QFEp.0, align 8, !tbaa !7
  store i64 %16, ptr @_QFEp.8, align 8, !tbaa !7
  %19 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d62cfee7f3ab6fd8395aeef25f85a9e1, i32 10)
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %.unpack167.unpack.unpack169 = load i64, ptr @_QFEp.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, 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 %2, 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 %2, 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 %2, 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 %2, 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 %2, 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 %2, 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 %2, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack167.unpack.unpack169, 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 %2, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %20 = call i1 @_FortranAioInputDescriptor(ptr %19, ptr nonnull %2)
  %21 = call i32 @_FortranAioEndIoStatement(ptr %19)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, i8 0, i64 12, i1 false), !tbaa !3
  %22 = load i32, ptr %6, align 4, !tbaa !3
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %24 = zext i32 %22 to i64
  %.unpack172 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %25 = load i32, ptr %3, align 4, !tbaa !3
  %26 = load i32, ptr %4, align 4, !tbaa !3
  %27 = getelementptr inbounds [3 x i32], ptr %5, i64 0, i64 1
  %28 = getelementptr inbounds [3 x i32], ptr %5, i64 0, i64 2
  br label %29

29:                                               ; preds = %.lr.ph, %52
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %52 ]
  %30 = phi i32 [ 0, %.lr.ph ], [ %53, %52 ]
  %31 = phi i32 [ 0, %.lr.ph ], [ %48, %52 ]
  %32 = phi i32 [ 0, %.lr.ph ], [ %40, %52 ]
  %33 = add nsw i64 %indvars.iv, -1
  %34 = getelementptr i32, ptr %.unpack172, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !3
  %.not = icmp sgt i32 %35, %25
  br i1 %.not, label %38, label %36

36:                                               ; preds = %29
  %37 = add i32 %32, 1
  store i32 %37, ptr %5, align 4, !tbaa !3
  %.pre = load i32, ptr %34, align 4, !tbaa !3
  br label %38

38:                                               ; preds = %36, %29
  %39 = phi i32 [ %.pre, %36 ], [ %35, %29 ]
  %40 = phi i32 [ %37, %36 ], [ %32, %29 ]
  %41 = icmp sgt i32 %39, %25
  %42 = icmp sle i32 %39, %26
  %43 = and i1 %41, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %38
  %45 = add i32 %31, 1
  store i32 %45, ptr %27, align 4, !tbaa !3
  %.pre211 = load i32, ptr %34, align 4, !tbaa !3
  br label %46

46:                                               ; preds = %44, %38
  %47 = phi i32 [ %.pre211, %44 ], [ %39, %38 ]
  %48 = phi i32 [ %45, %44 ], [ %31, %38 ]
  %49 = icmp sgt i32 %47, %26
  br i1 %49, label %50, label %52

50:                                               ; preds = %46
  %51 = add i32 %30, 1
  store i32 %51, ptr %28, align 4, !tbaa !3
  br label %52

52:                                               ; preds = %50, %46
  %53 = phi i32 [ %51, %50 ], [ %30, %46 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %24
  br i1 %exitcond.not, label %._crit_edge, label %29

._crit_edge:                                      ; preds = %52, %0
  %54 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.d62cfee7f3ab6fd8395aeef25f85a9e1, i32 17)
  store ptr %5, ptr %1, align 8, !tbaa !7
  %.fca.1.gep44 = 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.gep44, align 8, !tbaa !7
  %.fca.2.gep46 = 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.gep46, align 8, !tbaa !7
  %.fca.3.gep48 = 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.gep48, align 4, !tbaa !7
  %.fca.4.gep50 = 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.gep50, align 1, !tbaa !7
  %.fca.5.gep52 = 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.gep52, align 2, !tbaa !7
  %.fca.6.gep54 = 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.gep54, align 1, !tbaa !7
  %.fca.7.0.0.gep56 = 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.gep56, align 8, !tbaa !7
  %.fca.7.0.1.gep58 = 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 3, ptr %.fca.7.0.1.gep58, align 8, !tbaa !7
  %.fca.7.0.2.gep60 = 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.gep60, align 8, !tbaa !7
  %55 = call i32 @_FortranAMinvalInteger4(ptr nonnull %1, ptr nonnull @_QQcl.d62cfee7f3ab6fd8395aeef25f85a9e1, i32 17, i32 0, ptr null)
  %56 = call i1 @_FortranAioOutputInteger32(ptr %54, i32 %55)
  %57 = call i32 @_FortranAioEndIoStatement(ptr %54)
  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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }

!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}
