program main
  implicit none
  integer(8) :: x
  integer(8) :: a, b

  read *, x

  do a = -118, 119
    do b = -119, 118
      if ( a**5-b**5 == x ) then
        print *, a, b
        stop
      end if
    end do
  end do

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.05c9054a2ebfcaf7fece76fc4922c93a = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1521/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.05c9054a2ebfcaf7fece76fc4922c93a, i32 6)
  %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, %25
  %.01023 = phi i64 [ -118, %0 ], [ %26, %25 ]
  %6 = mul i64 %.01023, %.01023
  %7 = mul i64 %6, %6
  %spec.select.i.1 = mul i64 %7, %.01023
  br label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %23, %.preheader
  %.021 = phi i64 [ -119, %.preheader ], [ %24, %23 ]
  %8 = mul i64 %.021, %.021
  %9 = mul i64 %8, %8
  %spec.select.i15.1 = mul i64 %9, %.021
  %10 = sub i64 %spec.select.i.1, %spec.select.i15.1
  %11 = icmp eq i64 %10, %5
  br i1 %11, label %12, label %.lr.ph.i.preheader.1

12:                                               ; preds = %.lr.ph.i.preheader.1, %.lr.ph.i.preheader
  %.021.lcssa = phi i64 [ %.021, %.lr.ph.i.preheader ], [ %18, %.lr.ph.i.preheader.1 ]
  %13 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.05c9054a2ebfcaf7fece76fc4922c93a, i32 11)
  %14 = call i1 @_FortranAioOutputInteger64(ptr %13, i64 %.01023)
  %15 = call i1 @_FortranAioOutputInteger64(ptr %13, i64 %.021.lcssa)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %17 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.lr.ph.i.preheader.1:                             ; preds = %.lr.ph.i.preheader
  %18 = add nsw i64 %.021, 1
  %19 = mul i64 %18, %18
  %20 = mul i64 %19, %19
  %spec.select.i15.1.1 = mul i64 %20, %18
  %21 = sub i64 %spec.select.i.1, %spec.select.i15.1.1
  %22 = icmp eq i64 %21, %5
  br i1 %22, label %12, label %23

23:                                               ; preds = %.lr.ph.i.preheader.1
  %24 = add nsw i64 %.021, 2
  %exitcond.not.1 = icmp eq i64 %24, 119
  br i1 %exitcond.not.1, label %25, label %.lr.ph.i.preheader

25:                                               ; preds = %23
  %26 = add nsw i64 %.01023, 1
  %exitcond26.not = icmp eq i64 %26, 120
  br i1 %exitcond26.not, label %27, label %.preheader

27:                                               ; preds = %25
  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

declare {} @_FortranAStopStatement(i32, i1, i1) 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"}
