program main
  implicit none
  integer i,N,ans
  integer,allocatable :: p(:)
  integer,allocatable :: q(:)
  read(*, *) N
  allocate(p(N))
  allocate(q(N))
  read(*, *) (p(i), i = 1,N)
  do i = 1,N
    q(i) = p(i)
  end do
  call qsort(q)
  ans = 0
  do i = 1,N
    if (p(i) /= q(i)) then
      ans = ans + 1
    end if
  end do
  if (ans < 3) then
    write(*, *) 'YES'
  else
    write(*, *) 'NO'
  end if
  
contains

recursive subroutine qsort(a)
implicit none
!integer(8),intent(in) :: n
integer,intent(inout) :: a(:)
integer::i,j,toobig,toosmall,pv,n
n = size(a)
i = 1
j = n
pv = a((i+j)/2)
do
   do
     if (a(i) < pv) then
       i = i+1
     else
       exit
     end if
   end do
   do
     if(a(j) > pv) then
       j = j-1
     else
       exit
     end if
   end do
   if (i>=j) then
     exit
   else
     toobig = a(j)
     toosmall = a(i)
     a(i) = toobig
     a(j) = toosmall
     i = i+1
     j = j-1
   end if
 end do
 if (i > 2) then
   call qsort(a(1:i-1))
 end if
 if (j < n-1) then
   call qsort(a(j+1:n))
 end if
end subroutine qsort
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"

@_QFEp.0 = internal unnamed_addr global ptr null
@_QFEq.0 = internal unnamed_addr global ptr null
@_QFEq.8 = internal unnamed_addr global i64 0
@_QQcl.a22de618ba93c32eb1ae7dab961136f2 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3654/source.f\00"
@_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

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.a22de618ba93c32eb1ae7dab961136f2, i32 6)
  %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 @_QFEp.0, align 8, !tbaa !7
  %11 = call ptr @malloc(i64 %9)
  store ptr %11, ptr @_QFEq.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEq.8, align 8, !tbaa !7
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a22de618ba93c32eb1ae7dab961136f2, i32 9)
  %13 = load i32, ptr %2, align 4, !tbaa !3
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %15 = zext i32 %13 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %16 = phi i64 [ %21, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %.unpack314 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %sext = shl i64 %16, 32
  %17 = ashr exact i64 %sext, 32
  %18 = add nsw i64 %17, -1
  %19 = getelementptr i32, ptr %.unpack314, i64 %18
  %20 = call i1 @_FortranAioInputInteger(ptr %12, ptr %19, i32 4)
  %21 = add nuw nsw i64 %16, 1
  %exitcond.not = icmp eq i64 %16, %15
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %22 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %23 = load i32, ptr %2, align 4, !tbaa !3
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph327, label %._crit_edge.._crit_edge328_crit_edge

._crit_edge.._crit_edge328_crit_edge:             ; preds = %._crit_edge
  %.unpack.pre = load ptr, ptr @_QFEq.0, align 8, !tbaa !7
  br label %._crit_edge328

.lr.ph327:                                        ; preds = %._crit_edge
  %25 = zext i32 %23 to i64
  %.unpack290 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %.unpack302 = load ptr, ptr @_QFEq.0, align 8, !tbaa !7
  %min.iters.check = icmp ult i32 %23, 8
  %.unpack302343 = ptrtoint ptr %.unpack302 to i64
  %.unpack290344 = ptrtoint ptr %.unpack290 to i64
  %26 = sub i64 %.unpack302343, %.unpack290344
  %diff.check = icmp ult i64 %26, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph327
  %n.vec = and i64 %25, 4294967288
  %ind.end = or i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %27 = getelementptr i32, ptr %.unpack290, i64 %index
  %wide.load = load <4 x i32>, ptr %27, align 4, !tbaa !3
  %28 = getelementptr i32, ptr %27, i64 4
  %wide.load345 = load <4 x i32>, ptr %28, align 4, !tbaa !3
  %29 = getelementptr i32, ptr %.unpack302, i64 %index
  store <4 x i32> %wide.load, ptr %29, align 4, !tbaa !3
  %30 = getelementptr i32, ptr %29, i64 4
  store <4 x i32> %wide.load345, ptr %30, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %25
  br i1 %cmp.n, label %._crit_edge328, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph327, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph327 ], [ %ind.end, %middle.block ]
  %32 = add nuw nsw i64 %25, 1
  %33 = sub nsw i64 %32, %indvars.iv.ph
  %34 = sub nsw i64 %25, %indvars.iv.ph
  %xtraiter = and i64 %33, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %35 = add i64 %indvars.iv.prol, -1
  %36 = getelementptr i32, ptr %.unpack290, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !3
  %38 = add i64 %indvars.iv.prol, -1
  %39 = getelementptr i32, ptr %.unpack302, i64 %38
  store i32 %37, ptr %39, align 4, !tbaa !3
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %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 %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !12

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %40 = icmp ult i64 %34, 3
  br i1 %40, label %._crit_edge328, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %41 = add i64 %indvars.iv, -1
  %42 = getelementptr i32, ptr %.unpack290, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = add i64 %indvars.iv, -1
  %45 = getelementptr i32, ptr %.unpack302, i64 %44
  store i32 %43, ptr %45, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = getelementptr i32, ptr %.unpack290, i64 %indvars.iv
  %47 = load i32, ptr %46, align 4, !tbaa !3
  %48 = getelementptr i32, ptr %.unpack302, i64 %indvars.iv
  store i32 %47, ptr %48, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %49 = getelementptr i32, ptr %.unpack290, i64 %indvars.iv.next
  %50 = load i32, ptr %49, align 4, !tbaa !3
  %51 = getelementptr i32, ptr %.unpack302, i64 %indvars.iv.next
  store i32 %50, ptr %51, align 4, !tbaa !3
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %52 = getelementptr i32, ptr %.unpack290, i64 %indvars.iv.next.1
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %54 = getelementptr i32, ptr %.unpack302, i64 %indvars.iv.next.1
  store i32 %53, ptr %54, align 4, !tbaa !3
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond335.not.3 = icmp eq i64 %indvars.iv.next.2, %25
  br i1 %exitcond335.not.3, label %._crit_edge328, label %scalar.ph, !llvm.loop !14

._crit_edge328:                                   ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %._crit_edge.._crit_edge328_crit_edge
  %.unpack = phi ptr [ %.unpack.pre, %._crit_edge.._crit_edge328_crit_edge ], [ %.unpack302, %middle.block ], [ %.unpack302, %scalar.ph ], [ %.unpack302, %scalar.ph.prol.loopexit ]
  %.unpack261.unpack.unpack263 = load i64, ptr @_QFEq.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 %.unpack261.unpack.unpack263, 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
  call void @_QFPqsort(ptr nonnull %1)
  %55 = load i32, ptr %2, align 4, !tbaa !3
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph331, label %._crit_edge332.thread

.lr.ph331:                                        ; preds = %._crit_edge328
  %57 = zext i32 %55 to i64
  %.unpack266 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %min.iters.check348 = icmp ult i32 %55, 8
  br i1 %min.iters.check348, label %scalar.ph347.preheader, label %vector.ph349

vector.ph349:                                     ; preds = %.lr.ph331
  %n.vec351 = and i64 %57, 4294967288
  %ind.end352 = or i64 %n.vec351, 1
  br label %vector.body355

vector.body355:                                   ; preds = %vector.body355, %vector.ph349
  %index356 = phi i64 [ 0, %vector.ph349 ], [ %index.next363, %vector.body355 ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph349 ], [ %66, %vector.body355 ]
  %vec.phi357 = phi <4 x i32> [ zeroinitializer, %vector.ph349 ], [ %67, %vector.body355 ]
  %58 = getelementptr i32, ptr %.unpack266, i64 %index356
  %wide.load359 = load <4 x i32>, ptr %58, align 4, !tbaa !3
  %59 = getelementptr i32, ptr %58, i64 4
  %wide.load360 = load <4 x i32>, ptr %59, align 4, !tbaa !3
  %60 = getelementptr i32, ptr %.unpack, i64 %index356
  %wide.load361 = load <4 x i32>, ptr %60, align 4, !tbaa !3
  %61 = getelementptr i32, ptr %60, i64 4
  %wide.load362 = load <4 x i32>, ptr %61, align 4, !tbaa !3
  %62 = icmp ne <4 x i32> %wide.load359, %wide.load361
  %63 = icmp ne <4 x i32> %wide.load360, %wide.load362
  %64 = zext <4 x i1> %62 to <4 x i32>
  %65 = zext <4 x i1> %63 to <4 x i32>
  %66 = add <4 x i32> %vec.phi, %64
  %67 = add <4 x i32> %vec.phi357, %65
  %index.next363 = add nuw i64 %index356, 8
  %68 = icmp eq i64 %index.next363, %n.vec351
  br i1 %68, label %middle.block346, label %vector.body355, !llvm.loop !15

middle.block346:                                  ; preds = %vector.body355
  %bin.rdx = add <4 x i32> %67, %66
  %69 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n354 = icmp eq i64 %n.vec351, %57
  br i1 %cmp.n354, label %._crit_edge332, label %scalar.ph347.preheader

scalar.ph347.preheader:                           ; preds = %.lr.ph331, %middle.block346
  %indvars.iv336.ph = phi i64 [ 1, %.lr.ph331 ], [ %ind.end352, %middle.block346 ]
  %.0329.ph = phi i32 [ 0, %.lr.ph331 ], [ %69, %middle.block346 ]
  br label %scalar.ph347

scalar.ph347:                                     ; preds = %scalar.ph347.preheader, %scalar.ph347
  %indvars.iv336 = phi i64 [ %indvars.iv.next337, %scalar.ph347 ], [ %indvars.iv336.ph, %scalar.ph347.preheader ]
  %.0329 = phi i32 [ %spec.select, %scalar.ph347 ], [ %.0329.ph, %scalar.ph347.preheader ]
  %70 = add i64 %indvars.iv336, -1
  %71 = getelementptr i32, ptr %.unpack266, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !3
  %73 = add i64 %indvars.iv336, -1
  %74 = getelementptr i32, ptr %.unpack, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !3
  %.not = icmp ne i32 %72, %75
  %76 = zext i1 %.not to i32
  %spec.select = add i32 %.0329, %76
  %indvars.iv.next337 = add nuw nsw i64 %indvars.iv336, 1
  %exitcond339.not = icmp eq i64 %indvars.iv336, %57
  br i1 %exitcond339.not, label %._crit_edge332, label %scalar.ph347, !llvm.loop !16

._crit_edge332:                                   ; preds = %scalar.ph347, %middle.block346
  %spec.select.lcssa = phi i32 [ %69, %middle.block346 ], [ %spec.select, %scalar.ph347 ]
  %77 = icmp slt i32 %spec.select.lcssa, 3
  br i1 %77, label %._crit_edge332.thread, label %80

._crit_edge332.thread:                            ; preds = %._crit_edge328, %._crit_edge332
  %78 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a22de618ba93c32eb1ae7dab961136f2, i32 21)
  %79 = call i1 @_FortranAioOutputAscii(ptr %78, ptr nonnull @_QQcl.594553, i64 3)
  br label %83

80:                                               ; preds = %._crit_edge332
  %81 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a22de618ba93c32eb1ae7dab961136f2, i32 23)
  %82 = call i1 @_FortranAioOutputAscii(ptr %81, ptr nonnull @_QQcl.4E4F, i64 2)
  br label %83

83:                                               ; preds = %._crit_edge332.thread, %80
  %.sink = phi ptr [ %78, %._crit_edge332.thread ], [ %81, %80 ]
  %84 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none)
define void @_QFPqsort(ptr nocapture readonly %0) local_unnamed_addr #1 {
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %4 = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 1
  %5 = load i64, ptr %4, align 8, !tbaa !7
  %6 = trunc i64 %5 to i32
  %7 = add i32 %6, 1
  %8 = sdiv i32 %7, 2
  %narrow = add nsw i32 %8, -1
  %9 = sext i32 %narrow to i64
  %10 = load ptr, ptr %0, align 8, !tbaa !7
  %11 = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 2
  %12 = load i64, ptr %11, align 8, !tbaa !7
  %13 = mul i64 %12, %9
  %14 = getelementptr i8, ptr %10, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !3
  br label %.outer

.outer:                                           ; preds = %55, %1
  %.045.ph = phi i32 [ %32, %55 ], [ %6, %1 ]
  %.0.ph = phi i32 [ %23, %55 ], [ 1, %1 ]
  br label %16

16:                                               ; preds = %16, %.outer
  %.0 = phi i32 [ %23, %16 ], [ %.0.ph, %.outer ]
  %17 = sext i32 %.0 to i64
  %18 = add nsw i64 %17, -1
  %19 = mul i64 %18, %12
  %20 = getelementptr i8, ptr %10, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !3
  %22 = icmp slt i32 %21, %15
  %23 = add i32 %.0, 1
  br i1 %22, label %16, label %.preheader

.preheader:                                       ; preds = %16
  %24 = getelementptr i8, ptr %10, i64 %19
  br label %25

25:                                               ; preds = %25, %.preheader
  %.1 = phi i32 [ %32, %25 ], [ %.045.ph, %.preheader ]
  %26 = sext i32 %.1 to i64
  %27 = add nsw i64 %26, -1
  %28 = mul i64 %27, %12
  %29 = getelementptr i8, ptr %10, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !3
  %31 = icmp sgt i32 %30, %15
  %32 = add i32 %.1, -1
  br i1 %31, label %25, label %33

33:                                               ; preds = %25
  %.not = icmp slt i32 %.0, %.1
  br i1 %.not, label %55, label %34

34:                                               ; preds = %33
  %35 = icmp sgt i32 %.0, 2
  br i1 %35, label %36, label %39

36:                                               ; preds = %34
  %37 = add nsw i32 %.0, -1
  %38 = zext i32 %37 to i64
  store ptr %10, ptr %2, align 8, !tbaa !7
  %.fca.1.gep28 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep28, align 8, !tbaa !7
  %.fca.2.gep30 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep30, align 8, !tbaa !7
  %.fca.3.gep32 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep32, align 4, !tbaa !7
  %.fca.4.gep34 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep34, align 1, !tbaa !7
  %.fca.5.gep36 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep36, align 2, !tbaa !7
  %.fca.6.gep38 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep38, align 1, !tbaa !7
  %.fca.7.0.0.gep40 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep40, align 8, !tbaa !7
  %.fca.7.0.1.gep42 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 1
  store i64 %38, ptr %.fca.7.0.1.gep42, align 8, !tbaa !7
  %.fca.7.0.2.gep44 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 2
  store i64 %12, ptr %.fca.7.0.2.gep44, align 8, !tbaa !7
  call void @_QFPqsort(ptr nonnull %2)
  br label %39

39:                                               ; preds = %36, %34
  %40 = add i32 %6, -1
  %41 = icmp slt i32 %.1, %40
  br i1 %41, label %42, label %54

42:                                               ; preds = %39
  %43 = add nsw i32 %.1, 1
  %44 = sext i32 %43 to i64
  %sext = shl i64 %5, 32
  %45 = ashr exact i64 %sext, 32
  %46 = load i64, ptr %11, align 8, !tbaa !7
  %47 = load ptr, ptr %0, align 8, !tbaa !7
  %48 = add nsw i64 %44, -1
  %49 = mul i64 %46, %48
  %50 = getelementptr i8, ptr %47, i64 %49
  %51 = sub nsw i64 %45, %44
  %52 = tail call i64 @llvm.smax.i64(i64 %51, i64 -1)
  %53 = add nsw i64 %52, 1
  store ptr %50, ptr %3, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, 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 %3, 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 %3, 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 %3, 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 %3, 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 %3, 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 %3, 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 %3, i64 0, i32 7, i64 0, i64 1
  store i64 %53, 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 %3, i64 0, i32 7, i64 0, i64 2
  store i64 %46, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  call void @_QFPqsort(ptr nonnull %3)
  br label %54

54:                                               ; preds = %42, %39
  ret void

55:                                               ; preds = %33
  %56 = getelementptr i8, ptr %10, i64 %28
  store i32 %30, ptr %24, align 4, !tbaa !3
  store i32 %21, ptr %56, align 4, !tbaa !3
  br label %.outer
}

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 @_FortranAioBeginExternalListOutput(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 i64 @llvm.smax.i64(i64, i64) #2

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

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !11, !10}
