program main
 implicit none
 integer*8 n,l,ans,i
 read(*,*) n,l
 ans = 0
 do i = l,l+n-1
  ans = ans + i
 end do
 if(l >= 0) then
  write(*,*) ans - l
 else if(l+n-1 < 0) then
  write(*,*) ans - (l+n-1)
 else
  write(*,*) ans
 end if
end program main
; 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.c830654dbcf0fdd8a6696ab300b7c00a = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3924/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

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

.lr.ph.preheader:                                 ; preds = %0
  %10 = add nsw i64 %8, -1
  %11 = add i64 %7, 1
  %12 = mul i64 %10, %11
  %13 = zext i64 %10 to i65
  %14 = add nsw i64 %8, -2
  %15 = zext i64 %14 to i65
  %16 = mul i65 %13, %15
  %17 = lshr i65 %16, 1
  %18 = trunc i65 %17 to i64
  %19 = add i64 %7, %12
  %20 = add i64 %19, %18
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %0
  %.0.lcssa = phi i64 [ 0, %0 ], [ %20, %.lr.ph.preheader ]
  %21 = icmp sgt i64 %7, -1
  br i1 %21, label %22, label %27

22:                                               ; preds = %._crit_edge
  %23 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c830654dbcf0fdd8a6696ab300b7c00a, i32 10)
  %24 = load i64, ptr %1, align 8, !tbaa !3
  %25 = sub i64 %.0.lcssa, %24
  %26 = call i1 @_FortranAioOutputInteger64(ptr %23, i64 %25)
  br label %41

27:                                               ; preds = %._crit_edge
  %28 = add i64 %7, -1
  %29 = add i64 %28, %8
  %30 = icmp slt i64 %29, 0
  br i1 %30, label %31, label %38

31:                                               ; preds = %27
  %32 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c830654dbcf0fdd8a6696ab300b7c00a, i32 12)
  %33 = load i64, ptr %1, align 8, !tbaa !3
  %34 = load i64, ptr %2, align 8, !tbaa !3
  %.neg9 = add i64 %.0.lcssa, 1
  %35 = add i64 %33, %34
  %36 = sub i64 %.neg9, %35
  %37 = call i1 @_FortranAioOutputInteger64(ptr %32, i64 %36)
  br label %41

38:                                               ; preds = %27
  %39 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c830654dbcf0fdd8a6696ab300b7c00a, i32 14)
  %40 = call i1 @_FortranAioOutputInteger64(ptr %39, i64 %.0.lcssa)
  br label %41

41:                                               ; preds = %22, %31, %38
  %.sink = phi ptr [ %23, %22 ], [ %32, %31 ], [ %39, %38 ]
  %42 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  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 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

!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"}
