program sample
implicit none
integer(8) N,M,A(10**5),B(10**5),i,count1
integer(16) H(10**5),H2(10**5)
read(*,*) N,M
read(*,*)(H(i),i=1,N)
do i=1,M
read(*,*)A(i),B(i)
end do
do i=1,N
H2(i)=H(i)
end do
do i=1,M
if (H(A(i))<=H(B(i))) then
    H2(A(i))=0
end if
if (H(A(i))>=H(B(i))) then
    H2(B(i))=0
end if
end do
count1=0
do i=1,N
if (H2(i).ne.0) then
count1=count1+1
end if
end do
write(*,*) count1
stop
end program sample
; 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 [100000 x i64] undef
@_QFEb = internal global [100000 x i64] undef
@_QFEh = internal global [100000 x i128] undef
@_QFEh2 = internal unnamed_addr global [100000 x i128] undef
@_QQcl.b6f51d56637cbe1a727b820b3105ef5e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1508/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.b6f51d56637cbe1a727b820b3105ef5e, i32 5)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.b6f51d56637cbe1a727b820b3105ef5e, i32 6)
  %8 = load i64, ptr %2, align 8, !tbaa !3
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %10 = phi i64 [ %14, %.lr.ph ], [ 1, %0 ]
  %11 = add nsw i64 %10, -1
  %12 = getelementptr [100000 x i128], ptr @_QFEh, i64 0, i64 %11
  %13 = call i1 @_FortranAioInputInteger(ptr %7, ptr %12, i32 16)
  %14 = add nuw i64 %10, 1
  %exitcond.not = icmp eq i64 %10, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %15 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %16 = load i64, ptr %1, align 8, !tbaa !3
  %17 = icmp sgt i64 %16, 0
  br i1 %17, label %.lr.ph23, label %._crit_edge24

.lr.ph23:                                         ; preds = %._crit_edge, %.lr.ph23
  %18 = phi i64 [ %26, %.lr.ph23 ], [ 1, %._crit_edge ]
  %19 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.b6f51d56637cbe1a727b820b3105ef5e, i32 8)
  %20 = add nsw i64 %18, -1
  %21 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %20
  %22 = call i1 @_FortranAioInputInteger(ptr %19, ptr %21, i32 8)
  %23 = getelementptr [100000 x i64], ptr @_QFEb, i64 0, i64 %20
  %24 = call i1 @_FortranAioInputInteger(ptr %19, ptr %23, i32 8)
  %25 = call i32 @_FortranAioEndIoStatement(ptr %19)
  %26 = add nuw i64 %18, 1
  %exitcond33.not = icmp eq i64 %18, %16
  br i1 %exitcond33.not, label %._crit_edge24, label %.lr.ph23

._crit_edge24:                                    ; preds = %.lr.ph23, %._crit_edge
  %27 = load i64, ptr %2, align 8, !tbaa !3
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %.lr.ph26.preheader, label %._crit_edge27

.lr.ph26.preheader:                               ; preds = %._crit_edge24
  %29 = shl nuw i64 %27, 4
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @_QFEh2, ptr nonnull align 16 @_QFEh, i64 %29, i1 false), !tbaa !3
  br label %._crit_edge27

._crit_edge27:                                    ; preds = %.lr.ph26.preheader, %._crit_edge24
  %30 = load i64, ptr %1, align 8, !tbaa !3
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %.lr.ph29, label %.preheader

.preheader:                                       ; preds = %50, %._crit_edge27
  br i1 %28, label %.lr.ph31.preheader, label %._crit_edge32

.lr.ph31.preheader:                               ; preds = %.preheader
  %xtraiter = and i64 %27, 1
  %32 = icmp eq i64 %27, 1
  br i1 %32, label %._crit_edge32.loopexit.unr-lcssa, label %.lr.ph31.preheader.new

.lr.ph31.preheader.new:                           ; preds = %.lr.ph31.preheader
  %unroll_iter = and i64 %27, -2
  br label %.lr.ph31

.lr.ph29:                                         ; preds = %._crit_edge27, %50
  %33 = phi i64 [ %51, %50 ], [ 1, %._crit_edge27 ]
  %34 = add nsw i64 %33, -1
  %35 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !3
  %37 = add i64 %36, -1
  %38 = getelementptr [100000 x i128], ptr @_QFEh, i64 0, i64 %37
  %39 = load i128, ptr %38, align 16, !tbaa !3
  %40 = getelementptr [100000 x i64], ptr @_QFEb, i64 0, i64 %34
  %41 = load i64, ptr %40, align 8, !tbaa !3
  %42 = add i64 %41, -1
  %43 = getelementptr [100000 x i128], ptr @_QFEh, i64 0, i64 %42
  %44 = load i128, ptr %43, align 16, !tbaa !3
  %.not20 = icmp sgt i128 %39, %44
  br i1 %.not20, label %47, label %45

45:                                               ; preds = %.lr.ph29
  %46 = getelementptr [100000 x i128], ptr @_QFEh2, i64 0, i64 %37
  store i128 0, ptr %46, align 16, !tbaa !3
  br label %47

47:                                               ; preds = %45, %.lr.ph29
  %.not21 = icmp slt i128 %39, %44
  br i1 %.not21, label %50, label %48

48:                                               ; preds = %47
  %49 = getelementptr [100000 x i128], ptr @_QFEh2, i64 0, i64 %42
  store i128 0, ptr %49, align 16, !tbaa !3
  br label %50

50:                                               ; preds = %48, %47
  %51 = add nuw i64 %33, 1
  %exitcond34.not = icmp eq i64 %33, %30
  br i1 %exitcond34.not, label %.preheader, label %.lr.ph29

.lr.ph31:                                         ; preds = %.lr.ph31, %.lr.ph31.preheader.new
  %52 = phi i64 [ 1, %.lr.ph31.preheader.new ], [ %60, %.lr.ph31 ]
  %.030 = phi i64 [ 0, %.lr.ph31.preheader.new ], [ %spec.select.1, %.lr.ph31 ]
  %niter = phi i64 [ 0, %.lr.ph31.preheader.new ], [ %niter.next.1, %.lr.ph31 ]
  %53 = add nsw i64 %52, -1
  %54 = getelementptr [100000 x i128], ptr @_QFEh2, i64 0, i64 %53
  %55 = load i128, ptr %54, align 16, !tbaa !3
  %.not = icmp ne i128 %55, 0
  %56 = zext i1 %.not to i64
  %spec.select = add i64 %.030, %56
  %57 = getelementptr [100000 x i128], ptr @_QFEh2, i64 0, i64 %52
  %58 = load i128, ptr %57, align 16, !tbaa !3
  %.not.1 = icmp ne i128 %58, 0
  %59 = zext i1 %.not.1 to i64
  %spec.select.1 = add i64 %spec.select, %59
  %60 = add nuw i64 %52, 2
  %niter.next.1 = add nuw i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge32.loopexit.unr-lcssa.loopexit, label %.lr.ph31

._crit_edge32.loopexit.unr-lcssa.loopexit:        ; preds = %.lr.ph31
  %61 = add i64 %52, 1
  br label %._crit_edge32.loopexit.unr-lcssa

._crit_edge32.loopexit.unr-lcssa:                 ; preds = %._crit_edge32.loopexit.unr-lcssa.loopexit, %.lr.ph31.preheader
  %spec.select.lcssa.ph = phi i64 [ undef, %.lr.ph31.preheader ], [ %spec.select.1, %._crit_edge32.loopexit.unr-lcssa.loopexit ]
  %.unr = phi i64 [ 0, %.lr.ph31.preheader ], [ %61, %._crit_edge32.loopexit.unr-lcssa.loopexit ]
  %.030.unr = phi i64 [ 0, %.lr.ph31.preheader ], [ %spec.select.1, %._crit_edge32.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge32, label %.lr.ph31.epil

.lr.ph31.epil:                                    ; preds = %._crit_edge32.loopexit.unr-lcssa
  %62 = getelementptr [100000 x i128], ptr @_QFEh2, i64 0, i64 %.unr
  %63 = load i128, ptr %62, align 16, !tbaa !3
  %.not.epil = icmp ne i128 %63, 0
  %64 = zext i1 %.not.epil to i64
  %spec.select.epil = add i64 %.030.unr, %64
  br label %._crit_edge32

._crit_edge32:                                    ; preds = %.lr.ph31.epil, %._crit_edge32.loopexit.unr-lcssa, %.preheader
  %.0.lcssa = phi i64 [ 0, %.preheader ], [ %spec.select.lcssa.ph, %._crit_edge32.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph31.epil ]
  %65 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.b6f51d56637cbe1a727b820b3105ef5e, i32 27)
  %66 = call i1 @_FortranAioOutputInteger64(ptr %65, i64 %.0.lcssa)
  %67 = call i32 @_FortranAioEndIoStatement(ptr %65)
  %68 = 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 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

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

; 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) #1

attributes #0 = { noreturn }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: 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"}
