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

; 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.ImVec2 = type { float, float }
%"struct.vox::NodeEditor::NodeId" = type { %"struct.vox::NodeEditor::Details::SafePointerType.6" }
%"struct.vox::NodeEditor::Details::SafePointerType.6" = type { %"struct.vox::NodeEditor::Details::SafeType.7" }
%"struct.vox::NodeEditor::Details::SafeType.7" = type { i64 }
%"struct.vox::NodeEditor::Detail::Node" = type <{ %"struct.vox::NodeEditor::Detail::Object.base", [7 x i8], %"struct.vox::NodeEditor::NodeId", i32, %struct.ImRect, i32, ptr, %struct.ImVec2, i32, i32, float, float, i32, i32, float, float, %struct.ImRect, i8, i8, [6 x i8] }>
%"struct.vox::NodeEditor::Detail::Object.base" = type <{ ptr, ptr, i8 }>
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindNodeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040), i64) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN3vox10NodeEditor6Detail13EditorContext11GetNodeSizeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040) %0, i64 %1) #2 align 2 {
  %3 = alloca %struct.ImVec2, align 4
  %4 = alloca %"struct.vox::NodeEditor::NodeId", align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"struct.vox::NodeEditor::NodeId", align 8
  %8 = alloca i32, align 4
  %9 = getelementptr inbounds %"struct.vox::NodeEditor::NodeId", ptr %4, i32 0, i32 0
  %10 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafePointerType.6", ptr %9, i32 0, i32 0
  %11 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafeType.7", ptr %10, i32 0, i32 0
  store i64 %1, ptr %11, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %4, i64 8, i1 false)
  %13 = getelementptr inbounds %"struct.vox::NodeEditor::NodeId", ptr %7, i32 0, i32 0
  %14 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafePointerType.6", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafeType.7", ptr %14, i32 0, i32 0
  %16 = load i64, ptr %15, align 8
  %17 = call noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindNodeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040) %12, i64 %16)
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %2
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %3, float noundef 0.000000e+00, float noundef 0.000000e+00)
  store i32 1, ptr %8, align 4
  br label %25

21:                                               ; preds = %2
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Node", ptr %22, i32 0, i32 4
  %24 = call <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16) %23)
  store <2 x float> %24, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %25

25:                                               ; preds = %21, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %26 = load <2 x float>, ptr %3, align 4
  ret <2 x float> %26
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { 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"}


; 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.ImVec2 = type { float, float }

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindNodeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040), i64) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN3vox10NodeEditor6Detail13EditorContext11GetNodeSizeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040) %0, i64 %1) local_unnamed_addr #0 align 2 {
  %3 = alloca %struct.ImVec2, align 8
  %4 = tail call noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindNodeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040) %0, i64 %1)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %2
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %3, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %.pre = load <2 x float>, ptr %3, align 8
  br label %9

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %4, i64 36
  %8 = tail call <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16) %7)
  br label %9

9:                                                ; preds = %6, %5
  %10 = phi <2 x float> [ %8, %6 ], [ %.pre, %5 ]
  ret <2 x float> %10
}

attributes #0 = { 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 #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"="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)"}


; Effective O3 passes: DSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass