program xyz_triplets
  implicit none
  integer :: n, f(10000) = 0, i, x, y, z, sx, sy, sz
  read(*,*) n
  do x = 1, n
    sx = x * x
    if (sx > n) exit
    do y = 1, n
      sy = sx + y * y + x * y
      if (sy > n) exit
      do z = 1, n
        sz = sy + z * z + y * z + z * x
        if (sz > n) exit
        f(sz) = f(sz) + 1
      end do
    end do
  end do
  write(*,'(i0)') (f(i), i = 1, n)
end program xyz_triplets
; 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"

@_QFEf = internal unnamed_addr global [10000 x i32] zeroinitializer
@_QQcl.7435d57db0a46add188ea318e4f7aec8 = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_946/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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.7435d57db0a46add188ea318e4f7aec8, i32 4)
  %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 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph.split.us.split.us.preheader, label %._crit_edge

.lr.ph.split.us.split.us.preheader:               ; preds = %0
  %7 = add nuw i32 %5, 1
  %wide.trip.count = zext i32 %7 to i64
  br label %.lr.ph.split.us.split.us

.lr.ph.split.us.split.us:                         ; preds = %.lr.ph.split.us.split.us.preheader, %._crit_edge43.split.us.us.us
  %.02346.us.us = phi i32 [ %10, %._crit_edge43.split.us.us.us ], [ 1, %.lr.ph.split.us.split.us.preheader ]
  %8 = mul i32 %.02346.us.us, %.02346.us.us
  %9 = icmp sgt i32 %8, %5
  br i1 %9, label %._crit_edge, label %.preheader36.us.us

._crit_edge43.split.us.us.us:                     ; preds = %._crit_edge.us.us.us, %.preheader36.us.us
  %10 = add nuw i32 %.02346.us.us, 1
  %exitcond65.not = icmp eq i32 %.02346.us.us, %5
  br i1 %exitcond65.not, label %._crit_edge, label %.lr.ph.split.us.split.us

.preheader36.us.us:                               ; preds = %.lr.ph.split.us.split.us, %._crit_edge.us.us.us
  %.02241.us.us.us = phi i32 [ %22, %._crit_edge.us.us.us ], [ 1, %.lr.ph.split.us.split.us ]
  %reass.add.us.us.us = add i32 %.02241.us.us.us, %.02346.us.us
  %reass.mul.us.us.us = mul i32 %reass.add.us.us.us, %.02241.us.us.us
  %11 = add i32 %reass.mul.us.us.us, %8
  %12 = icmp sgt i32 %11, %5
  br i1 %12, label %._crit_edge43.split.us.us.us, label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %.preheader36.us.us, %16
  %indvars.iv = phi i64 [ %indvars.iv.next, %16 ], [ 1, %.preheader36.us.us ]
  %13 = trunc i64 %indvars.iv to i32
  %reass.add34.us.us.us = add i32 %reass.add.us.us.us, %13
  %reass.mul35.us.us.us = mul i32 %reass.add34.us.us.us, %13
  %14 = add i32 %reass.mul35.us.us.us, %11
  %15 = icmp sgt i32 %14, %5
  br i1 %15, label %._crit_edge.us.us.us, label %16

16:                                               ; preds = %.preheader.us.us.us
  %17 = sext i32 %14 to i64
  %18 = add nsw i64 %17, -1
  %19 = getelementptr [10000 x i32], ptr @_QFEf, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !3
  %21 = add i32 %20, 1
  store i32 %21, ptr %19, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us.us.us, label %.preheader.us.us.us

._crit_edge.us.us.us:                             ; preds = %16, %.preheader.us.us.us
  %22 = add nuw i32 %.02241.us.us.us, 1
  %exitcond64.not = icmp eq i32 %.02241.us.us.us, %5
  br i1 %exitcond64.not, label %._crit_edge43.split.us.us.us, label %.preheader36.us.us

._crit_edge:                                      ; preds = %._crit_edge43.split.us.us.us, %.lr.ph.split.us.split.us, %0
  %23 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.7435d57db0a46add188ea318e4f7aec8, i32 18)
  %24 = load i32, ptr %1, align 4, !tbaa !3
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph59.preheader, label %._crit_edge60

.lr.ph59.preheader:                               ; preds = %._crit_edge
  %26 = zext i32 %24 to i64
  br label %.lr.ph59

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %.lr.ph59
  %27 = phi i64 [ %33, %.lr.ph59 ], [ 1, %.lr.ph59.preheader ]
  %sext = shl i64 %27, 32
  %28 = ashr exact i64 %sext, 32
  %29 = add nsw i64 %28, -1
  %30 = getelementptr [10000 x i32], ptr @_QFEf, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !3
  %32 = call i1 @_FortranAioOutputInteger32(ptr %23, i32 %31)
  %33 = add nuw nsw i64 %27, 1
  %exitcond66.not = icmp eq i64 %27, %26
  br i1 %exitcond66.not, label %._crit_edge60, label %.lr.ph59

._crit_edge60:                                    ; preds = %.lr.ph59, %._crit_edge
  %34 = call i32 @_FortranAioEndIoStatement(ptr %23)
  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 @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) 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"}
