program sample
    implicit none
  
    integer(8) :: i,j,m,n,c,k,s
    
    integer(8),allocatable :: b(:),a(:)
  
    read(*,*) n,m,c
    allocate(b(m))
    allocate(a(m))
    read(*,*)b
    k=0
    do i=1,n
        read(*,*)a
        s=0
        do j=1,m
            s=s+a(j)*b(j)
        end do
        if (s+c>0)then
            k=k+1
        end if
    end do


    write(*,*) k  
    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.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEb.0 = internal unnamed_addr global ptr null
@_QFEb.8 = internal unnamed_addr global i64 0
@_QQcl.85df2cd965f70908754bfa6fe7fbc489 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4746/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

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %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 i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.85df2cd965f70908754bfa6fe7fbc489, i32 8)
  %7 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %5, i32 8)
  %8 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %4, i32 8)
  %9 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %3, i32 8)
  %10 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %11 = load i64, ptr %4, align 8, !tbaa !3
  %12 = call i64 @llvm.smax.i64(i64 %11, i64 0)
  %13 = shl i64 %12, 3
  %14 = call ptr @malloc(i64 %13)
  store ptr %14, ptr @_QFEb.0, align 8, !tbaa !7
  store i64 %12, ptr @_QFEb.8, align 8, !tbaa !7
  %15 = call ptr @malloc(i64 %13)
  store ptr %15, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %12, ptr @_QFEa.8, align 8, !tbaa !7
  %16 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.85df2cd965f70908754bfa6fe7fbc489, i32 11)
  %.unpack = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %.unpack221.unpack.unpack223 = load i64, ptr @_QFEb.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 8, 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 10, 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 %.unpack221.unpack.unpack223, 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 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %17 = call i1 @_FortranAioInputDescriptor(ptr %16, ptr nonnull %2)
  %18 = call i32 @_FortranAioEndIoStatement(ptr %16)
  %19 = load i64, ptr %5, align 8, !tbaa !3
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph265, label %._crit_edge266

.lr.ph265:                                        ; preds = %0
  %.fca.1.gep117 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  %.fca.2.gep119 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  %.fca.3.gep121 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  %.fca.4.gep123 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  %.fca.5.gep125 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  %.fca.6.gep127 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  %.fca.7.0.0.gep129 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  %.fca.7.0.1.gep131 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  %.fca.7.0.2.gep133 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  br label %21

21:                                               ; preds = %.lr.ph265, %._crit_edge
  %22 = phi i64 [ %19, %.lr.ph265 ], [ %52, %._crit_edge ]
  %.0194263 = phi i64 [ 0, %.lr.ph265 ], [ %spec.select, %._crit_edge ]
  %23 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.85df2cd965f70908754bfa6fe7fbc489, i32 14)
  %.unpack226 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack233.unpack.unpack235 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  store ptr %.unpack226, ptr %1, align 8, !tbaa !7
  store i64 8, ptr %.fca.1.gep117, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep119, align 8, !tbaa !7
  store i8 1, ptr %.fca.3.gep121, align 4, !tbaa !7
  store i8 10, ptr %.fca.4.gep123, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep125, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep127, align 1, !tbaa !7
  store i64 1, ptr %.fca.7.0.0.gep129, align 8, !tbaa !7
  store i64 %.unpack233.unpack.unpack235, ptr %.fca.7.0.1.gep131, align 8, !tbaa !7
  store i64 8, ptr %.fca.7.0.2.gep133, align 8, !tbaa !7
  %24 = call i1 @_FortranAioInputDescriptor(ptr %23, ptr nonnull %1)
  %25 = call i32 @_FortranAioEndIoStatement(ptr %23)
  %26 = load i64, ptr %4, align 8, !tbaa !3
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %21
  %.unpack238 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack250 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %min.iters.check = icmp ult i64 %26, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %26, -4
  %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 <2 x i64> [ zeroinitializer, %vector.ph ], [ %34, %vector.body ]
  %vec.phi268 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %35, %vector.body ]
  %28 = getelementptr i64, ptr %.unpack238, i64 %index
  %wide.load = load <2 x i64>, ptr %28, align 8, !tbaa !3
  %29 = getelementptr i64, ptr %28, i64 2
  %wide.load269 = load <2 x i64>, ptr %29, align 8, !tbaa !3
  %30 = getelementptr i64, ptr %.unpack250, i64 %index
  %wide.load270 = load <2 x i64>, ptr %30, align 8, !tbaa !3
  %31 = getelementptr i64, ptr %30, i64 2
  %wide.load271 = load <2 x i64>, ptr %31, align 8, !tbaa !3
  %32 = mul <2 x i64> %wide.load270, %wide.load
  %33 = mul <2 x i64> %wide.load271, %wide.load269
  %34 = add <2 x i64> %32, %vec.phi
  %35 = add <2 x i64> %33, %vec.phi268
  %index.next = add nuw i64 %index, 4
  %36 = icmp eq i64 %index.next, %n.vec
  br i1 %36, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %35, %34
  %37 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %26, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph, %middle.block
  %.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  %.0262.ph = phi i64 [ 0, %.lr.ph ], [ %37, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %38 = phi i64 [ %47, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %.0262 = phi i64 [ %46, %scalar.ph ], [ %.0262.ph, %scalar.ph.preheader ]
  %39 = add i64 %38, -1
  %40 = getelementptr i64, ptr %.unpack238, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !3
  %42 = add i64 %38, -1
  %43 = getelementptr i64, ptr %.unpack250, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !3
  %45 = mul i64 %44, %41
  %46 = add i64 %45, %.0262
  %47 = add nuw i64 %38, 1
  %exitcond.not = icmp eq i64 %38, %26
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %21
  %.0.lcssa = phi i64 [ 0, %21 ], [ %37, %middle.block ], [ %46, %scalar.ph ]
  %48 = load i64, ptr %3, align 8, !tbaa !3
  %49 = add i64 %48, %.0.lcssa
  %50 = icmp sgt i64 %49, 0
  %51 = zext i1 %50 to i64
  %spec.select = add i64 %.0194263, %51
  %52 = add nsw i64 %22, -1
  %53 = icmp sgt i64 %22, 1
  br i1 %53, label %21, label %._crit_edge266

._crit_edge266:                                   ; preds = %._crit_edge, %0
  %.0194.lcssa = phi i64 [ 0, %0 ], [ %spec.select, %._crit_edge ]
  %54 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.85df2cd965f70908754bfa6fe7fbc489, i32 25)
  %55 = call i1 @_FortranAioOutputInteger64(ptr %54, i64 %.0194.lcssa)
  %56 = call i32 @_FortranAioEndIoStatement(ptr %54)
  %57 = 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 i1 @_FortranAioInputDescriptor(ptr, 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 nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #2

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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}
