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

; 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_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::voronoicell_neighbor" = type { %"class.voro::voronoicell_base", ptr, ptr, ptr, 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
declare dso_local void @_ZN4voro16voronoicell_base21check_memory_for_copyINS_20voronoicell_neighborEEEvRT_PS0_(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(192), ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4voro16voronoicell_base4copyEPS0_(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4voro20voronoicell_neighboraSERNS_11voronoicellE(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull align 8 dereferenceable(160) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4voro16voronoicell_base21check_memory_for_copyINS_20voronoicell_neighborEEEvRT_PS0_(ptr noundef nonnull align 8 dereferenceable(160) %8, ptr noundef nonnull align 8 dereferenceable(192) %8, ptr noundef %10)
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4voro16voronoicell_base4copyEPS0_(ptr noundef nonnull align 8 dereferenceable(160) %8, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %93, %2
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %14, i32 0, i32 2
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp slt i32 %13, %16
  br i1 %17, label %18, label %96

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

19:                                               ; preds = %41, %18
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %21, i32 0, i32 11
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr %23, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = mul nsw i32 %27, %28
  %30 = icmp slt i32 %20, %29
  br i1 %30, label %31, label %44

31:                                               ; preds = %19
  %32 = getelementptr inbounds %"class.voro::voronoicell_neighbor", ptr %8, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %33, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %37, i64 %39
  store i32 0, ptr %40, align 4, !tbaa !9
  br label %41

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

44:                                               ; preds = %19
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %89, %44
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %47, i32 0, i32 11
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %49, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = icmp slt i32 %46, %53
  br i1 %54, label %55, label %92

55:                                               ; preds = %45
  %56 = getelementptr inbounds %"class.voro::voronoicell_neighbor", ptr %8, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = load i32, ptr %6, align 4, !tbaa !9
  %64 = mul nsw i32 %62, %63
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr %61, i64 %65
  %67 = getelementptr inbounds %"class.voro::voronoicell_neighbor", ptr %8, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %69, i32 0, i32 12
  %71 = load ptr, ptr %70, align 8, !tbaa !20
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds ptr, ptr %71, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = mul nsw i32 2, %76
  %78 = add nsw i32 %77, 1
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = mul nsw i32 %78, %79
  %81 = load i32, ptr %6, align 4, !tbaa !9
  %82 = mul nsw i32 2, %81
  %83 = add nsw i32 %80, %82
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr %75, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds ptr, ptr %68, i64 %87
  store ptr %66, ptr %88, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %55
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %7, align 4, !tbaa !9
  br label %45, !llvm.loop !21

92:                                               ; preds = %45
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %6, align 4, !tbaa !9
  br label %12, !llvm.loop !22

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

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 = { 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 = { 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 12}
!12 = !{!"_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, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 64}
!15 = !{!16, !6, i64 160}
!16 = !{!"_ZTSN4voro20voronoicell_neighborE", !12, i64 0, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!16, !6, i64 168}
!20 = !{!12, !6, i64 72}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}


; 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
declare dso_local void @_ZN4voro16voronoicell_base21check_memory_for_copyINS_20voronoicell_neighborEEEvRT_PS0_(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(192), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4voro16voronoicell_base4copyEPS0_(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4voro20voronoicell_neighboraSERNS_11voronoicellE(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull align 8 dereferenceable(160) %1) local_unnamed_addr #0 align 2 {
  tail call void @_ZN4voro16voronoicell_base21check_memory_for_copyINS_20voronoicell_neighborEEEvRT_PS0_(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %1)
  tail call void @_ZN4voro16voronoicell_base4copyEPS0_(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull %1)
  %3 = getelementptr inbounds i8, ptr %1, i64 12
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.preheader26.lr.ph, label %._crit_edge32

.preheader26.lr.ph:                               ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 64
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  %8 = getelementptr inbounds i8, ptr %0, i64 168
  %9 = getelementptr inbounds i8, ptr %1, i64 72
  %.pre = load ptr, ptr %6, align 8, !tbaa !12
  br label %.preheader26

.preheader26:                                     ; preds = %.preheader26.lr.ph, %._crit_edge
  %10 = phi ptr [ %.pre, %.preheader26.lr.ph ], [ %50, %._crit_edge ]
  %indvars.iv37 = phi i64 [ 0, %.preheader26.lr.ph ], [ %indvars.iv.next38, %._crit_edge ]
  %11 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv37
  %12 = load i32, ptr %11, align 4, !tbaa !13
  %13 = trunc nuw nsw i64 %indvars.iv37 to i32
  %14 = mul nsw i32 %12, %13
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %.preheader26
  %16 = load ptr, ptr %7, align 8, !tbaa !14
  %17 = getelementptr inbounds ptr, ptr %16, i64 %indvars.iv37
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  br label %23

.preheader:                                       ; preds = %23, %.preheader26
  %19 = phi i32 [ %12, %.preheader26 ], [ %25, %23 ]
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph30, label %._crit_edge

.lr.ph30:                                         ; preds = %.preheader
  %21 = shl nuw nsw i64 %indvars.iv37, 1
  %22 = or disjoint i64 %21, 1
  br label %29

23:                                               ; preds = %.lr.ph, %23
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %23 ]
  %24 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv
  store i32 0, ptr %24, align 4, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr %11, align 4, !tbaa !13
  %26 = mul nsw i32 %25, %13
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %23, label %.preheader, !llvm.loop !17

29:                                               ; preds = %.lr.ph30, %29
  %indvars.iv34 = phi i64 [ 0, %.lr.ph30 ], [ %indvars.iv.next35, %29 ]
  %30 = load ptr, ptr %7, align 8, !tbaa !14
  %31 = getelementptr inbounds ptr, ptr %30, i64 %indvars.iv37
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  %33 = mul nuw nsw i64 %indvars.iv34, %indvars.iv37
  %34 = getelementptr inbounds i32, ptr %32, i64 %33
  %35 = load ptr, ptr %8, align 8, !tbaa !19
  %36 = load ptr, ptr %9, align 8, !tbaa !20
  %37 = getelementptr inbounds ptr, ptr %36, i64 %indvars.iv37
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = mul nuw nsw i64 %indvars.iv34, %22
  %40 = getelementptr inbounds i32, ptr %38, i64 %39
  %41 = getelementptr inbounds i32, ptr %40, i64 %21
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds ptr, ptr %35, i64 %43
  store ptr %34, ptr %44, align 8, !tbaa !16
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %45 = load ptr, ptr %6, align 8, !tbaa !12
  %46 = getelementptr inbounds i32, ptr %45, i64 %indvars.iv37
  %47 = load i32, ptr %46, align 4, !tbaa !13
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next35, %48
  br i1 %49, label %29, label %._crit_edge, !llvm.loop !21

._crit_edge:                                      ; preds = %29, %.preheader
  %50 = phi ptr [ %10, %.preheader ], [ %45, %29 ]
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = icmp slt i64 %indvars.iv.next38, %52
  br i1 %53, label %.preheader26, label %._crit_edge32, !llvm.loop !22

._crit_edge32:                                    ; preds = %._crit_edge, %2
  ret void
}

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 = { 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" }

!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 12}
!6 = !{!"_ZTSN4voro16voronoicell_baseE", !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !7, i64 112, !7, i64 116, !10, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !10, i64 64}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !10, i64 160}
!15 = !{!"_ZTSN4voro20voronoicell_neighborE", !6, i64 0, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!15, !10, i64 168}
!20 = !{!6, !10, i64 72}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}


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