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

; 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: mustprogress uwtable
define dso_local void @_ZN4voro14container_poly17compute_all_cellsEv(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 %"class.voro::c_loop_all", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 160, ptr %3) #5
  call void @_ZN4voro11voronoicellC2Ev(ptr noundef nonnull align 8 dereferenceable(160) %3)
  call void @llvm.lifetime.start.p0(i64 72, ptr %4) #5
  invoke void @_ZN4voro10c_loop_allC2INS_14container_polyEEERT_(ptr noundef nonnull align 8 dereferenceable(68) %4, ptr noundef nonnull align 8 dereferenceable(408) %7)
          to label %8 unwind label %19

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

10:                                               ; preds = %8
  br i1 %9, label %11, label %23

11:                                               ; preds = %10
  br label %12

12:                                               ; preds = %17, %11
  %13 = invoke noundef zeroext i1 @_ZN4voro14container_poly12compute_cellINS_11voronoicellENS_10c_loop_allEEEbRT_RT0_(ptr noundef nonnull align 8 dereferenceable(408) %7, ptr noundef nonnull align 8 dereferenceable(160) %3, ptr noundef nonnull align 8 dereferenceable(68) %4)
          to label %14 unwind label %19

14:                                               ; preds = %12
  br label %15

15:                                               ; preds = %14
  %16 = invoke noundef zeroext i1 @_ZN4voro10c_loop_all3incEv(ptr noundef nonnull align 8 dereferenceable(68) %4)
          to label %17 unwind label %19

17:                                               ; preds = %15
  br i1 %16, label %12, label %18, !llvm.loop !9

18:                                               ; preds = %17
  br label %23

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

23:                                               ; preds = %18, %10
  call void @llvm.lifetime.end.p0(i64 72, ptr %4) #5
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %3) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr %3) #5
  ret void

24:                                               ; preds = %19
  %25 = load ptr, ptr %5, align 8
  %26 = load i32, ptr %6, align 4
  %27 = insertvalue { ptr, i32 } poison, ptr %25, 0
  %28 = insertvalue { ptr, i32 } %27, i32 %26, 1
  resume { ptr, i32 } %28
}

; 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

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 = { 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 = distinct !{!9, !10}
!10 = !{!"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: mustprogress uwtable
define dso_local void @_ZN4voro14container_poly17compute_all_cellsEv(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) #5
  call void @_ZN4voro11voronoicellC2Ev(ptr noundef nonnull align 8 dereferenceable(160) %2)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %3) #5
  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 %.loopexit2

.preheader:                                       ; preds = %6, %8
  %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
  %9 = call noundef zeroext i1 @_ZN4voro10c_loop_all3incEv(ptr noundef nonnull align 8 dereferenceable(68) %3)
  br i1 %9, label %.preheader, label %.loopexit2, !llvm.loop !5

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

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

10:                                               ; 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) #5
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %2) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #5
  resume { ptr, i32 } %lpad.phi

.loopexit2:                                       ; preds = %8, %6
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %3) #5
  call void @_ZN4voro16voronoicell_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(160) %2) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #5
  ret void
}

; 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

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 = { 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,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass