; LLVM IR from robotics-upo/Heuristic_path_planners :: include/voro++-0.4.6/src/container.ll (ZN4voro14container_poly16sum_cell_volumesEv)

; 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.voro::voronoicell" = type { %"class.voro::voronoicell_base" }
%"class.voro::voronoicell_base" = type { ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, double, double, double, double }
%"class.voro::c_loop_all" = type { %"class.voro::c_loop_base.base", [4 x i8] }
%"class.voro::c_loop_base.base" = type <{ i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32 }>

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
declare dso_local void @_ZN4voro10c_loop_allC2INS_14container_polyEEERT_(ptr noundef nonnull align 8 dereferenceable(68), ptr noundef nonnull align 8 dereferenceable(408)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4voro11voronoicellC2Ev(ptr noundef nonnull align 8 dereferenceable(160)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4voro10c_loop_all5startEv(ptr noundef nonnull align 8 dereferenceable(68)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4voro10c_loop_all3incEv(ptr noundef nonnull align 8 dereferenceable(68)) #3 align 2

; Function Attrs: nounwind
declare void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160)) unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4voro14container_poly12compute_cellINS_11voronoicellENS_10c_loop_allEEEbRT_RT0_(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(68)) #2 align 2

declare noundef double @_ZN4voro16voronoicell_base6volumeEv(ptr noundef nonnull align 8 dereferenceable(160)) #5

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN4voro14container_poly16sum_cell_volumesEv(ptr noundef nonnull align 8 dereferenceable(408) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.voro::voronoicell", align 8
  %4 = alloca double, align 8
  %5 = alloca %"class.voro::c_loop_all", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 160, ptr %3) #6
  call void @_ZN4voro11voronoicellC2Ev(ptr noundef nonnull align 8 dereferenceable(160) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store double 0.000000e+00, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 72, ptr %5) #6
  invoke void @_ZN4voro10c_loop_allC2INS_14container_polyEEERT_(ptr noundef nonnull align 8 dereferenceable(68) %5, ptr noundef nonnull align 8 dereferenceable(408) %8)
          to label %9 unwind label %21

9:                                                ; preds = %1
  %10 = invoke noundef zeroext i1 @_ZN4voro10c_loop_all5startEv(ptr noundef nonnull align 8 dereferenceable(68) %5)
          to label %11 unwind label %21

11:                                               ; preds = %9
  br i1 %10, label %12, label %30

12:                                               ; preds = %11
  br label %13

13:                                               ; preds = %28, %12
  %14 = invoke noundef zeroext i1 @_ZN4voro14container_poly12compute_cellINS_11voronoicellENS_10c_loop_allEEEbRT_RT0_(ptr noundef nonnull align 8 dereferenceable(408) %8, ptr noundef nonnull align 8 dereferenceable(160) %3, ptr noundef nonnull align 8 dereferenceable(68) %5)
          to label %15 unwind label %21

15:                                               ; preds = %13
  br i1 %14, label %16, label %25

16:                                               ; preds = %15
  %17 = invoke noundef double @_ZN4voro16voronoicell_base6volumeEv(ptr noundef nonnull align 8 dereferenceable(160) %3)
          to label %18 unwind label %21

18:                                               ; preds = %16
  %19 = load double, ptr %4, align 8, !tbaa !9
  %20 = fadd double %19, %17
  store double %20, ptr %4, align 8, !tbaa !9
  br label %25

21:                                               ; preds = %26, %16, %13, %9, %1
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %6, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 72, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %3) #6
  call void @llvm.lifetime.end.p0(i64 160, ptr %3) #6
  br label %32

25:                                               ; preds = %18, %15
  br label %26

26:                                               ; preds = %25
  %27 = invoke noundef zeroext i1 @_ZN4voro10c_loop_all3incEv(ptr noundef nonnull align 8 dereferenceable(68) %5)
          to label %28 unwind label %21

28:                                               ; preds = %26
  br i1 %27, label %13, label %29, !llvm.loop !11

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29, %11
  %31 = load double, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 72, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %3) #6
  call void @llvm.lifetime.end.p0(i64 160, ptr %3) #6
  ret double %31

32:                                               ; preds = %21
  %33 = load ptr, ptr %6, align 8
  %34 = load i32, ptr %7, align 4
  %35 = insertvalue { ptr, i32 } poison, ptr %33, 0
  %36 = insertvalue { ptr, i32 } %35, i32 %34, 1
  resume { ptr, i32 } %36
}

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 = { 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 #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 = { nounwind "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 = { "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, !10, i64 0}
!10 = !{!"double", !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.voro::voronoicell" = type { %"class.voro::voronoicell_base" }
%"class.voro::voronoicell_base" = type { ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, double, double, double, double }
%"class.voro::c_loop_all" = type { %"class.voro::c_loop_base.base", [4 x i8] }
%"class.voro::c_loop_base.base" = type <{ i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32 }>

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
declare dso_local void @_ZN4voro10c_loop_allC2INS_14container_polyEEERT_(ptr noundef nonnull align 8 dereferenceable(68), ptr noundef nonnull align 8 dereferenceable(408)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4voro11voronoicellC2Ev(ptr noundef nonnull align 8 dereferenceable(160)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4voro10c_loop_all5startEv(ptr noundef nonnull align 8 dereferenceable(68)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4voro10c_loop_all3incEv(ptr noundef nonnull align 8 dereferenceable(68)) local_unnamed_addr #3 align 2

; Function Attrs: nounwind
declare void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160)) unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4voro14container_poly12compute_cellINS_11voronoicellENS_10c_loop_allEEEbRT_RT0_(ptr noundef nonnull align 8 dereferenceable(408), ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(68)) local_unnamed_addr #2 align 2

declare noundef double @_ZN4voro16voronoicell_base6volumeEv(ptr noundef nonnull align 8 dereferenceable(160)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN4voro14container_poly16sum_cell_volumesEv(ptr noundef nonnull align 8 dereferenceable(408) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.voro::voronoicell", align 8
  %3 = alloca %"class.voro::c_loop_all", align 8
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %2) #6
  call void @_ZN4voro11voronoicellC2Ev(ptr noundef nonnull align 8 dereferenceable(160) %2)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %3) #6
  invoke void @_ZN4voro10c_loop_allC2INS_14container_polyEEERT_(ptr noundef nonnull align 8 dereferenceable(68) %3, ptr noundef nonnull align 8 dereferenceable(408) %0)
          to label %4 unwind label %.loopexit.split-lp

4:                                                ; preds = %1
  %5 = invoke noundef zeroext i1 @_ZN4voro10c_loop_all5startEv(ptr noundef nonnull align 8 dereferenceable(68) %3)
          to label %6 unwind label %.loopexit.split-lp

6:                                                ; preds = %4
  br i1 %5, label %.preheader, label %.loopexit4

.preheader:                                       ; preds = %6, %14
  %.0 = phi double [ %.1, %14 ], [ 0.000000e+00, %6 ]
  %7 = invoke noundef zeroext i1 @_ZN4voro14container_poly12compute_cellINS_11voronoicellENS_10c_loop_allEEEbRT_RT0_(ptr noundef nonnull align 8 dereferenceable(408) %0, ptr noundef nonnull align 8 dereferenceable(160) %2, ptr noundef nonnull align 8 dereferenceable(68) %3)
          to label %8 unwind label %.loopexit

8:                                                ; preds = %.preheader
  br i1 %7, label %9, label %14

9:                                                ; preds = %8
  %10 = invoke noundef double @_ZN4voro16voronoicell_base6volumeEv(ptr noundef nonnull align 8 dereferenceable(160) %2)
          to label %11 unwind label %.loopexit

11:                                               ; preds = %9
  %12 = fadd double %.0, %10
  br label %14

.loopexit:                                        ; preds = %.preheader, %9
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %13

.loopexit.split-lp:                               ; preds = %1, %4
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %13

13:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %3) #6
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %2) #6
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #6
  resume { ptr, i32 } %lpad.phi

14:                                               ; preds = %8, %11
  %.1 = phi double [ %12, %11 ], [ %.0, %8 ]
  %15 = call noundef zeroext i1 @_ZN4voro10c_loop_all3incEv(ptr noundef nonnull align 8 dereferenceable(68) %3)
  br i1 %15, label %.preheader, label %.loopexit4, !llvm.loop !5

.loopexit4:                                       ; preds = %14, %6
  %.2 = phi double [ 0.000000e+00, %6 ], [ %.1, %14 ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %3) #6
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %2) #6
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #6
  ret double %.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 = { 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 #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 = { nounwind "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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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