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

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

@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1

; 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 void @_ZN4voro23container_periodic_base12region_countEv(ptr noundef nonnull align 8 dereferenceable(384) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %8 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %7, i32 0, i32 11
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %9, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !17
  br label %10

10:                                               ; preds = %46, %1
  %11 = load i32, ptr %5, align 4, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %7, i64 224
  %13 = getelementptr inbounds %"class.voro::voro_base", ptr %12, i32 0, i32 2
  %14 = load i32, ptr %13, align 8, !tbaa !18
  %15 = icmp slt i32 %11, %14
  br i1 %15, label %16, label %49

16:                                               ; preds = %10
  store i32 0, ptr %4, align 4, !tbaa !17
  br label %17

17:                                               ; preds = %42, %16
  %18 = load i32, ptr %4, align 4, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %7, i64 224
  %20 = getelementptr inbounds %"class.voro::voro_base", ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !19
  %22 = icmp slt i32 %18, %21
  br i1 %22, label %23, label %45

23:                                               ; preds = %17
  store i32 0, ptr %3, align 4, !tbaa !17
  br label %24

24:                                               ; preds = %38, %23
  %25 = load i32, ptr %3, align 4, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %7, i64 224
  %27 = getelementptr inbounds %"class.voro::voro_base", ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !20
  %29 = icmp slt i32 %25, %28
  br i1 %29, label %30, label %41

30:                                               ; preds = %24
  %31 = load i32, ptr %3, align 4, !tbaa !17
  %32 = load i32, ptr %4, align 4, !tbaa !17
  %33 = load i32, ptr %5, align 4, !tbaa !17
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds i32, ptr %34, i32 1
  store ptr %35, ptr %6, align 8, !tbaa !5
  %36 = load i32, ptr %34, align 4, !tbaa !17
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %31, i32 noundef %32, i32 noundef %33, i32 noundef %36)
  br label %38

38:                                               ; preds = %30
  %39 = load i32, ptr %3, align 4, !tbaa !17
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %3, align 4, !tbaa !17
  br label %24, !llvm.loop !21

41:                                               ; preds = %24
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %4, align 4, !tbaa !17
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %4, align 4, !tbaa !17
  br label %17, !llvm.loop !23

45:                                               ; preds = %17
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %5, align 4, !tbaa !17
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %5, align 4, !tbaa !17
  br label %10, !llvm.loop !24

49:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

declare i32 @printf(ptr noundef, ...) #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 = { "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 = { 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, !6, i64 352}
!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 = !{!16, !15, i64 8}
!19 = !{!16, !15, i64 4}
!20 = !{!16, !15, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !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"

@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local void @_ZN4voro23container_periodic_base12region_countEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(384) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 224
  %3 = getelementptr inbounds i8, ptr %0, i64 232
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.preheader13.lr.ph, label %._crit_edge23

.preheader13.lr.ph:                               ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 228
  %7 = load i32, ptr %6, align 4, !tbaa !12
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader13.preheader, label %._crit_edge23

.preheader13.preheader:                           ; preds = %.preheader13.lr.ph
  %9 = getelementptr inbounds i8, ptr %0, i64 352
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  br label %.preheader13

.preheader13:                                     ; preds = %.preheader13.preheader, %._crit_edge18
  %11 = phi i32 [ %30, %._crit_edge18 ], [ %4, %.preheader13.preheader ]
  %12 = phi i32 [ %31, %._crit_edge18 ], [ %7, %.preheader13.preheader ]
  %13 = phi i32 [ %32, %._crit_edge18 ], [ %7, %.preheader13.preheader ]
  %.022 = phi ptr [ %.1.lcssa, %._crit_edge18 ], [ %10, %.preheader13.preheader ]
  %.01020 = phi i32 [ %33, %._crit_edge18 ], [ 0, %.preheader13.preheader ]
  %14 = icmp sgt i32 %13, 0
  %15 = load i32, ptr %2, align 8
  %16 = icmp sgt i32 %15, 0
  %or.cond = select i1 %14, i1 %16, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge18

.preheader:                                       ; preds = %.preheader13, %._crit_edge
  %17 = phi i32 [ %26, %._crit_edge ], [ %12, %.preheader13 ]
  %18 = phi i32 [ %27, %._crit_edge ], [ %15, %.preheader13 ]
  %.117 = phi ptr [ %.2.lcssa, %._crit_edge ], [ %.022, %.preheader13 ]
  %.01116 = phi i32 [ %28, %._crit_edge ], [ 0, %.preheader13 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.215 = phi ptr [ %20, %.lr.ph ], [ %.117, %.preheader ]
  %.01214 = phi i32 [ %23, %.lr.ph ], [ 0, %.preheader ]
  %20 = getelementptr inbounds i8, ptr %.215, i64 4
  %21 = load i32, ptr %.215, align 4, !tbaa !18
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.01214, i32 noundef %.01116, i32 noundef %.01020, i32 noundef %21)
  %23 = add nuw nsw i32 %.01214, 1
  %24 = load i32, ptr %2, align 8, !tbaa !19
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !20

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %6, align 4, !tbaa !12
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %26 = phi i32 [ %17, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %27 = phi i32 [ %18, %.preheader ], [ %24, %._crit_edge.loopexit ]
  %.2.lcssa = phi ptr [ %.117, %.preheader ], [ %20, %._crit_edge.loopexit ]
  %28 = add nuw nsw i32 %.01116, 1
  %29 = icmp slt i32 %28, %26
  br i1 %29, label %.preheader, label %._crit_edge18.loopexit, !llvm.loop !22

._crit_edge18.loopexit:                           ; preds = %._crit_edge
  %.pre26 = load i32, ptr %3, align 8, !tbaa !5
  br label %._crit_edge18

._crit_edge18:                                    ; preds = %._crit_edge18.loopexit, %.preheader13
  %30 = phi i32 [ %11, %.preheader13 ], [ %.pre26, %._crit_edge18.loopexit ]
  %31 = phi i32 [ %12, %.preheader13 ], [ %26, %._crit_edge18.loopexit ]
  %32 = phi i32 [ %13, %.preheader13 ], [ %26, %._crit_edge18.loopexit ]
  %.1.lcssa = phi ptr [ %.022, %.preheader13 ], [ %.2.lcssa, %._crit_edge18.loopexit ]
  %33 = add nuw nsw i32 %.01020, 1
  %34 = icmp slt i32 %33, %30
  br i1 %34, label %.preheader13, label %._crit_edge23, !llvm.loop !24

._crit_edge23:                                    ; preds = %._crit_edge18, %.preheader13.lr.ph, %1
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress nofree 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 = { nofree 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" }

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


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