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

; 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.51 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction5BeginEv = external hidden unnamed_addr constant [56 x i8], align 1

declare noundef ptr @_ZN5ImGui17GetWindowDrawListEv() #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3vox10NodeEditor6Detail16CreateItemAction5BeginEv(ptr noundef nonnull align 8 dereferenceable(88) %0) #2 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, 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
  %8 = zext i1 %7 to i32
  %9 = icmp eq i32 0, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  br label %13

11:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.51, ptr noundef @.str.1, i32 noundef 3808, ptr noundef @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction5BeginEv) #3
  unreachable

12:                                               ; No predecessors!
  br label %13

13:                                               ; preds = %12, %10
  %14 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 1
  store i8 1, ptr %14, align 8, !tbaa !9
  %15 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 3
  %16 = load i32, ptr %15, align 4, !tbaa !20
  %17 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 4
  store i32 %16, ptr %17, align 8, !tbaa !21
  %18 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 6
  store i32 0, ptr %18, align 8, !tbaa !22
  %19 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 7
  store i32 -1, ptr %19, align 4, !tbaa !23
  %20 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 8
  store float 1.000000e+00, ptr %20, align 8, !tbaa !24
  %21 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 4
  %22 = load i32, ptr %21, align 8, !tbaa !21
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %13
  store i1 false, ptr %2, align 1
  br label %31

25:                                               ; preds = %13
  %26 = call noundef ptr @_ZN5ImGui17GetWindowDrawListEv()
  %27 = getelementptr inbounds %struct.ImDrawList, ptr %26, i32 0, i32 13
  %28 = getelementptr inbounds %struct.ImDrawListSplitter, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !25
  %30 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::CreateItemAction", ptr %4, i32 0, i32 15
  store i32 %29, ptr %30, align 8, !tbaa !37
  store i1 true, ptr %2, align 1
  br label %31

31:                                               ; preds = %25, %24
  %32 = load i1, ptr %2, align 1
  ret i1 %32
}

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

!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, !13, i64 20}
!21 = !{!10, !13, i64 24}
!22 = !{!10, !15, i64 32}
!23 = !{!10, !16, i64 36}
!24 = !{!10, !17, i64 40}
!25 = !{!26, !16, i64 168}
!26 = !{!"_ZTS10ImDrawList", !27, i64 0, !28, i64 16, !29, i64 32, !16, i64 48, !16, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !30, i64 88, !31, i64 104, !32, i64 120, !33, i64 136, !35, i64 168, !17, i64 192}
!27 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !16, i64 0, !16, i64 4, !6, i64 8}
!28 = !{!"_ZTS8ImVectorItE", !16, i64 0, !16, i64 4, !6, i64 8}
!29 = !{!"_ZTS8ImVectorI10ImDrawVertE", !16, i64 0, !16, i64 4, !6, i64 8}
!30 = !{!"_ZTS8ImVectorI6ImVec4E", !16, i64 0, !16, i64 4, !6, i64 8}
!31 = !{!"_ZTS8ImVectorIPvE", !16, i64 0, !16, i64 4, !6, i64 8}
!32 = !{!"_ZTS8ImVectorI6ImVec2E", !16, i64 0, !16, i64 4, !6, i64 8}
!33 = !{!"_ZTS15ImDrawCmdHeader", !34, i64 0, !6, i64 16, !16, i64 24}
!34 = !{!"_ZTS6ImVec4", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!35 = !{!"_ZTS18ImDrawListSplitter", !16, i64 0, !16, i64 4, !36, i64 8}
!36 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !16, i64 0, !16, i64 4, !6, i64 8}
!37 = !{!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.51 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction5BeginEv = external hidden unnamed_addr constant [56 x i8], align 1

declare noundef ptr @_ZN5ImGui17GetWindowDrawListEv() local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3vox10NodeEditor6Detail16CreateItemAction5BeginEv(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 = icmp eq i8 %3, 0
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.51, ptr noundef nonnull @.str.1, i32 noundef 3808, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail16CreateItemAction5BeginEv) #3
  unreachable

6:                                                ; preds = %1
  store i8 1, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 20
  %8 = load i32, ptr %7, align 4, !tbaa !19
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %8, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %10, align 8, !tbaa !21
  %11 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 -1, ptr %11, align 4, !tbaa !22
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  store float 1.000000e+00, ptr %12, align 8, !tbaa !23
  %13 = icmp ne i32 %8, 0
  br i1 %13, label %14, label %19

14:                                               ; preds = %6
  %15 = tail call noundef ptr @_ZN5ImGui17GetWindowDrawListEv()
  %16 = getelementptr inbounds i8, ptr %15, i64 168
  %17 = load i32, ptr %16, align 8, !tbaa !24
  %18 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 %17, ptr %18, align 8, !tbaa !36
  br label %19

19:                                               ; preds = %6, %14
  ret i1 %13
}

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

!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, !12, i64 20}
!20 = !{!6, !12, i64 24}
!21 = !{!6, !14, i64 32}
!22 = !{!6, !15, i64 36}
!23 = !{!6, !16, i64 40}
!24 = !{!25, !15, i64 168}
!25 = !{!"_ZTS10ImDrawList", !26, i64 0, !27, i64 16, !28, i64 32, !15, i64 48, !15, i64 52, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !29, i64 88, !30, i64 104, !31, i64 120, !32, i64 136, !34, i64 168, !16, i64 192}
!26 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !15, i64 0, !15, i64 4, !8, i64 8}
!27 = !{!"_ZTS8ImVectorItE", !15, i64 0, !15, i64 4, !8, i64 8}
!28 = !{!"_ZTS8ImVectorI10ImDrawVertE", !15, i64 0, !15, i64 4, !8, i64 8}
!29 = !{!"_ZTS8ImVectorI6ImVec4E", !15, i64 0, !15, i64 4, !8, i64 8}
!30 = !{!"_ZTS8ImVectorIPvE", !15, i64 0, !15, i64 4, !8, i64 8}
!31 = !{!"_ZTS8ImVectorI6ImVec2E", !15, i64 0, !15, i64 4, !8, i64 8}
!32 = !{!"_ZTS15ImDrawCmdHeader", !33, i64 0, !8, i64 16, !15, i64 24}
!33 = !{!"_ZTS6ImVec4", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!34 = !{!"_ZTS18ImDrawListSplitter", !15, i64 0, !15, i64 4, !35, i64 8}
!35 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !15, i64 0, !15, i64 4, !8, i64 8}
!36 = !{!6, !15, i64 80}


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