; LLVM IR from VeloxChem/VeloxChem :: src/dft_func/GridPartitioner.ll (ZNK16CGridPartitioner20findDividingPositionEPKdi)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.0" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%class.CGridPartitioner = type <{ %"class.std::__cxx11::list", i32, [4 x i8] }>
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<CGridBox, std::allocator<CGridBox>>::_List_impl" }
%"struct.std::__cxx11::_List_base<CGridBox, std::allocator<CGridBox>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK16CGridPartitioner20findDividingPositionEPKdi(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef %1, i32 noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca double, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::vector", align 8
  %9 = alloca %"class.std::allocator.0", align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %16 = load ptr, ptr %5, align 8
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 1048576
  br i1 %18, label %19, label %23

19:                                               ; preds = %3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = call noundef double @_ZNK16CGridPartitioner16estimateMedianP2EPKdi(ptr noundef nonnull align 8 dereferenceable(28) %16, ptr noundef %20, i32 noundef %21)
  store double %22, ptr %4, align 8
  br label %168

23:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #4
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %25, i64 %27
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  invoke void @_ZNSt6vectorIdSaIdEEC2IPKdvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %24, ptr noundef %28, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %29 unwind label %66

29:                                               ; preds = %23
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  %30 = call ptr @_ZNSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  %31 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %30, ptr %31, align 8
  %32 = call ptr @_ZNSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  %33 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %32, ptr %33, align 8
  %34 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8
  %36 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_S7_(ptr %35, ptr %37)
          to label %38 unwind label %70

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %39 = getelementptr inbounds %class.CGridPartitioner, ptr %16, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !11
  store i32 %40, ptr %14, align 4, !tbaa !9
  %41 = load i32, ptr %14, align 4, !tbaa !9
  %42 = mul nsw i32 %41, 2
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %74

45:                                               ; preds = %38
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = mul nsw i32 %47, 3
  %49 = icmp sle i32 %46, %48
  br i1 %49, label %50, label %74

50:                                               ; preds = %45
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = sdiv i32 %51, 3
  %53 = mul nsw i32 %52, 1
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %55) #4
  %57 = load double, ptr %56, align 8, !tbaa !19
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = sdiv i32 %58, 3
  %60 = mul nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %61) #4
  %63 = load double, ptr %62, align 8, !tbaa !19
  %64 = fadd double %57, %63
  %65 = fmul double 5.000000e-01, %64
  store double %65, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %166

66:                                               ; preds = %23
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %10, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %11, align 4
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  br label %167

70:                                               ; preds = %29
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %10, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %11, align 4
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  br label %167

74:                                               ; preds = %45, %38
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = mul nsw i32 %75, 4
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %79, label %100

79:                                               ; preds = %74
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = load i32, ptr %14, align 4, !tbaa !9
  %82 = mul nsw i32 %81, 5
  %83 = icmp sle i32 %80, %82
  br i1 %83, label %84, label %100

84:                                               ; preds = %79
  %85 = load i32, ptr %7, align 4, !tbaa !9
  %86 = sdiv i32 %85, 5
  %87 = mul nsw i32 %86, 2
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %89) #4
  %91 = load double, ptr %90, align 8, !tbaa !19
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = sdiv i32 %92, 5
  %94 = mul nsw i32 %93, 2
  %95 = sext i32 %94 to i64
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %95) #4
  %97 = load double, ptr %96, align 8, !tbaa !19
  %98 = fadd double %91, %97
  %99 = fmul double 5.000000e-01, %98
  store double %99, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %166

100:                                              ; preds = %79, %74
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = mul nsw i32 %101, 6
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %126

105:                                              ; preds = %100
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = load i32, ptr %14, align 4, !tbaa !9
  %108 = mul nsw i32 %107, 7
  %109 = icmp sle i32 %106, %108
  br i1 %109, label %110, label %126

110:                                              ; preds = %105
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = sdiv i32 %111, 7
  %113 = mul nsw i32 %112, 3
  %114 = sub nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %115) #4
  %117 = load double, ptr %116, align 8, !tbaa !19
  %118 = load i32, ptr %7, align 4, !tbaa !9
  %119 = sdiv i32 %118, 7
  %120 = mul nsw i32 %119, 3
  %121 = sext i32 %120 to i64
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %121) #4
  %123 = load double, ptr %122, align 8, !tbaa !19
  %124 = fadd double %117, %123
  %125 = fmul double 5.000000e-01, %124
  store double %125, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %166

126:                                              ; preds = %105, %100
  %127 = load i32, ptr %14, align 4, !tbaa !9
  %128 = mul nsw i32 %127, 8
  %129 = load i32, ptr %7, align 4, !tbaa !9
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %131, label %152

131:                                              ; preds = %126
  %132 = load i32, ptr %7, align 4, !tbaa !9
  %133 = load i32, ptr %14, align 4, !tbaa !9
  %134 = mul nsw i32 %133, 9
  %135 = icmp sle i32 %132, %134
  br i1 %135, label %136, label %152

136:                                              ; preds = %131
  %137 = load i32, ptr %7, align 4, !tbaa !9
  %138 = sdiv i32 %137, 9
  %139 = mul nsw i32 %138, 4
  %140 = sub nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %141) #4
  %143 = load double, ptr %142, align 8, !tbaa !19
  %144 = load i32, ptr %7, align 4, !tbaa !9
  %145 = sdiv i32 %144, 9
  %146 = mul nsw i32 %145, 4
  %147 = sext i32 %146 to i64
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %147) #4
  %149 = load double, ptr %148, align 8, !tbaa !19
  %150 = fadd double %143, %149
  %151 = fmul double 5.000000e-01, %150
  store double %151, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %166

152:                                              ; preds = %131, %126
  %153 = load i32, ptr %7, align 4, !tbaa !9
  %154 = sdiv i32 %153, 2
  %155 = sub nsw i32 %154, 1
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %156) #4
  %158 = load double, ptr %157, align 8, !tbaa !19
  %159 = load i32, ptr %7, align 4, !tbaa !9
  %160 = sdiv i32 %159, 2
  %161 = sext i32 %160 to i64
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %161) #4
  %163 = load double, ptr %162, align 8, !tbaa !19
  %164 = fadd double %158, %163
  %165 = fmul double 5.000000e-01, %164
  store double %165, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %166

166:                                              ; preds = %152, %136, %110, %84, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br label %168

167:                                              ; preds = %70, %66
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br label %170

168:                                              ; preds = %166, %19
  %169 = load double, ptr %4, align 8
  ret double %169

170:                                              ; preds = %167
  %171 = load ptr, ptr %10, align 8
  %172 = load i32, ptr %11, align 4
  %173 = insertvalue { ptr, i32 } poison, ptr %171, 0
  %174 = insertvalue { ptr, i32 } %173, i32 %172, 1
  resume { ptr, i32 } %174
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK16CGridPartitioner16estimateMedianP2EPKdi(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEEC2IPKdvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_S7_(ptr, ptr) #3

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTS16CGridPartitioner", !13, i64 0, !10, i64 24}
!13 = !{!"_ZTSNSt7__cxx114listI8CGridBoxSaIS1_EEE", !14, i64 0}
!14 = !{!"_ZTSNSt7__cxx1110_List_baseI8CGridBoxSaIS1_EEE", !15, i64 0}
!15 = !{!"_ZTSNSt7__cxx1110_List_baseI8CGridBoxSaIS1_EE10_List_implE", !16, i64 0}
!16 = !{!"_ZTSNSt8__detail17_List_node_headerE", !17, i64 0, !18, i64 16}
!17 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"double", !7, i64 0}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.0" = type { i8 }

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK16CGridPartitioner20findDividingPositionEPKdi(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = icmp sgt i32 %2, 1048576
  br i1 %6, label %7, label %9

7:                                                ; preds = %3
  %8 = tail call noundef double @_ZNK16CGridPartitioner16estimateMedianP2EPKdi(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef %1, i32 noundef %2)
  br label %60

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  %10 = sext i32 %2 to i64
  %11 = getelementptr inbounds double, ptr %1, i64 %10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #4
  call void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  invoke void @_ZNSt6vectorIdSaIdEEC2IPKdvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef %1, ptr noundef %11, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %12 unwind label %23

12:                                               ; preds = %9
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  %13 = call ptr @_ZNSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %14 = call ptr @_ZNSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_S7_(ptr %13, ptr %14)
          to label %15 unwind label %25

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load i32, ptr %16, align 8, !tbaa !5
  %18 = shl nsw i32 %17, 1
  %19 = icmp sge i32 %18, %2
  %20 = mul nsw i32 %17, 3
  %.not = icmp slt i32 %20, %2
  %or.cond = select i1 %19, i1 true, i1 %.not
  br i1 %or.cond, label %27, label %21

21:                                               ; preds = %15
  %22 = sdiv i32 %2, 3
  br label %50

23:                                               ; preds = %9
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  br label %59

25:                                               ; preds = %12
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  br label %59

27:                                               ; preds = %15
  %28 = shl nsw i32 %17, 2
  %29 = icmp sge i32 %28, %2
  %30 = mul nsw i32 %17, 5
  %.not41 = icmp slt i32 %30, %2
  %or.cond44 = select i1 %29, i1 true, i1 %.not41
  br i1 %or.cond44, label %34, label %31

31:                                               ; preds = %27
  %32 = sdiv i32 %2, 5
  %33 = shl nsw i32 %32, 1
  br label %50

34:                                               ; preds = %27
  %35 = mul nsw i32 %17, 6
  %36 = icmp sge i32 %35, %2
  %37 = mul nsw i32 %17, 7
  %.not42 = icmp slt i32 %37, %2
  %or.cond45 = select i1 %36, i1 true, i1 %.not42
  br i1 %or.cond45, label %41, label %38

38:                                               ; preds = %34
  %39 = sdiv i32 %2, 7
  %40 = mul nsw i32 %39, 3
  br label %50

41:                                               ; preds = %34
  %42 = shl nsw i32 %17, 3
  %43 = icmp sge i32 %42, %2
  %44 = mul nsw i32 %17, 9
  %.not43 = icmp slt i32 %44, %2
  %or.cond46 = select i1 %43, i1 true, i1 %.not43
  br i1 %or.cond46, label %48, label %45

45:                                               ; preds = %41
  %46 = sdiv i32 %2, 9
  %47 = shl nsw i32 %46, 2
  br label %50

48:                                               ; preds = %41
  %49 = sdiv i32 %2, 2
  br label %50

50:                                               ; preds = %48, %45, %38, %31, %21
  %.sink = phi i32 [ %49, %48 ], [ %47, %45 ], [ %40, %38 ], [ %33, %31 ], [ %22, %21 ]
  %51 = add nsw i32 %.sink, -1
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %52) #4
  %54 = load double, ptr %53, align 8, !tbaa !17
  %55 = sext i32 %.sink to i64
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %55) #4
  %57 = load double, ptr %56, align 8, !tbaa !17
  %58 = fadd double %54, %57
  %.0 = fmul double %58, 5.000000e-01
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  br label %60

59:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  resume { ptr, i32 } %.pn

60:                                               ; preds = %50, %7
  %.1 = phi double [ %8, %7 ], [ %.0, %50 ]
  ret double %.1
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK16CGridPartitioner16estimateMedianP2EPKdi(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEEC2IPKdvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIdSaIdEE3endEv(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(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { 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, !16, i64 24}
!6 = !{!"_ZTS16CGridPartitioner", !7, i64 0, !16, i64 24}
!7 = !{!"_ZTSNSt7__cxx114listI8CGridBoxSaIS1_EEE", !8, i64 0}
!8 = !{!"_ZTSNSt7__cxx1110_List_baseI8CGridBoxSaIS1_EEE", !9, i64 0}
!9 = !{!"_ZTSNSt7__cxx1110_List_baseI8CGridBoxSaIS1_EE10_List_implE", !10, i64 0}
!10 = !{!"_ZTSNSt8__detail17_List_node_headerE", !11, i64 0, !15, i64 16}
!11 = !{!"_ZTSNSt8__detail15_List_node_baseE", !12, i64 0, !12, i64 8}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"int", !13, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass