program sample
    implicit none
  
    integer(8) :: i,j,k,m,n,l,r,d,a(10000),x,y,z
    
    read(*,*) n
    a(:)=0
    do i=1,100
        do j=1,100
            do k=1,100
                x=i**2+j**2+k**2+i*j+j*k+k*i
                if(x<=10000)then
                    a(x)=a(x)+1
                end if
            end do
        end do
    end do
    do i=1,n
        write(*,*) a(i)
    end do
    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"

@_QFEa = internal unnamed_addr global [10000 x i64] undef
@_QQcl.ba7aa2f586a3f0bda5258ebd961adefb = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_947/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
.preheader18.preheader:
  %0 = alloca i64, align 8
  %1 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.ba7aa2f586a3f0bda5258ebd961adefb, i32 6)
  %2 = call i1 @_FortranAioInputInteger(ptr %1, ptr nonnull %0, i32 8)
  %3 = call i32 @_FortranAioEndIoStatement(ptr %1)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80000) @_QFEa, i8 0, i64 80000, i1 false), !tbaa !3
  br label %.preheader18

.preheader18:                                     ; preds = %.preheader18.preheader, %30
  %4 = phi i64 [ %31, %30 ], [ 1, %.preheader18.preheader ]
  %5 = mul i64 %4, %4
  br label %.preheader

.preheader:                                       ; preds = %.preheader18, %28
  %6 = phi i64 [ 1, %.preheader18 ], [ %29, %28 ]
  %reass.add = add nuw nsw i64 %6, %4
  %reass.mul17 = mul i64 %reass.add, %6
  %7 = add i64 %reass.mul17, %5
  br label %8

8:                                                ; preds = %26, %.preheader
  %9 = phi i64 [ 1, %.preheader ], [ %27, %26 ]
  %reass.add15 = add nuw nsw i64 %reass.add, %9
  %reass.mul = mul i64 %reass.add15, %9
  %10 = add i64 %7, %reass.mul
  %11 = icmp slt i64 %10, 10001
  br i1 %11, label %12, label %17

12:                                               ; preds = %8
  %13 = add i64 %10, -1
  %14 = getelementptr [10000 x i64], ptr @_QFEa, i64 0, i64 %13
  %15 = load i64, ptr %14, align 8, !tbaa !3
  %16 = add i64 %15, 1
  store i64 %16, ptr %14, align 8, !tbaa !3
  br label %17

17:                                               ; preds = %12, %8
  %18 = add nuw nsw i64 %9, 1
  %reass.add15.1 = add nuw nsw i64 %reass.add, %18
  %reass.mul.1 = mul i64 %reass.add15.1, %18
  %19 = add i64 %7, %reass.mul.1
  %20 = icmp slt i64 %19, 10001
  br i1 %20, label %21, label %26

21:                                               ; preds = %17
  %22 = add i64 %19, -1
  %23 = getelementptr [10000 x i64], ptr @_QFEa, i64 0, i64 %22
  %24 = load i64, ptr %23, align 8, !tbaa !3
  %25 = add i64 %24, 1
  store i64 %25, ptr %23, align 8, !tbaa !3
  br label %26

26:                                               ; preds = %21, %17
  %27 = add nuw nsw i64 %9, 2
  %exitcond.not.1 = icmp eq i64 %27, 101
  br i1 %exitcond.not.1, label %28, label %8

28:                                               ; preds = %26
  %29 = add nuw nsw i64 %6, 1
  %exitcond20.not = icmp eq i64 %29, 101
  br i1 %exitcond20.not, label %30, label %.preheader

30:                                               ; preds = %28
  %31 = add nuw nsw i64 %4, 1
  %exitcond21.not = icmp eq i64 %31, 101
  br i1 %exitcond21.not, label %32, label %.preheader18

32:                                               ; preds = %30
  %33 = load i64, ptr %0, align 8, !tbaa !3
  %34 = icmp sgt i64 %33, 0
  br i1 %34, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %32, %.lr.ph
  %35 = phi i64 [ %42, %.lr.ph ], [ 1, %32 ]
  %36 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.ba7aa2f586a3f0bda5258ebd961adefb, i32 19)
  %37 = add nsw i64 %35, -1
  %38 = getelementptr [10000 x i64], ptr @_QFEa, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !3
  %40 = call i1 @_FortranAioOutputInteger64(ptr %36, i64 %39)
  %41 = call i32 @_FortranAioEndIoStatement(ptr %36)
  %42 = add nuw i64 %35, 1
  %exitcond22.not = icmp eq i64 %35, %33
  br i1 %exitcond22.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %32
  %43 = 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { noreturn }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }

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