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

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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4voro16voronoicell_base8verticesEdddRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(160) %0, double noundef %1, double noundef %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(24) %4) #2 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8
  %14 = load ptr, ptr %10, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %13, i32 0, i32 5
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = mul nsw i32 3, %16
  %18 = sext i32 %17 to i64
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %19 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %13, i32 0, i32 9
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  store ptr %20, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !15
  br label %21

21:                                               ; preds = %58, %5
  %22 = load i32, ptr %12, align 4, !tbaa !15
  %23 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %13, i32 0, i32 5
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = mul nsw i32 3, %24
  %26 = icmp slt i32 %22, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %61

28:                                               ; preds = %21
  %29 = load double, ptr %7, align 8, !tbaa !9
  %30 = load ptr, ptr %11, align 8, !tbaa !5
  %31 = getelementptr inbounds double, ptr %30, i32 1
  store ptr %31, ptr %11, align 8, !tbaa !5
  %32 = load double, ptr %30, align 8, !tbaa !9
  %33 = call double @llvm.fmuladd.f64(double %32, double 5.000000e-01, double %29)
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = load i32, ptr %12, align 4, !tbaa !15
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef %36) #4
  store double %33, ptr %37, align 8, !tbaa !9
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = getelementptr inbounds double, ptr %39, i32 1
  store ptr %40, ptr %11, align 8, !tbaa !5
  %41 = load double, ptr %39, align 8, !tbaa !9
  %42 = call double @llvm.fmuladd.f64(double %41, double 5.000000e-01, double %38)
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = load i32, ptr %12, align 4, !tbaa !15
  %45 = add nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef %46) #4
  store double %42, ptr %47, align 8, !tbaa !9
  %48 = load double, ptr %9, align 8, !tbaa !9
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds double, ptr %49, i32 1
  store ptr %50, ptr %11, align 8, !tbaa !5
  %51 = load double, ptr %49, align 8, !tbaa !9
  %52 = call double @llvm.fmuladd.f64(double %51, double 5.000000e-01, double %48)
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = load i32, ptr %12, align 4, !tbaa !15
  %55 = add nsw i32 %54, 2
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %56) #4
  store double %52, ptr %57, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %28
  %59 = load i32, ptr %12, align 4, !tbaa !15
  %60 = add nsw i32 %59, 3
  store i32 %60, ptr %12, align 4, !tbaa !15
  br label %21, !llvm.loop !16

61:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = { 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 #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, !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 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 24}
!12 = !{!"_ZTSN4voro16voronoicell_baseE", !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, 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, !13, i64 112, !13, i64 116, !6, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 48}
!15 = !{!13, !13, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4voro16voronoicell_base8verticesEdddRSt6vectorIdSaIdEE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(160) %0, double noundef %1, double noundef %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(24) %4) local_unnamed_addr #1 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = mul nsw i32 %7, 3
  %9 = sext i32 %8 to i64
  tail call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %9)
  %10 = load i32, ptr %6, align 8, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %5
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %5
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.01516 = phi ptr [ %13, %.lr.ph.preheader ], [ %23, %.lr.ph ]
  %14 = getelementptr inbounds i8, ptr %.01516, i64 8
  %15 = load double, ptr %.01516, align 8, !tbaa !13
  %16 = tail call double @llvm.fmuladd.f64(double %15, double 5.000000e-01, double %1)
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv) #3
  store double %16, ptr %17, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %.01516, i64 16
  %19 = load double, ptr %14, align 8, !tbaa !13
  %20 = tail call double @llvm.fmuladd.f64(double %19, double 5.000000e-01, double %2)
  %21 = add nuw nsw i64 %indvars.iv, 1
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %21) #3
  store double %20, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %.01516, i64 24
  %24 = load double, ptr %18, align 8, !tbaa !13
  %25 = tail call double @llvm.fmuladd.f64(double %24, double 5.000000e-01, double %3)
  %26 = add nuw nsw i64 %indvars.iv, 2
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %26) #3
  store double %25, ptr %27, align 8, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3
  %28 = load i32, ptr %6, align 8, !tbaa !5
  %29 = mul nsw i32 %28, 3
  %30 = trunc nuw i64 %indvars.iv.next to i32
  %31 = icmp sgt i32 %29, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !14
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 24}
!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 48}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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