; LLVM IR from Tudor67/Competitive-Programming :: AtCoder/ABC191 (D_sol1_shift_and_use_long_double)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca x86_fp80, align 16
  %3 = alloca x86_fp80, align 16
  %4 = alloca x86_fp80, align 16
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca x86_fp80, align 16
  %8 = alloca x86_fp80, align 16
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 16 dereferenceable(16) %2)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 16 dereferenceable(16) %3)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 16 dereferenceable(16) %4)
  %14 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %15 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %14)
  %16 = load x86_fp80, ptr %4, align 16, !tbaa !5
  %17 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %16)
  %18 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %17)
  %19 = fadd x86_fp80 %15, %18
  store x86_fp80 %19, ptr %2, align 16, !tbaa !5
  %20 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %21 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %20)
  %22 = load x86_fp80, ptr %4, align 16, !tbaa !5
  %23 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %22)
  %24 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %23)
  %25 = fadd x86_fp80 %21, %24
  store x86_fp80 %25, ptr %3, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %26 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %27 = load x86_fp80, ptr %4, align 16, !tbaa !5
  %28 = fsub x86_fp80 %26, %27
  %29 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %28)
  %30 = fptosi x86_fp80 %29 to i64
  store i64 %30, ptr %6, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %69, %0
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = sitofp i64 %32 to x86_fp80
  %34 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %35 = load x86_fp80, ptr %4, align 16, !tbaa !5
  %36 = fadd x86_fp80 %34, %35
  %37 = fcmp ole x86_fp80 %33, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %72

39:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  %40 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %41 = load i64, ptr %6, align 8, !tbaa !9
  %42 = sitofp i64 %41 to x86_fp80
  %43 = fsub x86_fp80 %40, %42
  %44 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %43)
  store x86_fp80 %44, ptr %7, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %45 = load x86_fp80, ptr %4, align 16, !tbaa !5
  %46 = load x86_fp80, ptr %4, align 16, !tbaa !5
  %47 = load x86_fp80, ptr %7, align 16, !tbaa !5
  %48 = load x86_fp80, ptr %7, align 16, !tbaa !5
  %49 = fmul x86_fp80 %47, %48
  %50 = fneg x86_fp80 %49
  %51 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %45, x86_fp80 %46, x86_fp80 %50)
  %52 = call noundef x86_fp80 @_ZSt4sqrte(x86_fp80 noundef %51)
  store x86_fp80 %52, ptr %8, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %53 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %54 = load x86_fp80, ptr %8, align 16, !tbaa !5
  %55 = fadd x86_fp80 %53, %54
  %56 = call noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef %55)
  %57 = fptosi x86_fp80 %56 to i64
  store i64 %57, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %58 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %59 = load x86_fp80, ptr %8, align 16, !tbaa !5
  %60 = fsub x86_fp80 %58, %59
  %61 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %60)
  %62 = fptosi x86_fp80 %61 to i64
  store i64 %62, ptr %10, align 8, !tbaa !9
  %63 = load i64, ptr %9, align 8, !tbaa !9
  %64 = load i64, ptr %10, align 8, !tbaa !9
  %65 = sub nsw i64 %63, %64
  %66 = add nsw i64 %65, 1
  %67 = load i64, ptr %5, align 8, !tbaa !9
  %68 = add nsw i64 %67, %66
  store i64 %68, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  br label %69

69:                                               ; preds = %39
  %70 = load i64, ptr %6, align 8, !tbaa !9
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %6, align 8, !tbaa !9
  br label %31, !llvm.loop !11

72:                                               ; preds = %38
  %73 = load i64, ptr %5, align 8, !tbaa !9
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %73)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #5
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt4sqrte(x86_fp80 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca x86_fp80, align 16
  %2 = alloca x86_fp80, align 16
  %3 = alloca x86_fp80, align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 16 dereferenceable(16) %1)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) %2)
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 16 dereferenceable(16) %3)
  %7 = load x86_fp80, ptr %1, align 16, !tbaa !5
  %8 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %7)
  %9 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %10 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %9)
  %11 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %10)
  %12 = fadd x86_fp80 %8, %11
  store x86_fp80 %12, ptr %1, align 16, !tbaa !5
  %13 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %14 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %13)
  %15 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %16 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %15)
  %17 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %16)
  %18 = fadd x86_fp80 %14, %17
  store x86_fp80 %18, ptr %2, align 16, !tbaa !5
  %19 = load x86_fp80, ptr %1, align 16, !tbaa !5
  %20 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %21 = fsub x86_fp80 %19, %20
  %22 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %21)
  %23 = fptosi x86_fp80 %22 to i64
  %24 = sitofp i64 %23 to x86_fp80
  %25 = load x86_fp80, ptr %1, align 16, !tbaa !5
  %26 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %27 = fadd x86_fp80 %25, %26
  %28 = fcmp ult x86_fp80 %27, %24
  br i1 %28, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.0.lcssa = phi i64 [ 0, %0 ], [ %49, %.lr.ph ]
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.0.lcssa)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #5
  ret i32 0

.lr.ph:                                           ; preds = %0, %.lr.ph
  %30 = phi x86_fp80 [ %52, %.lr.ph ], [ %25, %0 ]
  %31 = phi x86_fp80 [ %51, %.lr.ph ], [ %24, %0 ]
  %.014 = phi i64 [ %49, %.lr.ph ], [ 0, %0 ]
  %.01113 = phi i64 [ %50, %.lr.ph ], [ %23, %0 ]
  %32 = fsub x86_fp80 %30, %31
  %33 = call noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef %32)
  %34 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %35 = fneg x86_fp80 %33
  %36 = fmul x86_fp80 %33, %35
  %37 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %34, x86_fp80 %34, x86_fp80 %36)
  %38 = call noundef x86_fp80 @_ZSt4sqrte(x86_fp80 noundef %37)
  %39 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %40 = fadd x86_fp80 %38, %39
  %41 = call noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef %40)
  %42 = fptosi x86_fp80 %41 to i64
  %43 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %44 = fsub x86_fp80 %43, %38
  %45 = call noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef %44)
  %46 = fptosi x86_fp80 %45 to i64
  %47 = add i64 %.014, 1
  %48 = add i64 %47, %42
  %49 = sub i64 %48, %46
  %50 = add nsw i64 %.01113, 1
  %51 = sitofp i64 %50 to x86_fp80
  %52 = load x86_fp80, ptr %1, align 16, !tbaa !5
  %53 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %54 = fadd x86_fp80 %52, %53
  %55 = fcmp ult x86_fp80 %54, %51
  br i1 %55, label %._crit_edge, label %.lr.ph, !llvm.loop !9
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERe(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt3abse(x86_fp80 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt4ceile(x86_fp80 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt4sqrte(x86_fp80 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass