; LLVM IR from yangfengzzz/DigitalVox4 :: editor/imgui_node_editor.ll (ZNK3vox10NodeEditor6Detail4Link7TestHitERK6ImVec2f)

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

%struct.ImCubicBezierPointsT = type { %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2 }
%struct.ImVec2 = type { float, float }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImProjectResult = type { %struct.ImVec2, float, float }
%"struct.vox::NodeEditor::Detail::Object" = type <{ ptr, ptr, i8, [7 x i8] }>
%"struct.vox::NodeEditor::Detail::Link" = type { %"struct.vox::NodeEditor::Detail::Object.base", %"struct.vox::NodeEditor::LinkId", ptr, ptr, i32, float, %struct.ImVec2, %struct.ImVec2 }
%"struct.vox::NodeEditor::Detail::Object.base" = type <{ ptr, ptr, i8 }>
%"struct.vox::NodeEditor::LinkId" = type { %"struct.vox::NodeEditor::Details::SafePointerType.50" }
%"struct.vox::NodeEditor::Details::SafePointerType.50" = type { %"struct.vox::NodeEditor::Details::SafeType.51" }
%"struct.vox::NodeEditor::Details::SafeType.51" = type { i64 }

; 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
declare dso_local noundef zeroext i1 @_ZNK6ImRect8ContainsERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3vox10NodeEditor6Detail4Link8GetCurveEv(ptr dead_on_unwind noalias writable sret(%struct.ImCubicBezierPointsT) align 4, ptr noundef nonnull align 8 dereferenceable(72)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3vox10NodeEditor6Detail4Link7TestHitERK6ImVec2f(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca %struct.ImRect, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.ImCubicBezierPointsT, align 4
  %11 = alloca %struct.ImProjectResult, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store float %2, ptr %7, align 4, !tbaa !9
  %12 = load ptr, ptr %5, align 8
  %13 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Object", ptr %12, i32 0, i32 2
  %14 = load i8, ptr %13, align 8, !tbaa !11, !range !14, !noundef !15
  %15 = trunc i8 %14 to i1
  br i1 %15, label %17, label %16

16:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %50

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  %18 = call { <2 x float>, <2 x float> } @_ZNK3vox10NodeEditor6Detail4Link9GetBoundsEv(ptr noundef nonnull align 8 dereferenceable(72) %12)
  %19 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %20 = extractvalue { <2 x float>, <2 x float> } %18, 0
  store <2 x float> %20, ptr %19, align 4
  %21 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %22 = extractvalue { <2 x float>, <2 x float> } %18, 1
  store <2 x float> %22, ptr %21, align 4
  %23 = load float, ptr %7, align 4, !tbaa !9
  %24 = fcmp ogt float %23, 0.000000e+00
  br i1 %24, label %25, label %27

25:                                               ; preds = %17
  %26 = load float, ptr %7, align 4, !tbaa !9
  call void @_ZN6ImRect6ExpandEf(ptr noundef nonnull align 4 dereferenceable(16) %8, float noundef %26)
  br label %27

27:                                               ; preds = %25, %17
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = call noundef zeroext i1 @_ZNK6ImRect8ContainsERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(8) %28)
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %49

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @_ZNK3vox10NodeEditor6Detail4Link8GetCurveEv(ptr dead_on_unwind writable sret(%struct.ImCubicBezierPointsT) align 4 %10, ptr noundef nonnull align 8 dereferenceable(72) %12)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ImCubicBezierPointsT, ptr %10, i32 0, i32 0
  %34 = getelementptr inbounds %struct.ImCubicBezierPointsT, ptr %10, i32 0, i32 1
  %35 = getelementptr inbounds %struct.ImCubicBezierPointsT, ptr %10, i32 0, i32 2
  %36 = getelementptr inbounds %struct.ImCubicBezierPointsT, ptr %10, i32 0, i32 3
  %37 = call { <2 x float>, <2 x float> } @_Z22ImProjectOnCubicBezierRK6ImVec2S1_S1_S1_S1_i(ptr noundef nonnull align 4 dereferenceable(8) %32, ptr noundef nonnull align 4 dereferenceable(8) %33, ptr noundef nonnull align 4 dereferenceable(8) %34, ptr noundef nonnull align 4 dereferenceable(8) %35, ptr noundef nonnull align 4 dereferenceable(8) %36, i32 noundef 50)
  %38 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 0
  %39 = extractvalue { <2 x float>, <2 x float> } %37, 0
  store <2 x float> %39, ptr %38, align 4
  %40 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 1
  %41 = extractvalue { <2 x float>, <2 x float> } %37, 1
  store <2 x float> %41, ptr %40, align 4
  %42 = getelementptr inbounds %struct.ImProjectResult, ptr %11, i32 0, i32 2
  %43 = load float, ptr %42, align 4, !tbaa !16
  %44 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Link", ptr %12, i32 0, i32 5
  %45 = load float, ptr %44, align 4, !tbaa !19
  %46 = load float, ptr %7, align 4, !tbaa !9
  %47 = fadd float %45, %46
  %48 = fcmp ole float %43, %47
  store i1 %48, ptr %4, align 1
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  br label %49

49:                                               ; preds = %31, %30
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  br label %50

50:                                               ; preds = %49, %16
  %51 = load i1, ptr %4, align 1
  ret i1 %51
}

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZNK3vox10NodeEditor6Detail4Link9GetBoundsEv(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImRect6ExpandEf(ptr noundef nonnull align 4 dereferenceable(16), float noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_Z22ImProjectOnCubicBezierRK6ImVec2S1_S1_S1_S1_i(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #3

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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = !{!"float", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"_ZTSN3vox10NodeEditor6Detail6ObjectE", !6, i64 8, !13, i64 16}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !10, i64 12}
!17 = !{!"_ZTS15ImProjectResult", !18, i64 0, !10, i64 8, !10, i64 12}
!18 = !{!"_ZTS6ImVec2", !10, i64 0, !10, i64 4}
!19 = !{!20, !10, i64 52}
!20 = !{!"_ZTSN3vox10NodeEditor6Detail4LinkE", !12, i64 0, !21, i64 24, !6, i64 32, !6, i64 40, !25, i64 48, !10, i64 52, !18, i64 56, !18, i64 64}
!21 = !{!"_ZTSN3vox10NodeEditor6LinkIdE", !22, i64 0}
!22 = !{!"_ZTSN3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEE", !23, i64 0}
!23 = !{!"_ZTSN3vox10NodeEditor7Details8SafeTypeImNS0_6LinkIdEEE", !24, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!"int", !7, i64 0}


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

%struct.ImCubicBezierPointsT = type { %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2 }
%struct.ImVec2 = type { float, float }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6ImRect8ContainsERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3vox10NodeEditor6Detail4Link8GetCurveEv(ptr dead_on_unwind noalias writable sret(%struct.ImCubicBezierPointsT) align 4, ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3vox10NodeEditor6Detail4Link7TestHitERK6ImVec2f(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca %struct.ImRect, align 8
  %5 = alloca %struct.ImCubicBezierPointsT, align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i8, ptr %6, align 8, !tbaa !5, !range !11, !noundef !12
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %9, label %29

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %10 = tail call { <2 x float>, <2 x float> } @_ZNK3vox10NodeEditor6Detail4Link9GetBoundsEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %11 = extractvalue { <2 x float>, <2 x float> } %10, 0
  store <2 x float> %11, ptr %4, align 8
  %12 = getelementptr inbounds i8, ptr %4, i64 8
  %13 = extractvalue { <2 x float>, <2 x float> } %10, 1
  store <2 x float> %13, ptr %12, align 8
  %14 = fcmp ogt float %2, 0.000000e+00
  br i1 %14, label %15, label %16

15:                                               ; preds = %9
  call void @_ZN6ImRect6ExpandEf(ptr noundef nonnull align 4 dereferenceable(16) %4, float noundef %2)
  br label %16

16:                                               ; preds = %15, %9
  %17 = call noundef zeroext i1 @_ZNK6ImRect8ContainsERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(8) %1)
  br i1 %17, label %18, label %28

18:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @_ZNK3vox10NodeEditor6Detail4Link8GetCurveEv(ptr dead_on_unwind nonnull writable sret(%struct.ImCubicBezierPointsT) align 4 %5, ptr noundef nonnull align 8 dereferenceable(72) %0)
  %19 = getelementptr inbounds i8, ptr %5, i64 8
  %20 = getelementptr inbounds i8, ptr %5, i64 16
  %21 = getelementptr inbounds i8, ptr %5, i64 24
  %22 = call { <2 x float>, <2 x float> } @_Z22ImProjectOnCubicBezierRK6ImVec2S1_S1_S1_S1_i(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(8) %21, i32 noundef 50)
  %23 = extractvalue { <2 x float>, <2 x float> } %22, 1
  %.sroa.3.12.vec.extract = extractelement <2 x float> %23, i64 1
  %24 = getelementptr inbounds i8, ptr %0, i64 52
  %25 = load float, ptr %24, align 4, !tbaa !13
  %26 = fadd float %25, %2
  %27 = fcmp ole float %.sroa.3.12.vec.extract, %26
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  br label %28

28:                                               ; preds = %16, %18
  %.0 = phi i1 [ %27, %18 ], [ false, %16 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br label %29

29:                                               ; preds = %3, %28
  %.1 = phi i1 [ %.0, %28 ], [ false, %3 ]
  ret i1 %.1
}

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZNK3vox10NodeEditor6Detail4Link9GetBoundsEv(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImRect6ExpandEf(ptr noundef nonnull align 4 dereferenceable(16), float noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_Z22ImProjectOnCubicBezierRK6ImVec2S1_S1_S1_S1_i(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress 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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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, !10, i64 16}
!6 = !{!"_ZTSN3vox10NodeEditor6Detail6ObjectE", !7, i64 8, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !20, i64 52}
!14 = !{!"_ZTSN3vox10NodeEditor6Detail4LinkE", !6, i64 0, !15, i64 24, !7, i64 32, !7, i64 40, !19, i64 48, !20, i64 52, !21, i64 56, !21, i64 64}
!15 = !{!"_ZTSN3vox10NodeEditor6LinkIdE", !16, i64 0}
!16 = !{!"_ZTSN3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEE", !17, i64 0}
!17 = !{!"_ZTSN3vox10NodeEditor7Details8SafeTypeImNS0_6LinkIdEEE", !18, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!"int", !8, i64 0}
!20 = !{!"float", !8, i64 0}
!21 = !{!"_ZTS6ImVec2", !20, i64 0, !20, i64 4}


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