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

; 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_base17create_all_imagesEv(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
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = 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
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %37, %1
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %6, i32 0, i32 7
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = icmp slt i32 %8, %10
  br i1 %11, label %12, label %40

12:                                               ; preds = %7
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %33, %12
  %14 = load i32, ptr %4, align 4, !tbaa !9
  %15 = getelementptr inbounds %"class.voro::container_periodic_base", ptr %6, i32 0, i32 6
  %16 = load i32, ptr %15, align 8, !tbaa !18
  %17 = icmp slt i32 %14, %16
  br i1 %17, label %18, label %36

18:                                               ; preds = %13
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %29, %18
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %6, i64 224
  %22 = getelementptr inbounds %"class.voro::voro_base", ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !19
  %24 = icmp slt i32 %20, %23
  br i1 %24, label %25, label %32

25:                                               ; preds = %19
  %26 = load i32, ptr %3, align 4, !tbaa !9
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = load i32, ptr %5, align 4, !tbaa !9
  call void @_ZN4voro23container_periodic_base21create_periodic_imageEiii(ptr noundef nonnull align 8 dereferenceable(384) %6, i32 noundef %26, i32 noundef %27, i32 noundef %28)
  br label %29

29:                                               ; preds = %25
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %3, align 4, !tbaa !9
  br label %19, !llvm.loop !20

32:                                               ; preds = %19
  br label %33

33:                                               ; preds = %32
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %4, align 4, !tbaa !9
  br label %13, !llvm.loop !22

36:                                               ; preds = %13
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %5, align 4, !tbaa !9
  br label %7, !llvm.loop !23

40:                                               ; preds = %7
  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
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4voro23container_periodic_base21create_periodic_imageEiii(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef, i32 noundef) #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 = { 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 324}
!12 = !{!"_ZTSN4voro23container_periodic_baseE", !13, i64 0, !17, i64 224, !10, i64 304, !10, i64 308, !10, i64 312, !10, i64 316, !10, i64 320, !10, i64 324, !10, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !10, i64 376, !10, i64 380}
!13 = !{!"_ZTSN4voro8unitcellE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !15, i64 48, !14, i64 208, !14, i64 216}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN4voro11voronoicellE", !16, i64 0}
!16 = !{!"_ZTSN4voro16voronoicell_baseE", !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, 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, !10, i64 112, !10, i64 116, !6, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !14, i64 152}
!17 = !{!"_ZTSN4voro9voro_baseE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !6, i64 72}
!18 = !{!12, !10, i64 320}
!19 = !{!17, !10, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}


; 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 uwtable
define dso_local void @_ZN4voro23container_periodic_base17create_all_imagesEv(ptr noundef nonnull align 8 dereferenceable(384) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 324
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.preheader11.lr.ph, label %._crit_edge17

.preheader11.lr.ph:                               ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 320
  %6 = getelementptr inbounds i8, ptr %0, i64 224
  %7 = load i32, ptr %5, align 8, !tbaa !16
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader11, label %._crit_edge17

.preheader11:                                     ; preds = %.preheader11.lr.ph, %._crit_edge14
  %9 = phi i32 [ %25, %._crit_edge14 ], [ %3, %.preheader11.lr.ph ]
  %10 = phi i32 [ %26, %._crit_edge14 ], [ %7, %.preheader11.lr.ph ]
  %11 = phi i32 [ %27, %._crit_edge14 ], [ %7, %.preheader11.lr.ph ]
  %.015 = phi i32 [ %28, %._crit_edge14 ], [ 0, %.preheader11.lr.ph ]
  %12 = icmp sgt i32 %11, 0
  %13 = load i32, ptr %6, align 8
  %14 = icmp sgt i32 %13, 0
  %or.cond = select i1 %12, i1 %14, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge14

.preheader:                                       ; preds = %.preheader11, %._crit_edge
  %15 = phi i32 [ %21, %._crit_edge ], [ %10, %.preheader11 ]
  %16 = phi i32 [ %22, %._crit_edge ], [ %13, %.preheader11 ]
  %.0913 = phi i32 [ %23, %._crit_edge ], [ 0, %.preheader11 ]
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.01012 = phi i32 [ %18, %.lr.ph ], [ 0, %.preheader ]
  tail call void @_ZN4voro23container_periodic_base21create_periodic_imageEiii(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %.01012, i32 noundef %.0913, i32 noundef %.015)
  %18 = add nuw nsw i32 %.01012, 1
  %19 = load i32, ptr %6, align 8, !tbaa !17
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %5, align 8, !tbaa !16
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %21 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %15, %.preheader ]
  %22 = phi i32 [ %19, %._crit_edge.loopexit ], [ %16, %.preheader ]
  %23 = add nuw nsw i32 %.0913, 1
  %24 = icmp slt i32 %23, %21
  br i1 %24, label %.preheader, label %._crit_edge14.loopexit, !llvm.loop !20

._crit_edge14.loopexit:                           ; preds = %._crit_edge
  %.pre20 = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge14

._crit_edge14:                                    ; preds = %._crit_edge14.loopexit, %.preheader11
  %25 = phi i32 [ %.pre20, %._crit_edge14.loopexit ], [ %9, %.preheader11 ]
  %26 = phi i32 [ %21, %._crit_edge14.loopexit ], [ %10, %.preheader11 ]
  %27 = phi i32 [ %21, %._crit_edge14.loopexit ], [ %11, %.preheader11 ]
  %28 = add nuw nsw i32 %.015, 1
  %29 = icmp slt i32 %28, %25
  br i1 %29, label %.preheader11, label %._crit_edge17, !llvm.loop !22

._crit_edge17:                                    ; preds = %._crit_edge14, %.preheader11.lr.ph, %1
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4voro23container_periodic_base21create_periodic_imageEiii(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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

!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 324}
!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, !13, i64 320}
!17 = !{!15, !13, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19, !21}
!21 = !{!"llvm.loop.unswitch.partial.disable"}
!22 = distinct !{!22, !19, !21}


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