program d
 integer :: n,i,j
 integer(8) :: a(0:9)=(/0,1,2,4,7,12,20,29,38,52/),f(10)=0
 read(*,*) n
 f(3)=1
 do i=4,n
  f(i)=f(i-1)*(a(i-2)+a(i-3)+1)
 enddo
 do i=1,n
  do j=1,n
   if(i==j)then
    write(*,'(i0,x)',advance='no') 0;cycle
   endif
   write(*,'(i0,x)',advance='no') f(max(i,j))*a(min(i,j))+1
  enddo
  write(*,*)
 enddo
end program d
; 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 constant [10 x i64] [i64 0, i64 1, i64 2, i64 4, i64 7, i64 12, i64 20, i64 29, i64 38, i64 52]
@_QFEf = internal unnamed_addr global [10 x i64] zeroinitializer
@_QQcl.0658f2c5d5599c0003726e482ed04d09 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4062/source.f\00"
@_QQcl.2869302C7829 = linkonce constant [6 x i8] c"(i0,x)"
@_QQcl.6E6F = linkonce constant [2 x i8] c"no"
@_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.0658f2c5d5599c0003726e482ed04d09, i32 4)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  store i64 1, ptr getelementptr inbounds ([10 x i64], ptr @_QFEf, i64 0, i64 2), align 16, !tbaa !3
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = icmp sgt i32 %5, 3
  br i1 %6, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %0
  %7 = zext i32 %5 to i64
  %8 = add nsw i64 %7, -3
  %xtraiter = and i64 %8, 1
  %9 = icmp eq i32 %5, 4
  br i1 %9, label %.preheader.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %8, -2
  br label %.lr.ph

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph, %.lr.ph.preheader
  %.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %31, %.lr.ph ]
  %.unr26 = phi i64 [ 1, %.lr.ph.preheader ], [ %34, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 4, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader.loopexit.unr-lcssa
  %10 = add nsw i64 %indvars.iv.unr, -1
  %11 = add nsw i64 %indvars.iv.unr, -2
  %12 = getelementptr [10 x i64], ptr @_QFEa, i64 0, i64 %11
  %13 = load i64, ptr %12, align 8, !tbaa !3
  %14 = add i64 %13, 1
  %15 = add i64 %14, %.unr
  %16 = mul i64 %15, %.unr26
  %17 = getelementptr [10 x i64], ptr @_QFEf, i64 0, i64 %10
  store i64 %16, ptr %17, align 8, !tbaa !3
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph.epil, %.preheader.loopexit.unr-lcssa, %0
  %18 = icmp sgt i32 %5, 0
  br i1 %18, label %.lr.ph21, label %._crit_edge22

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %19 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %31, %.lr.ph ]
  %20 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %34, %.lr.ph ]
  %indvars.iv = phi i64 [ 4, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %21 = add nsw i64 %indvars.iv, -1
  %22 = add nsw i64 %indvars.iv, -2
  %23 = getelementptr [10 x i64], ptr @_QFEa, i64 0, i64 %22
  %24 = load i64, ptr %23, align 16, !tbaa !3
  %25 = add i64 %24, 1
  %26 = add i64 %25, %19
  %27 = mul i64 %26, %20
  %28 = getelementptr [10 x i64], ptr @_QFEf, i64 0, i64 %21
  store i64 %27, ptr %28, align 8, !tbaa !3
  %29 = add nsw i64 %indvars.iv, -1
  %30 = getelementptr [10 x i64], ptr @_QFEa, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !3
  %32 = add i64 %31, 1
  %33 = add i64 %32, %24
  %34 = mul i64 %33, %27
  %35 = getelementptr [10 x i64], ptr @_QFEf, i64 0, i64 %indvars.iv
  store i64 %34, ptr %35, align 16, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph

.lr.ph21:                                         ; preds = %.preheader, %._crit_edge
  %.01220 = phi i32 [ %63, %._crit_edge ], [ 1, %.preheader ]
  %36 = load i32, ptr %1, align 4, !tbaa !3
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph18, label %._crit_edge

.lr.ph18:                                         ; preds = %.lr.ph21, %58
  %.017 = phi i32 [ %60, %58 ], [ 1, %.lr.ph21 ]
  %38 = icmp eq i32 %.01220, %.017
  br i1 %38, label %39, label %43

39:                                               ; preds = %.lr.ph18
  %40 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C7829, i64 6, ptr null, i32 -1, ptr nonnull @_QQcl.0658f2c5d5599c0003726e482ed04d09, i32 12)
  %41 = call i1 @_FortranAioSetAdvance(ptr %40, ptr nonnull @_QQcl.6E6F, i64 2)
  %42 = call i1 @_FortranAioOutputInteger32(ptr %40, i32 0)
  br label %58

43:                                               ; preds = %.lr.ph18
  %44 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C7829, i64 6, ptr null, i32 -1, ptr nonnull @_QQcl.0658f2c5d5599c0003726e482ed04d09, i32 14)
  %45 = call i1 @_FortranAioSetAdvance(ptr %44, ptr nonnull @_QQcl.6E6F, i64 2)
  %46 = call i32 @llvm.smax.i32(i32 %.01220, i32 %.017)
  %47 = sext i32 %46 to i64
  %48 = add nsw i64 %47, -1
  %49 = getelementptr [10 x i64], ptr @_QFEf, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !3
  %51 = call i32 @llvm.smin.i32(i32 %.01220, i32 %.017)
  %52 = sext i32 %51 to i64
  %53 = getelementptr [10 x i64], ptr @_QFEa, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !3
  %55 = mul i64 %54, %50
  %56 = add i64 %55, 1
  %57 = call i1 @_FortranAioOutputInteger64(ptr %44, i64 %56)
  br label %58

58:                                               ; preds = %39, %43
  %.sink = phi ptr [ %40, %39 ], [ %44, %43 ]
  %59 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  %60 = add nuw i32 %.017, 1
  %exitcond24.not = icmp eq i32 %.017, %36
  br i1 %exitcond24.not, label %._crit_edge, label %.lr.ph18

._crit_edge:                                      ; preds = %58, %.lr.ph21
  %61 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.0658f2c5d5599c0003726e482ed04d09, i32 16)
  %62 = call i32 @_FortranAioEndIoStatement(ptr %61)
  %63 = add nuw i32 %.01220, 1
  %exitcond25.not = icmp eq i32 %.01220, %5
  br i1 %exitcond25.not, label %._crit_edge22, label %.lr.ph21

._crit_edge22:                                    ; preds = %._crit_edge, %.preheader
  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 @_FortranAioSetAdvance(ptr, ptr, i64) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #0

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

attributes #0 = { nocallback nofree nosync nounwind speculatable 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"}
