program main
    implicit none
    integer n, x, y
    integer i,j,k
    integer, allocatable, dimension(:) :: d
    integer d1, d2, min
    read(*,*) n, x, y
    allocate(d(n-1))

    d = 0

    do i = 1, n-1
        do j = i+1, n
            d1 = j-i
            d2 = abs(i-x)+abs(j-y)+1
            if(d1 < d2) then
                min = d1
            else
                min = d2
            end if
            d(min) = d(min) + 1
        end do
    end do

    do k = 1, n-1
        write(*,*) d(k)
    end do

end program
; 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"

@_QFEd.0 = internal unnamed_addr global ptr null
@_QFEd.7 = internal unnamed_addr global i64 1
@_QQcl.50b3f7ceee68d6c19b8cca2c255be692 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1987/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.50b3f7ceee68d6c19b8cca2c255be692, i32 7)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %1, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %7 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %9 = load i32, ptr %1, align 4, !tbaa !3
  %10 = add i32 %9, -1
  %11 = call i32 @llvm.smax.i32(i32 %10, i32 0)
  %12 = zext i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 2
  %14 = call ptr @malloc(i64 %13)
  store ptr %14, ptr @_QFEd.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEd.7, align 8, !tbaa !7
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %0
  %.not207 = icmp slt i32 %10, 1
  br i1 %.not207, label %._crit_edge206, label %.loopexit.thread

.loopexit.thread:                                 ; preds = %.preheader
  %15 = call i64 @llvm.smax.i64(i64 %12, i64 1)
  %16 = shl nuw nsw i64 %15, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %14, i8 0, i64 %16, i1 false), !tbaa !3
  br label %.lr.ph202

.loopexit:                                        ; preds = %0
  %17 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.50b3f7ceee68d6c19b8cca2c255be692, i32 10)
  %.unpack186.unpack.unpack = load i64, ptr @_QFEd.7, align 8, !tbaa !7
  %18 = icmp slt i32 %10, 1
  %19 = select i1 %18, i64 1, i64 %.unpack186.unpack.unpack
  store ptr null, ptr @_QFEd.0, align 8, !tbaa !7
  store i64 %19, ptr @_QFEd.7, align 8, !tbaa !7
  %.pre = load i32, ptr %1, align 4, !tbaa !3
  %.pre217 = add i32 %.pre, -1
  %20 = icmp sgt i32 %.pre217, 0
  br i1 %20, label %.lr.ph202, label %._crit_edge206

.lr.ph202:                                        ; preds = %.loopexit.thread, %.loopexit
  %21 = phi i32 [ %9, %.loopexit.thread ], [ %.pre, %.loopexit ]
  %.unpack174.unpack.unpack224 = phi i64 [ 1, %.loopexit.thread ], [ %19, %.loopexit ]
  %.pre-phi223 = phi i32 [ %10, %.loopexit.thread ], [ %.pre217, %.loopexit ]
  %22 = zext i32 %.pre-phi223 to i64
  %23 = sext i32 %21 to i64
  %.pre215 = load i32, ptr %2, align 4
  %.pre216 = load i32, ptr %3, align 4
  br label %24

24:                                               ; preds = %.lr.ph202, %._crit_edge
  %indvars.iv = phi i64 [ 1, %.lr.ph202 ], [ %indvars.iv.next, %._crit_edge ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext = shl i64 %indvars.iv.next, 32
  %25 = ashr exact i64 %sext, 32
  %26 = sub nsw i64 1, %25
  %27 = add nsw i64 %26, %23
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %.lr.ph200.preheader, label %._crit_edge

.lr.ph200.preheader:                              ; preds = %24
  %29 = trunc i64 %indvars.iv.next to i32
  %30 = trunc i64 %indvars.iv to i32
  %31 = sub i32 %30, %.pre215
  %32 = call i32 @llvm.abs.i32(i32 %31, i1 false)
  %33 = add nuw i32 %32, 1
  br label %.lr.ph200

.lr.ph200:                                        ; preds = %.lr.ph200.preheader, %.lr.ph200
  %34 = phi i64 [ %46, %.lr.ph200 ], [ %27, %.lr.ph200.preheader ]
  %35 = phi i32 [ %45, %.lr.ph200 ], [ %29, %.lr.ph200.preheader ]
  %36 = sub i32 %35, %30
  %37 = sub i32 %35, %.pre216
  %38 = call i32 @llvm.abs.i32(i32 %37, i1 false)
  %39 = add i32 %33, %38
  %. = call i32 @llvm.smin.i32(i32 %36, i32 %39)
  %40 = sext i32 %. to i64
  %41 = sub i64 %40, %.unpack174.unpack.unpack224
  %42 = getelementptr i32, ptr %14, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = add i32 %43, 1
  store i32 %44, ptr %42, align 4, !tbaa !3
  %45 = add i32 %35, 1
  %46 = add nsw i64 %34, -1
  %47 = icmp ugt i64 %34, 1
  br i1 %47, label %.lr.ph200, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph200, %24
  %exitcond.not = icmp eq i64 %indvars.iv, %22
  br i1 %exitcond.not, label %.lr.ph205, label %24

.lr.ph205:                                        ; preds = %._crit_edge, %.lr.ph205
  %indvars.iv209 = phi i64 [ %indvars.iv.next210, %.lr.ph205 ], [ 1, %._crit_edge ]
  %48 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.50b3f7ceee68d6c19b8cca2c255be692, i32 26)
  %.unpack = load ptr, ptr @_QFEd.0, align 8, !tbaa !7
  %.unpack162.unpack.unpack = load i64, ptr @_QFEd.7, align 8, !tbaa !7
  %49 = sub i64 %indvars.iv209, %.unpack162.unpack.unpack
  %50 = getelementptr i32, ptr %.unpack, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !3
  %52 = call i1 @_FortranAioOutputInteger32(ptr %48, i32 %51)
  %53 = call i32 @_FortranAioEndIoStatement(ptr %48)
  %indvars.iv.next210 = add nuw nsw i64 %indvars.iv209, 1
  %exitcond212.not = icmp eq i64 %indvars.iv209, %22
  br i1 %exitcond212.not, label %._crit_edge206, label %.lr.ph205

._crit_edge206:                                   ; preds = %.lr.ph205, %.preheader, %.loopexit
  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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) 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 speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
