program test03
 implicit none
 integer N, M
 integer i
 integer,allocatable :: AC(:)
 integer,allocatable :: WA(:)
 integer Nnum
 character Nkek*2
 integer :: allAC=0, allWA=0


 read *, N, M
 allocate(AC(N))
 allocate(WA(N))
 AC=0; WA=0

 do i=1,M
  read *, Nnum, Nkek
  if ( Nkek == 'AC' ) then
   AC(Nnum)=1
  else
   if ( AC(Nnum) == 0 ) then
   WA(Nnum)=WA(Nnum)+1
   end if
  end if
 end do

 do i=1,N
  allAC=allAC+AC(i)
  if ( AC(i) == 1 ) then
   allWA=allWA+WA(i)
  end if
 end do

 print '(i0,A,i0)', allAC, ' ',allWA

endprogram test03

; 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"

@_QFEac.0 = internal unnamed_addr global ptr null
@_QFEac.7 = internal unnamed_addr global i64 1
@_QFEallac = internal unnamed_addr global i32 0
@_QFEallwa = internal unnamed_addr global i32 0
@_QFEwa.0 = internal unnamed_addr global ptr null
@_QFEwa.7 = internal unnamed_addr global i64 1
@_QFEwa.8 = internal unnamed_addr global i64 0
@_QQcl.0610bde3beb9a0bf9d825c6c4a71f1a4 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2628/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"
@_QQcl.4143 = linkonce constant [2 x i8] c"AC"
@_QQcl.2869302C412C693029 = linkonce constant [9 x i8] c"(i0,A,i0)"
@_QQcl.20 = linkonce constant [1 x i8] c" "
@_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 [2 x i8], align 1
  %4 = alloca i32, align 4
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0610bde3beb9a0bf9d825c6c4a71f1a4, i32 12)
  %6 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %2, i32 4)
  %7 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %1, i32 4)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %9 = load i32, ptr %2, align 4, !tbaa !3
  %10 = call i32 @llvm.smax.i32(i32 %9, i32 0)
  %11 = zext i32 %10 to i64
  %12 = shl nuw nsw i64 %11, 2
  %13 = call ptr @malloc(i64 %12)
  store ptr %13, ptr @_QFEac.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEac.7, align 8, !tbaa !7
  %14 = call ptr @malloc(i64 %12)
  store ptr %14, ptr @_QFEwa.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEwa.7, align 8, !tbaa !7
  store i64 %11, ptr @_QFEwa.8, align 8, !tbaa !7
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %17, label %.preheader495

.preheader495:                                    ; preds = %0
  %.not502 = icmp slt i32 %9, 1
  br i1 %.not502, label %.loopexit496, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader495
  %15 = call i64 @llvm.smax.i64(i64 %11, i64 1)
  %16 = shl nuw nsw i64 %15, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %13, i8 0, i64 %16, i1 false), !tbaa !3
  br label %.loopexit496

17:                                               ; preds = %0
  %18 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.0610bde3beb9a0bf9d825c6c4a71f1a4, i32 15)
  %.unpack480.unpack.unpack = load i64, ptr @_QFEac.7, align 8, !tbaa !7
  %19 = icmp slt i32 %9, 1
  %20 = select i1 %19, i64 1, i64 %.unpack480.unpack.unpack
  store ptr null, ptr @_QFEac.0, align 8, !tbaa !7
  store i64 %20, ptr @_QFEac.7, align 8, !tbaa !7
  %.unpack367.pre = load ptr, ptr @_QFEwa.0, align 8, !tbaa !7
  %.unpack374.unpack.unpack376.pre = load i64, ptr @_QFEwa.8, align 8, !tbaa !7
  br label %.loopexit496

.loopexit496:                                     ; preds = %.lr.ph.preheader, %.preheader495, %17
  %.unpack374.unpack.unpack376 = phi i64 [ %11, %.lr.ph.preheader ], [ %11, %.preheader495 ], [ %.unpack374.unpack.unpack376.pre, %17 ]
  %.unpack367 = phi ptr [ %14, %.lr.ph.preheader ], [ %14, %.preheader495 ], [ %.unpack367.pre, %17 ]
  %.not379 = icmp eq ptr %.unpack367, null
  br i1 %.not379, label %23, label %.preheader

.preheader:                                       ; preds = %.loopexit496
  %21 = icmp sgt i64 %.unpack374.unpack.unpack376, 0
  br i1 %21, label %.lr.ph497.preheader, label %.loopexit

.lr.ph497.preheader:                              ; preds = %.preheader
  %22 = shl nuw i64 %.unpack374.unpack.unpack376, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %.unpack367, i8 0, i64 %22, i1 false), !tbaa !3
  br label %.loopexit

23:                                               ; preds = %.loopexit496
  %24 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.0610bde3beb9a0bf9d825c6c4a71f1a4, i32 15)
  %.unpack459.unpack.unpack = load i64, ptr @_QFEwa.7, align 8, !tbaa !7
  %25 = icmp eq i64 %.unpack374.unpack.unpack376, 0
  %26 = select i1 %25, i64 1, i64 %.unpack459.unpack.unpack
  store ptr null, ptr @_QFEwa.0, align 8, !tbaa !7
  store i64 %26, ptr @_QFEwa.7, align 8, !tbaa !7
  store i64 %.unpack374.unpack.unpack376, ptr @_QFEwa.8, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph497.preheader, %.preheader, %23
  %27 = load i32, ptr %1, align 4, !tbaa !3
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph498.preheader, label %._crit_edge

.lr.ph498.preheader:                              ; preds = %.loopexit
  %29 = zext i32 %27 to i64
  br label %.lr.ph498

.lr.ph498:                                        ; preds = %.lr.ph498.preheader, %50
  %30 = phi i64 [ %51, %50 ], [ %29, %.lr.ph498.preheader ]
  %31 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0610bde3beb9a0bf9d825c6c4a71f1a4, i32 18)
  %32 = call i1 @_FortranAioInputInteger(ptr %31, ptr nonnull %4, i32 4)
  %33 = call i1 @_FortranAioInputAscii(ptr %31, ptr nonnull %3, i64 2)
  %34 = call i32 @_FortranAioEndIoStatement(ptr %31)
  %35 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %3, ptr nonnull @_QQcl.4143, i64 2, i64 2)
  %36 = icmp eq i32 %35, 0
  %.unpack440 = load ptr, ptr @_QFEac.0, align 8, !tbaa !7
  %.unpack447.unpack.unpack = load i64, ptr @_QFEac.7, align 8, !tbaa !7
  %37 = load i32, ptr %4, align 4, !tbaa !3
  %38 = sext i32 %37 to i64
  %39 = sub i64 %38, %.unpack447.unpack.unpack
  %40 = getelementptr i32, ptr %.unpack440, i64 %39
  br i1 %36, label %41, label %42

41:                                               ; preds = %.lr.ph498
  store i32 1, ptr %40, align 4, !tbaa !3
  br label %50

42:                                               ; preds = %.lr.ph498
  %43 = load i32, ptr %40, align 4, !tbaa !3
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %50

45:                                               ; preds = %42
  %.unpack428 = load ptr, ptr @_QFEwa.0, align 8, !tbaa !7
  %.unpack435.unpack.unpack = load i64, ptr @_QFEwa.7, align 8, !tbaa !7
  %46 = sub i64 %38, %.unpack435.unpack.unpack
  %47 = getelementptr i32, ptr %.unpack428, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !3
  %49 = add i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !3
  br label %50

50:                                               ; preds = %41, %45, %42
  %51 = add nsw i64 %30, -1
  %52 = icmp sgt i64 %30, 1
  br i1 %52, label %.lr.ph498, label %._crit_edge

._crit_edge:                                      ; preds = %50, %.loopexit
  %53 = load i32, ptr %2, align 4, !tbaa !3
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph500, label %94

.lr.ph500:                                        ; preds = %._crit_edge
  %55 = zext i32 %53 to i64
  %_QFEallwa.promoted = load i32, ptr @_QFEallwa, align 4, !tbaa !3
  %_QFEallac.promoted = load i32, ptr @_QFEallac, align 4, !tbaa !3
  %.unpack380 = load ptr, ptr @_QFEac.0, align 8, !tbaa !7
  %.unpack387.unpack.unpack = load i64, ptr @_QFEac.7, align 8, !tbaa !7
  %.unpack404 = load ptr, ptr @_QFEwa.0, align 8
  %.unpack411.unpack.unpack = load i64, ptr @_QFEwa.7, align 8
  %xtraiter = and i64 %55, 1
  %56 = icmp eq i32 %53, 1
  br i1 %56, label %._crit_edge501.unr-lcssa, label %.lr.ph500.new

.lr.ph500.new:                                    ; preds = %.lr.ph500
  %unroll_iter = and i64 %55, 4294967294
  br label %57

57:                                               ; preds = %82, %.lr.ph500.new
  %indvars.iv = phi i64 [ 1, %.lr.ph500.new ], [ %indvars.iv.next.1, %82 ]
  %58 = phi i32 [ %_QFEallac.promoted, %.lr.ph500.new ], [ %75, %82 ]
  %59 = phi i32 [ %_QFEallwa.promoted, %.lr.ph500.new ], [ %83, %82 ]
  %niter = phi i64 [ 0, %.lr.ph500.new ], [ %niter.next.1, %82 ]
  %60 = sub i64 %indvars.iv, %.unpack387.unpack.unpack
  %61 = getelementptr i32, ptr %.unpack380, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !3
  %63 = add i32 %62, %58
  %64 = icmp eq i32 %62, 1
  br i1 %64, label %65, label %70

65:                                               ; preds = %57
  %66 = sub i64 %indvars.iv, %.unpack411.unpack.unpack
  %67 = getelementptr i32, ptr %.unpack404, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !3
  %69 = add i32 %68, %59
  store i32 %69, ptr @_QFEallwa, align 4, !tbaa !3
  br label %70

70:                                               ; preds = %65, %57
  %71 = phi i32 [ %69, %65 ], [ %59, %57 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %72 = sub i64 %indvars.iv.next, %.unpack387.unpack.unpack
  %73 = getelementptr i32, ptr %.unpack380, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !3
  %75 = add i32 %74, %63
  %76 = icmp eq i32 %74, 1
  br i1 %76, label %77, label %82

77:                                               ; preds = %70
  %78 = sub i64 %indvars.iv.next, %.unpack411.unpack.unpack
  %79 = getelementptr i32, ptr %.unpack404, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !3
  %81 = add i32 %80, %71
  store i32 %81, ptr @_QFEallwa, align 4, !tbaa !3
  br label %82

82:                                               ; preds = %77, %70
  %83 = phi i32 [ %81, %77 ], [ %71, %70 ]
  %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_edge501.unr-lcssa, label %57

._crit_edge501.unr-lcssa:                         ; preds = %82, %.lr.ph500
  %.lcssa.ph = phi i32 [ undef, %.lr.ph500 ], [ %75, %82 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph500 ], [ %indvars.iv.next.1, %82 ]
  %.unr = phi i32 [ %_QFEallac.promoted, %.lr.ph500 ], [ %75, %82 ]
  %.unr506 = phi i32 [ %_QFEallwa.promoted, %.lr.ph500 ], [ %83, %82 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge501, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge501.unr-lcssa
  %84 = sub i64 %indvars.iv.unr, %.unpack387.unpack.unpack
  %85 = getelementptr i32, ptr %.unpack380, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !3
  %87 = add i32 %86, %.unr
  %88 = icmp eq i32 %86, 1
  br i1 %88, label %89, label %._crit_edge501

89:                                               ; preds = %.epil.preheader
  %90 = sub i64 %indvars.iv.unr, %.unpack411.unpack.unpack
  %91 = getelementptr i32, ptr %.unpack404, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !3
  %93 = add i32 %92, %.unr506
  store i32 %93, ptr @_QFEallwa, align 4, !tbaa !3
  br label %._crit_edge501

._crit_edge501:                                   ; preds = %.epil.preheader, %89, %._crit_edge501.unr-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge501.unr-lcssa ], [ %87, %89 ], [ %87, %.epil.preheader ]
  store i32 %.lcssa, ptr @_QFEallac, align 4, !tbaa !3
  br label %94

94:                                               ; preds = %._crit_edge501, %._crit_edge
  %95 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C412C693029, i64 9, ptr null, i32 -1, ptr nonnull @_QQcl.0610bde3beb9a0bf9d825c6c4a71f1a4, i32 35)
  %96 = load i32, ptr @_QFEallac, align 4, !tbaa !3
  %97 = call i1 @_FortranAioOutputInteger32(ptr %95, i32 %96)
  %98 = call i1 @_FortranAioOutputAscii(ptr %95, ptr nonnull @_QQcl.20, i64 1)
  %99 = load i32, ptr @_QFEallwa, align 4, !tbaa !3
  %100 = call i1 @_FortranAioOutputInteger32(ptr %95, i32 %99)
  %101 = call i32 @_FortranAioEndIoStatement(ptr %95)
  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 i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(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 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}
