; 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::Detail::ObjectId" = type <{ %"struct.vox::NodeEditor::Details::SafePointerType.38", i32, [4 x i8] }>
%"struct.vox::NodeEditor::Details::SafePointerType.38" = type { %"struct.vox::NodeEditor::Details::SafeType.39" }
%"struct.vox::NodeEditor::Details::SafeType.39" = type { i64 }
%"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 }
%"struct.vox::NodeEditor::Detail::EditorAction" = type { ptr, ptr }
%"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.ImVec2 = type { float, float }
%"struct.vox::NodeEditor::Detail::Pin" = type <{ %"struct.vox::NodeEditor::Detail::Object.base", [7 x i8], %"struct.vox::NodeEditor::PinId", i32, [4 x i8], ptr, %struct.ImRect, %struct.ImRect, ptr, i32, i32, float, float, i32, %struct.ImVec2, float, float, float, float, i8, i8, [2 x i8] }>
%"struct.vox::NodeEditor::PinId" = type { %"struct.vox::NodeEditor::Details::SafePointerType" }
%"struct.vox::NodeEditor::Details::SafePointerType" = type { %"struct.vox::NodeEditor::Details::SafeType" }
%"struct.vox::NodeEditor::Details::SafeType" = type { i64 }
%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 noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindLinkENS0_6LinkIdE(ptr noundef nonnull align 8 dereferenceable(2040), i64) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNK3vox10NodeEditor6Detail8ObjectId8AsLinkIdEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox10NodeEditor6Detail8ObjectIdC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3vox10NodeEditor6Detail17DeleteItemsAction9QueryLinkEPNS0_6LinkIdEPNS0_5PinIdES6_(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.vox::NodeEditor::Detail::ObjectId", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.vox::NodeEditor::LinkId", align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"struct.vox::NodeEditor::LinkId", align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  call void @_ZN3vox10NodeEditor6Detail8ObjectIdC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %16 = call noundef zeroext i1 @_ZN3vox10NodeEditor6Detail17DeleteItemsAction9QueryItemEPNS1_8ObjectIdENS2_12IteratorTypeE(ptr noundef nonnull align 8 dereferenceable(88) %15, ptr noundef %10, i32 noundef 1)
  br i1 %16, label %18, label %17

17:                                               ; preds = %4
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %64

18:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %19 = call i64 @_ZNK3vox10NodeEditor6Detail8ObjectId8AsLinkIdEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %20 = getelementptr inbounds %"struct.vox::NodeEditor::LinkId", ptr %12, i32 0, i32 0
  %21 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafePointerType.50", ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafeType.51", ptr %21, i32 0, i32 0
  store i64 %19, ptr %22, align 8
  %23 = call noundef zeroext i1 @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEcvbEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
  br i1 %23, label %24, label %26

24:                                               ; preds = %18
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 8 %12, i64 8, i1 false)
  br label %27

26:                                               ; preds = %18
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %28

27:                                               ; preds = %24
  store i32 0, ptr %11, align 4
  br label %28

28:                                               ; preds = %27, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %29 = load i32, ptr %11, align 4
  switch i32 %29, label %64 [
    i32 0, label %30
  ]

30:                                               ; preds = %28
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %63

36:                                               ; preds = %33, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %37 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::EditorAction", ptr %15, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %39, i64 8, i1 false)
  %40 = getelementptr inbounds %"struct.vox::NodeEditor::LinkId", ptr %14, i32 0, i32 0
  %41 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafePointerType.50", ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds %"struct.vox::NodeEditor::Details::SafeType.51", ptr %41, i32 0, i32 0
  %43 = load i64, ptr %42, align 8
  %44 = call noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindLinkENS0_6LinkIdE(ptr noundef nonnull align 8 dereferenceable(2040) %38, i64 %43)
  store ptr %44, ptr %13, align 8, !tbaa !5
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %53

47:                                               ; preds = %36
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Link", ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Pin", ptr %50, i32 0, i32 2
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %52, ptr align 8 %51, i64 8, i1 false)
  br label %53

53:                                               ; preds = %47, %36
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %62

56:                                               ; preds = %53
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Link", ptr %57, i32 0, i32 3
  %59 = load ptr, ptr %58, align 8, !tbaa !22
  %60 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Pin", ptr %59, i32 0, i32 2
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %61, ptr align 8 %60, i64 8, i1 false)
  br label %62

62:                                               ; preds = %56, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %63

63:                                               ; preds = %62, %33
  store i1 true, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %64

64:                                               ; preds = %63, %28, %17
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  %65 = load i1, ptr %5, align 1
  ret i1 %65
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3vox10NodeEditor6Detail17DeleteItemsAction9QueryItemEPNS1_8ObjectIdENS2_12IteratorTypeE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEcvbEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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"="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 = { 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 = { 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, !6, i64 8}
!10 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !6, i64 8}
!11 = !{!12, !6, i64 32}
!12 = !{!"_ZTSN3vox10NodeEditor6Detail4LinkE", !13, i64 0, !15, i64 24, !6, i64 32, !6, i64 40, !19, i64 48, !20, i64 52, !21, i64 56, !21, i64 64}
!13 = !{!"_ZTSN3vox10NodeEditor6Detail6ObjectE", !6, i64 8, !14, i64 16}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN3vox10NodeEditor6LinkIdE", !16, i64 0}
!16 = !{!"_ZTSN3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEE", !17, i64 0}
!17 = !{!"_ZTSN3vox10NodeEditor7Details8SafeTypeImNS0_6LinkIdEEE", !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTS6ImVec2", !20, i64 0, !20, i64 4}
!22 = !{!12, !6, i64 40}


; 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.vox::NodeEditor::Detail::ObjectId" = type <{ %"struct.vox::NodeEditor::Details::SafePointerType.38", i32, [4 x i8] }>
%"struct.vox::NodeEditor::Details::SafePointerType.38" = type { %"struct.vox::NodeEditor::Details::SafeType.39" }
%"struct.vox::NodeEditor::Details::SafeType.39" = type { i64 }
%"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: 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 uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindLinkENS0_6LinkIdE(ptr noundef nonnull align 8 dereferenceable(2040), i64) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNK3vox10NodeEditor6Detail8ObjectId8AsLinkIdEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox10NodeEditor6Detail8ObjectIdC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3vox10NodeEditor6Detail17DeleteItemsAction9QueryLinkEPNS0_6LinkIdEPNS0_5PinIdES6_(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr nocapture noundef writeonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3) local_unnamed_addr #1 align 2 {
  %5 = alloca %"struct.vox::NodeEditor::Detail::ObjectId", align 8
  %6 = alloca %"struct.vox::NodeEditor::LinkId", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  call void @_ZN3vox10NodeEditor6Detail8ObjectIdC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %7 = call noundef zeroext i1 @_ZN3vox10NodeEditor6Detail17DeleteItemsAction9QueryItemEPNS1_8ObjectIdENS2_12IteratorTypeE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull %5, i32 noundef 1)
  br i1 %7, label %8, label %30

8:                                                ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %9 = call i64 @_ZNK3vox10NodeEditor6Detail8ObjectId8AsLinkIdEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  store i64 %9, ptr %6, align 8
  %10 = call noundef zeroext i1 @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEcvbEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %10, label %11, label %.critedge

11:                                               ; preds = %8
  %12 = load i64, ptr %6, align 8
  store i64 %12, ptr %1, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %13 = icmp ne ptr %2, null
  %14 = icmp ne ptr %3, null
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %30

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = call noundef ptr @_ZN3vox10NodeEditor6Detail13EditorContext8FindLinkENS0_6LinkIdE(ptr noundef nonnull align 8 dereferenceable(2040) %17, i64 %12)
  br i1 %13, label %19, label %24

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %18, i64 32
  %21 = load ptr, ptr %20, align 8, !tbaa !10
  %22 = getelementptr inbounds i8, ptr %21, i64 24
  %23 = load i64, ptr %22, align 8
  store i64 %23, ptr %2, align 8
  br label %24

24:                                               ; preds = %19, %15
  br i1 %14, label %25, label %30

25:                                               ; preds = %24
  %26 = getelementptr inbounds i8, ptr %18, i64 40
  %27 = load ptr, ptr %26, align 8, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %27, i64 24
  %29 = load i64, ptr %28, align 8
  store i64 %29, ptr %3, align 8
  br label %30

.critedge:                                        ; preds = %8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br label %30

30:                                               ; preds = %11, %25, %24, %.critedge, %4
  %.1 = phi i1 [ false, %4 ], [ false, %.critedge ], [ true, %24 ], [ true, %25 ], [ true, %11 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  ret i1 %.1
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3vox10NodeEditor6Detail17DeleteItemsAction9QueryItemEPNS1_8ObjectIdENS2_12IteratorTypeE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEcvbEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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, !7, i64 8}
!6 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 32}
!11 = !{!"_ZTSN3vox10NodeEditor6Detail4LinkE", !12, i64 0, !14, i64 24, !7, i64 32, !7, i64 40, !18, i64 48, !19, i64 52, !20, i64 56, !20, i64 64}
!12 = !{!"_ZTSN3vox10NodeEditor6Detail6ObjectE", !7, i64 8, !13, i64 16}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"_ZTSN3vox10NodeEditor6LinkIdE", !15, i64 0}
!15 = !{!"_ZTSN3vox10NodeEditor7Details15SafePointerTypeINS0_6LinkIdEEE", !16, i64 0}
!16 = !{!"_ZTSN3vox10NodeEditor7Details8SafeTypeImNS0_6LinkIdEEE", !17, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!"int", !8, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = !{!"_ZTS6ImVec2", !19, i64 0, !19, i64 4}
!21 = !{!11, !7, i64 40}


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