program B
    implicit none
    integer :: N, L, m = 1000000, mi = 0, sum = 0, i, num
    read*,N, L
    do i = 0 , N - 1, 1
        num = L + i
        sum = sum + num
        if (abs(num) < m) then
            m = abs(num)
            mi = num
        endif
    enddo
    print*, sum - mi
end program B
; 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"

@_QFEm = internal unnamed_addr global i32 1000000
@_QFEmi = internal unnamed_addr global i32 0
@_QFEsum = internal unnamed_addr global i32 0
@_QQcl.32726f75a1bf28bf0f7aeaaa69f141c4 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3933/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.32726f75a1bf28bf0f7aeaaa69f141c4, i32 4)
  %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 %2, align 4, !tbaa !3
  %8 = add i32 %7, -1
  %9 = icmp sgt i32 %8, -1
  br i1 %9, label %.lr.ph, label %39

.lr.ph:                                           ; preds = %0
  %10 = zext i32 %8 to i64
  %11 = add nuw nsw i64 %10, 1
  %_QFEm.promoted = load i32, ptr @_QFEm, align 4, !tbaa !3
  %_QFEsum.promoted = load i32, ptr @_QFEsum, align 4, !tbaa !3
  %12 = load i32, ptr %1, align 4, !tbaa !3
  %xtraiter = and i64 %11, 1
  %13 = icmp eq i32 %8, 0
  br i1 %13, label %._crit_edge.unr-lcssa, label %.lr.ph.new

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

14:                                               ; preds = %31, %.lr.ph.new
  %15 = phi i32 [ 0, %.lr.ph.new ], [ %33, %31 ]
  %16 = phi i32 [ %_QFEsum.promoted, %.lr.ph.new ], [ %27, %31 ]
  %17 = phi i32 [ %_QFEm.promoted, %.lr.ph.new ], [ %32, %31 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %31 ]
  %18 = add i32 %12, %15
  %19 = add i32 %16, %18
  %20 = call i32 @llvm.abs.i32(i32 %18, i1 false)
  %21 = icmp slt i32 %20, %17
  br i1 %21, label %22, label %23

22:                                               ; preds = %14
  store i32 %20, ptr @_QFEm, align 4, !tbaa !3
  store i32 %18, ptr @_QFEmi, align 4, !tbaa !3
  br label %23

23:                                               ; preds = %22, %14
  %24 = phi i32 [ %20, %22 ], [ %17, %14 ]
  %25 = or i32 %15, 1
  %26 = add i32 %12, %25
  %27 = add i32 %19, %26
  %28 = call i32 @llvm.abs.i32(i32 %26, i1 false)
  %29 = icmp slt i32 %28, %24
  br i1 %29, label %30, label %31

30:                                               ; preds = %23
  store i32 %28, ptr @_QFEm, align 4, !tbaa !3
  store i32 %26, ptr @_QFEmi, align 4, !tbaa !3
  br label %31

31:                                               ; preds = %30, %23
  %32 = phi i32 [ %28, %30 ], [ %24, %23 ]
  %33 = add nuw i32 %15, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge.unr-lcssa, label %14

._crit_edge.unr-lcssa:                            ; preds = %31, %.lr.ph
  %.lcssa.ph = phi i32 [ undef, %.lr.ph ], [ %27, %31 ]
  %.unr7 = phi i32 [ 0, %.lr.ph ], [ %33, %31 ]
  %.unr8 = phi i32 [ %_QFEsum.promoted, %.lr.ph ], [ %27, %31 ]
  %.unr9 = phi i32 [ %_QFEm.promoted, %.lr.ph ], [ %32, %31 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.unr-lcssa
  %34 = add i32 %12, %.unr7
  %35 = add i32 %.unr8, %34
  %36 = call i32 @llvm.abs.i32(i32 %34, i1 false)
  %37 = icmp slt i32 %36, %.unr9
  br i1 %37, label %38, label %._crit_edge

38:                                               ; preds = %.epil.preheader
  store i32 %36, ptr @_QFEm, align 4, !tbaa !3
  store i32 %34, ptr @_QFEmi, align 4, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %.epil.preheader, %38, %._crit_edge.unr-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %35, %38 ], [ %35, %.epil.preheader ]
  store i32 %.lcssa, ptr @_QFEsum, align 4, !tbaa !3
  br label %39

39:                                               ; preds = %._crit_edge, %0
  %40 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.32726f75a1bf28bf0f7aeaaa69f141c4, i32 13)
  %41 = load i32, ptr @_QFEsum, align 4, !tbaa !3
  %42 = load i32, ptr @_QFEmi, align 4, !tbaa !3
  %43 = sub i32 %41, %42
  %44 = call i1 @_FortranAioOutputInteger32(ptr %40, i32 %43)
  %45 = call i32 @_FortranAioEndIoStatement(ptr %40)
  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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #0

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