program main
	implicit none
	integer :: n,l(1000),r(1000),sv
	integer::i
	read(*,*)n
	do i=1,n
		read(*,*)l(i),r(i)
	enddo
	do i=1,n
		sv=sv+r(i)-l(i)+1
	enddo
	write(*,*)sv
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"

@_QFEl = internal global [1000 x i32] undef
@_QFEr = internal global [1000 x i32] undef
@_QQcl.b6542a5644f9fd3ce1eea7087aafd855 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6922/source.f\00"
@_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.b6542a5644f9fd3ce1eea7087aafd855, i32 5)
  %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 = sext i32 %5 to i64
  %7 = icmp sgt i32 %5, 0
  br i1 %7, label %.lr.ph, label %._crit_edge12

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %8 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.b6542a5644f9fd3ce1eea7087aafd855, i32 7)
  %9 = add nsw i64 %indvars.iv, -1
  %10 = getelementptr [1000 x i32], ptr @_QFEl, i64 0, i64 %9
  %11 = call i1 @_FortranAioInputInteger(ptr %8, ptr %10, i32 4)
  %12 = getelementptr [1000 x i32], ptr @_QFEr, i64 0, i64 %9
  %13 = call i1 @_FortranAioInputInteger(ptr %8, ptr %12, i32 4)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %6
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %.pre = load i32, ptr %1, align 4, !tbaa !3
  %.pre18 = sext i32 %.pre to i64
  %15 = icmp sgt i32 %.pre, 0
  br i1 %15, label %.lr.ph11.preheader, label %._crit_edge12

.lr.ph11.preheader:                               ; preds = %._crit_edge
  %min.iters.check = icmp ult i32 %.pre, 8
  br i1 %min.iters.check, label %.lr.ph11.preheader24, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph11.preheader
  %n.vec = and i64 %.pre18, -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> [ <i32 undef, i32 0, i32 0, i32 0>, %vector.ph ], [ %24, %vector.body ]
  %vec.phi20 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %25, %vector.body ]
  %16 = getelementptr [1000 x i32], ptr @_QFEr, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %16, align 16, !tbaa !3
  %17 = getelementptr i32, ptr %16, i64 4
  %wide.load21 = load <4 x i32>, ptr %17, align 16, !tbaa !3
  %18 = getelementptr [1000 x i32], ptr @_QFEl, i64 0, i64 %index
  %wide.load22 = load <4 x i32>, ptr %18, align 16, !tbaa !3
  %19 = getelementptr i32, ptr %18, i64 4
  %wide.load23 = load <4 x i32>, ptr %19, align 16, !tbaa !3
  %20 = add <4 x i32> %vec.phi, <i32 1, i32 1, i32 1, i32 1>
  %21 = add <4 x i32> %vec.phi20, <i32 1, i32 1, i32 1, i32 1>
  %22 = add <4 x i32> %20, %wide.load
  %23 = add <4 x i32> %21, %wide.load21
  %24 = sub <4 x i32> %22, %wide.load22
  %25 = sub <4 x i32> %23, %wide.load23
  %index.next = add nuw i64 %index, 8
  %26 = icmp eq i64 %index.next, %n.vec
  br i1 %26, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %25, %24
  %27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %.pre18
  br i1 %cmp.n, label %._crit_edge12, label %.lr.ph11.preheader24

.lr.ph11.preheader24:                             ; preds = %.lr.ph11.preheader, %middle.block
  %indvars.iv14.ph = phi i64 [ 1, %.lr.ph11.preheader ], [ %ind.end, %middle.block ]
  %.09.ph = phi i32 [ undef, %.lr.ph11.preheader ], [ %27, %middle.block ]
  br label %.lr.ph11

.lr.ph11:                                         ; preds = %.lr.ph11.preheader24, %.lr.ph11
  %indvars.iv14 = phi i64 [ %indvars.iv.next15, %.lr.ph11 ], [ %indvars.iv14.ph, %.lr.ph11.preheader24 ]
  %.09 = phi i32 [ %35, %.lr.ph11 ], [ %.09.ph, %.lr.ph11.preheader24 ]
  %28 = add nsw i64 %indvars.iv14, -1
  %29 = getelementptr [1000 x i32], ptr @_QFEr, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !3
  %31 = getelementptr [1000 x i32], ptr @_QFEl, i64 0, i64 %28
  %32 = load i32, ptr %31, align 4, !tbaa !3
  %33 = add i32 %.09, 1
  %34 = add i32 %33, %30
  %35 = sub i32 %34, %32
  %indvars.iv.next15 = add nuw nsw i64 %indvars.iv14, 1
  %exitcond17.not = icmp eq i64 %indvars.iv14, %.pre18
  br i1 %exitcond17.not, label %._crit_edge12, label %.lr.ph11, !llvm.loop !10

._crit_edge12:                                    ; preds = %.lr.ph11, %middle.block, %0, %._crit_edge
  %.0.lcssa = phi i32 [ undef, %._crit_edge ], [ undef, %0 ], [ %27, %middle.block ], [ %35, %.lr.ph11 ]
  %36 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.b6542a5644f9fd3ce1eea7087aafd855, i32 12)
  %37 = call i1 @_FortranAioOutputInteger32(ptr %36, i32 %.0.lcssa)
  %38 = call i32 @_FortranAioEndIoStatement(ptr %36)
  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 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}
