INTEGER N,A,B,X,ANS
CHARACTER(20) S
READ*,N,A,B
ANS=0
DO I=1,N
  X=0
  WRITE(S,"(I0)") I
  DO J=1,LEN_TRIM(S)
    X=X+ICHAR(S(J:J))-ICHAR("0")
  END DO
  IF( A<=X .AND. X<=B)ANS=ANS+I
END DO
PRINT"(I0)",ANS
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.0cf868cdce7b0af13e328765e6345267 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6525/source.f\00"
@_QQcl.28493029 = 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 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [20 x i8], align 1
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0cf868cdce7b0af13e328765e6345267, i32 3)
  %6 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %3, i32 4)
  %7 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %1, i32 4)
  %8 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %2, i32 4)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %10 = load i32, ptr %3, align 4, !tbaa !3
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph17.preheader, label %._crit_edge

.lr.ph17.preheader:                               ; preds = %0
  %12 = zext i32 %10 to i64
  br label %.lr.ph17

.lr.ph17:                                         ; preds = %.lr.ph17.preheader, %select.unfold._crit_edge
  %13 = phi i64 [ %52, %select.unfold._crit_edge ], [ %12, %.lr.ph17.preheader ]
  %14 = phi i32 [ %51, %select.unfold._crit_edge ], [ 1, %.lr.ph17.preheader ]
  %.0916 = phi i32 [ %spec.select, %select.unfold._crit_edge ], [ 0, %.lr.ph17.preheader ]
  %15 = call ptr @_FortranAioBeginInternalFormattedOutput(ptr nonnull %4, i64 20, ptr nonnull @_QQcl.28493029, i64 4, ptr null, ptr null, i64 0, ptr nonnull @_QQcl.0cf868cdce7b0af13e328765e6345267, i32 7)
  %16 = call i1 @_FortranAioOutputInteger32(ptr %15, i32 %14)
  %17 = call i32 @_FortranAioEndIoStatement(ptr %15)
  br label %18

18:                                               ; preds = %.lr.ph17, %18
  %19 = phi i64 [ 19, %.lr.ph17 ], [ %23, %18 ]
  %20 = getelementptr [20 x [1 x i8]], ptr %4, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !3
  %22 = icmp eq i8 %21, 32
  %23 = add nsw i64 %19, -1
  %24 = icmp ne i64 %19, 0
  %25 = and i1 %22, %24
  br i1 %25, label %18, label %26

26:                                               ; preds = %18
  %27 = shl i64 %19, 32
  %sext = add i64 %27, 4294967296
  %28 = ashr exact i64 %sext, 32
  %spec.select13 = select i1 %22, i64 0, i64 %28
  %29 = icmp sgt i64 %spec.select13, 0
  br i1 %29, label %select.unfold.preheader, label %select.unfold._crit_edge

select.unfold.preheader:                          ; preds = %26
  %min.iters.check = icmp ult i64 %spec.select13, 8
  br i1 %min.iters.check, label %select.unfold.preheader28, label %vector.ph

vector.ph:                                        ; preds = %select.unfold.preheader
  %n.vec = and i64 %spec.select13, -8
  %ind.end = or i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %36, %vector.body ]
  %vec.phi26 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %37, %vector.body ]
  %30 = getelementptr [20 x [1 x i8]], ptr %4, i64 0, i64 %index
  %wide.load = load <4 x i8>, ptr %30, align 1, !tbaa !3
  %31 = getelementptr i8, ptr %30, i64 4
  %wide.load27 = load <4 x i8>, ptr %31, align 1, !tbaa !3
  %32 = zext <4 x i8> %wide.load to <4 x i32>
  %33 = zext <4 x i8> %wide.load27 to <4 x i32>
  %34 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
  %35 = add <4 x i32> %vec.phi26, <i32 -48, i32 -48, i32 -48, i32 -48>
  %36 = add <4 x i32> %34, %32
  %37 = add <4 x i32> %35, %33
  %index.next = add nuw i64 %index, 8
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %37, %36
  %39 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %spec.select13, %n.vec
  br i1 %cmp.n, label %select.unfold._crit_edge, label %select.unfold.preheader28

select.unfold.preheader28:                        ; preds = %select.unfold.preheader, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %select.unfold.preheader ], [ %ind.end, %middle.block ]
  %.015.ph = phi i32 [ 0, %select.unfold.preheader ], [ %39, %middle.block ]
  br label %select.unfold

select.unfold:                                    ; preds = %select.unfold.preheader28, %select.unfold
  %indvars.iv = phi i64 [ %indvars.iv.next, %select.unfold ], [ %indvars.iv.ph, %select.unfold.preheader28 ]
  %.015 = phi i32 [ %44, %select.unfold ], [ %.015.ph, %select.unfold.preheader28 ]
  %40 = add nsw i64 %indvars.iv, -1
  %41 = getelementptr [20 x [1 x i8]], ptr %4, i64 0, i64 %40
  %.fca.0.load = load i8, ptr %41, align 1, !tbaa !3
  %42 = zext i8 %.fca.0.load to i32
  %43 = add i32 %.015, -48
  %44 = add i32 %43, %42
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %spec.select13
  br i1 %exitcond.not, label %select.unfold._crit_edge, label %select.unfold, !llvm.loop !10

select.unfold._crit_edge:                         ; preds = %select.unfold, %middle.block, %26
  %.0.lcssa = phi i32 [ 0, %26 ], [ %39, %middle.block ], [ %44, %select.unfold ]
  %45 = load i32, ptr %1, align 4, !tbaa !3
  %46 = icmp sle i32 %45, %.0.lcssa
  %47 = load i32, ptr %2, align 4, !tbaa !3
  %48 = icmp sle i32 %.0.lcssa, %47
  %49 = and i1 %46, %48
  %50 = select i1 %49, i32 %14, i32 0
  %spec.select = add i32 %50, %.0916
  %51 = add nuw i32 %14, 1
  %52 = add nsw i64 %13, -1
  %53 = icmp sgt i64 %13, 1
  br i1 %53, label %.lr.ph17, label %._crit_edge

._crit_edge:                                      ; preds = %select.unfold._crit_edge, %0
  %.09.lcssa = phi i32 [ 0, %0 ], [ %spec.select, %select.unfold._crit_edge ]
  %54 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28493029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.0cf868cdce7b0af13e328765e6345267, i32 13)
  %55 = call i1 @_FortranAioOutputInteger32(ptr %54, i32 %.09.lcssa)
  %56 = call i32 @_FortranAioEndIoStatement(ptr %54)
  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 @_FortranAioBeginInternalFormattedOutput(ptr, i64, ptr, i64, ptr, ptr, i64, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #0

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