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

; 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_neighboraSERS0_(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull align 8 dereferenceable(192) %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 = %104, %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 %107

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

19:                                               ; preds = %52, %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 %55

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

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

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

56:                                               ; preds = %100, %55
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %58, i32 0, i32 11
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %60, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = icmp slt i32 %57, %64
  br i1 %65, label %66, label %103

66:                                               ; preds = %56
  %67 = getelementptr inbounds %"class.voro::voronoicell_neighbor", ptr %8, i32 0, i32 1
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %68, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = load i32, ptr %7, align 4, !tbaa !9
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = mul nsw i32 %73, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %72, i64 %76
  %78 = getelementptr inbounds %"class.voro::voronoicell_neighbor", ptr %8, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %80, i32 0, i32 12
  %82 = load ptr, ptr %81, align 8, !tbaa !20
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds ptr, ptr %82, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = load i32, ptr %6, align 4, !tbaa !9
  %88 = mul nsw i32 2, %87
  %89 = add nsw i32 %88, 1
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = mul nsw i32 %89, %90
  %92 = load i32, ptr %6, align 4, !tbaa !9
  %93 = mul nsw i32 2, %92
  %94 = add nsw i32 %91, %93
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %86, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds ptr, ptr %79, i64 %98
  store ptr %77, ptr %99, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %66
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %7, align 4, !tbaa !9
  br label %56, !llvm.loop !21

103:                                              ; preds = %56
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %6, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %6, align 4, !tbaa !9
  br label %12, !llvm.loop !22

107:                                              ; 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_neighboraSERS0_(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull align 8 dereferenceable(192) %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 %.preheader29.lr.ph, label %._crit_edge35

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

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

.lr.ph:                                           ; preds = %.preheader29
  %17 = load ptr, ptr %7, align 8, !tbaa !14
  %18 = getelementptr inbounds ptr, ptr %17, i64 %indvars.iv40
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  %20 = load ptr, ptr %8, align 8, !tbaa !14
  %21 = getelementptr inbounds ptr, ptr %20, i64 %indvars.iv40
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  br label %27

.preheader:                                       ; preds = %27, %.preheader29
  %23 = phi i32 [ %13, %.preheader29 ], [ %31, %27 ]
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph33, label %._crit_edge

.lr.ph33:                                         ; preds = %.preheader
  %25 = shl nuw nsw i64 %indvars.iv40, 1
  %26 = or disjoint i64 %25, 1
  br label %35

27:                                               ; preds = %.lr.ph, %27
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %27 ]
  %28 = getelementptr inbounds i32, ptr %19, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = getelementptr inbounds i32, ptr %22, i64 %indvars.iv
  store i32 %29, ptr %30, align 4, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr %12, align 4, !tbaa !13
  %32 = mul nsw i32 %31, %14
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %27, label %.preheader, !llvm.loop !17

35:                                               ; preds = %.lr.ph33, %35
  %indvars.iv37 = phi i64 [ 0, %.lr.ph33 ], [ %indvars.iv.next38, %35 ]
  %36 = load ptr, ptr %8, align 8, !tbaa !14
  %37 = getelementptr inbounds ptr, ptr %36, i64 %indvars.iv40
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = mul nuw nsw i64 %indvars.iv37, %indvars.iv40
  %40 = getelementptr inbounds i32, ptr %38, i64 %39
  %41 = load ptr, ptr %9, align 8, !tbaa !19
  %42 = load ptr, ptr %10, align 8, !tbaa !20
  %43 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv40
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  %45 = mul nuw nsw i64 %indvars.iv37, %26
  %46 = getelementptr inbounds i32, ptr %44, i64 %45
  %47 = getelementptr inbounds i32, ptr %46, i64 %25
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds ptr, ptr %41, i64 %49
  store ptr %40, ptr %50, align 8, !tbaa !16
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %51 = load ptr, ptr %6, align 8, !tbaa !12
  %52 = getelementptr inbounds i32, ptr %51, i64 %indvars.iv40
  %53 = load i32, ptr %52, align 4, !tbaa !13
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next38, %54
  br i1 %55, label %35, label %._crit_edge, !llvm.loop !21

._crit_edge:                                      ; preds = %35, %.preheader
  %56 = phi ptr [ %11, %.preheader ], [ %51, %35 ]
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next41, %58
  br i1 %59, label %.preheader29, label %._crit_edge35, !llvm.loop !22

._crit_edge35:                                    ; 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