; LLVM IR from xtaci/algorithms :: src/suffix_array_demo.ll (ZN3alg11SuffixArray11suffix_sortEv)

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

%"struct.std::_Placeholder" = type { i8 }
%"struct.std::_Placeholder.9" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.std::_Bind" = type { { i64, i64 }, %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.8" }
%"struct.std::_Head_base.8" = type { %"class.alg::SuffixArray" }
%"class.alg::SuffixArray" = type { %"class.std::vector", %"class.std::vector.0", i32, i32, i32, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZNSt12placeholders2_1E = external global %"struct.std::_Placeholder", align 1
@_ZNSt12placeholders2_2E = external global %"struct.std::_Placeholder.9", align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3alg11SuffixArray11suffix_sortEv(ptr noundef nonnull align 8 dereferenceable(72) %0) #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.std::_Bind", align 8
  %8 = alloca { i64, i64 }, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  %12 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 1
  %13 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 2
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = sext i32 %14 to i64
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !20
  br label %16

16:                                               ; preds = %28, %1
  %17 = load i32, ptr %3, align 4, !tbaa !20
  %18 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %31

22:                                               ; preds = %16
  %23 = load i32, ptr %3, align 4, !tbaa !20
  %24 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 1
  %25 = load i32, ptr %3, align 4, !tbaa !20
  %26 = sext i32 %25 to i64
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %26) #6
  store i32 %23, ptr %27, align 4, !tbaa !20
  br label %28

28:                                               ; preds = %22
  %29 = load i32, ptr %3, align 4, !tbaa !20
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %3, align 4, !tbaa !20
  br label %16, !llvm.loop !21

31:                                               ; preds = %21
  %32 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 0
  %33 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !9
  %35 = call noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %34)
  %36 = call double @llvm.ceil.f64(double %35)
  %37 = fadd double %36, 1.000000e+00
  %38 = fptoui double %37 to i64
  call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %38)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !23
  br label %39

39:                                               ; preds = %55, %31
  %40 = load i64, ptr %4, align 8, !tbaa !23
  %41 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 0
  %42 = call noundef i64 @_ZNKSt6vectorIS_IiSaIiEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #6
  %43 = icmp ult i64 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %58

45:                                               ; preds = %39
  %46 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 0
  %47 = load i64, ptr %4, align 8, !tbaa !23
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #6
  %49 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 2
  %50 = load i32, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !9
  %53 = add nsw i32 %50, %52
  %54 = sext i32 %53 to i64
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %54)
  br label %55

55:                                               ; preds = %45
  %56 = load i64, ptr %4, align 8, !tbaa !23
  %57 = add i64 %56, 1
  store i64 %57, ptr %4, align 8, !tbaa !23
  br label %39, !llvm.loop !25

58:                                               ; preds = %44
  %59 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 3
  store i32 1, ptr %59, align 4, !tbaa !26
  %60 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 4
  store i32 0, ptr %60, align 8, !tbaa !27
  br label %61

61:                                               ; preds = %80, %58
  %62 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 3
  %63 = load i32, ptr %62, align 4, !tbaa !26
  %64 = ashr i32 %63, 1
  %65 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 2
  %66 = load i32, ptr %65, align 8, !tbaa !9
  %67 = icmp slt i32 %64, %66
  br i1 %67, label %68, label %91

68:                                               ; preds = %61
  %69 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 1
  %70 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %69) #6
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  %72 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 1
  %73 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %72) #6
  %74 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %73, ptr %74, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  store { i64, i64 } { i64 ptrtoint (ptr @_ZN3alg11SuffixArray9less_thanEii to i64), i64 0 }, ptr %8, align 8, !tbaa !28
  call void @_ZSt4bindIMN3alg11SuffixArrayEFbiiEJRS1_RKSt12_PlaceholderILi1EERKS5_ILi2EEEENSt12_Bind_helperIXsr15__is_socketlikeIT_EE5valueESD_JDpT0_EE4typeEOSD_DpOSE_(ptr dead_on_unwind writable sret(%"class.std::_Bind") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(72) %11, ptr noundef nonnull align 1 dereferenceable(1) @_ZNSt12placeholders2_1E, ptr noundef nonnull align 1 dereferenceable(1) @_ZNSt12placeholders2_2E)
  %75 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8
  %77 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEESt5_BindIFMN3alg11SuffixArrayEFbiiES9_St12_PlaceholderILi1EESC_ILi2EEEEEvT_SH_T0_(ptr %76, ptr %78, ptr noundef %7)
          to label %79 unwind label %87

79:                                               ; preds = %68
  call void @_ZNSt5_BindIFMN3alg11SuffixArrayEFbiiES1_St12_PlaceholderILi1EES4_ILi2EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(88) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @_ZN3alg11SuffixArray13update_bucketEv(ptr noundef nonnull align 8 dereferenceable(72) %11)
  br label %80

80:                                               ; preds = %79
  %81 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 3
  %82 = load i32, ptr %81, align 4, !tbaa !26
  %83 = shl i32 %82, 1
  store i32 %83, ptr %81, align 4, !tbaa !26
  %84 = getelementptr inbounds %"class.alg::SuffixArray", ptr %11, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !27
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %84, align 8, !tbaa !27
  br label %61, !llvm.loop !29

87:                                               ; preds = %68
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %9, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %10, align 4
  call void @_ZNSt5_BindIFMN3alg11SuffixArrayEFbiiES1_St12_PlaceholderILi1EES4_ILi2EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(88) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  br label %92

91:                                               ; preds = %61
  ret void

92:                                               ; preds = %87
  %93 = load ptr, ptr %9, align 8
  %94 = load i32, ptr %10, align 4
  %95 = insertvalue { ptr, i32 } poison, ptr %93, 0
  %96 = insertvalue { ptr, i32 } %95, i32 %94, 1
  resume { ptr, i32 } %96
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; 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 dso_local void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIS_IiSaIiEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEESt5_BindIFMN3alg11SuffixArrayEFbiiES9_St12_PlaceholderILi1EESC_ILi2EEEEEvT_SH_T0_(ptr, ptr, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4bindIMN3alg11SuffixArrayEFbiiEJRS1_RKSt12_PlaceholderILi1EERKS5_ILi2EEEENSt12_Bind_helperIXsr15__is_socketlikeIT_EE5valueESD_JDpT0_EE4typeEOSD_DpOSE_(ptr dead_on_unwind noalias writable sret(%"class.std::_Bind") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3alg11SuffixArray9less_thanEii(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef, i32 noundef) #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5_BindIFMN3alg11SuffixArrayEFbiiES1_St12_PlaceholderILi1EES4_ILi2EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3alg11SuffixArray13update_bucketEv(ptr noundef nonnull align 8 dereferenceable(72)) #0 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !19, i64 48}
!10 = !{!"_ZTSN3alg11SuffixArrayE", !11, i64 0, !15, i64 24, !19, i64 48, !19, i64 52, !19, i64 56, !6, i64 64}
!11 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSSt6vectorIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"int", !7, i64 0}
!20 = !{!19, !19, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !24, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = distinct !{!25, !22}
!26 = !{!10, !19, i64 52}
!27 = !{!10, !19, i64 56}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !22}


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

%"struct.std::_Placeholder" = type { i8 }
%"struct.std::_Placeholder.9" = type { i8 }
%"class.std::_Bind" = type { { i64, i64 }, %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.8" }
%"struct.std::_Head_base.8" = type { %"class.alg::SuffixArray" }
%"class.alg::SuffixArray" = type { %"class.std::vector", %"class.std::vector.0", i32, i32, i32, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZNSt12placeholders2_1E = external global %"struct.std::_Placeholder", align 1
@_ZNSt12placeholders2_2E = external global %"struct.std::_Placeholder.9", align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3alg11SuffixArray11suffix_sortEv(ptr noundef nonnull align 8 dereferenceable(72) %0) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::_Bind", align 8
  %3 = alloca { i64, i64 }, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = sext i32 %6 to i64
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %7)
  %8 = load i32, ptr %5, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %1
  %.lcssa = phi i32 [ %8, %1 ], [ %17, %.lr.ph ]
  %10 = tail call noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %.lcssa)
  %11 = tail call double @llvm.ceil.f64(double %10)
  %12 = fadd double %11, 1.000000e+00
  %13 = fptoui double %12 to i64
  tail call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %13)
  %14 = tail call noundef i64 @_ZNKSt6vectorIS_IiSaIiEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %.not = icmp eq i64 %14, 0
  br i1 %.not, label %._crit_edge16, label %.lr.ph15

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %1 ]
  %15 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv) #6
  %16 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %16, ptr %15, align 4, !tbaa !19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %5, align 8, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !20

._crit_edge16:                                    ; preds = %.lr.ph15, %._crit_edge
  %20 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 1, ptr %20, align 4, !tbaa !22
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 0, ptr %21, align 8, !tbaa !23
  %22 = load i32, ptr %5, align 8, !tbaa !5
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph18, label %._crit_edge19

.lr.ph18:                                         ; preds = %._crit_edge16
  %.fca.1.gep = getelementptr inbounds i8, ptr %3, i64 8
  br label %31

.lr.ph15:                                         ; preds = %._crit_edge, %.lr.ph15
  %.01013 = phi i64 [ %28, %.lr.ph15 ], [ 0, %._crit_edge ]
  %24 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.01013) #6
  %25 = load i32, ptr %5, align 8, !tbaa !5
  %26 = shl nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %27)
  %28 = add nuw i64 %.01013, 1
  %29 = tail call noundef i64 @_ZNKSt6vectorIS_IiSaIiEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %30 = icmp ult i64 %28, %29
  br i1 %30, label %.lr.ph15, label %._crit_edge16, !llvm.loop !24

31:                                               ; preds = %.lr.ph18, %34
  %32 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %33 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  store i64 ptrtoint (ptr @_ZN3alg11SuffixArray9less_thanEii to i64), ptr %3, align 8, !tbaa !25
  store i64 0, ptr %.fca.1.gep, align 8, !tbaa !25
  call void @_ZSt4bindIMN3alg11SuffixArrayEFbiiEJRS1_RKSt12_PlaceholderILi1EERKS5_ILi2EEEENSt12_Bind_helperIXsr15__is_socketlikeIT_EE5valueESD_JDpT0_EE4typeEOSD_DpOSE_(ptr dead_on_unwind nonnull writable sret(%"class.std::_Bind") align 8 %2, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 1 dereferenceable(1) @_ZNSt12placeholders2_1E, ptr noundef nonnull align 1 dereferenceable(1) @_ZNSt12placeholders2_2E)
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEESt5_BindIFMN3alg11SuffixArrayEFbiiES9_St12_PlaceholderILi1EESC_ILi2EEEEEvT_SH_T0_(ptr %32, ptr %33, ptr noundef nonnull %2)
          to label %34 unwind label %42

34:                                               ; preds = %31
  call void @_ZNSt5_BindIFMN3alg11SuffixArrayEFbiiES1_St12_PlaceholderILi1EES4_ILi2EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(88) %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @_ZN3alg11SuffixArray13update_bucketEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %35 = load i32, ptr %20, align 4, !tbaa !22
  %36 = shl i32 %35, 1
  store i32 %36, ptr %20, align 4, !tbaa !22
  %37 = load i32, ptr %21, align 8, !tbaa !23
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %21, align 8, !tbaa !23
  %39 = ashr exact i32 %36, 1
  %40 = load i32, ptr %5, align 8, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %31, label %._crit_edge19, !llvm.loop !26

42:                                               ; preds = %31
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt5_BindIFMN3alg11SuffixArrayEFbiiES1_St12_PlaceholderILi1EES4_ILi2EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(88) %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  resume { ptr, i32 } %43

._crit_edge19:                                    ; preds = %34, %._crit_edge16
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; 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 dso_local void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIS_IiSaIiEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEESt5_BindIFMN3alg11SuffixArrayEFbiiES9_St12_PlaceholderILi1EESC_ILi2EEEEEvT_SH_T0_(ptr, ptr, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4bindIMN3alg11SuffixArrayEFbiiEJRS1_RKSt12_PlaceholderILi1EERKS5_ILi2EEEENSt12_Bind_helperIXsr15__is_socketlikeIT_EE5valueESD_JDpT0_EE4typeEOSD_DpOSE_(ptr dead_on_unwind noalias writable sret(%"class.std::_Bind") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3alg11SuffixArray9less_thanEii(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef, i32 noundef) #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5_BindIFMN3alg11SuffixArrayEFbiiES1_St12_PlaceholderILi1EES4_ILi2EEEED2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3alg11SuffixArray13update_bucketEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { 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, !18, i64 48}
!6 = !{!"_ZTSN3alg11SuffixArrayE", !7, i64 0, !14, i64 24, !18, i64 48, !18, i64 52, !18, i64 56, !11, i64 64}
!7 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt6vectorIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!18 = !{!"int", !12, i64 0}
!19 = !{!18, !18, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!6, !18, i64 52}
!23 = !{!6, !18, i64 56}
!24 = distinct !{!24, !21}
!25 = !{!12, !12, i64 0}
!26 = distinct !{!26, !21}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass