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

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

%class.anon.141 = type { i8 }
%"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::Detail::DragAction" = type { %"struct.vox::NodeEditor::Detail::EditorAction", i8, i8, ptr, %"class.std::vector.28" }
%"struct.vox::NodeEditor::Detail::EditorAction" = type { ptr, ptr }
%"class.std::vector.28" = type { %"struct.std::_Vector_base.29" }
%"struct.std::_Vector_base.29" = type { %"struct.std::_Vector_base<vox::NodeEditor::Detail::Object *, std::allocator<vox::NodeEditor::Detail::Object *>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::NodeEditor::Detail::Object *, std::allocator<vox::NodeEditor::Detail::Object *>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::NodeEditor::Detail::Object *, std::allocator<vox::NodeEditor::Detail::Object *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::NodeEditor::Detail::Object *, std::allocator<vox::NodeEditor::Detail::Object *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.31 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [18 x i8], align 1

; 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

declare void @_ZN5ImGui4TextEPKcz(ptr noundef, ...) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6Detail8ObjectIdEE9AsPointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail10DragAction11ShowMetricsEv(ptr noundef nonnull align 8 dereferenceable(56) %0) unnamed_addr #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.anon.141, align 1
  %4 = alloca %"struct.vox::NodeEditor::Detail::ObjectId", align 8
  %5 = alloca { i64, i32 }, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @_ZN3vox10NodeEditor6Detail12EditorAction11ShowMetricsEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #6
  %7 = call noundef ptr @_ZNK3vox10NodeEditor6Detail10DragAction7GetNameEv(ptr noundef nonnull align 8 dereferenceable(56) %6)
  call void (ptr, ...) @_ZN5ImGui4TextEPKcz(ptr noundef @.str.31, ptr noundef %7)
  %8 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::DragAction", ptr %6, i32 0, i32 1
  %9 = load i8, ptr %8, align 8, !tbaa !9, !range !17, !noundef !18
  %10 = trunc i8 %9 to i1
  %11 = zext i1 %10 to i64
  %12 = select i1 %10, ptr @.str.33, ptr @.str.34
  call void (ptr, ...) @_ZN5ImGui4TextEPKcz(ptr noundef @.str.32, ptr noundef %12)
  %13 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::DragAction", ptr %6, i32 0, i32 3
  %14 = load ptr, ptr %13, align 8, !tbaa !19
  %15 = call noundef ptr @"_ZZN3vox10NodeEditor6Detail10DragAction11ShowMetricsEvENK3$_0clEPNS1_6ObjectE"(ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef %14)
  %16 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::DragAction", ptr %6, i32 0, i32 3
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %18 = icmp ne ptr %17, null
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #6
  br i1 %18, label %19, label %27

19:                                               ; preds = %1
  %20 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::DragAction", ptr %6, i32 0, i32 3
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  %23 = getelementptr inbounds ptr, ptr %22, i64 2
  %24 = load ptr, ptr %23, align 8
  %25 = call { i64, i32 } %24(ptr noundef nonnull align 8 dereferenceable(17) %21)
  store { i64, i32 } %25, ptr %5, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %5, i64 12, i1 false)
  %26 = call noundef ptr @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6Detail8ObjectIdEE9AsPointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %4)
  br label %28

27:                                               ; preds = %1
  br label %28

28:                                               ; preds = %27, %19
  %29 = phi ptr [ %26, %19 ], [ null, %27 ]
  call void (ptr, ...) @_ZN5ImGui4TextEPKcz(ptr noundef @.str.37, ptr noundef %15, ptr noundef %29)
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #6
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3vox10NodeEditor6Detail10DragAction7GetNameEv(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @"_ZZN3vox10NodeEditor6Detail10DragAction11ShowMetricsEvENK3$_0clEPNS1_6ObjectE"(ptr noundef nonnull align 1 dereferenceable(1), 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 = { "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"="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 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 #5 = { inlinehint 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 = { 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, !12, i64 16}
!10 = !{!"_ZTSN3vox10NodeEditor6Detail10DragActionE", !11, i64 0, !12, i64 16, !12, i64 17, !6, i64 24, !13, i64 32}
!11 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !6, i64 8}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSSt6vectorIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!10, !6, i64 24}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !8, 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"

%class.anon.141 = type { i8 }
%"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 }

@.str.31 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [18 x i8], align 1

; 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

declare void @_ZN5ImGui4TextEPKcz(ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail10DragAction11ShowMetricsEv(ptr noundef nonnull align 8 dereferenceable(56) %0) unnamed_addr #2 align 2 {
  %2 = alloca %class.anon.141, align 1
  %3 = alloca %"struct.vox::NodeEditor::Detail::ObjectId", align 8
  tail call void @_ZN3vox10NodeEditor6Detail12EditorAction11ShowMetricsEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  %4 = tail call noundef ptr @_ZNK3vox10NodeEditor6Detail10DragAction7GetNameEv(ptr noundef nonnull align 8 dereferenceable(56) %0)
  tail call void (ptr, ...) @_ZN5ImGui4TextEPKcz(ptr noundef nonnull @.str.31, ptr noundef %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !16, !noundef !17
  %7 = trunc nuw i8 %6 to i1
  %8 = select i1 %7, ptr @.str.33, ptr @.str.34
  tail call void (ptr, ...) @_ZN5ImGui4TextEPKcz(ptr noundef nonnull @.str.32, ptr noundef nonnull %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !18
  %11 = call noundef ptr @"_ZZN3vox10NodeEditor6Detail10DragAction11ShowMetricsEvENK3$_0clEPNS1_6ObjectE"(ptr noundef nonnull align 1 dereferenceable(1) %2, ptr noundef %10)
  %12 = load ptr, ptr %9, align 8, !tbaa !18
  %.not = icmp eq ptr %12, null
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  br i1 %.not, label %19, label %13

13:                                               ; preds = %1
  %14 = load ptr, ptr %12, align 8, !tbaa !19
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %16 = load ptr, ptr %15, align 8
  %17 = call { i64, i32 } %16(ptr noundef nonnull align 8 dereferenceable(17) %12)
  %.fca.0.extract = extractvalue { i64, i32 } %17, 0
  %.fca.1.extract = extractvalue { i64, i32 } %17, 1
  store i64 %.fca.0.extract, ptr %3, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %18 = call noundef ptr @_ZNK3vox10NodeEditor7Details15SafePointerTypeINS0_6Detail8ObjectIdEE9AsPointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %19

19:                                               ; preds = %1, %13
  %20 = phi ptr [ %18, %13 ], [ null, %1 ]
  call void (ptr, ...) @_ZN5ImGui4TextEPKcz(ptr noundef nonnull @.str.37, ptr noundef %11, ptr noundef %20)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  ret void
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @"_ZZN3vox10NodeEditor6Detail10DragAction11ShowMetricsEvENK3$_0clEPNS1_6ObjectE"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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" }
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 = { inlinehint 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, !11, i64 16}
!6 = !{!"_ZTSN3vox10NodeEditor6Detail10DragActionE", !7, i64 0, !11, i64 16, !11, i64 17, !8, i64 24, !12, i64 32}
!7 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!"_ZTSSt6vectorIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN3vox10NodeEditor6Detail6ObjectESaIS4_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!6, !8, i64 24}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !10, i64 0}


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