   program abc170c
      implicit none
      integer::x,n
      integer,allocatable,dimension(:)::p
      logical,allocatable,dimension(:)::check
      integer::i,step


         read *, x,n
         allocate( p(n),check(-100:200) )
         check=.false.
         read *, p(1:n)

         if ( n==0 ) then
            print *, x
            stop
         end if

         do i=1,n
            check(p(i))=.true.
         end do

         if ( check(x) .eqv. .false. ) then
            print *, x
            stop
         end if

         step=0
         do while ( check(x+step) .and. check(x-step) )
            step=step+1
            if ( check(x+step) .eqv. .false. ) then
               if ( check(x-step) .eqv. .false. ) then
                  print *, x-step
                  stop
               else
                  print *, x+step
                  stop
               end if
            else if ( check(x-step) .eqv. .false. ) then
               print *, x-step
               stop
            end if
         end do


   end program abc170c
; 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
@_QQcl.e80946bf994e96239fc95ed98323bcdc = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1205/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null
@_QFEcheck.0.body = internal global [1204 x i8] undef

; 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 {
.loopexit:
  %0 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 9)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i32, ptr %1, align 4, !tbaa !3
  %8 = call i32 @llvm.smax.i32(i32 %7, i32 0)
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 2
  %11 = call ptr @malloc(i64 %10)
  store ptr %11, ptr @_QFEp.0, align 8, !tbaa !7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1204) @_QFEcheck.0.body, i8 0, i64 1204, i1 false)
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 12)
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %13 = load i32, ptr %1, align 4, !tbaa !3
  %14 = call i32 @llvm.smax.i32(i32 %13, i32 0)
  %15 = zext i32 %14 to i64
  store ptr %.unpack, ptr %0, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, 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 %0, 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 %0, 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 %0, 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 %0, 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 %0, 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 %0, 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 %0, i64 0, i32 7, i64 0, i64 1
  store i64 %15, 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 %0, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %16 = call i1 @_FortranAioInputDescriptor(ptr %12, ptr nonnull %0)
  %17 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %18 = load i32, ptr %1, align 4, !tbaa !3
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %26

20:                                               ; preds = %.loopexit
  %21 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 15)
  %22 = load i32, ptr %2, align 4, !tbaa !3
  %23 = call i1 @_FortranAioOutputInteger32(ptr %21, i32 %22)
  %24 = call i32 @_FortranAioEndIoStatement(ptr %21)
  %25 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

26:                                               ; preds = %.loopexit
  %27 = icmp sgt i32 %18, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %26
  %28 = zext i32 %18 to i64
  %.unpack467 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %xtraiter = and i64 %28, 1
  %29 = icmp eq i32 %18, 1
  br i1 %29, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %28, 4294967294
  br label %30

30:                                               ; preds = %30, %.lr.ph.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.1, %30 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %30 ]
  %31 = add nsw i64 %indvars.iv, -1
  %32 = getelementptr i32, ptr %.unpack467, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !3
  %34 = sext i32 %33 to i64
  %35 = add nsw i64 %34, 100
  %36 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %35
  store i32 1, ptr %36, align 4, !tbaa !3
  %37 = getelementptr i32, ptr %.unpack467, i64 %indvars.iv
  %38 = load i32, ptr %37, align 4, !tbaa !3
  %39 = sext i32 %38 to i64
  %40 = add nsw i64 %39, 100
  %41 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %40
  store i32 1, ptr %41, 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_edge.loopexit.unr-lcssa.loopexit, label %30

._crit_edge.loopexit.unr-lcssa.loopexit:          ; preds = %30
  %42 = add nuw nsw i64 %indvars.iv, 1
  br label %._crit_edge.loopexit.unr-lcssa

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

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %43 = getelementptr i32, ptr %.unpack467, i64 %indvars.iv.unr
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %45 = sext i32 %44 to i64
  %46 = add nsw i64 %45, 100
  %47 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %46
  store i32 1, ptr %47, align 4, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %26
  %48 = load i32, ptr %2, align 4, !tbaa !3
  %49 = sext i32 %48 to i64
  %50 = add nsw i64 %49, 100
  %51 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !3
  %.not439 = icmp eq i32 %52, 0
  br i1 %.not439, label %53, label %.preheader

53:                                               ; preds = %._crit_edge
  %54 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 24)
  %55 = load i32, ptr %2, align 4, !tbaa !3
  %56 = call i1 @_FortranAioOutputInteger32(ptr %54, i32 %55)
  %57 = call i32 @_FortranAioEndIoStatement(ptr %54)
  %58 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.preheader:                                       ; preds = %._crit_edge, %99
  %.0 = phi i32 [ %73, %99 ], [ 0, %._crit_edge ]
  %59 = add i32 %.0, %48
  %60 = sext i32 %59 to i64
  %61 = add nsw i64 %60, 100
  %62 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !3
  %64 = sub i32 %48, %.0
  %65 = sext i32 %64 to i64
  %66 = add nsw i64 %65, 100
  %67 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !3
  %69 = icmp ne i32 %63, 0
  %70 = icmp ne i32 %68, 0
  %71 = and i1 %69, %70
  br i1 %71, label %72, label %107

72:                                               ; preds = %.preheader
  %73 = add i32 %.0, 1
  %74 = add i32 %73, %48
  %75 = sext i32 %74 to i64
  %76 = add nsw i64 %75, 100
  %77 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !3
  %.not452 = icmp eq i32 %78, 0
  %79 = sub i32 %48, %73
  %80 = sext i32 %79 to i64
  %81 = add nsw i64 %80, 100
  %82 = getelementptr i32, ptr @_QFEcheck.0.body, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !3
  %.not454 = icmp eq i32 %83, 0
  br i1 %.not452, label %84, label %99

84:                                               ; preds = %72
  br i1 %.not454, label %85, label %92

85:                                               ; preds = %84
  %86 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 33)
  %87 = load i32, ptr %2, align 4, !tbaa !3
  %88 = sub i32 %87, %73
  %89 = call i1 @_FortranAioOutputInteger32(ptr %86, i32 %88)
  %90 = call i32 @_FortranAioEndIoStatement(ptr %86)
  %91 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

92:                                               ; preds = %84
  %93 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 36)
  %94 = load i32, ptr %2, align 4, !tbaa !3
  %95 = add i32 %94, %73
  %96 = call i1 @_FortranAioOutputInteger32(ptr %93, i32 %95)
  %97 = call i32 @_FortranAioEndIoStatement(ptr %93)
  %98 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

99:                                               ; preds = %72
  br i1 %.not454, label %100, label %.preheader

100:                                              ; preds = %99
  %101 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e80946bf994e96239fc95ed98323bcdc, i32 40)
  %102 = load i32, ptr %2, align 4, !tbaa !3
  %103 = sub i32 %102, %73
  %104 = call i1 @_FortranAioOutputInteger32(ptr %101, i32 %103)
  %105 = call i32 @_FortranAioEndIoStatement(ptr %101)
  %106 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

107:                                              ; preds = %.preheader
  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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

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