    program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) n
    allocate(x(n),y(n))
    read(*,*)x
    if(mod(n,2)==0)then
        do i=1,n/2
            y(i)=x(n+2-2*i)
            y(i+n/2)=x(i*2-1)
        end do
    else
        do i=1,n/2+1
            y(i)=x(n+2-2*i)
        end do
        do i=1,n/2
            y(n/2+1+i)=x(i*2)
        end do
    end if
    write(*,*)y

    stop
end program sample
  


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

@_QFEx.0 = internal unnamed_addr global ptr null
@_QFEx.8 = internal unnamed_addr global i64 0
@_QFEy.0 = internal unnamed_addr global ptr null
@_QFEy.8 = internal unnamed_addr global i64 0
@_QQcl.0ad9f9fc7bec2ebafff2d5fd9ea062ff = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7157/source.f\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

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca i64, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0ad9f9fc7bec2ebafff2d5fd9ea062ff, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = load i64, ptr %3, align 8, !tbaa !3
  %8 = call i64 @llvm.smax.i64(i64 %7, i64 0)
  %9 = shl i64 %8, 3
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEx.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEx.8, align 8, !tbaa !7
  %11 = call ptr @malloc(i64 %9)
  store ptr %11, ptr @_QFEy.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEy.8, align 8, !tbaa !7
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0ad9f9fc7bec2ebafff2d5fd9ea062ff, i32 10)
  %.unpack = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %.unpack400.unpack.unpack402 = load i64, ptr @_QFEx.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 1
  store i64 8, 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 %2, 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 %2, 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 %2, i64 0, i32 4
  store i8 10, 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 %2, 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 %2, 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 %2, 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 %2, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack400.unpack.unpack402, 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 %2, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %13 = call i1 @_FortranAioInputDescriptor(ptr %12, ptr nonnull %2)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %15 = load i64, ptr %3, align 8, !tbaa !3
  %16 = and i64 %15, 1
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %18, label %39

18:                                               ; preds = %0
  %19 = icmp sgt i64 %15, 1
  br i1 %19, label %.lr.ph520, label %.loopexit

.lr.ph520:                                        ; preds = %18
  %20 = lshr i64 %15, 1
  %.unpack465 = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %.unpack477 = load ptr, ptr @_QFEy.0, align 8, !tbaa !7
  br label %21

21:                                               ; preds = %.lr.ph520, %21
  %22 = phi i64 [ 1, %.lr.ph520 ], [ %38, %21 ]
  %23 = load i64, ptr %3, align 8, !tbaa !3
  %24 = shl nuw i64 %22, 1
  %25 = sub i64 1, %24
  %26 = add i64 %25, %23
  %27 = getelementptr i64, ptr %.unpack465, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !3
  %29 = add nsw i64 %22, -1
  %30 = getelementptr i64, ptr %.unpack477, i64 %29
  store i64 %28, ptr %30, align 8, !tbaa !3
  %31 = add i64 %24, -2
  %32 = getelementptr i64, ptr %.unpack465, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !3
  %34 = load i64, ptr %3, align 8, !tbaa !3
  %35 = sdiv i64 %34, 2
  %36 = add i64 %29, %35
  %37 = getelementptr i64, ptr %.unpack477, i64 %36
  store i64 %33, ptr %37, align 8, !tbaa !3
  %38 = add nuw nsw i64 %22, 1
  %exitcond523.not = icmp eq i64 %22, %20
  br i1 %exitcond523.not, label %.loopexit, label %21

39:                                               ; preds = %0
  %40 = icmp sgt i64 %15, -2
  br i1 %40, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %39
  %41 = sdiv i64 %15, 2
  %.unpack441 = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %.unpack453 = load ptr, ptr @_QFEy.0, align 8, !tbaa !7
  %42 = add nsw i64 %41, 1
  %xtraiter = and i64 %42, 1
  %.off = add i64 %15, 1
  %43 = icmp ult i64 %.off, 3
  br i1 %43, label %._crit_edge.unr-lcssa, label %.lr.ph.new

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

44:                                               ; preds = %44, %.lr.ph.new
  %45 = phi i64 [ 1, %.lr.ph.new ], [ %61, %44 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %44 ]
  %46 = load i64, ptr %3, align 8, !tbaa !3
  %47 = shl nuw i64 %45, 1
  %48 = sub i64 1, %47
  %49 = add i64 %48, %46
  %50 = getelementptr i64, ptr %.unpack441, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !3
  %52 = add nsw i64 %45, -1
  %53 = getelementptr i64, ptr %.unpack453, i64 %52
  store i64 %51, ptr %53, align 8, !tbaa !3
  %54 = load i64, ptr %3, align 8, !tbaa !3
  %55 = shl nuw i64 %45, 1
  %56 = xor i64 %55, -1
  %57 = add i64 %54, %56
  %58 = getelementptr i64, ptr %.unpack441, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !3
  %60 = getelementptr i64, ptr %.unpack453, i64 %45
  store i64 %59, ptr %60, align 8, !tbaa !3
  %61 = add nuw nsw i64 %45, 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 %44

._crit_edge.unr-lcssa:                            ; preds = %44, %.lr.ph
  %.unr = phi i64 [ 1, %.lr.ph ], [ %61, %44 ]
  %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
  %62 = load i64, ptr %3, align 8, !tbaa !3
  %63 = shl nuw i64 %.unr, 1
  %64 = sub i64 1, %63
  %65 = add i64 %64, %62
  %66 = getelementptr i64, ptr %.unpack441, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !3
  %68 = add nsw i64 %.unr, -1
  %69 = getelementptr i64, ptr %.unpack453, i64 %68
  store i64 %67, ptr %69, align 8, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %.pre = load i64, ptr %3, align 8, !tbaa !3
  %70 = icmp sgt i64 %.pre, 1
  br i1 %70, label %.lr.ph518, label %.loopexit

.lr.ph518:                                        ; preds = %._crit_edge
  %71 = lshr i64 %.pre, 1
  %.unpack417 = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %.unpack429 = load ptr, ptr @_QFEy.0, align 8, !tbaa !7
  %72 = icmp eq i64 %71, 1
  br i1 %72, label %.loopexit.loopexit526.unr-lcssa, label %.lr.ph518.new

.lr.ph518.new:                                    ; preds = %.lr.ph518
  %unroll_iter531 = and i64 %71, 9223372036854775806
  br label %73

73:                                               ; preds = %73, %.lr.ph518.new
  %74 = phi i64 [ 1, %.lr.ph518.new ], [ %90, %73 ]
  %niter532 = phi i64 [ 0, %.lr.ph518.new ], [ %niter532.next.1, %73 ]
  %75 = shl nuw i64 %74, 1
  %76 = add nsw i64 %75, -1
  %77 = getelementptr i64, ptr %.unpack417, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !3
  %79 = load i64, ptr %3, align 8, !tbaa !3
  %80 = sdiv i64 %79, 2
  %81 = add nuw nsw i64 %74, 1
  %82 = add i64 %74, %80
  %83 = getelementptr i64, ptr %.unpack429, i64 %82
  store i64 %78, ptr %83, align 8, !tbaa !3
  %84 = shl nuw i64 %81, 1
  %85 = add i64 %84, -1
  %86 = getelementptr i64, ptr %.unpack417, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !3
  %88 = load i64, ptr %3, align 8, !tbaa !3
  %89 = sdiv i64 %88, 2
  %90 = add nuw nsw i64 %74, 2
  %91 = add i64 %81, %89
  %92 = getelementptr i64, ptr %.unpack429, i64 %91
  store i64 %87, ptr %92, align 8, !tbaa !3
  %niter532.next.1 = add i64 %niter532, 2
  %niter532.ncmp.1 = icmp eq i64 %niter532.next.1, %unroll_iter531
  br i1 %niter532.ncmp.1, label %.loopexit.loopexit526.unr-lcssa, label %73

.loopexit.loopexit526.unr-lcssa:                  ; preds = %73, %.lr.ph518
  %.unr529 = phi i64 [ 1, %.lr.ph518 ], [ %90, %73 ]
  %93 = and i64 %.pre, 2
  %lcmp.mod530.not = icmp eq i64 %93, 0
  br i1 %lcmp.mod530.not, label %.loopexit, label %.loopexit.loopexit526.epilog-lcssa

.loopexit.loopexit526.epilog-lcssa:               ; preds = %.loopexit.loopexit526.unr-lcssa
  %94 = shl nuw i64 %.unr529, 1
  %95 = add i64 %94, -1
  %96 = getelementptr i64, ptr %.unpack417, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !3
  %98 = load i64, ptr %3, align 8, !tbaa !3
  %99 = sdiv i64 %98, 2
  %100 = add i64 %.unr529, %99
  %101 = getelementptr i64, ptr %.unpack429, i64 %100
  store i64 %97, ptr %101, align 8, !tbaa !3
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit526.epilog-lcssa, %.loopexit.loopexit526.unr-lcssa, %21, %39, %._crit_edge, %18
  %102 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.0ad9f9fc7bec2ebafff2d5fd9ea062ff, i32 24)
  %.unpack405 = load ptr, ptr @_QFEy.0, align 8, !tbaa !7
  %.unpack412.unpack.unpack414 = load i64, ptr @_QFEy.8, align 8, !tbaa !7
  store ptr %.unpack405, ptr %1, align 8, !tbaa !7
  %.fca.1.gep117 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep117, align 8, !tbaa !7
  %.fca.2.gep119 = 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.gep119, align 8, !tbaa !7
  %.fca.3.gep121 = 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.gep121, align 4, !tbaa !7
  %.fca.4.gep123 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep123, align 1, !tbaa !7
  %.fca.5.gep125 = 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.gep125, align 2, !tbaa !7
  %.fca.6.gep127 = 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.gep127, align 1, !tbaa !7
  %.fca.7.0.0.gep129 = 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.gep129, align 8, !tbaa !7
  %.fca.7.0.1.gep131 = 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 %.unpack412.unpack.unpack414, ptr %.fca.7.0.1.gep131, align 8, !tbaa !7
  %.fca.7.0.2.gep133 = 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 8, ptr %.fca.7.0.2.gep133, align 8, !tbaa !7
  %103 = call i1 @_FortranAioOutputDescriptor(ptr %102, ptr nonnull %1)
  %104 = call i32 @_FortranAioEndIoStatement(ptr %102)
  %105 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputDescriptor(ptr, ptr) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { 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}
