program main
    integer::n,a=0,t=0,i
    integer,allocatable::h(:)
    read *,n
    allocate(h(n))
    read *,h(:)
    do i=2,n
    	if(h(i-1)>=h(i))then
        	t=t+1
        else
        	a=max(a,t)
            t=0
        end if
    end do
    a=max(a,t)
    print '(i0)',a
end program main
; 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 i32 0
@_QFEh.0 = internal unnamed_addr global ptr null
@_QFEh.8 = internal unnamed_addr global i64 0
@_QFEt = internal unnamed_addr global i32 0
@_QQcl.bdfb91a0d674419ba414044577dcfd11 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3365/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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 { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.bdfb91a0d674419ba414044577dcfd11, i32 4)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i32, ptr %2, align 4, !tbaa !3
  %7 = call i32 @llvm.smax.i32(i32 %6, i32 0)
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 2
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEh.8, align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.bdfb91a0d674419ba414044577dcfd11, i32 6)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack84.unpack.unpack86 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  %12 = call i64 @llvm.smax.i64(i64 %.unpack84.unpack.unpack86, i64 0)
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %12, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %13 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %15 = load i32, ptr %2, align 4, !tbaa !3
  %16 = icmp sgt i32 %15, 1
  br i1 %16, label %.lr.ph, label %._crit_edge104

._crit_edge104:                                   ; preds = %0
  %.pre = load i32, ptr @_QFEa, align 4, !tbaa !3
  %.pre105 = load i32, ptr @_QFEt, align 4, !tbaa !3
  br label %48

.lr.ph:                                           ; preds = %0
  %17 = zext i32 %15 to i64
  %_QFEa.promoted = load i32, ptr @_QFEa, align 4, !tbaa !3
  %_QFEt.promoted = load i32, ptr @_QFEt, align 4, !tbaa !3
  %.unpack89 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %18 = add nsw i64 %17, -1
  %xtraiter = and i64 %18, 1
  %19 = icmp eq i32 %15, 2
  br i1 %19, label %._crit_edge.unr-lcssa, label %.lr.ph.new

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

20:                                               ; preds = %20, %.lr.ph.new
  %indvars.iv = phi i64 [ 2, %.lr.ph.new ], [ %indvars.iv.next.1, %20 ]
  %storemerge101102 = phi i32 [ %_QFEt.promoted, %.lr.ph.new ], [ %storemerge.1, %20 ]
  %21 = phi i32 [ %_QFEa.promoted, %.lr.ph.new ], [ %38, %20 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %20 ]
  %22 = add nsw i64 %indvars.iv, -2
  %23 = getelementptr i32, ptr %.unpack89, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !3
  %25 = add nsw i64 %indvars.iv, -1
  %26 = getelementptr i32, ptr %.unpack89, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !3
  %.not = icmp slt i32 %24, %27
  %28 = call i32 @llvm.smax.i32(i32 %21, i32 %storemerge101102)
  %29 = add i32 %storemerge101102, 1
  %30 = select i1 %.not, i32 %28, i32 %21
  %storemerge = select i1 %.not, i32 0, i32 %29
  %31 = add nsw i64 %indvars.iv, -1
  %32 = getelementptr i32, ptr %.unpack89, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !3
  %34 = getelementptr i32, ptr %.unpack89, i64 %indvars.iv
  %35 = load i32, ptr %34, align 4, !tbaa !3
  %.not.1 = icmp slt i32 %33, %35
  %36 = call i32 @llvm.smax.i32(i32 %30, i32 %storemerge)
  %37 = add i32 %storemerge, 1
  %38 = select i1 %.not.1, i32 %36, i32 %30
  %storemerge.1 = select i1 %.not.1, i32 0, i32 %37
  %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 %._crit_edge.unr-lcssa, label %20

._crit_edge.unr-lcssa:                            ; preds = %20, %.lr.ph
  %.lcssa.ph = phi i32 [ undef, %.lr.ph ], [ %38, %20 ]
  %storemerge.lcssa.ph = phi i32 [ undef, %.lr.ph ], [ %storemerge.1, %20 ]
  %indvars.iv.unr = phi i64 [ 2, %.lr.ph ], [ %indvars.iv.next.1, %20 ]
  %storemerge101102.unr = phi i32 [ %_QFEt.promoted, %.lr.ph ], [ %storemerge.1, %20 ]
  %.unr = phi i32 [ %_QFEa.promoted, %.lr.ph ], [ %38, %20 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %._crit_edge.unr-lcssa
  %39 = add nsw i64 %indvars.iv.unr, -2
  %40 = getelementptr i32, ptr %.unpack89, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !3
  %42 = add nsw i64 %indvars.iv.unr, -1
  %43 = getelementptr i32, ptr %.unpack89, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %.not.epil = icmp slt i32 %41, %44
  %45 = call i32 @llvm.smax.i32(i32 %.unr, i32 %storemerge101102.unr)
  %46 = add i32 %storemerge101102.unr, 1
  %47 = select i1 %.not.epil, i32 %45, i32 %.unr
  %storemerge.epil = select i1 %.not.epil, i32 0, i32 %46
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %47, %._crit_edge.epilog-lcssa ]
  %storemerge.lcssa = phi i32 [ %storemerge.lcssa.ph, %._crit_edge.unr-lcssa ], [ %storemerge.epil, %._crit_edge.epilog-lcssa ]
  store i32 %storemerge.lcssa, ptr @_QFEt, align 4, !tbaa !3
  br label %48

48:                                               ; preds = %._crit_edge104, %._crit_edge
  %49 = phi i32 [ %.pre105, %._crit_edge104 ], [ %storemerge.lcssa, %._crit_edge ]
  %50 = phi i32 [ %.pre, %._crit_edge104 ], [ %.lcssa, %._crit_edge ]
  %51 = call i32 @llvm.smax.i32(i32 %50, i32 %49)
  store i32 %51, ptr @_QFEa, align 4, !tbaa !3
  %52 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.bdfb91a0d674419ba414044577dcfd11, i32 16)
  %53 = load i32, ptr @_QFEa, align 4, !tbaa !3
  %54 = call i1 @_FortranAioOutputInteger32(ptr %52, i32 %53)
  %55 = call i32 @_FortranAioEndIoStatement(ptr %52)
  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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, 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

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) }

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