program ABC149C
    implicit none
    integer::X
    integer::i,j
    logical::flag
    read*,X
    do i=X,10**5+3
        flag=.true.
        do j=2,int(sqrt(real(X)+1))
            if(mod(i,j)==0)then
                flag=.false.
                exit
            endif
        end do
        if(flag)then
            print"(i0)",i
            stop
        endif
    end do
end program ABC149C
; 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"

@_QQcl.2b2661ce629256d2f8abf3ab67454a14 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2733/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2b2661ce629256d2f8abf3ab67454a14, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = sub i32 100004, %5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph22, label %._crit_edge

.lr.ph22:                                         ; preds = %0
  %8 = sitofp i32 %5 to float
  %9 = fadd contract float %8, 1.000000e+00
  %10 = call contract float @llvm.sqrt.f32(float %9)
  %11 = fptosi float %10 to i32
  %.01315 = add i32 %11, -1
  %12 = icmp sgt i32 %.01315, 0
  br i1 %12, label %.lr.ph.us, label %.critedge

.lr.ph.us:                                        ; preds = %.lr.ph22, %18
  %.01021.us = phi i32 [ %20, %18 ], [ %5, %.lr.ph22 ]
  %.01220.us = phi i32 [ %19, %18 ], [ %6, %.lr.ph22 ]
  br label %15

13:                                               ; preds = %15
  %14 = add nuw i32 %.016.us, 1
  %exitcond.not = icmp eq i32 %.016.us, %11
  br i1 %exitcond.not, label %.critedge, label %15

15:                                               ; preds = %.lr.ph.us, %13
  %.016.us = phi i32 [ 2, %.lr.ph.us ], [ %14, %13 ]
  %16 = srem i32 %.01021.us, %.016.us
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %13

18:                                               ; preds = %15
  %19 = add i32 %.01220.us, -1
  %20 = add i32 %.01021.us, 1
  %21 = icmp sgt i32 %19, 0
  br i1 %21, label %.lr.ph.us, label %._crit_edge

.critedge:                                        ; preds = %13, %.lr.ph22
  %.010.lcssa14 = phi i32 [ %5, %.lr.ph22 ], [ %.01021.us, %13 ]
  %22 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.2b2661ce629256d2f8abf3ab67454a14, i32 16)
  %23 = call i1 @_FortranAioOutputInteger32(ptr %22, i32 %.010.lcssa14)
  %24 = call i32 @_FortranAioEndIoStatement(ptr %22)
  %25 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

._crit_edge:                                      ; preds = %18, %0
  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 ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.sqrt.f32(float) #0

attributes #0 = { mustprogress 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"}
