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

; 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::CreateItemAction" = type <{ %"struct.vox::NodeEditor::Detail::EditorAction", i8, [3 x i8], i32, i32, i32, i32, i32, float, [4 x i8], ptr, ptr, i8, [7 x i8], ptr, i32, i8, [3 x i8] }>
%"struct.vox::NodeEditor::Detail::EditorAction" = type { ptr, ptr }
%struct.ImDrawList = type <{ %struct.ImVector, %struct.ImVector.0, %struct.ImVector.1, i32, i32, ptr, ptr, ptr, ptr, %struct.ImVector.2, %struct.ImVector.3, %struct.ImVector.4, %struct.ImDrawCmdHeader, %struct.ImDrawListSplitter, float, [4 x i8] }>
%struct.ImVector = type { i32, i32, ptr }
%struct.ImVector.0 = type { i32, i32, ptr }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImDrawCmdHeader = type <{ %struct.ImVec4, ptr, i32, [4 x i8] }>
%struct.ImVec4 = type { float, float, float, float }
%struct.ImDrawListSplitter = type { i32, i32, %struct.ImVector.5 }
%struct.ImVector.5 = type { i32, i32, ptr }

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [11 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction3EndEv = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10ImDrawList18ChannelsSetCurrentEi(ptr noundef nonnull align 8 dereferenceable(196), i32 noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare noundef ptr @_ZN5ImGui17GetWindowDrawListEv() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox10NodeEditor6Detail13EditorContext6ResumeENS1_12SuspendFlagsE(ptr noundef nonnull align 8 dereferenceable(2040), i8 noundef zeroext) #3 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare void @_ZN5ImGui11PopClipRectEv() #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail16CreateItemAction3EndEv(ptr noundef nonnull align 8 dereferenceable(88) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 1
  %6 = load i8, ptr %5, align 8, !tbaa !9, !range !18, !noundef !19
  %7 = trunc i8 %6 to i1
  br i1 %7, label %8, label %9

8:                                                ; preds = %1
  br label %11

9:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str.52, ptr noundef @.str.1, i32 noundef 3825, ptr noundef @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction3EndEv) #5
  unreachable

10:                                               ; No predecessors!
  br label %11

11:                                               ; preds = %10, %8
  %12 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 16
  %13 = load i8, ptr %12, align 4, !tbaa !20, !range !18, !noundef !19
  %14 = trunc i8 %13 to i1
  br i1 %14, label %15, label %32

15:                                               ; preds = %11
  call void @_ZN5ImGui11PopClipRectEv()
  %16 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::EditorAction", ptr %4, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !21
  call void @_ZN3vox10NodeEditor6Detail13EditorContext6ResumeENS1_12SuspendFlagsE(ptr noundef nonnull align 8 dereferenceable(2040) %17, i8 noundef zeroext 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %18 = call noundef ptr @_ZN5ImGui17GetWindowDrawListEv()
  %19 = getelementptr inbounds %struct.ImDrawList, ptr %18, i32 0, i32 13
  %20 = getelementptr inbounds %struct.ImDrawListSplitter, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !22
  store i32 %21, ptr %3, align 4, !tbaa !34
  %22 = load i32, ptr %3, align 4, !tbaa !34
  %23 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 15
  %24 = load i32, ptr %23, align 8, !tbaa !35
  %25 = icmp ne i32 %22, %24
  br i1 %25, label %26, label %30

26:                                               ; preds = %15
  %27 = call noundef ptr @_ZN5ImGui17GetWindowDrawListEv()
  %28 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 15
  %29 = load i32, ptr %28, align 8, !tbaa !35
  call void @_ZN10ImDrawList18ChannelsSetCurrentEi(ptr noundef nonnull align 8 dereferenceable(196) %27, i32 noundef %29)
  br label %30

30:                                               ; preds = %26, %15
  %31 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 16
  store i8 0, ptr %31, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %32

32:                                               ; preds = %30, %11
  %33 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 1
  store i8 0, ptr %33, align 8, !tbaa !9
  ret void
}

attributes #0 = { 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 #1 = { nocallback nofree nosync 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 = { noreturn nounwind "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 = { noreturn nounwind }
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 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemActionE", !11, i64 0, !12, i64 16, !13, i64 20, !13, i64 24, !14, i64 28, !15, i64 32, !16, i64 36, !17, i64 40, !6, i64 48, !6, i64 56, !12, i64 64, !6, i64 72, !16, i64 80, !12, i64 84}
!11 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !6, i64 8}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemAction5StageE", !7, i64 0}
!14 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemAction4TypeE", !7, i64 0}
!15 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemAction6ActionE", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!10, !12, i64 84}
!21 = !{!11, !6, i64 8}
!22 = !{!23, !16, i64 168}
!23 = !{!"_ZTS10ImDrawList", !24, i64 0, !25, i64 16, !26, i64 32, !16, i64 48, !16, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !27, i64 88, !28, i64 104, !29, i64 120, !30, i64 136, !32, i64 168, !17, i64 192}
!24 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !16, i64 0, !16, i64 4, !6, i64 8}
!25 = !{!"_ZTS8ImVectorItE", !16, i64 0, !16, i64 4, !6, i64 8}
!26 = !{!"_ZTS8ImVectorI10ImDrawVertE", !16, i64 0, !16, i64 4, !6, i64 8}
!27 = !{!"_ZTS8ImVectorI6ImVec4E", !16, i64 0, !16, i64 4, !6, i64 8}
!28 = !{!"_ZTS8ImVectorIPvE", !16, i64 0, !16, i64 4, !6, i64 8}
!29 = !{!"_ZTS8ImVectorI6ImVec2E", !16, i64 0, !16, i64 4, !6, i64 8}
!30 = !{!"_ZTS15ImDrawCmdHeader", !31, i64 0, !6, i64 16, !16, i64 24}
!31 = !{!"_ZTS6ImVec4", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!32 = !{!"_ZTS18ImDrawListSplitter", !16, i64 0, !16, i64 4, !33, i64 8}
!33 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !16, i64 0, !16, i64 4, !6, i64 8}
!34 = !{!16, !16, i64 0}
!35 = !{!10, !16, i64 80}


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

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [11 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction3EndEv = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10ImDrawList18ChannelsSetCurrentEi(ptr noundef nonnull align 8 dereferenceable(196), i32 noundef) local_unnamed_addr #0 align 2

declare noundef ptr @_ZN5ImGui17GetWindowDrawListEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox10NodeEditor6Detail13EditorContext6ResumeENS1_12SuspendFlagsE(ptr noundef nonnull align 8 dereferenceable(2040), i8 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @_ZN5ImGui11PopClipRectEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail16CreateItemAction3EndEv(ptr nocapture noundef nonnull align 8 dereferenceable(88) %0) local_unnamed_addr #2 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i8, ptr %2, align 8, !tbaa !5, !range !17, !noundef !18
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.52, ptr noundef nonnull @.str.1, i32 noundef 3825, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction3EndEv) #4
  unreachable

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 84
  %8 = load i8, ptr %7, align 4, !tbaa !19, !range !17, !noundef !18
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %10, label %22

10:                                               ; preds = %6
  tail call void @_ZN5ImGui11PopClipRectEv()
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !20
  tail call void @_ZN3vox10NodeEditor6Detail13EditorContext6ResumeENS1_12SuspendFlagsE(ptr noundef nonnull align 8 dereferenceable(2040) %12, i8 noundef zeroext 1)
  %13 = tail call noundef ptr @_ZN5ImGui17GetWindowDrawListEv()
  %14 = getelementptr inbounds i8, ptr %13, i64 168
  %15 = load i32, ptr %14, align 8, !tbaa !21
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  %17 = load i32, ptr %16, align 8, !tbaa !33
  %.not = icmp eq i32 %15, %17
  br i1 %.not, label %21, label %18

18:                                               ; preds = %10
  %19 = tail call noundef ptr @_ZN5ImGui17GetWindowDrawListEv()
  %20 = load i32, ptr %16, align 8, !tbaa !33
  tail call void @_ZN10ImDrawList18ChannelsSetCurrentEi(ptr noundef nonnull align 8 dereferenceable(196) %19, i32 noundef %20)
  br label %21

21:                                               ; preds = %18, %10
  store i8 0, ptr %7, align 4, !tbaa !19
  br label %22

22:                                               ; preds = %21, %6
  store i8 0, ptr %2, align 8, !tbaa !5
  ret void
}

attributes #0 = { 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 #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 = { noreturn nounwind "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 = { noreturn 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 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemActionE", !7, i64 0, !11, i64 16, !12, i64 20, !12, i64 24, !13, i64 28, !14, i64 32, !15, i64 36, !16, i64 40, !8, i64 48, !8, i64 56, !11, i64 64, !8, i64 72, !15, i64 80, !11, i64 84}
!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 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemAction5StageE", !9, i64 0}
!13 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemAction4TypeE", !9, i64 0}
!14 = !{!"_ZTSN3vox10NodeEditor6Detail16CreateItemAction6ActionE", !9, i64 0}
!15 = !{!"int", !9, i64 0}
!16 = !{!"float", !9, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!6, !11, i64 84}
!20 = !{!7, !8, i64 8}
!21 = !{!22, !15, i64 168}
!22 = !{!"_ZTS10ImDrawList", !23, i64 0, !24, i64 16, !25, i64 32, !15, i64 48, !15, i64 52, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !26, i64 88, !27, i64 104, !28, i64 120, !29, i64 136, !31, i64 168, !16, i64 192}
!23 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !15, i64 0, !15, i64 4, !8, i64 8}
!24 = !{!"_ZTS8ImVectorItE", !15, i64 0, !15, i64 4, !8, i64 8}
!25 = !{!"_ZTS8ImVectorI10ImDrawVertE", !15, i64 0, !15, i64 4, !8, i64 8}
!26 = !{!"_ZTS8ImVectorI6ImVec4E", !15, i64 0, !15, i64 4, !8, i64 8}
!27 = !{!"_ZTS8ImVectorIPvE", !15, i64 0, !15, i64 4, !8, i64 8}
!28 = !{!"_ZTS8ImVectorI6ImVec2E", !15, i64 0, !15, i64 4, !8, i64 8}
!29 = !{!"_ZTS15ImDrawCmdHeader", !30, i64 0, !8, i64 16, !15, i64 24}
!30 = !{!"_ZTS6ImVec4", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!31 = !{!"_ZTS18ImDrawListSplitter", !15, i64 0, !15, i64 4, !32, i64 8}
!32 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !15, i64 0, !15, i64 4, !8, i64 8}
!33 = !{!6, !15, i64 80}


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