; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/dear_imgui/imnodes.ll (ZN7imnodes15IsEditorHoveredEv)

; 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.anon = type <{ ptr, ptr, ptr, %struct.ImGuiStorage, %struct.ImVector.0, %struct.ImVector.0, %struct.ImVec2, %struct.ImRect, i32, [4 x i8], %"struct.imnodes::IO", %"struct.imnodes::Style", %struct.ImVector.1, %struct.ImVector.2, %struct.ImGuiTextBuffer, i32, [4 x i8], %struct.ImVector.0, i32, i32, i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, i32, i8, [3 x i8], %struct.ImVec2, i8, i8, i8, i8, i8, [3 x i8] }>
%struct.ImGuiStorage = type { %struct.ImVector }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%"struct.imnodes::IO" = type { %"struct.imnodes::IO::EmulateThreeButtonMouse", %"struct.imnodes::IO::LinkDetachWithModifierClick" }
%"struct.imnodes::IO::EmulateThreeButtonMouse" = type { i8, ptr }
%"struct.imnodes::IO::LinkDetachWithModifierClick" = type { ptr }
%"struct.imnodes::Style" = type { float, float, float, float, float, float, float, float, float, float, float, float, float, i32, [16 x i32] }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImGuiTextBuffer = type { %struct.ImVector.3 }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.0 = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::OptionalIndex" = type { i32 }
%struct.ImVec2 = type { float, float }

@_ZN7imnodes12_GLOBAL__N_11gE = external hidden global %struct.anon, align 8

; 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
define dso_local noundef zeroext i1 @_ZN7imnodes15IsEditorHoveredEv() #2 {
  %1 = alloca %struct.ImVec2, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %2 = call <2 x float> @_ZN5ImGui11GetMousePosEv()
  store <2 x float> %2, ptr %1, align 4
  %3 = call noundef zeroext i1 @_ZNK6ImRect8ContainsERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16) getelementptr inbounds (%struct.anon, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i32 0, i32 7), ptr noundef nonnull align 4 dereferenceable(8) %1)
  br i1 %3, label %4, label %6

4:                                                ; preds = %0
  %5 = call noundef zeroext i1 @_ZN5ImGui15IsWindowHoveredEi(i32 noundef 0)
  br label %6

6:                                                ; preds = %4, %0
  %7 = phi i1 [ false, %0 ], [ %5, %4 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret i1 %7
}

declare <2 x float> @_ZN5ImGui11GetMousePosEv() #3

declare noundef zeroext i1 @_ZN5ImGui15IsWindowHoveredEi(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 = { "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)"}


; 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.anon = type <{ ptr, ptr, ptr, %struct.ImGuiStorage, %struct.ImVector.0, %struct.ImVector.0, %struct.ImVec2, %struct.ImRect, i32, [4 x i8], %"struct.imnodes::IO", %"struct.imnodes::Style", %struct.ImVector.1, %struct.ImVector.2, %struct.ImGuiTextBuffer, i32, [4 x i8], %struct.ImVector.0, i32, i32, i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, i32, i8, [3 x i8], %struct.ImVec2, i8, i8, i8, i8, i8, [3 x i8] }>
%struct.ImGuiStorage = type { %struct.ImVector }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%"struct.imnodes::IO" = type { %"struct.imnodes::IO::EmulateThreeButtonMouse", %"struct.imnodes::IO::LinkDetachWithModifierClick" }
%"struct.imnodes::IO::EmulateThreeButtonMouse" = type { i8, ptr }
%"struct.imnodes::IO::LinkDetachWithModifierClick" = type { ptr }
%"struct.imnodes::Style" = type { float, float, float, float, float, float, float, float, float, float, float, float, float, i32, [16 x i32] }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImGuiTextBuffer = type { %struct.ImVector.3 }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.0 = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::OptionalIndex" = type { i32 }
%struct.ImVec2 = type { float, float }

@_ZN7imnodes12_GLOBAL__N_11gE = external hidden global %struct.anon, align 8

; 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
define dso_local noundef zeroext i1 @_ZN7imnodes15IsEditorHoveredEv() local_unnamed_addr #2 {
  %1 = alloca %struct.ImVec2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %2 = tail call <2 x float> @_ZN5ImGui11GetMousePosEv()
  store <2 x float> %2, ptr %1, align 8
  %3 = call noundef zeroext i1 @_ZNK6ImRect8ContainsERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16) getelementptr inbounds (i8, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i64 80), ptr noundef nonnull align 4 dereferenceable(8) %1)
  br i1 %3, label %4, label %6

4:                                                ; preds = %0
  %5 = call noundef zeroext i1 @_ZN5ImGui15IsWindowHoveredEi(i32 noundef 0)
  br label %6

6:                                                ; preds = %4, %0
  %7 = phi i1 [ false, %0 ], [ %5, %4 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i1 %7
}

declare <2 x float> @_ZN5ImGui11GetMousePosEv() local_unnamed_addr #3

declare noundef zeroext i1 @_ZN5ImGui15IsWindowHoveredEi(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 = { "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)"}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,TailCallElimPass