! 2019.9.28 
!
      program answer
      implicit none
      integer :: N_i
      integer,allocatable,dimension(:) :: A_i
      integer,allocatable,dimension(:) :: ans_i
      integer :: i
! read
      read(*,*) N_i
      allocate(A_i(N_i),ans_i(N_i))
      read(*,*) (A_i(i),i=1,N_i)
!
      do i=1,N_i
        ans_i(A_i(i)) = i
      end do
      write(*,*) (ans_i(i),i=1,N_i) 
      end program answer
; 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_i.0 = internal unnamed_addr global ptr null
@_QFEans_i.0 = internal unnamed_addr global ptr null
@_QQcl.2f6ad7c2688a1a5193de04ab26bec5ae = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3187/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

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2f6ad7c2688a1a5193de04ab26bec5ae, i32 10)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = call i32 @llvm.smax.i32(i32 %5, i32 0)
  %7 = zext i32 %6 to i64
  %8 = shl nuw nsw i64 %7, 2
  %9 = call ptr @malloc(i64 %8)
  store ptr %9, ptr @_QFEa_i.0, align 8, !tbaa !7
  %10 = call ptr @malloc(i64 %8)
  store ptr %10, ptr @_QFEans_i.0, align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2f6ad7c2688a1a5193de04ab26bec5ae, i32 12)
  %12 = load i32, ptr %1, align 4, !tbaa !3
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph.preheader, label %._crit_edge

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

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  %21 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %22 = load i32, ptr %1, align 4, !tbaa !3
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph200, label %._crit_edge201

.lr.ph200:                                        ; preds = %._crit_edge
  %24 = zext i32 %22 to i64
  %.unpack162 = load ptr, ptr @_QFEans_i.0, align 8, !tbaa !7
  %.unpack174 = load ptr, ptr @_QFEa_i.0, align 8, !tbaa !7
  %xtraiter = and i64 %24, 3
  %25 = icmp ult i32 %22, 4
  br i1 %25, label %._crit_edge201.loopexit.unr-lcssa, label %.lr.ph200.new

.lr.ph200.new:                                    ; preds = %.lr.ph200
  %unroll_iter = and i64 %24, 4294967292
  br label %26

26:                                               ; preds = %26, %.lr.ph200.new
  %indvars.iv = phi i64 [ 1, %.lr.ph200.new ], [ %indvars.iv.next.3, %26 ]
  %niter = phi i64 [ 0, %.lr.ph200.new ], [ %niter.next.3, %26 ]
  %27 = add nsw i64 %indvars.iv, -1
  %28 = getelementptr i32, ptr %.unpack174, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !3
  %30 = sext i32 %29 to i64
  %31 = add nsw i64 %30, -1
  %32 = getelementptr i32, ptr %.unpack162, i64 %31
  %33 = trunc i64 %indvars.iv to i32
  store i32 %33, ptr %32, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = getelementptr i32, ptr %.unpack174, i64 %indvars.iv
  %35 = load i32, ptr %34, align 4, !tbaa !3
  %36 = sext i32 %35 to i64
  %37 = add nsw i64 %36, -1
  %38 = getelementptr i32, ptr %.unpack162, i64 %37
  %39 = trunc i64 %indvars.iv.next to i32
  store i32 %39, ptr %38, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %40 = getelementptr i32, ptr %.unpack174, i64 %indvars.iv.next
  %41 = load i32, ptr %40, align 4, !tbaa !3
  %42 = sext i32 %41 to i64
  %43 = add nsw i64 %42, -1
  %44 = getelementptr i32, ptr %.unpack162, i64 %43
  %45 = trunc i64 %indvars.iv.next.1 to i32
  store i32 %45, ptr %44, align 4, !tbaa !3
  %46 = getelementptr i32, ptr %.unpack174, i64 %indvars.iv.next.1
  %47 = load i32, ptr %46, align 4, !tbaa !3
  %48 = sext i32 %47 to i64
  %49 = add nsw i64 %48, -1
  %50 = getelementptr i32, ptr %.unpack162, i64 %49
  %51 = trunc i64 %indvars.iv to i32
  %52 = add i32 %51, 3
  store i32 %52, ptr %50, align 4, !tbaa !3
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge201.loopexit.unr-lcssa, label %26

._crit_edge201.loopexit.unr-lcssa:                ; preds = %26, %.lr.ph200
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph200 ], [ %indvars.iv.next.3, %26 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge201, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge201.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge201.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge201.loopexit.unr-lcssa ]
  %53 = add nsw i64 %indvars.iv.epil, -1
  %54 = getelementptr i32, ptr %.unpack174, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = sext i32 %55 to i64
  %57 = add nsw i64 %56, -1
  %58 = getelementptr i32, ptr %.unpack162, i64 %57
  %59 = trunc i64 %indvars.iv.epil to i32
  store i32 %59, ptr %58, align 4, !tbaa !3
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge201, label %.epil.preheader, !llvm.loop !9

._crit_edge201:                                   ; preds = %._crit_edge201.loopexit.unr-lcssa, %.epil.preheader, %._crit_edge
  %60 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.2f6ad7c2688a1a5193de04ab26bec5ae, i32 17)
  %61 = load i32, ptr %1, align 4, !tbaa !3
  %62 = icmp sgt i32 %61, 0
  br i1 %62, label %.lr.ph203.preheader, label %._crit_edge204

.lr.ph203.preheader:                              ; preds = %._crit_edge201
  %63 = zext i32 %61 to i64
  br label %.lr.ph203

.lr.ph203:                                        ; preds = %.lr.ph203.preheader, %.lr.ph203
  %64 = phi i64 [ %70, %.lr.ph203 ], [ 1, %.lr.ph203.preheader ]
  %.unpack = load ptr, ptr @_QFEans_i.0, align 8, !tbaa !7
  %sext = shl i64 %64, 32
  %65 = ashr exact i64 %sext, 32
  %66 = add nsw i64 %65, -1
  %67 = getelementptr i32, ptr %.unpack, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !3
  %69 = call i1 @_FortranAioOutputInteger32(ptr %60, i32 %68)
  %70 = add nuw nsw i64 %64, 1
  %exitcond207.not = icmp eq i64 %64, %63
  br i1 %exitcond207.not, label %._crit_edge204, label %.lr.ph203

._crit_edge204:                                   ; preds = %.lr.ph203, %._crit_edge201
  %71 = call i32 @_FortranAioEndIoStatement(ptr %60)
  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 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 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}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
