; LLVM IR from robotics-upo/Heuristic_path_planners :: src/Planners (LazyThetaStarM1Mod)

; 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.Planners::utils::Node" = type <{ ptr, %"class.Planners::utils::Vec3i", i32, i32, i32, i32, i32, double, i8, i8, i8, [5 x i8] }>
%"class.Planners::utils::Vec3i" = type { i32, i32, i32 }
%"class.Planners::AlgorithmBase" = type { ptr, %"class.std::function", %"class.std::vector", %"class.Planners::utils::DiscreteWorld", i32, i8, double, i32, %"class.std::__cxx11::basic_string" }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Planners::utils::Vec3i, std::allocator<Planners::utils::Vec3i>>::_Vector_impl" }
%"struct.std::_Vector_base<Planners::utils::Vec3i, std::allocator<Planners::utils::Vec3i>>::_Vector_impl" = type { %"struct.std::_Vector_base<Planners::utils::Vec3i, std::allocator<Planners::utils::Vec3i>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Planners::utils::Vec3i, std::allocator<Planners::utils::Vec3i>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Planners::utils::DiscreteWorld" = type { %"class.std::vector.0", i64, i32, i32, i32, double }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<Planners::utils::Node, std::allocator<Planners::utils::Node>>::_Vector_impl" }
%"struct.std::_Vector_base<Planners::utils::Node, std::allocator<Planners::utils::Node>>::_Vector_impl" = type { %"struct.std::_Vector_base<Planners::utils::Node, std::allocator<Planners::utils::Node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Planners::utils::Node, std::allocator<Planners::utils::Node>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; 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 @_ZN8Planners18LazyThetaStarM1Mod11ComputeCostEPNS_5utils4NodeES3_(ptr noundef nonnull align 8 dereferenceable(320) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.Planners::utils::Node", ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = call noundef i32 @_ZN8Planners5utils8geometry21distanceBetween2NodesEPKNS0_4NodeES4_(ptr noundef %12, ptr noundef %13)
  store i32 %14, ptr %7, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %15 = getelementptr inbounds %"class.Planners::AlgorithmBase", ptr %9, i32 0, i32 6
  %16 = load double, ptr %15, align 8, !tbaa !16
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.Planners::utils::Node", ptr %17, i32 0, i32 7
  %19 = load double, ptr %18, align 8, !tbaa !32
  %20 = fmul double %16, %19
  %21 = fmul double %20, 1.000000e+00
  %22 = fptoui double %21 to i32
  store i32 %22, ptr %8, align 4, !tbaa !15
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.Planners::utils::Node", ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %"class.Planners::utils::Node", ptr %25, i32 0, i32 2
  %27 = load i32, ptr %26, align 4, !tbaa !33
  %28 = load i32, ptr %7, align 4, !tbaa !15
  %29 = add i32 %27, %28
  %30 = load i32, ptr %8, align 4, !tbaa !15
  %31 = add i32 %29, %30
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.Planners::utils::Node", ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 4, !tbaa !33
  %35 = icmp ult i32 %31, %34
  br i1 %35, label %36, label %60

36:                                               ; preds = %3
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.Planners::utils::Node", ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.Planners::utils::Node", ptr %40, i32 0, i32 0
  store ptr %39, ptr %41, align 8, !tbaa !9
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.Planners::utils::Node", ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds %"class.Planners::utils::Node", ptr %44, i32 0, i32 2
  %46 = load i32, ptr %45, align 4, !tbaa !33
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.Planners::utils::Node", ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = call noundef i32 @_ZN8Planners5utils8geometry21distanceBetween2NodesEPKNS0_4NodeES4_(ptr noundef %49, ptr noundef %50)
  %52 = add i32 %46, %51
  %53 = load i32, ptr %8, align 4, !tbaa !15
  %54 = add i32 %52, %53
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"class.Planners::utils::Node", ptr %55, i32 0, i32 2
  store i32 %54, ptr %56, align 4, !tbaa !33
  %57 = load i32, ptr %8, align 4, !tbaa !15
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.Planners::utils::Node", ptr %58, i32 0, i32 4
  store i32 %57, ptr %59, align 4, !tbaa !34
  br label %60

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

declare noundef i32 @_ZN8Planners5utils8geometry21distanceBetween2NodesEPKNS0_4NodeES4_(ptr noundef, ptr noundef) #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 = { "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, !6, i64 0}
!10 = !{!"_ZTSN8Planners5utils4NodeE", !6, i64 0, !11, i64 8, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !13, i64 40, !14, i64 48, !14, i64 49, !14, i64 50}
!11 = !{!"_ZTSN8Planners5utils5Vec3iE", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{!17, !13, i64 128}
!17 = !{!"_ZTSN8Planners13AlgorithmBaseE", !18, i64 8, !20, i64 40, !24, i64 64, !12, i64 120, !14, i64 124, !13, i64 128, !12, i64 136, !30, i64 144}
!18 = !{!"_ZTSSt8functionIFjN8Planners5utils5Vec3iES2_EE", !19, i64 0, !6, i64 24}
!19 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!20 = !{!"_ZTSSt6vectorIN8Planners5utils5Vec3iESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIN8Planners5utils5Vec3iESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils5Vec3iESaIS2_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils5Vec3iESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSN8Planners5utils13DiscreteWorldE", !25, i64 0, !29, i64 24, !12, i64 32, !12, i64 36, !12, i64 40, !13, i64 48}
!25 = !{!"_ZTSSt6vectorIN8Planners5utils4NodeESaIS2_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIN8Planners5utils4NodeESaIS2_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils4NodeESaIS2_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils4NodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"long", !7, i64 0}
!30 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !31, i64 0, !29, i64 8, !7, i64 16}
!31 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!32 = !{!10, !13, i64 40}
!33 = !{!10, !12, i64 20}
!34 = !{!10, !12, i64 28}


; 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 @_ZN8Planners18LazyThetaStarM1Mod11ComputeCostEPNS_5utils4NodeES3_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(320) %0, ptr nocapture noundef readonly %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = load ptr, ptr %1, align 8, !tbaa !5
  %5 = tail call noundef i32 @_ZN8Planners5utils8geometry21distanceBetween2NodesEPKNS0_4NodeES4_(ptr noundef %4, ptr noundef %2)
  %6 = getelementptr inbounds i8, ptr %0, i64 128
  %7 = load double, ptr %6, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %2, i64 40
  %9 = load double, ptr %8, align 8, !tbaa !30
  %10 = fmul double %7, %9
  %11 = fptoui double %10 to i32
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 20
  %14 = load i32, ptr %13, align 4, !tbaa !31
  %15 = add i32 %14, %11
  %16 = add i32 %15, %5
  %17 = getelementptr inbounds i8, ptr %2, i64 20
  %18 = load i32, ptr %17, align 4, !tbaa !31
  %19 = icmp ult i32 %16, %18
  br i1 %19, label %20, label %24

20:                                               ; preds = %3
  store ptr %12, ptr %2, align 8, !tbaa !5
  %21 = tail call noundef i32 @_ZN8Planners5utils8geometry21distanceBetween2NodesEPKNS0_4NodeES4_(ptr noundef nonnull %12, ptr noundef nonnull %2)
  %22 = add i32 %15, %21
  store i32 %22, ptr %17, align 4, !tbaa !31
  %23 = getelementptr inbounds i8, ptr %2, i64 28
  store i32 %11, ptr %23, align 4, !tbaa !32
  br label %24

24:                                               ; preds = %20, %3
  ret void
}

declare noundef i32 @_ZN8Planners5utils8geometry21distanceBetween2NodesEPKNS0_4NodeES4_(ptr noundef, ptr noundef) local_unnamed_addr #1

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 = { "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 0}
!6 = !{!"_ZTSN8Planners5utils4NodeE", !7, i64 0, !10, i64 8, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !12, i64 40, !13, i64 48, !13, i64 49, !13, i64 50}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN8Planners5utils5Vec3iE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!15, !12, i64 128}
!15 = !{!"_ZTSN8Planners13AlgorithmBaseE", !16, i64 8, !18, i64 40, !22, i64 64, !11, i64 120, !13, i64 124, !12, i64 128, !11, i64 136, !28, i64 144}
!16 = !{!"_ZTSSt8functionIFjN8Planners5utils5Vec3iES2_EE", !17, i64 0, !7, i64 24}
!17 = !{!"_ZTSSt14_Function_base", !8, i64 0, !7, i64 16}
!18 = !{!"_ZTSSt6vectorIN8Planners5utils5Vec3iESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIN8Planners5utils5Vec3iESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils5Vec3iESaIS2_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils5Vec3iESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!22 = !{!"_ZTSN8Planners5utils13DiscreteWorldE", !23, i64 0, !27, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !12, i64 48}
!23 = !{!"_ZTSSt6vectorIN8Planners5utils4NodeESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN8Planners5utils4NodeESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils4NodeESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN8Planners5utils4NodeESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!27 = !{!"long", !8, i64 0}
!28 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !29, i64 0, !27, i64 8, !8, i64 16}
!29 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!30 = !{!6, !12, i64 40}
!31 = !{!6, !11, i64 20}
!32 = !{!6, !11, i64 28}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass