program main
  implicit none
  integer(8) :: n, sni
  read(*, *) n
  sni = nint(n ** 0.5_8)
  if (sni ** 2 <= n) then
    write(*, "(i0)") sni ** 2
  else
    write(*, "(i0)") (sni - 1) ** 2
  end if
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.29e1f27daf29c01b715e06d009d347e0 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6757/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 -1, ptr nonnull @_QQcl.29e1f27daf29c01b715e06d009d347e0, 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
  %6 = sitofp i64 %5 to double
  %7 = call double @llvm.sqrt.f64(double %6)
  %8 = call i32 @llvm.lround.i32.f64(double %7)
  %9 = sext i32 %8 to i64
  %10 = mul nsw i64 %9, %9
  %.not = icmp sgt i64 %10, %5
  br i1 %.not, label %14, label %11

11:                                               ; preds = %0
  %12 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.29e1f27daf29c01b715e06d009d347e0, i32 7)
  %13 = call i1 @_FortranAioOutputInteger64(ptr %12, i64 %10)
  br label %19

14:                                               ; preds = %0
  %15 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.29e1f27daf29c01b715e06d009d347e0, i32 9)
  %16 = add nsw i64 %9, -1
  %17 = mul nsw i64 %16, %16
  %18 = call i1 @_FortranAioOutputInteger64(ptr %15, i64 %17)
  br label %19

19:                                               ; preds = %11, %14
  %.sink = phi ptr [ %12, %11 ], [ %15, %14 ]
  %20 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.lround.i32.f64(double) #0

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #0

attributes #0 = { mustprogress 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"}
