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

; 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: mustprogress nounwind uwtable
define dso_local void @_ZN4voro16voronoicell_base9translateEddd(ptr noundef nonnull align 8 dereferenceable(160) %0, double noundef %1, double noundef %2, double noundef %3) #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %5, align 8
  %11 = load double, ptr %6, align 8, !tbaa !9
  %12 = fmul double %11, 2.000000e+00
  store double %12, ptr %6, align 8, !tbaa !9
  %13 = load double, ptr %7, align 8, !tbaa !9
  %14 = fmul double %13, 2.000000e+00
  store double %14, ptr %7, align 8, !tbaa !9
  %15 = load double, ptr %8, align 8, !tbaa !9
  %16 = fmul double %15, 2.000000e+00
  store double %16, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %17 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %10, i32 0, i32 9
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  store ptr %18, ptr %9, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %29, %4
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %10, i32 0, i32 9
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %10, i32 0, i32 5
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = mul nsw i32 3, %24
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds double, ptr %22, i64 %26
  %28 = icmp ult ptr %20, %27
  br i1 %28, label %29, label %39

29:                                               ; preds = %19
  %30 = load double, ptr %6, align 8, !tbaa !9
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds double, ptr %31, i32 1
  store ptr %32, ptr %9, align 8, !tbaa !5
  store double %30, ptr %31, align 8, !tbaa !9
  %33 = load double, ptr %7, align 8, !tbaa !9
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = getelementptr inbounds double, ptr %34, i32 1
  store ptr %35, ptr %9, align 8, !tbaa !5
  store double %33, ptr %34, align 8, !tbaa !9
  %36 = load double, ptr %8, align 8, !tbaa !9
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %37, i32 1
  store ptr %38, ptr %9, align 8, !tbaa !5
  store double %36, ptr %37, align 8, !tbaa !9
  br label %19, !llvm.loop !15

39:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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, !6, i64 48}
!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, !13, i64 24}
!15 = distinct !{!15, !16}
!16 = !{!"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 nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN4voro16voronoicell_base9translateEddd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(160) %0, double noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #0 align 2 {
  %5 = insertelement <2 x double> poison, double %1, i64 0
  %6 = insertelement <2 x double> %5, double %2, i64 1
  %7 = fmul <2 x double> %6, <double 2.000000e+00, double 2.000000e+00>
  %8 = fmul double %3, 2.000000e+00
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = load i32, ptr %11, align 8, !tbaa !12
  %13 = mul nsw i32 %12, 3
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds double, ptr %10, i64 %14
  %16 = icmp sgt i32 %12, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4, %.lr.ph
  %.011 = phi ptr [ %18, %.lr.ph ], [ %10, %4 ]
  %17 = getelementptr inbounds i8, ptr %.011, i64 16
  store <2 x double> %7, ptr %.011, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %.011, i64 24
  store double %8, ptr %17, align 8, !tbaa !13
  %19 = icmp ult ptr %18, %15
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !14

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) 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, !10, i64 48}
!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, !7, i64 24}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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