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

; 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::container_periodic_base" = type { %"class.voro::unitcell", %"class.voro::voro_base", i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%"class.voro::unitcell" = type { double, double, double, double, double, double, %"class.voro::voronoicell", double, double }
%"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::voro_base" = type { i32, i32, i32, i32, i32, double, double, double, double, double, double, ptr }

; 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 nounwind uwtable
declare dso_local void @_ZN4voro9voro_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4voro23container_periodic_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %5 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 8
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = sub nsw i32 %6, 1
  store i32 %7, ptr %3, align 4, !tbaa !17
  br label %8

8:                                                ; preds = %40, %1
  %9 = load i32, ptr %3, align 4, !tbaa !17
  %10 = icmp sge i32 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %43

12:                                               ; preds = %8
  %13 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 12
  %14 = load ptr, ptr %13, align 8, !tbaa !18
  %15 = load i32, ptr %3, align 4, !tbaa !17
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr %14, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !17
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %20, label %39

20:                                               ; preds = %12
  %21 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 10
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  %23 = load i32, ptr %3, align 4, !tbaa !17
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds ptr, ptr %22, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %20
  call void @_ZdaPv(ptr noundef %26) #5
  br label %29

29:                                               ; preds = %28, %20
  %30 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 9
  %31 = load ptr, ptr %30, align 8, !tbaa !20
  %32 = load i32, ptr %3, align 4, !tbaa !17
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds ptr, ptr %31, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %29
  call void @_ZdaPv(ptr noundef %35) #5
  br label %38

38:                                               ; preds = %37, %29
  br label %39

39:                                               ; preds = %38, %12
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %3, align 4, !tbaa !17
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %3, align 4, !tbaa !17
  br label %8, !llvm.loop !21

43:                                               ; preds = %11
  %44 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 13
  %45 = load ptr, ptr %44, align 8, !tbaa !23
  %46 = icmp eq ptr %45, null
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @_ZdaPv(ptr noundef %45) #5
  br label %48

48:                                               ; preds = %47, %43
  %49 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 12
  %50 = load ptr, ptr %49, align 8, !tbaa !18
  %51 = icmp eq ptr %50, null
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  call void @_ZdaPv(ptr noundef %50) #5
  br label %53

53:                                               ; preds = %52, %48
  %54 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 11
  %55 = load ptr, ptr %54, align 8, !tbaa !24
  %56 = icmp eq ptr %55, null
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  call void @_ZdaPv(ptr noundef %55) #5
  br label %58

58:                                               ; preds = %57, %53
  %59 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 9
  %60 = load ptr, ptr %59, align 8, !tbaa !20
  %61 = icmp eq ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @_ZdaPv(ptr noundef %60) #5
  br label %63

63:                                               ; preds = %62, %58
  %64 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %4, i32 0, i32 10
  %65 = load ptr, ptr %64, align 8, !tbaa !19
  %66 = icmp eq ptr %65, null
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  call void @_ZdaPv(ptr noundef %65) #5
  br label %68

68:                                               ; preds = %67, %63
  %69 = getelementptr inbounds i8, ptr %4, i64 224
  call void @_ZN4voro9voro_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(80) %69) #4
  call void @_ZN4voro8unitcellD2Ev(ptr noundef nonnull align 8 dereferenceable(224) %4) #4
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nobuiltin 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 #4 = { nounwind }
attributes #5 = { builtin 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, !15, i64 328}
!10 = !{!"_ZTSN4voro23container_periodic_baseE", !11, i64 0, !16, i64 224, !15, i64 304, !15, i64 308, !15, i64 312, !15, i64 316, !15, i64 320, !15, i64 324, !15, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !15, i64 376, !15, i64 380}
!11 = !{!"_ZTSN4voro8unitcellE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !13, i64 48, !12, i64 208, !12, i64 216}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTSN4voro11voronoicellE", !14, i64 0}
!14 = !{!"_ZTSN4voro16voronoicell_baseE", !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !15, i64 112, !15, i64 116, !6, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSN4voro9voro_baseE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !6, i64 72}
!17 = !{!15, !15, i64 0}
!18 = !{!10, !6, i64 360}
!19 = !{!10, !6, i64 344}
!20 = !{!10, !6, i64 336}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!10, !6, i64 368}
!24 = !{!10, !6, i64 352}


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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4voro23container_periodic_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 328
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 360
  %6 = getelementptr inbounds i8, ptr %0, i64 344
  %7 = getelementptr inbounds i8, ptr %0, i64 336
  %8 = zext nneg i32 %3 to i64
  br label %12

._crit_edge:                                      ; preds = %29, %1
  %9 = getelementptr inbounds i8, ptr %0, i64 368
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  %11 = icmp eq ptr %10, null
  br i1 %11, label %32, label %31

12:                                               ; preds = %.lr.ph, %29
  %indvars.iv = phi i64 [ %8, %.lr.ph ], [ %indvars.iv.next, %29 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %13 = load ptr, ptr %5, align 8, !tbaa !17
  %14 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv.next
  %15 = load i32, ptr %14, align 4, !tbaa !18
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %17, label %29

17:                                               ; preds = %12
  %18 = load ptr, ptr %6, align 8, !tbaa !19
  %19 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv.next
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  %21 = icmp eq ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  tail call void @_ZdaPv(ptr noundef nonnull %20) #3
  br label %23

23:                                               ; preds = %22, %17
  %24 = load ptr, ptr %7, align 8, !tbaa !21
  %25 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv.next
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %27 = icmp eq ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %23
  tail call void @_ZdaPv(ptr noundef nonnull %26) #3
  br label %29

29:                                               ; preds = %12, %28, %23
  %30 = icmp ugt i64 %indvars.iv, 1
  br i1 %30, label %12, label %._crit_edge, !llvm.loop !22

31:                                               ; preds = %._crit_edge
  tail call void @_ZdaPv(ptr noundef nonnull %10) #3
  br label %32

32:                                               ; preds = %31, %._crit_edge
  %33 = getelementptr inbounds i8, ptr %0, i64 360
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = icmp eq ptr %34, null
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  tail call void @_ZdaPv(ptr noundef nonnull %34) #3
  br label %37

37:                                               ; preds = %36, %32
  %38 = getelementptr inbounds i8, ptr %0, i64 352
  %39 = load ptr, ptr %38, align 8, !tbaa !24
  %40 = icmp eq ptr %39, null
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  tail call void @_ZdaPv(ptr noundef nonnull %39) #3
  br label %42

42:                                               ; preds = %41, %37
  %43 = getelementptr inbounds i8, ptr %0, i64 336
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = icmp eq ptr %44, null
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  tail call void @_ZdaPv(ptr noundef nonnull %44) #3
  br label %47

47:                                               ; preds = %46, %42
  %48 = getelementptr inbounds i8, ptr %0, i64 344
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = icmp eq ptr %49, null
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  tail call void @_ZdaPv(ptr noundef nonnull %49) #3
  br label %52

52:                                               ; preds = %51, %47
  %53 = getelementptr inbounds i8, ptr %0, i64 224
  tail call void @_ZN4voro9voro_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(80) %53) #4
  tail call void @_ZN4voro8unitcellD2Ev(ptr noundef nonnull align 8 dereferenceable(224) %0) #4
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { nobuiltin 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 #3 = { builtin nounwind }
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, !13, i64 328}
!6 = !{!"_ZTSN4voro23container_periodic_baseE", !7, i64 0, !15, i64 224, !13, i64 304, !13, i64 308, !13, i64 312, !13, i64 316, !13, i64 320, !13, i64 324, !13, i64 328, !14, i64 336, !14, i64 344, !14, i64 352, !14, i64 360, !14, i64 368, !13, i64 376, !13, i64 380}
!7 = !{!"_ZTSN4voro8unitcellE", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !11, i64 48, !8, i64 208, !8, i64 216}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN4voro11voronoicellE", !12, i64 0}
!12 = !{!"_ZTSN4voro16voronoicell_baseE", !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !13, i64 112, !13, i64 116, !14, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152}
!13 = !{!"int", !9, i64 0}
!14 = !{!"any pointer", !9, i64 0}
!15 = !{!"_ZTSN4voro9voro_baseE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !14, i64 72}
!16 = !{!6, !14, i64 368}
!17 = !{!6, !14, i64 360}
!18 = !{!13, !13, i64 0}
!19 = !{!6, !14, i64 344}
!20 = !{!14, !14, i64 0}
!21 = !{!6, !14, i64 336}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!6, !14, i64 352}


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