program sample
    implicit none
  
    integer(8) :: i,j,m,n,k,s
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) k,s
    m=0
    do i=0,k
        do j=0,k
            if (s-i-j<=k .and. s-i-j>=0)then
                m=m+1
            end if
        end do
    end do
    write(*,*) m
  
    stop
end program sample
  


; 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.40fa7c3bb0cb00084c339fa788dd526c = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7601/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.40fa7c3bb0cb00084c339fa788dd526c, i32 7)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i64, ptr %1, align 8, !tbaa !3
  %8 = add i64 %7, 1
  %9 = icmp ult i64 %7, 9223372036854775807
  br i1 %9, label %.preheader.lr.ph, label %._crit_edge12

.preheader.lr.ph:                                 ; preds = %0
  %10 = load i64, ptr %2, align 8
  %11 = add i64 %7, 2
  %smin = call i64 @llvm.smin.i64(i64 %8, i64 1)
  %12 = sub i64 %11, %smin
  %min.iters.check = icmp ult i64 %12, 4
  %n.vec = and i64 %12, -4
  %ind.end = sub i64 %8, %n.vec
  %broadcast.splatinsert19 = insertelement <2 x i64> poison, i64 %10, i64 0
  %broadcast.splat20 = shufflevector <2 x i64> %broadcast.splatinsert19, <2 x i64> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert21 = insertelement <2 x i64> poison, i64 %10, i64 0
  %broadcast.splat22 = shufflevector <2 x i64> %broadcast.splatinsert21, <2 x i64> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert23 = insertelement <2 x i64> poison, i64 %7, i64 0
  %broadcast.splat24 = shufflevector <2 x i64> %broadcast.splatinsert23, <2 x i64> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert25 = insertelement <2 x i64> poison, i64 %7, i64 0
  %broadcast.splat26 = shufflevector <2 x i64> %broadcast.splatinsert25, <2 x i64> poison, <2 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %12, %n.vec
  br label %.preheader.us

.preheader.us:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph
  %13 = phi i64 [ %8, %.preheader.lr.ph ], [ %46, %._crit_edge.us ]
  %14 = phi i64 [ 0, %.preheader.lr.ph ], [ %45, %._crit_edge.us ]
  %.011.us = phi i64 [ 0, %.preheader.lr.ph ], [ %spec.select.us.lcssa, %._crit_edge.us ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.preheader.us
  %15 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.011.us, i64 0
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %14, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  %.scalar = add i64 %14, 2
  %16 = insertelement <2 x i64> poison, i64 %.scalar, i64 0
  %17 = shufflevector <2 x i64> %16, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %15, %vector.ph ], [ %30, %vector.body ]
  %vec.phi16 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %31, %vector.body ]
  %18 = add nuw <2 x i64> %vec.ind, %broadcast.splat
  %19 = add <2 x i64> %17, %vec.ind
  %20 = sub <2 x i64> %broadcast.splat20, %18
  %21 = sub <2 x i64> %broadcast.splat22, %19
  %22 = icmp sle <2 x i64> %20, %broadcast.splat24
  %23 = icmp sle <2 x i64> %21, %broadcast.splat26
  %24 = icmp sgt <2 x i64> %20, <i64 -1, i64 -1>
  %25 = icmp sgt <2 x i64> %21, <i64 -1, i64 -1>
  %26 = and <2 x i1> %22, %24
  %27 = and <2 x i1> %23, %25
  %28 = zext <2 x i1> %26 to <2 x i64>
  %29 = zext <2 x i1> %27 to <2 x i64>
  %30 = add <2 x i64> %vec.phi, %28
  %31 = add <2 x i64> %vec.phi16, %29
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %32 = icmp eq i64 %index.next, %n.vec
  br i1 %32, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %31, %30
  %33 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.preheader.us, %middle.block
  %.ph = phi i64 [ %8, %.preheader.us ], [ %ind.end, %middle.block ]
  %.ph27 = phi i64 [ 0, %.preheader.us ], [ %n.vec, %middle.block ]
  %.110.us.ph = phi i64 [ %.011.us, %.preheader.us ], [ %33, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %34 = phi i64 [ %43, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %35 = phi i64 [ %42, %scalar.ph ], [ %.ph27, %scalar.ph.preheader ]
  %.110.us = phi i64 [ %spec.select.us, %scalar.ph ], [ %.110.us.ph, %scalar.ph.preheader ]
  %36 = add nuw i64 %35, %14
  %37 = sub i64 %10, %36
  %38 = icmp sle i64 %37, %7
  %39 = icmp sgt i64 %37, -1
  %40 = and i1 %38, %39
  %41 = zext i1 %40 to i64
  %spec.select.us = add i64 %.110.us, %41
  %42 = add nuw nsw i64 %35, 1
  %43 = add nsw i64 %34, -1
  %44 = icmp sgt i64 %34, 1
  br i1 %44, label %scalar.ph, label %._crit_edge.us, !llvm.loop !10

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %spec.select.us.lcssa = phi i64 [ %33, %middle.block ], [ %spec.select.us, %scalar.ph ]
  %45 = add nuw i64 %14, 1
  %46 = add i64 %13, -1
  %47 = icmp sgt i64 %46, 0
  br i1 %47, label %.preheader.us, label %._crit_edge12

._crit_edge12:                                    ; preds = %._crit_edge.us, %0
  %.0.lcssa = phi i64 [ 0, %0 ], [ %spec.select.us.lcssa, %._crit_edge.us ]
  %48 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.40fa7c3bb0cb00084c339fa788dd526c, i32 16)
  %49 = call i1 @_FortranAioOutputInteger64(ptr %48, i64 %.0.lcssa)
  %50 = call i32 @_FortranAioEndIoStatement(ptr %48)
  %51 = 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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #2

attributes #0 = { noreturn }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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}
