program ABC097B
	integer(8)::X,i,j
	integer(8)::result=1
	
	read(5,*)X
	
	do i=2,9
		do j=2,31
			if(j**i>X)then
				exit
			else if(j**i>result)then
				result=j**i
			end if
		end do
	end do
	
	print'(i0)',result
end program ABC097B

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

@_QFEresult = internal unnamed_addr global i64 1
@_QQcl.a3d008b28cb8579e827da3a3b3c1dcd8 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5975/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i64, align 8
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.a3d008b28cb8579e827da3a3b3c1dcd8, i32 5)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 8)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i64, ptr %1, align 8
  %_QFEresult.promoted42 = load i64, ptr @_QFEresult, align 8, !tbaa !3
  br label %.preheader

.preheader:                                       ; preds = %0, %split
  %.01249 = phi i64 [ 2, %0 ], [ %35, %split ]
  %_QFEresult.promoted4647 = phi i64 [ %_QFEresult.promoted42, %0 ], [ %_QFEresult.promoted44.ph, %split ]
  %6 = and i64 %.01249, 1
  %.not3.i = icmp eq i64 %6, 0
  br label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %33, %.preheader
  %_QFEresult.promoted45 = phi i64 [ %_QFEresult.promoted4647, %.preheader ], [ %_QFEresult.promoted43, %33 ]
  %.040 = phi i64 [ 2, %.preheader ], [ %34, %33 ]
  %common.ret.op.i253738 = phi i64 [ %_QFEresult.promoted4647, %.preheader ], [ %common.ret.op.i2536, %33 ]
  %7 = select i1 %.not3.i, i64 1, i64 %.040
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader, %.lr.ph.i
  %spec.select4.i = phi i64 [ %spec.select.i, %.lr.ph.i ], [ %7, %.lr.ph.i.preheader ]
  %8 = phi i64 [ %10, %.lr.ph.i ], [ %.01249, %.lr.ph.i.preheader ]
  %9 = phi i64 [ %11, %.lr.ph.i ], [ %.040, %.lr.ph.i.preheader ]
  %10 = lshr i64 %8, 1
  %11 = mul i64 %9, %9
  %12 = and i64 %8, 2
  %.not.i = icmp eq i64 %12, 0
  %13 = select i1 %.not.i, i64 1, i64 %11
  %spec.select.i = mul i64 %13, %spec.select4.i
  %14 = icmp ult i64 %8, 4
  br i1 %14, label %__mlir_math_ipowi_i64.exit, label %.lr.ph.i

__mlir_math_ipowi_i64.exit:                       ; preds = %.lr.ph.i
  %15 = icmp sgt i64 %spec.select.i, %5
  br i1 %15, label %split, label %.lr.ph.i23.preheader

.lr.ph.i23.preheader:                             ; preds = %__mlir_math_ipowi_i64.exit
  %16 = select i1 %.not3.i, i64 1, i64 %.040
  br label %.lr.ph.i23

.lr.ph.i23:                                       ; preds = %.lr.ph.i23.preheader, %.lr.ph.i23
  %spec.select4.i20 = phi i64 [ %spec.select.i22, %.lr.ph.i23 ], [ %16, %.lr.ph.i23.preheader ]
  %17 = phi i64 [ %19, %.lr.ph.i23 ], [ %.01249, %.lr.ph.i23.preheader ]
  %18 = phi i64 [ %20, %.lr.ph.i23 ], [ %.040, %.lr.ph.i23.preheader ]
  %19 = lshr i64 %17, 1
  %20 = mul i64 %18, %18
  %21 = and i64 %17, 2
  %.not.i21 = icmp eq i64 %21, 0
  %22 = select i1 %.not.i21, i64 1, i64 %20
  %spec.select.i22 = mul i64 %22, %spec.select4.i20
  %23 = icmp ult i64 %17, 4
  br i1 %23, label %__mlir_math_ipowi_i64.exit24, label %.lr.ph.i23

__mlir_math_ipowi_i64.exit24:                     ; preds = %.lr.ph.i23
  %24 = icmp sgt i64 %spec.select.i22, %common.ret.op.i253738
  br i1 %24, label %.lr.ph.i33.preheader, label %33

.lr.ph.i33.preheader:                             ; preds = %__mlir_math_ipowi_i64.exit24
  %25 = select i1 %.not3.i, i64 1, i64 %.040
  br label %.lr.ph.i33

.lr.ph.i33:                                       ; preds = %.lr.ph.i33.preheader, %.lr.ph.i33
  %spec.select4.i30 = phi i64 [ %spec.select.i32, %.lr.ph.i33 ], [ %25, %.lr.ph.i33.preheader ]
  %26 = phi i64 [ %28, %.lr.ph.i33 ], [ %.01249, %.lr.ph.i33.preheader ]
  %27 = phi i64 [ %29, %.lr.ph.i33 ], [ %.040, %.lr.ph.i33.preheader ]
  %28 = lshr i64 %26, 1
  %29 = mul i64 %27, %27
  %30 = and i64 %26, 2
  %.not.i31 = icmp eq i64 %30, 0
  %31 = select i1 %.not.i31, i64 1, i64 %29
  %spec.select.i32 = mul i64 %31, %spec.select4.i30
  %32 = icmp ult i64 %26, 4
  br i1 %32, label %__mlir_math_ipowi_i64.exit34, label %.lr.ph.i33

__mlir_math_ipowi_i64.exit34:                     ; preds = %.lr.ph.i33
  store i64 %spec.select.i32, ptr @_QFEresult, align 8, !tbaa !3
  br label %33

33:                                               ; preds = %__mlir_math_ipowi_i64.exit34, %__mlir_math_ipowi_i64.exit24
  %_QFEresult.promoted43 = phi i64 [ %spec.select.i32, %__mlir_math_ipowi_i64.exit34 ], [ %_QFEresult.promoted45, %__mlir_math_ipowi_i64.exit24 ]
  %common.ret.op.i2536 = phi i64 [ %spec.select.i32, %__mlir_math_ipowi_i64.exit34 ], [ %common.ret.op.i253738, %__mlir_math_ipowi_i64.exit24 ]
  %34 = add nuw nsw i64 %.040, 1
  %exitcond.not = icmp eq i64 %34, 32
  br i1 %exitcond.not, label %split, label %.lr.ph.i.preheader

split:                                            ; preds = %__mlir_math_ipowi_i64.exit, %33
  %_QFEresult.promoted44.ph = phi i64 [ %_QFEresult.promoted43, %33 ], [ %_QFEresult.promoted45, %__mlir_math_ipowi_i64.exit ]
  %35 = add nuw nsw i64 %.01249, 1
  %exitcond50.not = icmp eq i64 %35, 10
  br i1 %exitcond50.not, label %36, label %.preheader

36:                                               ; preds = %split
  %37 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.a3d008b28cb8579e827da3a3b3c1dcd8, i32 17)
  %38 = load i64, ptr @_QFEresult, align 8, !tbaa !3
  %39 = call i1 @_FortranAioOutputInteger64(ptr %37, i64 %38)
  %40 = call i32 @_FortranAioEndIoStatement(ptr %37)
  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 @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

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