program sample
    implicit none
    integer(8) ::a, b,c,i,j,m,n,k,a1,b1,c1
    integer(8)::x,y(100)
    integer(8),allocatable::p(:)
    read(*,*) x,n
    if (n==0)then
        write(*,*)x
        stop
    end if
    allocate(p(n))

    read(*,*)p
    do i=1,100
        y(i)=1
    end do
    do i=1,n
        y(p(i))=0
    end do
    do i=0,100
        if (x-i==0)then
            write(*,*)x-i
            stop
        end if
        
        if (y(x-i)==1) then
            write(*,*)x-i
            stop
        end if
        if ( x+i==101)then
            write(*,*)x+i
            stop
        end if 
        if (y(x+i)==1) then
            write(*,*)x+i
            stop
        end if
    end do
    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"

@_QFEp.0 = internal unnamed_addr global ptr null
@_QFEp.8 = internal unnamed_addr global i64 0
@_QFEy = internal unnamed_addr global [100 x i64] undef
@_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1202/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 i64, align 8
  %3 = alloca i64, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 6)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 8)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 8)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i64, ptr %2, align 8, !tbaa !3
  %9 = icmp eq i64 %8, 0
  br i1 %9, label %10, label %vector.ph

10:                                               ; preds = %0
  %11 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 8)
  %12 = load i64, ptr %3, align 8, !tbaa !3
  %13 = call i1 @_FortranAioOutputInteger64(ptr %11, i64 %12)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %15 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

vector.ph:                                        ; preds = %0
  %16 = call i64 @llvm.smax.i64(i64 %8, i64 0)
  %17 = shl i64 %16, 3
  %18 = call ptr @malloc(i64 %17)
  store ptr %18, ptr @_QFEp.0, align 8, !tbaa !7
  store i64 %16, ptr @_QFEp.8, align 8, !tbaa !7
  %19 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 13)
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %.unpack103.unpack.unpack105 = load i64, ptr @_QFEp.8, align 8, !tbaa !7
  store ptr %.unpack, 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 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 %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 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 %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 %.unpack103.unpack.unpack105, 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 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %20 = call i1 @_FortranAioInputDescriptor(ptr %19, ptr nonnull %1)
  %21 = call i32 @_FortranAioEndIoStatement(ptr %19)
  store <2 x i64> <i64 1, i64 1>, ptr @_QFEy, align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 2), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 4), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 6), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 8), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 10), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 12), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 14), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 16), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 18), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 20), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 22), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 24), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 26), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 28), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 30), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 32), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 34), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 36), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 38), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 40), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 42), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 44), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 46), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 48), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 50), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 52), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 54), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 56), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 58), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 60), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 62), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 64), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 66), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 68), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 70), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 72), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 74), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 76), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 78), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 80), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 82), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 84), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 86), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 88), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 90), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 92), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 94), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 96), align 16, !tbaa !3
  store <2 x i64> <i64 1, i64 1>, ptr getelementptr inbounds ([100 x i64], ptr @_QFEy, i64 0, i64 98), align 16, !tbaa !3
  %22 = load i64, ptr %2, align 8, !tbaa !3
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %vector.ph
  %.unpack108 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %xtraiter = and i64 %22, 1
  %24 = icmp eq i64 %22, 1
  br i1 %24, label %.preheader.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %22, -2
  br label %31

.preheader.loopexit.unr-lcssa.loopexit:           ; preds = %31
  %25 = add i64 %32, 1
  br label %.preheader.loopexit.unr-lcssa

.preheader.loopexit.unr-lcssa:                    ; preds = %.preheader.loopexit.unr-lcssa.loopexit, %.lr.ph
  %.unr = phi i64 [ 0, %.lr.ph ], [ %25, %.preheader.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.preheader.loopexit.epilog-lcssa

.preheader.loopexit.epilog-lcssa:                 ; preds = %.preheader.loopexit.unr-lcssa
  %26 = getelementptr i64, ptr %.unpack108, i64 %.unr
  %27 = load i64, ptr %26, align 8, !tbaa !3
  %28 = add i64 %27, -1
  %29 = getelementptr [100 x i64], ptr @_QFEy, i64 0, i64 %28
  store i64 0, ptr %29, align 8, !tbaa !3
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit.epilog-lcssa, %.preheader.loopexit.unr-lcssa, %vector.ph
  %30 = load i64, ptr %3, align 8, !tbaa !3
  br label %43

31:                                               ; preds = %31, %.lr.ph.new
  %32 = phi i64 [ 1, %.lr.ph.new ], [ %42, %31 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %31 ]
  %33 = add nsw i64 %32, -1
  %34 = getelementptr i64, ptr %.unpack108, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !3
  %36 = add i64 %35, -1
  %37 = getelementptr [100 x i64], ptr @_QFEy, i64 0, i64 %36
  store i64 0, ptr %37, align 8, !tbaa !3
  %38 = getelementptr i64, ptr %.unpack108, i64 %32
  %39 = load i64, ptr %38, align 8, !tbaa !3
  %40 = add i64 %39, -1
  %41 = getelementptr [100 x i64], ptr @_QFEy, i64 0, i64 %40
  store i64 0, ptr %41, align 8, !tbaa !3
  %42 = add nuw i64 %32, 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 %.preheader.loopexit.unr-lcssa.loopexit, label %31

43:                                               ; preds = %.preheader, %88
  %.0125 = phi i64 [ 0, %.preheader ], [ %89, %88 ]
  %44 = icmp eq i64 %30, %.0125
  br i1 %44, label %45, label %52

45:                                               ; preds = %43
  %46 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 22)
  %47 = load i64, ptr %3, align 8, !tbaa !3
  %48 = sub i64 %47, %30
  %49 = call i1 @_FortranAioOutputInteger64(ptr %46, i64 %48)
  %50 = call i32 @_FortranAioEndIoStatement(ptr %46)
  %51 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

52:                                               ; preds = %43
  %53 = xor i64 %.0125, -1
  %54 = add i64 %30, %53
  %55 = getelementptr [100 x i64], ptr @_QFEy, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !3
  %57 = icmp eq i64 %56, 1
  br i1 %57, label %58, label %65

58:                                               ; preds = %52
  %59 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 27)
  %60 = load i64, ptr %3, align 8, !tbaa !3
  %61 = sub i64 %60, %.0125
  %62 = call i1 @_FortranAioOutputInteger64(ptr %59, i64 %61)
  %63 = call i32 @_FortranAioEndIoStatement(ptr %59)
  %64 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

65:                                               ; preds = %52
  %66 = add i64 %30, %.0125
  %67 = icmp eq i64 %66, 101
  br i1 %67, label %68, label %76

68:                                               ; preds = %65
  %69 = sub i64 101, %30
  %70 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 31)
  %71 = load i64, ptr %3, align 8, !tbaa !3
  %72 = add i64 %71, %69
  %73 = call i1 @_FortranAioOutputInteger64(ptr %70, i64 %72)
  %74 = call i32 @_FortranAioEndIoStatement(ptr %70)
  %75 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

76:                                               ; preds = %65
  %77 = add i64 %66, -1
  %78 = getelementptr [100 x i64], ptr @_QFEy, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !3
  %80 = icmp eq i64 %79, 1
  br i1 %80, label %81, label %88

81:                                               ; preds = %76
  %82 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.1d9d020b7e36d28f0ba87cc0d4ccbd9f, i32 35)
  %83 = load i64, ptr %3, align 8, !tbaa !3
  %84 = add i64 %83, %.0125
  %85 = call i1 @_FortranAioOutputInteger64(ptr %82, i64 %84)
  %86 = call i32 @_FortranAioEndIoStatement(ptr %82)
  %87 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

88:                                               ; preds = %76
  %89 = add nuw nsw i64 %.0125, 1
  %exitcond131.not = icmp eq i64 %89, 101
  br i1 %exitcond131.not, label %90, label %43

90:                                               ; preds = %88
  %91 = 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

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #2

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) }

!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}
