program a
  implicit none
  integer :: N,i,M
  integer,allocatable :: W(:),st(:),bro(:)

  read(*,*) N,M
  allocate(W(N))
  W=1
  allocate(bro(M))
  allocate(st(N))
 
  if(M.gt.0) then
 	 read(*,*) bro 
     do i=1,M
          W(bro(i))=0
     enddo
  endif
  do i=1,N
     if(i.eq.1) then
        st(i)=W(1)
     elseif(i.eq.2) then
        st(i)=W(2)*(W(1)+1)
     else
        st(i)=mod((st(i-2)+st(i-1)),1000000007)*W(i)
     endif
  enddo

  write(*,'(i0)') st(n)

                                                                    
  deallocate(st)
  deallocate(W)
end program a

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

@_QFEbro.0 = internal unnamed_addr global ptr null
@_QFEbro.8 = internal unnamed_addr global i64 0
@_QFEst.0 = internal unnamed_addr global ptr null
@_QFEw.0 = internal unnamed_addr global ptr null
@_QFEw.7 = internal unnamed_addr global i64 1
@_QQcl.bf8e8b3b02b3ad4678f35d0e28016c5f = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4110/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.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.bf8e8b3b02b3ad4678f35d0e28016c5f, i32 6)
  %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 @_QFEw.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEw.7, align 8, !tbaa !7
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %22, label %.preheader

.preheader:                                       ; preds = %0
  %.not727 = icmp slt i32 %8, 1
  br i1 %.not727, label %.loopexit724, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %min.iters.check = icmp ult i32 %9, 8
  br i1 %min.iters.check, label %.lr.ph.preheader739, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %10, 2147483640
  %ind.end = and i64 %10, 7
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %13 = getelementptr i32, ptr %12, i64 %index
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 4, !tbaa !3
  %14 = getelementptr i32, ptr %13, i64 4
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %14, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %15 = icmp eq i64 %index.next, %n.vec
  br i1 %15, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %10
  br i1 %cmp.n, label %.loopexit724, label %.lr.ph.preheader739

.lr.ph.preheader739:                              ; preds = %.lr.ph.preheader, %middle.block
  %.ph = phi i64 [ %10, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.ph740 = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader739, %.lr.ph
  %16 = phi i64 [ %20, %.lr.ph ], [ %.ph, %.lr.ph.preheader739 ]
  %17 = phi i64 [ %18, %.lr.ph ], [ %.ph740, %.lr.ph.preheader739 ]
  %18 = add nuw nsw i64 %17, 1
  %19 = getelementptr i32, ptr %12, i64 %17
  store i32 1, ptr %19, align 4, !tbaa !3
  %20 = add nsw i64 %16, -1
  %21 = icmp ugt i64 %16, 1
  br i1 %21, label %.lr.ph, label %.loopexit724, !llvm.loop !12

22:                                               ; preds = %0
  %23 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.bf8e8b3b02b3ad4678f35d0e28016c5f, i32 8)
  %.unpack710.unpack.unpack = load i64, ptr @_QFEw.7, align 8, !tbaa !7
  %24 = icmp slt i32 %8, 1
  %25 = select i1 %24, i64 1, i64 %.unpack710.unpack.unpack
  store ptr null, ptr @_QFEw.0, align 8, !tbaa !7
  store i64 %25, ptr @_QFEw.7, align 8, !tbaa !7
  %.pre = load i32, ptr %3, align 4, !tbaa !3
  %.pre733 = call i32 @llvm.smax.i32(i32 %.pre, i32 0)
  %.pre734 = zext i32 %.pre733 to i64
  %.pre736 = shl nuw nsw i64 %.pre734, 2
  br label %.loopexit724

.loopexit724:                                     ; preds = %.lr.ph, %middle.block, %.preheader, %22
  %.pre-phi737 = phi i64 [ %11, %.preheader ], [ %.pre736, %22 ], [ %11, %middle.block ], [ %11, %.lr.ph ]
  %26 = load i32, ptr %2, align 4, !tbaa !3
  %27 = call i32 @llvm.smax.i32(i32 %26, i32 0)
  %28 = zext i32 %27 to i64
  %29 = shl nuw nsw i64 %28, 2
  %30 = call ptr @malloc(i64 %29)
  store ptr %30, ptr @_QFEbro.0, align 8, !tbaa !7
  store i64 %28, ptr @_QFEbro.8, align 8, !tbaa !7
  %31 = call ptr @malloc(i64 %.pre-phi737)
  store ptr %31, ptr @_QFEst.0, align 8, !tbaa !7
  %32 = icmp sgt i32 %26, 0
  br i1 %32, label %33, label %.loopexit

33:                                               ; preds = %.loopexit724
  %34 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.bf8e8b3b02b3ad4678f35d0e28016c5f, i32 13)
  %.unpack667 = load ptr, ptr @_QFEbro.0, align 8, !tbaa !7
  %.unpack674.unpack.unpack676 = load i64, ptr @_QFEbro.8, align 8, !tbaa !7
  store ptr %.unpack667, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = 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.gep, align 8, !tbaa !7
  %.fca.2.gep = 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.gep, align 8, !tbaa !7
  %.fca.3.gep = 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.gep, align 4, !tbaa !7
  %.fca.4.gep = 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.gep, align 1, !tbaa !7
  %.fca.5.gep = 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.gep, align 2, !tbaa !7
  %.fca.6.gep = 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.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 %1, 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 %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack674.unpack.unpack676, 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 %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %35 = call i1 @_FortranAioInputDescriptor(ptr %34, ptr nonnull %1)
  %36 = call i32 @_FortranAioEndIoStatement(ptr %34)
  %37 = load i32, ptr %2, align 4, !tbaa !3
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph725, label %.loopexit

.lr.ph725:                                        ; preds = %33
  %39 = zext i32 %37 to i64
  %.unpack679 = load ptr, ptr @_QFEw.0, align 8, !tbaa !7
  %.unpack686.unpack.unpack = load i64, ptr @_QFEw.7, align 8, !tbaa !7
  %.unpack691 = load ptr, ptr @_QFEbro.0, align 8, !tbaa !7
  %xtraiter = and i64 %39, 3
  %40 = icmp ult i32 %37, 4
  br i1 %40, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph725.new

.lr.ph725.new:                                    ; preds = %.lr.ph725
  %unroll_iter = and i64 %39, 4294967292
  br label %41

41:                                               ; preds = %41, %.lr.ph725.new
  %indvars.iv = phi i64 [ 1, %.lr.ph725.new ], [ %indvars.iv.next.3, %41 ]
  %niter = phi i64 [ 0, %.lr.ph725.new ], [ %niter.next.3, %41 ]
  %42 = add nsw i64 %indvars.iv, -1
  %43 = getelementptr i32, ptr %.unpack691, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %45 = sext i32 %44 to i64
  %46 = sub i64 %45, %.unpack686.unpack.unpack
  %47 = getelementptr i32, ptr %.unpack679, i64 %46
  store i32 0, ptr %47, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %48 = getelementptr i32, ptr %.unpack691, i64 %indvars.iv
  %49 = load i32, ptr %48, align 4, !tbaa !3
  %50 = sext i32 %49 to i64
  %51 = sub i64 %50, %.unpack686.unpack.unpack
  %52 = getelementptr i32, ptr %.unpack679, i64 %51
  store i32 0, ptr %52, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %53 = getelementptr i32, ptr %.unpack691, i64 %indvars.iv.next
  %54 = load i32, ptr %53, align 4, !tbaa !3
  %55 = sext i32 %54 to i64
  %56 = sub i64 %55, %.unpack686.unpack.unpack
  %57 = getelementptr i32, ptr %.unpack679, i64 %56
  store i32 0, ptr %57, align 4, !tbaa !3
  %58 = getelementptr i32, ptr %.unpack691, i64 %indvars.iv.next.1
  %59 = load i32, ptr %58, align 4, !tbaa !3
  %60 = sext i32 %59 to i64
  %61 = sub i64 %60, %.unpack686.unpack.unpack
  %62 = getelementptr i32, ptr %.unpack679, i64 %61
  store i32 0, ptr %62, align 4, !tbaa !3
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.loopexit.loopexit.unr-lcssa, label %41

.loopexit.loopexit.unr-lcssa:                     ; preds = %41, %.lr.ph725
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph725 ], [ %indvars.iv.next.3, %41 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.epil.preheader

.epil.preheader:                                  ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %63 = add nsw i64 %indvars.iv.epil, -1
  %64 = getelementptr i32, ptr %.unpack691, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !3
  %66 = sext i32 %65 to i64
  %67 = sub i64 %66, %.unpack686.unpack.unpack
  %68 = getelementptr i32, ptr %.unpack679, i64 %67
  store i32 0, ptr %68, align 4, !tbaa !3
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.loopexit, label %.epil.preheader, !llvm.loop !13

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader, %33, %.loopexit724
  %69 = load i32, ptr %3, align 4, !tbaa !3
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph726, label %._crit_edge

.lr.ph726:                                        ; preds = %.loopexit
  %71 = zext i32 %69 to i64
  %.unpack619 = load ptr, ptr @_QFEw.0, align 8
  %.unpack626.unpack.unpack = load i64, ptr @_QFEw.7, align 8
  %72 = sub i64 2, %.unpack626.unpack.unpack
  %73 = getelementptr i32, ptr %.unpack619, i64 %72
  %74 = sub i64 1, %.unpack626.unpack.unpack
  %75 = getelementptr i32, ptr %.unpack619, i64 %74
  %.unpack631 = load ptr, ptr @_QFEst.0, align 8
  %76 = getelementptr i32, ptr %.unpack631, i64 1
  br label %77

77:                                               ; preds = %.lr.ph726, %101
  %indvars.iv729 = phi i64 [ 1, %.lr.ph726 ], [ %indvars.iv.next730, %101 ]
  %78 = trunc i64 %indvars.iv729 to i32
  switch i32 %78, label %86 [
    i32 1, label %79
    i32 2, label %81
  ]

79:                                               ; preds = %77
  %80 = load i32, ptr %75, align 4, !tbaa !3
  store i32 %80, ptr %.unpack631, align 4, !tbaa !3
  br label %101

81:                                               ; preds = %77
  %82 = load i32, ptr %73, align 4, !tbaa !3
  %83 = load i32, ptr %75, align 4, !tbaa !3
  %84 = add i32 %83, 1
  %85 = mul i32 %84, %82
  store i32 %85, ptr %76, align 4, !tbaa !3
  br label %101

86:                                               ; preds = %77
  %87 = add nsw i64 %indvars.iv729, -3
  %88 = getelementptr i32, ptr %.unpack631, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !3
  %90 = add nsw i64 %indvars.iv729, -2
  %91 = getelementptr i32, ptr %.unpack631, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !3
  %93 = add i32 %92, %89
  %94 = srem i32 %93, 1000000007
  %95 = sub i64 %indvars.iv729, %.unpack626.unpack.unpack
  %96 = getelementptr i32, ptr %.unpack619, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !3
  %98 = mul i32 %97, %94
  %99 = add nsw i64 %indvars.iv729, -1
  %100 = getelementptr i32, ptr %.unpack631, i64 %99
  store i32 %98, ptr %100, align 4, !tbaa !3
  br label %101

101:                                              ; preds = %79, %81, %86
  %indvars.iv.next730 = add nuw nsw i64 %indvars.iv729, 1
  %exitcond732.not = icmp eq i64 %indvars.iv729, %71
  br i1 %exitcond732.not, label %._crit_edge, label %77

._crit_edge:                                      ; preds = %101, %.loopexit
  %102 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.bf8e8b3b02b3ad4678f35d0e28016c5f, i32 28)
  %.unpack = load ptr, ptr @_QFEst.0, align 8, !tbaa !7
  %103 = load i32, ptr %3, align 4, !tbaa !3
  %104 = sext i32 %103 to i64
  %105 = add nsw i64 %104, -1
  %106 = getelementptr i32, ptr %.unpack, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !3
  %108 = call i1 @_FortranAioOutputInteger32(ptr %102, i32 %107)
  %109 = call i32 @_FortranAioEndIoStatement(ptr %102)
  %.unpack571 = load ptr, ptr @_QFEst.0, align 8, !tbaa !7
  call void @free(ptr %.unpack571)
  store ptr null, ptr @_QFEst.0, align 8, !tbaa !7
  %.unpack583 = load ptr, ptr @_QFEw.0, align 8, !tbaa !7
  call void @free(ptr %.unpack583)
  store ptr null, ptr @_QFEw.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEw.7, align 8, !tbaa !7
  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 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, 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 i32 @llvm.smax.i32(i32, i32) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #2 = { nocallback nofree nosync nounwind speculatable 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}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
