program main
    implicit none
    integer(8) a,b,x,i,j
    read(*,*) x
    do i = 0, 1000
        do j = 0, 1000
            if ( j**5-i**5==x ) then
                a=j
                b=i
                exit
            else if ( j**5+i**5==x ) then
                a=j
                b=-i
                exit
            end if
        end do
    end do
    write(*,*) a,b
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"

@_QQcl.c2a1d0f4c6cef55d1a9e2945f1a37f24 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1527/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

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

.preheader:                                       ; preds = %0, %.loopexit
  %.01643 = phi i64 [ 0, %0 ], [ %26, %.loopexit ]
  %.01742 = phi i64 [ undef, %0 ], [ %.1, %.loopexit ]
  %.01841 = phi i64 [ undef, %0 ], [ %.119, %.loopexit ]
  %6 = mul i64 %.01643, %.01643
  %7 = mul i64 %6, %6
  %spec.select.i24.1 = mul i64 %7, %.01643
  br label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %24, %.preheader
  %.039 = phi i64 [ 0, %.preheader ], [ %25, %24 ]
  %8 = mul i64 %.039, %.039
  %9 = mul i64 %8, %8
  %spec.select.i.1 = mul i64 %9, %.039
  %10 = sub i64 %spec.select.i.1, %spec.select.i24.1
  %11 = icmp eq i64 %10, %5
  br i1 %11, label %.loopexit, label %.lr.ph.i30.preheader

.lr.ph.i30.preheader:                             ; preds = %.lr.ph.i.preheader
  %12 = add i64 %spec.select.i24.1, %spec.select.i.1
  %13 = icmp eq i64 %12, %5
  br i1 %13, label %14, label %16

14:                                               ; preds = %.lr.ph.i30.preheader.1, %.lr.ph.i30.preheader
  %.039.lcssa49 = phi i64 [ %.039, %.lr.ph.i30.preheader ], [ %17, %.lr.ph.i30.preheader.1 ]
  %15 = sub nsw i64 0, %.01643
  br label %.loopexit

16:                                               ; preds = %.lr.ph.i30.preheader
  %17 = or i64 %.039, 1
  %exitcond.not = icmp eq i64 %17, 1001
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph.i.preheader.1

.lr.ph.i.preheader.1:                             ; preds = %16
  %18 = mul i64 %17, %17
  %19 = mul i64 %18, %18
  %spec.select.i.1.1 = mul i64 %19, %17
  %20 = sub i64 %spec.select.i.1.1, %spec.select.i24.1
  %21 = icmp eq i64 %20, %5
  br i1 %21, label %.loopexit, label %.lr.ph.i30.preheader.1

.lr.ph.i30.preheader.1:                           ; preds = %.lr.ph.i.preheader.1
  %22 = add i64 %spec.select.i24.1, %spec.select.i.1.1
  %23 = icmp eq i64 %22, %5
  br i1 %23, label %14, label %24

24:                                               ; preds = %.lr.ph.i30.preheader.1
  %25 = add nuw nsw i64 %.039, 2
  br label %.lr.ph.i.preheader

.loopexit:                                        ; preds = %.lr.ph.i.preheader, %16, %.lr.ph.i.preheader.1, %14
  %.119 = phi i64 [ %.039.lcssa49, %14 ], [ %.039, %.lr.ph.i.preheader ], [ %.01841, %16 ], [ %17, %.lr.ph.i.preheader.1 ]
  %.1 = phi i64 [ %15, %14 ], [ %.01643, %.lr.ph.i.preheader ], [ %.01742, %16 ], [ %.01643, %.lr.ph.i.preheader.1 ]
  %26 = add nuw nsw i64 %.01643, 1
  %exitcond46.not = icmp eq i64 %26, 1001
  br i1 %exitcond46.not, label %27, label %.preheader

27:                                               ; preds = %.loopexit
  %28 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c2a1d0f4c6cef55d1a9e2945f1a37f24, i32 18)
  %29 = call i1 @_FortranAioOutputInteger64(ptr %28, i64 %.119)
  %30 = call i1 @_FortranAioOutputInteger64(ptr %28, i64 %.1)
  %31 = call i32 @_FortranAioEndIoStatement(ptr %28)
  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 @_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"}
