program test 
implicit none
integer::n,k,d,i,j,ans
integer,allocatable::a(:),e(:)
read*,n,k
allocate(a(n))
allocate(e(n))
a=0
ans=0
do i=1,k
	e=0
	read*,d
   	read(5,*)(e(j),j=1,d)
    do j=1,d
        a(e(j))=a(e(j))+1
    end do
end do
do i=1,n
	if(a(i)==0)then
    	ans=ans+1
    else 
    	ans=ans
 	end if
end do
print*,ans
end program test
; 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.7 = internal unnamed_addr global i64 1
@_QFEe.0 = internal unnamed_addr global ptr null
@_QFEe.7 = internal unnamed_addr global i64 1
@_QFEe.8 = internal unnamed_addr global i64 0
@_QQcl.390da62b1979bf5b94cf97c142ffa456 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1489/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\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 i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.390da62b1979bf5b94cf97c142ffa456, i32 5)
  %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 1, ptr @_QFEa.7, align 8, !tbaa !7
  %13 = call ptr @malloc(i64 %11)
  store ptr %13, ptr @_QFEe.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEe.7, align 8, !tbaa !7
  store i64 %10, ptr @_QFEe.8, align 8, !tbaa !7
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %16, label %.preheader438

.preheader438:                                    ; preds = %0
  %.not452 = icmp slt i32 %8, 1
  br i1 %.not452, label %.loopexit439, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader438
  %14 = call i64 @llvm.smax.i64(i64 %10, i64 1)
  %15 = shl nuw nsw i64 %14, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %12, i8 0, i64 %15, i1 false), !tbaa !3
  br label %.loopexit439

16:                                               ; preds = %0
  %17 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.390da62b1979bf5b94cf97c142ffa456, i32 8)
  %.unpack423.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %18 = icmp slt i32 %8, 1
  %19 = select i1 %18, i64 1, i64 %.unpack423.unpack.unpack
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %19, ptr @_QFEa.7, align 8, !tbaa !7
  br label %.loopexit439

.loopexit439:                                     ; preds = %.lr.ph.preheader, %.preheader438, %16
  %20 = load i32, ptr %2, align 4, !tbaa !3
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph446.preheader, label %._crit_edge447

.lr.ph446.preheader:                              ; preds = %.loopexit439
  %22 = zext i32 %20 to i64
  br label %.lr.ph446

.lr.ph446:                                        ; preds = %.lr.ph446.preheader, %._crit_edge444
  %23 = phi i64 [ %73, %._crit_edge444 ], [ %22, %.lr.ph446.preheader ]
  %.unpack346 = load ptr, ptr @_QFEe.0, align 8, !tbaa !7
  %.unpack353.unpack.unpack355 = load i64, ptr @_QFEe.8, align 8, !tbaa !7
  %.not358 = icmp eq ptr %.unpack346, null
  br i1 %.not358, label %26, label %.preheader

.preheader:                                       ; preds = %.lr.ph446
  %24 = icmp sgt i64 %.unpack353.unpack.unpack355, 0
  br i1 %24, label %.lr.ph440.preheader, label %.loopexit

.lr.ph440.preheader:                              ; preds = %.preheader
  %25 = shl nuw i64 %.unpack353.unpack.unpack355, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %.unpack346, i8 0, i64 %25, i1 false), !tbaa !3
  br label %.loopexit

26:                                               ; preds = %.lr.ph446
  %27 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.390da62b1979bf5b94cf97c142ffa456, i32 11)
  %.unpack402.unpack.unpack = load i64, ptr @_QFEe.7, align 8, !tbaa !7
  %28 = icmp eq i64 %.unpack353.unpack.unpack355, 0
  %29 = select i1 %28, i64 1, i64 %.unpack402.unpack.unpack
  store ptr null, ptr @_QFEe.0, align 8, !tbaa !7
  store i64 %29, ptr @_QFEe.7, align 8, !tbaa !7
  store i64 %.unpack353.unpack.unpack355, ptr @_QFEe.8, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph440.preheader, %.preheader, %26
  %30 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.390da62b1979bf5b94cf97c142ffa456, i32 12)
  %31 = call i1 @_FortranAioInputInteger(ptr %30, ptr nonnull %1, i32 4)
  %32 = call i32 @_FortranAioEndIoStatement(ptr %30)
  %33 = call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.390da62b1979bf5b94cf97c142ffa456, i32 13)
  %34 = load i32, ptr %1, align 4, !tbaa !3
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph441.preheader, label %._crit_edge

.lr.ph441.preheader:                              ; preds = %.loopexit
  %36 = zext i32 %34 to i64
  br label %.lr.ph441

.lr.ph441:                                        ; preds = %.lr.ph441.preheader, %.lr.ph441
  %37 = phi i64 [ %42, %.lr.ph441 ], [ 1, %.lr.ph441.preheader ]
  %.unpack383 = load ptr, ptr @_QFEe.0, align 8, !tbaa !7
  %.unpack390.unpack.unpack = load i64, ptr @_QFEe.7, align 8, !tbaa !7
  %sext = shl i64 %37, 32
  %38 = ashr exact i64 %sext, 32
  %39 = sub i64 %38, %.unpack390.unpack.unpack
  %40 = getelementptr i32, ptr %.unpack383, i64 %39
  %41 = call i1 @_FortranAioInputInteger(ptr %33, ptr %40, i32 4)
  %42 = add nuw nsw i64 %37, 1
  %exitcond.not = icmp eq i64 %37, %36
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph441

._crit_edge:                                      ; preds = %.lr.ph441, %.loopexit
  %43 = call i32 @_FortranAioEndIoStatement(ptr %33)
  %44 = load i32, ptr %1, align 4, !tbaa !3
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph443, label %._crit_edge444

.lr.ph443:                                        ; preds = %._crit_edge
  %46 = zext i32 %44 to i64
  %.unpack359 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack366.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %.unpack371 = load ptr, ptr @_QFEe.0, align 8, !tbaa !7
  %.unpack378.unpack.unpack = load i64, ptr @_QFEe.7, align 8, !tbaa !7
  %xtraiter = and i64 %46, 1
  %47 = icmp eq i32 %44, 1
  br i1 %47, label %._crit_edge444.loopexit.unr-lcssa, label %.lr.ph443.new

.lr.ph443.new:                                    ; preds = %.lr.ph443
  %unroll_iter = and i64 %46, 4294967294
  br label %48

48:                                               ; preds = %48, %.lr.ph443.new
  %indvars.iv = phi i64 [ 1, %.lr.ph443.new ], [ %indvars.iv.next.1, %48 ]
  %niter = phi i64 [ 0, %.lr.ph443.new ], [ %niter.next.1, %48 ]
  %49 = sub i64 %indvars.iv, %.unpack378.unpack.unpack
  %50 = getelementptr i32, ptr %.unpack371, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !3
  %52 = sext i32 %51 to i64
  %53 = sub i64 %52, %.unpack366.unpack.unpack
  %54 = getelementptr i32, ptr %.unpack359, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = add i32 %55, 1
  store i32 %56, ptr %54, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %57 = sub i64 %indvars.iv.next, %.unpack378.unpack.unpack
  %58 = getelementptr i32, ptr %.unpack371, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !3
  %60 = sext i32 %59 to i64
  %61 = sub i64 %60, %.unpack366.unpack.unpack
  %62 = getelementptr i32, ptr %.unpack359, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !3
  %64 = add i32 %63, 1
  store i32 %64, ptr %62, align 4, !tbaa !3
  %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_edge444.loopexit.unr-lcssa, label %48

._crit_edge444.loopexit.unr-lcssa:                ; preds = %48, %.lr.ph443
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph443 ], [ %indvars.iv.next.1, %48 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge444, label %._crit_edge444.loopexit.epilog-lcssa

._crit_edge444.loopexit.epilog-lcssa:             ; preds = %._crit_edge444.loopexit.unr-lcssa
  %65 = sub i64 %indvars.iv.unr, %.unpack378.unpack.unpack
  %66 = getelementptr i32, ptr %.unpack371, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !3
  %68 = sext i32 %67 to i64
  %69 = sub i64 %68, %.unpack366.unpack.unpack
  %70 = getelementptr i32, ptr %.unpack359, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !3
  %72 = add i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !3
  br label %._crit_edge444

._crit_edge444:                                   ; preds = %._crit_edge444.loopexit.epilog-lcssa, %._crit_edge444.loopexit.unr-lcssa, %._crit_edge
  %73 = add nsw i64 %23, -1
  %74 = icmp sgt i64 %23, 1
  br i1 %74, label %.lr.ph446, label %._crit_edge447

._crit_edge447:                                   ; preds = %._crit_edge444, %.loopexit439
  %75 = load i32, ptr %3, align 4, !tbaa !3
  %76 = icmp sgt i32 %75, 0
  br i1 %76, label %.lr.ph450, label %._crit_edge451

.lr.ph450:                                        ; preds = %._crit_edge447
  %77 = zext i32 %75 to i64
  %.unpack334 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack341.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %min.iters.check = icmp ult i32 %75, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph450
  %n.vec = and i64 %77, 4294967288
  %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 ], [ %85, %vector.body ]
  %vec.phi459 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %86, %vector.body ]
  %offset.idx = or i64 %index, 1
  %78 = sub i64 %offset.idx, %.unpack341.unpack.unpack
  %79 = getelementptr i32, ptr %.unpack334, i64 %78
  %wide.load = load <4 x i32>, ptr %79, align 4, !tbaa !3
  %80 = getelementptr i32, ptr %79, i64 4
  %wide.load460 = load <4 x i32>, ptr %80, align 4, !tbaa !3
  %81 = icmp eq <4 x i32> %wide.load, zeroinitializer
  %82 = icmp eq <4 x i32> %wide.load460, zeroinitializer
  %83 = zext <4 x i1> %81 to <4 x i32>
  %84 = zext <4 x i1> %82 to <4 x i32>
  %85 = add <4 x i32> %vec.phi, %83
  %86 = add <4 x i32> %vec.phi459, %84
  %index.next = add nuw i64 %index, 8
  %87 = icmp eq i64 %index.next, %n.vec
  br i1 %87, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %86, %85
  %88 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %77
  br i1 %cmp.n, label %._crit_edge451, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph450, %middle.block
  %indvars.iv455.ph = phi i64 [ 1, %.lr.ph450 ], [ %ind.end, %middle.block ]
  %.0448.ph = phi i32 [ 0, %.lr.ph450 ], [ %88, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv455 = phi i64 [ %indvars.iv.next456, %scalar.ph ], [ %indvars.iv455.ph, %scalar.ph.preheader ]
  %.0448 = phi i32 [ %.1, %scalar.ph ], [ %.0448.ph, %scalar.ph.preheader ]
  %89 = sub i64 %indvars.iv455, %.unpack341.unpack.unpack
  %90 = getelementptr i32, ptr %.unpack334, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !3
  %92 = icmp eq i32 %91, 0
  %93 = zext i1 %92 to i32
  %.1 = add i32 %.0448, %93
  %indvars.iv.next456 = add nuw nsw i64 %indvars.iv455, 1
  %exitcond458.not = icmp eq i64 %indvars.iv455, %77
  br i1 %exitcond458.not, label %._crit_edge451, label %scalar.ph, !llvm.loop !12

._crit_edge451:                                   ; preds = %scalar.ph, %middle.block, %._crit_edge447
  %.0.lcssa = phi i32 [ 0, %._crit_edge447 ], [ %88, %middle.block ], [ %.1, %scalar.ph ]
  %94 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.390da62b1979bf5b94cf97c142ffa456, i32 25)
  %95 = call i1 @_FortranAioOutputInteger32(ptr %94, i32 %.0.lcssa)
  %96 = call i32 @_FortranAioEndIoStatement(ptr %94)
  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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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) }
attributes #3 = { 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}
