integer,allocatable,dimension(:)::A,B
integer N
integer check
read*,N
allocate(a(N),B(N))
read*,a
b=a
call heapsort(n,b)
check=0
do i=1,N
  if(a(i)==b(i))cycle
  check=check+1 
end do
if(check<=2)then
  print"(A)","YES"
else
  print"(A)","NO"
endif
contains
subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)
  integer::i,k,j,l
  integer:: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort
end
; 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.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEb.0 = internal unnamed_addr global ptr null
@_QFEb.7 = internal unnamed_addr global i64 1
@_QFEb.8 = internal unnamed_addr global i64 0
@_QQcl.f24438c2a81c1caf8844a1a4eb7e9a74 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3653/source.f\00"
@_QQcl.284129 = linkonce constant [3 x i8] c"(A)"
@_QQcl.594553 = linkonce constant [3 x i8] c"YES"
@_QQcl.4E4F = linkonce constant [2 x i8] c"NO"
@_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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

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.f24438c2a81c1caf8844a1a4eb7e9a74, 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 @_QFEa.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEa.8, align 8, !tbaa !7
  %11 = call ptr @malloc(i64 %9)
  store ptr %11, ptr @_QFEb.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEb.7, align 8, !tbaa !7
  store i64 %8, ptr @_QFEb.8, align 8, !tbaa !7
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f24438c2a81c1caf8844a1a4eb7e9a74, i32 6)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack308.unpack.unpack310 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  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 %.unpack308.unpack.unpack310, 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 %12, ptr nonnull %1)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %.unpack313 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack313407 = ptrtoint ptr %.unpack313 to i64
  %.unpack320.unpack.unpack322 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %.unpack325 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %.unpack325410 = ptrtoint ptr %.unpack325 to i64
  %.not = icmp eq ptr %.unpack325, null
  br i1 %.not, label %84, label %15

15:                                               ; preds = %0
  %.unpack332.unpack.unpack334 = load i64, ptr @_QFEb.8, align 8, !tbaa !7
  %.not384 = icmp eq i64 %.unpack332.unpack.unpack334, %.unpack320.unpack.unpack322
  br i1 %.not384, label %.preheader, label %31

.preheader:                                       ; preds = %15
  %16 = icmp sgt i64 %.unpack320.unpack.unpack322, 0
  br i1 %16, label %.lr.ph386.preheader, label %._crit_edge

.lr.ph386.preheader:                              ; preds = %.preheader
  %min.iters.check414 = icmp ult i64 %.unpack320.unpack.unpack322, 8
  %17 = sub i64 %.unpack325410, %.unpack313407
  %diff.check411 = icmp ult i64 %17, 32
  %or.cond = select i1 %min.iters.check414, i1 true, i1 %diff.check411
  br i1 %or.cond, label %.lr.ph386.preheader462, label %vector.ph415

vector.ph415:                                     ; preds = %.lr.ph386.preheader
  %n.vec417 = and i64 %.unpack320.unpack.unpack322, -8
  br label %vector.body420

vector.body420:                                   ; preds = %vector.body420, %vector.ph415
  %index421 = phi i64 [ 0, %vector.ph415 ], [ %index.next424, %vector.body420 ]
  %18 = getelementptr i32, ptr %.unpack313, i64 %index421
  %wide.load422 = load <4 x i32>, ptr %18, align 4, !tbaa !3
  %19 = getelementptr i32, ptr %18, i64 4
  %wide.load423 = load <4 x i32>, ptr %19, align 4, !tbaa !3
  %20 = getelementptr i32, ptr %.unpack325, i64 %index421
  store <4 x i32> %wide.load422, ptr %20, align 4, !tbaa !3
  %21 = getelementptr i32, ptr %20, i64 4
  store <4 x i32> %wide.load423, ptr %21, align 4, !tbaa !3
  %index.next424 = add nuw i64 %index421, 8
  %22 = icmp eq i64 %index.next424, %n.vec417
  br i1 %22, label %middle.block412, label %vector.body420, !llvm.loop !9

middle.block412:                                  ; preds = %vector.body420
  %cmp.n419 = icmp eq i64 %.unpack320.unpack.unpack322, %n.vec417
  br i1 %cmp.n419, label %._crit_edge, label %.lr.ph386.preheader462

.lr.ph386.preheader462:                           ; preds = %.lr.ph386.preheader, %middle.block412
  %.ph463 = phi i64 [ 0, %.lr.ph386.preheader ], [ %n.vec417, %middle.block412 ]
  %23 = xor i64 %.ph463, -1
  %24 = add i64 %.unpack320.unpack.unpack322, %23
  %xtraiter467 = and i64 %.unpack320.unpack.unpack322, 3
  %lcmp.mod468.not = icmp eq i64 %xtraiter467, 0
  br i1 %lcmp.mod468.not, label %.lr.ph386.prol.loopexit, label %.lr.ph386.prol

.lr.ph386.prol:                                   ; preds = %.lr.ph386.preheader462, %.lr.ph386.prol
  %25 = phi i64 [ %28, %.lr.ph386.prol ], [ %.ph463, %.lr.ph386.preheader462 ]
  %prol.iter469 = phi i64 [ %prol.iter469.next, %.lr.ph386.prol ], [ 0, %.lr.ph386.preheader462 ]
  %26 = getelementptr i32, ptr %.unpack313, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !3
  %28 = add nuw nsw i64 %25, 1
  %29 = getelementptr i32, ptr %.unpack325, i64 %25
  store i32 %27, ptr %29, align 4, !tbaa !3
  %prol.iter469.next = add i64 %prol.iter469, 1
  %prol.iter469.cmp.not = icmp eq i64 %prol.iter469.next, %xtraiter467
  br i1 %prol.iter469.cmp.not, label %.lr.ph386.prol.loopexit, label %.lr.ph386.prol, !llvm.loop !12

.lr.ph386.prol.loopexit:                          ; preds = %.lr.ph386.prol, %.lr.ph386.preheader462
  %.unr470 = phi i64 [ %.ph463, %.lr.ph386.preheader462 ], [ %28, %.lr.ph386.prol ]
  %30 = icmp ult i64 %24, 3
  br i1 %30, label %._crit_edge, label %.lr.ph386

31:                                               ; preds = %15
  %32 = shl i64 %.unpack320.unpack.unpack322, 2
  %33 = call ptr @malloc(i64 %32)
  %34 = icmp sgt i64 %.unpack320.unpack.unpack322, 0
  br i1 %34, label %.lr.ph.preheader, label %.thread383

.lr.ph.preheader:                                 ; preds = %31
  %35 = ptrtoint ptr %33 to i64
  %min.iters.check = icmp ult i64 %.unpack320.unpack.unpack322, 8
  %36 = sub i64 %35, %.unpack313407
  %diff.check = icmp ult i64 %36, 32
  %or.cond456 = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond456, label %.lr.ph.preheader464, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %.unpack320.unpack.unpack322, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %37 = getelementptr i32, ptr %.unpack313, i64 %index
  %wide.load = load <4 x i32>, ptr %37, align 4, !tbaa !3
  %38 = getelementptr i32, ptr %37, i64 4
  %wide.load408 = load <4 x i32>, ptr %38, align 4, !tbaa !3
  %39 = getelementptr i32, ptr %33, i64 %index
  store <4 x i32> %wide.load, ptr %39, align 4, !tbaa !3
  %40 = getelementptr i32, ptr %39, i64 4
  store <4 x i32> %wide.load408, ptr %40, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %.unpack320.unpack.unpack322, %n.vec
  br i1 %cmp.n, label %.loopexit, label %.lr.ph.preheader464

.lr.ph.preheader464:                              ; preds = %.lr.ph.preheader, %middle.block
  %.ph465 = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %42 = xor i64 %.ph465, -1
  %43 = add i64 %.unpack320.unpack.unpack322, %42
  %xtraiter = and i64 %.unpack320.unpack.unpack322, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader464, %.lr.ph.prol
  %44 = phi i64 [ %47, %.lr.ph.prol ], [ %.ph465, %.lr.ph.preheader464 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader464 ]
  %45 = getelementptr i32, ptr %.unpack313, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !3
  %47 = add nuw nsw i64 %44, 1
  %48 = getelementptr i32, ptr %33, i64 %44
  store i32 %46, ptr %48, align 4, !tbaa !3
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !15

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader464
  %.unr = phi i64 [ %.ph465, %.lr.ph.preheader464 ], [ %47, %.lr.ph.prol ]
  %49 = icmp ult i64 %43, 3
  br i1 %49, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %50 = phi i64 [ %65, %.lr.ph ], [ %.unr, %.lr.ph.prol.loopexit ]
  %51 = getelementptr i32, ptr %.unpack313, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !3
  %53 = add nuw nsw i64 %50, 1
  %54 = getelementptr i32, ptr %33, i64 %50
  store i32 %52, ptr %54, align 4, !tbaa !3
  %55 = getelementptr i32, ptr %.unpack313, i64 %53
  %56 = load i32, ptr %55, align 4, !tbaa !3
  %57 = add nuw nsw i64 %50, 2
  %58 = getelementptr i32, ptr %33, i64 %53
  store i32 %56, ptr %58, align 4, !tbaa !3
  %59 = getelementptr i32, ptr %.unpack313, i64 %57
  %60 = load i32, ptr %59, align 4, !tbaa !3
  %61 = add nuw nsw i64 %50, 3
  %62 = getelementptr i32, ptr %33, i64 %57
  store i32 %60, ptr %62, align 4, !tbaa !3
  %63 = getelementptr i32, ptr %.unpack313, i64 %61
  %64 = load i32, ptr %63, align 4, !tbaa !3
  %65 = add nuw nsw i64 %50, 4
  %66 = getelementptr i32, ptr %33, i64 %61
  store i32 %64, ptr %66, align 4, !tbaa !3
  %exitcond.not.3 = icmp eq i64 %65, %.unpack320.unpack.unpack322
  br i1 %exitcond.not.3, label %.loopexit, label %.lr.ph, !llvm.loop !16

.lr.ph386:                                        ; preds = %.lr.ph386.prol.loopexit, %.lr.ph386
  %67 = phi i64 [ %82, %.lr.ph386 ], [ %.unr470, %.lr.ph386.prol.loopexit ]
  %68 = getelementptr i32, ptr %.unpack313, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !3
  %70 = add nuw nsw i64 %67, 1
  %71 = getelementptr i32, ptr %.unpack325, i64 %67
  store i32 %69, ptr %71, align 4, !tbaa !3
  %72 = getelementptr i32, ptr %.unpack313, i64 %70
  %73 = load i32, ptr %72, align 4, !tbaa !3
  %74 = add nuw nsw i64 %67, 2
  %75 = getelementptr i32, ptr %.unpack325, i64 %70
  store i32 %73, ptr %75, align 4, !tbaa !3
  %76 = getelementptr i32, ptr %.unpack313, i64 %74
  %77 = load i32, ptr %76, align 4, !tbaa !3
  %78 = add nuw nsw i64 %67, 3
  %79 = getelementptr i32, ptr %.unpack325, i64 %74
  store i32 %77, ptr %79, align 4, !tbaa !3
  %80 = getelementptr i32, ptr %.unpack313, i64 %78
  %81 = load i32, ptr %80, align 4, !tbaa !3
  %82 = add nuw nsw i64 %67, 4
  %83 = getelementptr i32, ptr %.unpack325, i64 %78
  store i32 %81, ptr %83, align 4, !tbaa !3
  %exitcond394.not.3 = icmp eq i64 %82, %.unpack320.unpack.unpack322
  br i1 %exitcond394.not.3, label %._crit_edge, label %.lr.ph386, !llvm.loop !17

84:                                               ; preds = %0
  %85 = shl i64 %.unpack320.unpack.unpack322, 2
  %86 = call ptr @malloc(i64 %85)
  %87 = icmp sgt i64 %.unpack320.unpack.unpack322, 0
  br i1 %87, label %.lr.ph388.preheader, label %.loopexit.thread

.lr.ph388.preheader:                              ; preds = %84
  %88 = ptrtoint ptr %86 to i64
  %min.iters.check429 = icmp ult i64 %.unpack320.unpack.unpack322, 8
  %89 = sub i64 %88, %.unpack313407
  %diff.check426 = icmp ult i64 %89, 32
  %or.cond457 = select i1 %min.iters.check429, i1 true, i1 %diff.check426
  br i1 %or.cond457, label %.lr.ph388.preheader460, label %vector.ph430

vector.ph430:                                     ; preds = %.lr.ph388.preheader
  %n.vec432 = and i64 %.unpack320.unpack.unpack322, -8
  br label %vector.body435

vector.body435:                                   ; preds = %vector.body435, %vector.ph430
  %index436 = phi i64 [ 0, %vector.ph430 ], [ %index.next439, %vector.body435 ]
  %90 = getelementptr i32, ptr %.unpack313, i64 %index436
  %wide.load437 = load <4 x i32>, ptr %90, align 4, !tbaa !3
  %91 = getelementptr i32, ptr %90, i64 4
  %wide.load438 = load <4 x i32>, ptr %91, align 4, !tbaa !3
  %92 = getelementptr i32, ptr %86, i64 %index436
  store <4 x i32> %wide.load437, ptr %92, align 4, !tbaa !3
  %93 = getelementptr i32, ptr %92, i64 4
  store <4 x i32> %wide.load438, ptr %93, align 4, !tbaa !3
  %index.next439 = add nuw i64 %index436, 8
  %94 = icmp eq i64 %index.next439, %n.vec432
  br i1 %94, label %middle.block427, label %vector.body435, !llvm.loop !18

middle.block427:                                  ; preds = %vector.body435
  %cmp.n434 = icmp eq i64 %.unpack320.unpack.unpack322, %n.vec432
  br i1 %cmp.n434, label %.loopexit, label %.lr.ph388.preheader460

.lr.ph388.preheader460:                           ; preds = %.lr.ph388.preheader, %middle.block427
  %.ph461 = phi i64 [ 0, %.lr.ph388.preheader ], [ %n.vec432, %middle.block427 ]
  %95 = xor i64 %.ph461, -1
  %96 = add i64 %.unpack320.unpack.unpack322, %95
  %xtraiter471 = and i64 %.unpack320.unpack.unpack322, 3
  %lcmp.mod472.not = icmp eq i64 %xtraiter471, 0
  br i1 %lcmp.mod472.not, label %.lr.ph388.prol.loopexit, label %.lr.ph388.prol

.lr.ph388.prol:                                   ; preds = %.lr.ph388.preheader460, %.lr.ph388.prol
  %97 = phi i64 [ %100, %.lr.ph388.prol ], [ %.ph461, %.lr.ph388.preheader460 ]
  %prol.iter473 = phi i64 [ %prol.iter473.next, %.lr.ph388.prol ], [ 0, %.lr.ph388.preheader460 ]
  %98 = getelementptr i32, ptr %.unpack313, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !3
  %100 = add nuw nsw i64 %97, 1
  %101 = getelementptr i32, ptr %86, i64 %97
  store i32 %99, ptr %101, align 4, !tbaa !3
  %prol.iter473.next = add i64 %prol.iter473, 1
  %prol.iter473.cmp.not = icmp eq i64 %prol.iter473.next, %xtraiter471
  br i1 %prol.iter473.cmp.not, label %.lr.ph388.prol.loopexit, label %.lr.ph388.prol, !llvm.loop !19

.lr.ph388.prol.loopexit:                          ; preds = %.lr.ph388.prol, %.lr.ph388.preheader460
  %.unr474 = phi i64 [ %.ph461, %.lr.ph388.preheader460 ], [ %100, %.lr.ph388.prol ]
  %102 = icmp ult i64 %96, 3
  br i1 %102, label %.loopexit, label %.lr.ph388

.lr.ph388:                                        ; preds = %.lr.ph388.prol.loopexit, %.lr.ph388
  %103 = phi i64 [ %118, %.lr.ph388 ], [ %.unr474, %.lr.ph388.prol.loopexit ]
  %104 = getelementptr i32, ptr %.unpack313, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !3
  %106 = add nuw nsw i64 %103, 1
  %107 = getelementptr i32, ptr %86, i64 %103
  store i32 %105, ptr %107, align 4, !tbaa !3
  %108 = getelementptr i32, ptr %.unpack313, i64 %106
  %109 = load i32, ptr %108, align 4, !tbaa !3
  %110 = add nuw nsw i64 %103, 2
  %111 = getelementptr i32, ptr %86, i64 %106
  store i32 %109, ptr %111, align 4, !tbaa !3
  %112 = getelementptr i32, ptr %.unpack313, i64 %110
  %113 = load i32, ptr %112, align 4, !tbaa !3
  %114 = add nuw nsw i64 %103, 3
  %115 = getelementptr i32, ptr %86, i64 %110
  store i32 %113, ptr %115, align 4, !tbaa !3
  %116 = getelementptr i32, ptr %.unpack313, i64 %114
  %117 = load i32, ptr %116, align 4, !tbaa !3
  %118 = add nuw nsw i64 %103, 4
  %119 = getelementptr i32, ptr %86, i64 %114
  store i32 %117, ptr %119, align 4, !tbaa !3
  %exitcond395.not.3 = icmp eq i64 %118, %.unpack320.unpack.unpack322
  br i1 %exitcond395.not.3, label %.loopexit, label %.lr.ph388, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %.lr.ph388.prol.loopexit, %.lr.ph388, %middle.block, %middle.block427
  %.ph = phi ptr [ %86, %middle.block427 ], [ %33, %middle.block ], [ %86, %.lr.ph388 ], [ %86, %.lr.ph388.prol.loopexit ], [ %33, %.lr.ph ], [ %33, %.lr.ph.prol.loopexit ]
  br i1 %.not, label %.loopexit.thread, label %.thread383

.thread383:                                       ; preds = %31, %.loopexit
  %.ph403 = phi ptr [ %.ph, %.loopexit ], [ %33, %31 ]
  call void @free(ptr nonnull %.unpack325)
  br label %.loopexit.thread

.loopexit.thread:                                 ; preds = %84, %.thread383, %.loopexit
  %.ph400 = phi ptr [ %.ph403, %.thread383 ], [ %.ph, %.loopexit ], [ %86, %84 ]
  store ptr %.ph400, ptr @_QFEb.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEb.7, align 8, !tbaa !7
  store i64 %.unpack320.unpack.unpack322, ptr @_QFEb.8, align 8, !tbaa !7
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph386.prol.loopexit, %.lr.ph386, %middle.block412, %.preheader, %.loopexit.thread
  %.unpack337 = phi ptr [ %.ph400, %.loopexit.thread ], [ %.unpack325, %.preheader ], [ %.unpack325, %middle.block412 ], [ %.unpack325, %.lr.ph386 ], [ %.unpack325, %.lr.ph386.prol.loopexit ]
  call void @_QFPheapsort(ptr nonnull %2, ptr %.unpack337)
  %120 = load i32, ptr %2, align 4, !tbaa !3
  %121 = icmp sgt i32 %120, 0
  br i1 %121, label %.lr.ph391, label %._crit_edge392.thread

.lr.ph391:                                        ; preds = %._crit_edge
  %122 = zext i32 %120 to i64
  %.unpack368.unpack.unpack = load i64, ptr @_QFEb.7, align 8, !tbaa !7
  %min.iters.check442 = icmp ult i32 %120, 8
  br i1 %min.iters.check442, label %scalar.ph441.preheader, label %vector.ph443

vector.ph443:                                     ; preds = %.lr.ph391
  %n.vec445 = and i64 %122, 4294967288
  %ind.end = or i64 %n.vec445, 1
  br label %vector.body448

vector.body448:                                   ; preds = %vector.body448, %vector.ph443
  %index449 = phi i64 [ 0, %vector.ph443 ], [ %index.next455, %vector.body448 ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph443 ], [ %132, %vector.body448 ]
  %vec.phi450 = phi <4 x i32> [ zeroinitializer, %vector.ph443 ], [ %133, %vector.body448 ]
  %offset.idx = or i64 %index449, 1
  %123 = getelementptr i32, ptr %.unpack313, i64 %index449
  %wide.load451 = load <4 x i32>, ptr %123, align 4, !tbaa !3
  %124 = getelementptr i32, ptr %123, i64 4
  %wide.load452 = load <4 x i32>, ptr %124, align 4, !tbaa !3
  %125 = sub i64 %offset.idx, %.unpack368.unpack.unpack
  %126 = getelementptr i32, ptr %.unpack337, i64 %125
  %wide.load453 = load <4 x i32>, ptr %126, align 4, !tbaa !3
  %127 = getelementptr i32, ptr %126, i64 4
  %wide.load454 = load <4 x i32>, ptr %127, align 4, !tbaa !3
  %128 = icmp ne <4 x i32> %wide.load451, %wide.load453
  %129 = icmp ne <4 x i32> %wide.load452, %wide.load454
  %130 = zext <4 x i1> %128 to <4 x i32>
  %131 = zext <4 x i1> %129 to <4 x i32>
  %132 = add <4 x i32> %vec.phi, %130
  %133 = add <4 x i32> %vec.phi450, %131
  %index.next455 = add nuw i64 %index449, 8
  %134 = icmp eq i64 %index.next455, %n.vec445
  br i1 %134, label %middle.block440, label %vector.body448, !llvm.loop !21

middle.block440:                                  ; preds = %vector.body448
  %bin.rdx = add <4 x i32> %133, %132
  %135 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n447 = icmp eq i64 %n.vec445, %122
  br i1 %cmp.n447, label %._crit_edge392, label %scalar.ph441.preheader

scalar.ph441.preheader:                           ; preds = %.lr.ph391, %middle.block440
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph391 ], [ %ind.end, %middle.block440 ]
  %.0389.ph = phi i32 [ 0, %.lr.ph391 ], [ %135, %middle.block440 ]
  br label %scalar.ph441

scalar.ph441:                                     ; preds = %scalar.ph441.preheader, %scalar.ph441
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph441 ], [ %indvars.iv.ph, %scalar.ph441.preheader ]
  %.0389 = phi i32 [ %spec.select, %scalar.ph441 ], [ %.0389.ph, %scalar.ph441.preheader ]
  %136 = add i64 %indvars.iv, -1
  %137 = getelementptr i32, ptr %.unpack313, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !3
  %139 = sub i64 %indvars.iv, %.unpack368.unpack.unpack
  %140 = getelementptr i32, ptr %.unpack337, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !3
  %.not373 = icmp ne i32 %138, %141
  %142 = zext i1 %.not373 to i32
  %spec.select = add i32 %.0389, %142
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond397.not = icmp eq i64 %indvars.iv, %122
  br i1 %exitcond397.not, label %._crit_edge392, label %scalar.ph441, !llvm.loop !22

._crit_edge392:                                   ; preds = %scalar.ph441, %middle.block440
  %spec.select.lcssa = phi i32 [ %135, %middle.block440 ], [ %spec.select, %scalar.ph441 ]
  %143 = icmp slt i32 %spec.select.lcssa, 3
  br i1 %143, label %._crit_edge392.thread, label %146

._crit_edge392.thread:                            ; preds = %._crit_edge, %._crit_edge392
  %144 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.f24438c2a81c1caf8844a1a4eb7e9a74, i32 15)
  %145 = call i1 @_FortranAioOutputAscii(ptr %144, ptr nonnull @_QQcl.594553, i64 3)
  br label %149

146:                                              ; preds = %._crit_edge392
  %147 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.f24438c2a81c1caf8844a1a4eb7e9a74, i32 17)
  %148 = call i1 @_FortranAioOutputAscii(ptr %147, ptr nonnull @_QQcl.4E4F, i64 2)
  br label %149

149:                                              ; preds = %._crit_edge392.thread, %146
  %.sink = phi ptr [ %144, %._crit_edge392.thread ], [ %147, %146 ]
  %150 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite)
define void @_QFPheapsort(ptr nocapture readonly %0, ptr nocapture %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %.not51 = icmp eq i32 %3, 1
  br i1 %.not51, label %.loopexit, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %2
  %4 = sdiv i32 %3, 2
  %5 = add nsw i32 %4, 1
  br label %.lr.ph54

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %.split49.us
  %.02653 = phi i32 [ %.1, %.split49.us ], [ %5, %.lr.ph54.preheader ]
  %.02752 = phi i32 [ %.128.fr, %.split49.us ], [ %3, %.lr.ph54.preheader ]
  %6 = icmp sgt i32 %.02653, 1
  br i1 %6, label %7, label %13

7:                                                ; preds = %.lr.ph54
  %8 = add nsw i32 %.02653, -1
  %9 = zext i32 %8 to i64
  %10 = add nsw i64 %9, -1
  %11 = getelementptr i32, ptr %1, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !3
  br label %22

13:                                               ; preds = %.lr.ph54
  %14 = sext i32 %.02752 to i64
  %15 = add nsw i64 %14, -1
  %16 = getelementptr i32, ptr %1, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !3
  %18 = load i32, ptr %1, align 4, !tbaa !3
  store i32 %18, ptr %16, align 4, !tbaa !3
  %19 = add i32 %.02752, -1
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %22

21:                                               ; preds = %13
  store i32 %17, ptr %1, align 4, !tbaa !3
  br label %.loopexit

22:                                               ; preds = %7, %13
  %.128 = phi i32 [ %.02752, %7 ], [ %19, %13 ]
  %.1 = phi i32 [ %8, %7 ], [ %.02653, %13 ]
  %.0 = phi i32 [ %12, %7 ], [ %17, %13 ]
  %.128.fr = freeze i32 %.128
  %23 = shl i32 %.1, 1
  %.not343643 = icmp sgt i32 %23, %.128.fr
  br i1 %.not343643, label %.split49.us, label %.lr.ph.lr.ph

.lr.ph.lr.ph:                                     ; preds = %22
  %.not34.not = icmp eq i32 %.128.fr, 2147483647
  br i1 %.not34.not, label %.lr.ph.preheader, label %.lr.ph.us

.lr.ph.preheader:                                 ; preds = %.lr.ph.lr.ph
  %.128.fr.le = freeze i32 %.128
  %24 = add i32 %.128.fr.le, 1
  %.not58 = icmp eq i32 %24, 2147483647
  %25 = sext i32 %24 to i64
  %26 = add nsw i64 %25, -1
  %27 = getelementptr i32, ptr %1, i64 %26
  %28 = getelementptr i32, ptr %1, i64 %25
  br label %49

.lr.ph.us:                                        ; preds = %.lr.ph.lr.ph, %.split.us.us
  %.029.ph45.us = phi i32 [ %48, %.split.us.us ], [ %23, %.lr.ph.lr.ph ]
  %.031.ph44.us = phi i32 [ %.130.us.us, %.split.us.us ], [ %.1, %.lr.ph.lr.ph ]
  %29 = icmp slt i32 %.029.ph45.us, %.128.fr
  br i1 %29, label %30, label %39

30:                                               ; preds = %.lr.ph.us
  %31 = sext i32 %.029.ph45.us to i64
  %32 = add nsw i64 %31, -1
  %33 = getelementptr i32, ptr %1, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !3
  %35 = getelementptr i32, ptr %1, i64 %31
  %36 = load i32, ptr %35, align 4, !tbaa !3
  %37 = icmp slt i32 %34, %36
  %38 = zext i1 %37 to i32
  %spec.select.us.us = or i32 %.029.ph45.us, %38
  br label %39

39:                                               ; preds = %30, %.lr.ph.us
  %.130.us.us = phi i32 [ %.029.ph45.us, %.lr.ph.us ], [ %spec.select.us.us, %30 ]
  %40 = sext i32 %.130.us.us to i64
  %41 = add nsw i64 %40, -1
  %42 = getelementptr i32, ptr %1, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = icmp slt i32 %.0, %43
  br i1 %44, label %.split.us.us, label %.split49.us

.split.us.us:                                     ; preds = %39
  %45 = sext i32 %.031.ph44.us to i64
  %46 = add nsw i64 %45, -1
  %47 = getelementptr i32, ptr %1, i64 %46
  store i32 %43, ptr %47, align 4, !tbaa !3
  %48 = shl i32 %.130.us.us, 1
  %.not3436.us = icmp sgt i32 %48, %.128.fr
  br i1 %.not3436.us, label %.split49.us, label %.lr.ph.us

49:                                               ; preds = %.split, %.lr.ph.preheader
  %.029.ph45 = phi i32 [ %77, %.split ], [ %23, %.lr.ph.preheader ]
  %.031.ph44 = phi i32 [ %.130.lcssa, %.split ], [ %.1, %.lr.ph.preheader ]
  %50 = sext i32 %.029.ph45 to i64
  %51 = add nsw i64 %50, -1
  %52 = getelementptr i32, ptr %1, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %54 = getelementptr i32, ptr %1, i64 %50
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = icmp slt i32 %53, %55
  %57 = zext i1 %56 to i32
  %spec.select.peel = or i32 %.029.ph45, %57
  %58 = sext i32 %spec.select.peel to i64
  %59 = add nsw i64 %58, -1
  %60 = getelementptr i32, ptr %1, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !3
  %62 = icmp slt i32 %.0, %61
  br i1 %62, label %.split, label %.peel.next

.peel.next:                                       ; preds = %49, %68
  br i1 %.not58, label %68, label %63

63:                                               ; preds = %.peel.next
  %64 = load i32, ptr %27, align 4, !tbaa !3
  %65 = load i32, ptr %28, align 4, !tbaa !3
  %66 = icmp slt i32 %64, %65
  %67 = zext i1 %66 to i32
  %spec.select = add nsw i32 %24, %67
  br label %68

68:                                               ; preds = %63, %.peel.next
  %.130 = phi i32 [ 2147483647, %.peel.next ], [ %spec.select, %63 ]
  %69 = sext i32 %.130 to i64
  %70 = add nsw i64 %69, -1
  %71 = getelementptr i32, ptr %1, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !3
  %73 = icmp slt i32 %.0, %72
  br i1 %73, label %.split, label %.peel.next, !llvm.loop !23

.split:                                           ; preds = %68, %49
  %.130.lcssa = phi i32 [ %spec.select.peel, %49 ], [ %.130, %68 ]
  %.lcssa = phi i32 [ %61, %49 ], [ %72, %68 ]
  %74 = sext i32 %.031.ph44 to i64
  %75 = add nsw i64 %74, -1
  %76 = getelementptr i32, ptr %1, i64 %75
  store i32 %.lcssa, ptr %76, align 4, !tbaa !3
  %77 = shl i32 %.130.lcssa, 1
  br label %49

.split49.us:                                      ; preds = %.split.us.us, %39, %22
  %.031.ph.lcssa = phi i32 [ %.1, %22 ], [ %.031.ph44.us, %39 ], [ %.130.us.us, %.split.us.us ]
  %78 = sext i32 %.031.ph.lcssa to i64
  %79 = add nsw i64 %78, -1
  %80 = getelementptr i32, ptr %1, i64 %79
  store i32 %.0, ptr %80, align 4, !tbaa !3
  %.not = icmp eq i32 %.128.fr, 1
  br i1 %.not, label %.loopexit, label %.lr.ph54

.loopexit:                                        ; preds = %.split49.us, %2, %21
  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 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind 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}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10, !11}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !11}
!22 = distinct !{!22, !11, !10}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.peeled.count", i32 1}
