implicit none

integer :: n, m
integer :: i

read *, n

m = 0
do i = 1, n
   if (i < 10) then
      m = m + 1
      cycle
   else if (99 < i .and. i < 1000) then
      m = m + 1
      cycle
   else if (9999 < i .and. i < 100000) then
      m = m + 1
      cycle
   endif
enddo

write(6,'(i0)') m

stop
end
; 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.4fe5942902a88e216f0feccac632fd1c = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3575/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.4fe5942902a88e216f0feccac632fd1c, 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 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph.preheader, label %._crit_edge

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

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i32 %5, -8
  %ind.end = or i32 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ]
  %vec.phi16 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %7 = icmp ult <4 x i32> %vec.ind, <i32 10, i32 10, i32 10, i32 10>
  %8 = icmp ult <4 x i32> %step.add, <i32 10, i32 10, i32 10, i32 10>
  %9 = add nsw <4 x i32> %vec.ind, <i32 -100, i32 -100, i32 -100, i32 -100>
  %10 = add <4 x i32> %vec.ind, <i32 -96, i32 -96, i32 -96, i32 -96>
  %11 = icmp ult <4 x i32> %9, <i32 900, i32 900, i32 900, i32 900>
  %12 = icmp ult <4 x i32> %10, <i32 900, i32 900, i32 900, i32 900>
  %13 = or <4 x i1> %7, %11
  %14 = or <4 x i1> %8, %12
  %15 = add nsw <4 x i32> %vec.ind, <i32 -10000, i32 -10000, i32 -10000, i32 -10000>
  %16 = add <4 x i32> %vec.ind, <i32 -9996, i32 -9996, i32 -9996, i32 -9996>
  %17 = icmp ult <4 x i32> %15, <i32 90000, i32 90000, i32 90000, i32 90000>
  %18 = icmp ult <4 x i32> %16, <i32 90000, i32 90000, i32 90000, i32 90000>
  %19 = or <4 x i1> %17, %13
  %20 = or <4 x i1> %18, %14
  %21 = zext <4 x i1> %19 to <4 x i32>
  %22 = zext <4 x i1> %20 to <4 x i32>
  %23 = add <4 x i32> %vec.phi, %21
  %24 = add <4 x i32> %vec.phi16, %22
  %index.next = add nuw i32 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %25 = icmp eq i32 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %24, %23
  %26 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i32 %5, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader18

.lr.ph.preheader18:                               ; preds = %.lr.ph.preheader, %middle.block
  %.015.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %26, %middle.block ]
  %.0814.ph = phi i32 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader18, %.lr.ph
  %.015 = phi i32 [ %.1, %.lr.ph ], [ %.015.ph, %.lr.ph.preheader18 ]
  %.0814 = phi i32 [ %33, %.lr.ph ], [ %.0814.ph, %.lr.ph.preheader18 ]
  %27 = icmp ult i32 %.0814, 10
  %28 = add nsw i32 %.0814, -100
  %29 = icmp ult i32 %28, 900
  %or.cond = or i1 %27, %29
  %30 = add nsw i32 %.0814, -10000
  %31 = icmp ult i32 %30, 90000
  %or.cond12 = or i1 %31, %or.cond
  %32 = zext i1 %or.cond12 to i32
  %.1 = add i32 %.015, %32
  %33 = add nuw i32 %.0814, 1
  %exitcond.not = icmp eq i32 %.0814, %5
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %0
  %.0.lcssa = phi i32 [ 0, %0 ], [ %26, %middle.block ], [ %.1, %.lr.ph ]
  %34 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 6, ptr nonnull @_QQcl.4fe5942902a88e216f0feccac632fd1c, i32 22)
  %35 = call i1 @_FortranAioOutputInteger32(ptr %34, i32 %.0.lcssa)
  %36 = call i32 @_FortranAioEndIoStatement(ptr %34)
  %37 = 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 @_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: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #1

attributes #0 = { noreturn }
attributes #1 = { 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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
