; LLVM IR from karlkurzer/path_planner :: src/node3d.ll (ZN11HybridAStar6Node3D7updateGEv)

; 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.HybridAStar::Node3D" = type { float, float, float, float, float, i32, i8, i8, i32, ptr }

@_ZN11HybridAStar6Node3D2dxE = external dso_local constant [3 x float], align 4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11HybridAStar6Node3D7updateGEv(ptr noundef nonnull align 8 dereferenceable(40) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 8
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = icmp slt i32 %5, 3
  br i1 %6, label %7, label %39

7:                                                ; preds = %1
  %8 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 9
  %9 = load ptr, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %9, i32 0, i32 8
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 8
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = icmp ne i32 %11, %13
  br i1 %14, label %15, label %33

15:                                               ; preds = %7
  %16 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 9
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %17, i32 0, i32 8
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = icmp sgt i32 %19, 2
  br i1 %20, label %21, label %27

21:                                               ; preds = %15
  %22 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !15
  %23 = fmul float %22, 0x3FF0CCCCC0000000
  %24 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 3
  %25 = load float, ptr %24, align 4, !tbaa !16
  %26 = call float @llvm.fmuladd.f32(float %23, float 2.000000e+00, float %25)
  store float %26, ptr %24, align 4, !tbaa !16
  br label %32

27:                                               ; preds = %15
  %28 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !15
  %29 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 3
  %30 = load float, ptr %29, align 4, !tbaa !16
  %31 = call float @llvm.fmuladd.f32(float %28, float 0x3FF0CCCCC0000000, float %30)
  store float %31, ptr %29, align 4, !tbaa !16
  br label %32

32:                                               ; preds = %27, %21
  br label %38

33:                                               ; preds = %7
  %34 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !15
  %35 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 3
  %36 = load float, ptr %35, align 4, !tbaa !16
  %37 = fadd float %36, %34
  store float %37, ptr %35, align 4, !tbaa !16
  br label %38

38:                                               ; preds = %33, %32
  br label %73

39:                                               ; preds = %1
  %40 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 9
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %41, i32 0, i32 8
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 8
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp ne i32 %43, %45
  br i1 %46, label %47, label %67

47:                                               ; preds = %39
  %48 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 9
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %49, i32 0, i32 8
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = icmp slt i32 %51, 3
  br i1 %52, label %53, label %60

53:                                               ; preds = %47
  %54 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !15
  %55 = fmul float %54, 0x3FF0CCCCC0000000
  %56 = fmul float %55, 2.000000e+00
  %57 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 3
  %58 = load float, ptr %57, align 4, !tbaa !16
  %59 = call float @llvm.fmuladd.f32(float %56, float 2.000000e+00, float %58)
  store float %59, ptr %57, align 4, !tbaa !16
  br label %66

60:                                               ; preds = %47
  %61 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !15
  %62 = fmul float %61, 0x3FF0CCCCC0000000
  %63 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 3
  %64 = load float, ptr %63, align 4, !tbaa !16
  %65 = call float @llvm.fmuladd.f32(float %62, float 2.000000e+00, float %64)
  store float %65, ptr %63, align 4, !tbaa !16
  br label %66

66:                                               ; preds = %60, %53
  br label %72

67:                                               ; preds = %39
  %68 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !15
  %69 = getelementptr inbounds %"class.HybridAStar::Node3D", ptr %3, i32 0, i32 3
  %70 = load float, ptr %69, align 4, !tbaa !16
  %71 = call float @llvm.fmuladd.f32(float %68, float 2.000000e+00, float %70)
  store float %71, ptr %69, align 4, !tbaa !16
  br label %72

72:                                               ; preds = %67, %66
  br label %73

73:                                               ; preds = %72, %38
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 28}
!10 = !{!"_ZTSN11HybridAStar6Node3DE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20, !13, i64 24, !13, i64 25, !12, i64 28, !6, i64 32}
!11 = !{!"float", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!10, !6, i64 32}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 12}


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

@_ZN11HybridAStar6Node3D2dxE = external dso_local local_unnamed_addr constant [3 x float], align 4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN11HybridAStar6Node3D7updateGEv(ptr nocapture noundef nonnull align 8 dereferenceable(40) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 28
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 3
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load ptr, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %6, i64 28
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %.not3 = icmp eq i32 %8, %3
  br i1 %4, label %9, label %27

9:                                                ; preds = %1
  br i1 %.not3, label %22, label %10

10:                                               ; preds = %9
  %11 = icmp sgt i32 %8, 2
  %12 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !14
  br i1 %11, label %13, label %18

13:                                               ; preds = %10
  %14 = fmul float %12, 0x3FF0CCCCC0000000
  %15 = getelementptr inbounds i8, ptr %0, i64 12
  %16 = load float, ptr %15, align 4, !tbaa !15
  %17 = tail call float @llvm.fmuladd.f32(float %14, float 2.000000e+00, float %16)
  store float %17, ptr %15, align 4, !tbaa !15
  br label %46

18:                                               ; preds = %10
  %19 = getelementptr inbounds i8, ptr %0, i64 12
  %20 = load float, ptr %19, align 4, !tbaa !15
  %21 = tail call float @llvm.fmuladd.f32(float %12, float 0x3FF0CCCCC0000000, float %20)
  store float %21, ptr %19, align 4, !tbaa !15
  br label %46

22:                                               ; preds = %9
  %23 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %0, i64 12
  %25 = load float, ptr %24, align 4, !tbaa !15
  %26 = fadd float %23, %25
  store float %26, ptr %24, align 4, !tbaa !15
  br label %46

27:                                               ; preds = %1
  br i1 %.not3, label %41, label %28

28:                                               ; preds = %27
  %29 = icmp slt i32 %8, 3
  %30 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !14
  %31 = fmul float %30, 0x3FF0CCCCC0000000
  br i1 %29, label %32, label %37

32:                                               ; preds = %28
  %33 = fmul float %31, 2.000000e+00
  %34 = getelementptr inbounds i8, ptr %0, i64 12
  %35 = load float, ptr %34, align 4, !tbaa !15
  %36 = tail call float @llvm.fmuladd.f32(float %33, float 2.000000e+00, float %35)
  store float %36, ptr %34, align 4, !tbaa !15
  br label %46

37:                                               ; preds = %28
  %38 = getelementptr inbounds i8, ptr %0, i64 12
  %39 = load float, ptr %38, align 4, !tbaa !15
  %40 = tail call float @llvm.fmuladd.f32(float %31, float 2.000000e+00, float %39)
  store float %40, ptr %38, align 4, !tbaa !15
  br label %46

41:                                               ; preds = %27
  %42 = load float, ptr @_ZN11HybridAStar6Node3D2dxE, align 4, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %0, i64 12
  %44 = load float, ptr %43, align 4, !tbaa !15
  %45 = tail call float @llvm.fmuladd.f32(float %42, float 2.000000e+00, float %44)
  store float %45, ptr %43, align 4, !tbaa !15
  br label %46

46:                                               ; preds = %41, %37, %32, %22, %18, %13
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, 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 28}
!6 = !{!"_ZTSN11HybridAStar6Node3DE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 20, !11, i64 24, !11, i64 25, !10, i64 28, !12, i64 32}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !12, i64 32}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !7, i64 12}


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