; 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.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.ImVec2 = type { float, float }
%"struct.vox::NodeEditor::Detail::Object" = type <{ ptr, ptr, i8, [7 x i8] }>
%"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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZneRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3

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

22:                                               ; preds = %3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %4, i64 8, i1 false)
  %23 = getelementptr inbounds %"struct.vox::NodeEditor::NodeId", ptr %9, i32 0, i32 0
  %24 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafePointerType.6", ptr %23, i32 0, i32 0
  %25 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafeType.7", ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8
  %27 = call noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext10CreateNodeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040) %14, i64 %26)
  store ptr %27, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Object", ptr %28, i32 0, i32 2
  store i8 0, ptr %29, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %22, %3
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Node", ptr %31, i32 0, i32 4
  %33 = getelementptr inbounds %struct.ImRect, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call noundef zeroext i1 @_ZneRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %33, ptr noundef nonnull align 4 dereferenceable(8) %34)
  br i1 %35, label %36, label %47

36:                                               ; preds = %30
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Node", ptr %37, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Node", ptr %40, i32 0, i32 4
  %42 = getelementptr inbounds %struct.ImRect, ptr %41, i32 0, i32 0
  %43 = call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %39, ptr noundef nonnull align 4 dereferenceable(8) %42)
  store <2 x float> %43, ptr %10, align 4
  call void @_ZN6ImRect9TranslateERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16) %38, ptr noundef nonnull align 4 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Node", ptr %44, i32 0, i32 4
  call void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16) %45)
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN3vox10NodeEditor6Detail13EditorContext9MakeDirtyENS0_15SaveReasonFlagsEPNS1_4NodeE(ptr noundef nonnull align 8 dereferenceable(2040) %14, i32 noundef 2, ptr noundef %46)
  br label %47

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImRect9TranslateERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox10NodeEditor6Detail13EditorContext9MakeDirtyENS0_15SaveReasonFlagsEPNS1_4NodeE(ptr noundef nonnull align 8 dereferenceable(2040), i32 noundef, ptr noundef) #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #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 = { 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 #5 = { 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 #6 = { 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 #7 = { 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, !11, i64 16}
!10 = !{!"_ZTSN3vox10NodeEditor6Detail6ObjectE", !6, i64 8, !11, i64 16}
!11 = !{!"bool", !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.ImVec2 = type { float, float }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZneRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

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

6:                                                ; preds = %3
  %7 = tail call noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext10CreateNodeENS0_6NodeIdE(ptr noundef nonnull align 8 dereferenceable(2040) %0, i64 %1)
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store i8 0, ptr %8, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %6, %3
  %.0 = phi ptr [ %5, %3 ], [ %7, %6 ]
  %10 = getelementptr inbounds i8, ptr %.0, i64 36
  %11 = tail call noundef zeroext i1 @_ZneRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %2)
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %13 = tail call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %10)
  store <2 x float> %13, ptr %4, align 8
  call void @_ZN6ImRect9TranslateERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16) %10)
  call void @_ZN3vox10NodeEditor6Detail13EditorContext9MakeDirtyENS0_15SaveReasonFlagsEPNS1_4NodeE(ptr noundef nonnull align 8 dereferenceable(2040) %0, i32 noundef 2, ptr noundef nonnull %.0)
  br label %14

14:                                               ; preds = %12, %9
  ret void
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox10NodeEditor6Detail13EditorContext9MakeDirtyENS0_15SaveReasonFlagsEPNS1_4NodeE(ptr noundef nonnull align 8 dereferenceable(2040), i32 noundef, ptr noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #3 = { 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 = { 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 = { 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 #6 = { 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}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass