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

; 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.ImVec2 = type { float, float }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%"struct.vox::NodeEditor::Detail::NodeBuilder" = type { ptr, ptr, ptr, %struct.ImRect, %struct.ImRect, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, i8, i8, %struct.ImRect, i8, %struct.ImDrawListSplitter, %struct.ImDrawListSplitter }
%struct.ImDrawListSplitter = type { i32, i32, %struct.ImVector.5 }
%struct.ImVector.5 = type { i32, i32, ptr }
%"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.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 }

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2 = external hidden unnamed_addr constant [65 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

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL7IsGroupPKN3vox10NodeEditor6Detail4NodeE(ptr noundef) #3

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

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

declare void @_ZN5ImGui5DummyERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZN3vox10NodeEditor6Detail17ImGui_GetItemRectEv() #6

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.ImVec2, align 4
  %6 = alloca %struct.ImRect, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 1
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = icmp ne ptr null, %9
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %14

12:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.57, ptr noundef @.str.1, i32 noundef 4422, ptr noundef @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2) #7
  unreachable

13:                                               ; No predecessors!
  br label %14

14:                                               ; preds = %13, %11
  %15 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 2
  %16 = load ptr, ptr %15, align 8, !tbaa !18
  %17 = icmp eq ptr null, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  br label %21

19:                                               ; preds = %14
  call void @__assert_fail(ptr noundef @.str.59, ptr noundef @.str.1, i32 noundef 4423, ptr noundef @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2) #7
  unreachable

20:                                               ; No predecessors!
  br label %21

21:                                               ; preds = %20, %18
  %22 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 11
  %23 = load i8, ptr %22, align 4, !tbaa !19, !range !20, !noundef !21
  %24 = trunc i8 %23 to i1
  %25 = zext i1 %24 to i32
  %26 = icmp eq i32 0, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %21
  br label %30

28:                                               ; preds = %21
  call void @__assert_fail(ptr noundef @.str.60, ptr noundef @.str.1, i32 noundef 4424, ptr noundef @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2) #7
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  %31 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 11
  store i8 1, ptr %31, align 4, !tbaa !19
  %32 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call noundef zeroext i1 @_ZL7IsGroupPKN3vox10NodeEditor6Detail4NodeE(ptr noundef %33)
  br i1 %34, label %35, label %40

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %36 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Node", ptr %37, i32 0, i32 16
  %39 = call <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16) %38)
  store <2 x float> %39, ptr %5, align 4
  call void @_ZN5ImGui5DummyERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %42

40:                                               ; preds = %30
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN5ImGui5DummyERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(8) %41)
  br label %42

42:                                               ; preds = %40, %35
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #8
  %43 = call { <2 x float>, <2 x float> } @_ZN3vox10NodeEditor6Detail17ImGui_GetItemRectEv()
  %44 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 0
  %45 = extractvalue { <2 x float>, <2 x float> } %43, 0
  store <2 x float> %45, ptr %44, align 4
  %46 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 1
  %47 = extractvalue { <2 x float>, <2 x float> } %43, 1
  store <2 x float> %47, ptr %46, align 4
  %48 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %6, i64 16, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #8
  %49 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NodeBuilder", ptr %7, i32 0, i32 10
  call void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16) %49)
  ret void
}

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"="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 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 = { 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 = { "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 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"_ZTSN3vox10NodeEditor6Detail11NodeBuilderE", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 40, !12, i64 56, !12, i64 64, !12, i64 72, !14, i64 80, !14, i64 81, !11, i64 84, !14, i64 100, !15, i64 104, !15, i64 128}
!11 = !{!"_ZTS6ImRect", !12, i64 0, !12, i64 8}
!12 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTS18ImDrawListSplitter", !16, i64 0, !16, i64 4, !17, i64 8}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !16, i64 0, !16, i64 4, !6, i64 8}
!18 = !{!10, !6, i64 16}
!19 = !{!10, !14, i64 100}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{i64 0, i64 4, !23, i64 4, i64 4, !23, i64 8, i64 4, !23, i64 12, i64 4, !23}
!23 = !{!13, !13, 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 }

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2 = external hidden unnamed_addr constant [65 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

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL7IsGroupPKN3vox10NodeEditor6Detail4NodeE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16)) 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 @_ZN5ImGui5DummyERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZN3vox10NodeEditor6Detail17ImGui_GetItemRectEv() local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %struct.ImVec2, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.57, ptr noundef nonnull @.str.1, i32 noundef 4422, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2) #6
  unreachable

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !17
  %10 = icmp eq ptr %9, null
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.59, ptr noundef nonnull @.str.1, i32 noundef 4423, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2) #6
  unreachable

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 100
  %14 = load i8, ptr %13, align 4, !tbaa !18, !range !19, !noundef !20
  %15 = icmp eq i8 %14, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.60, ptr noundef nonnull @.str.1, i32 noundef 4424, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vox10NodeEditor6Detail11NodeBuilder5GroupERK6ImVec2) #6
  unreachable

17:                                               ; preds = %12
  store i8 1, ptr %13, align 4, !tbaa !18
  %18 = tail call noundef zeroext i1 @_ZL7IsGroupPKN3vox10NodeEditor6Detail4NodeE(ptr noundef nonnull %5)
  br i1 %18, label %19, label %23

19:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 104
  %22 = tail call <2 x float> @_ZNK6ImRect7GetSizeEv(ptr noundef nonnull align 4 dereferenceable(16) %21)
  store <2 x float> %22, ptr %3, align 8
  call void @_ZN5ImGui5DummyERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %24

23:                                               ; preds = %17
  tail call void @_ZN5ImGui5DummyERK6ImVec2(ptr noundef nonnull align 4 dereferenceable(8) %1)
  br label %24

24:                                               ; preds = %23, %19
  %25 = call { <2 x float>, <2 x float> } @_ZN3vox10NodeEditor6Detail17ImGui_GetItemRectEv()
  %26 = extractvalue { <2 x float>, <2 x float> } %25, 0
  %27 = extractvalue { <2 x float>, <2 x float> } %25, 1
  %28 = getelementptr inbounds i8, ptr %0, i64 84
  store <2 x float> %26, ptr %28, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 92
  store <2 x float> %27, ptr %.sroa.4.0..sroa_idx, align 4
  call void @_ZN6ImRect5FloorEv(ptr noundef nonnull align 4 dereferenceable(16) %28)
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { "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"="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 #6 = { noreturn nounwind }
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, !7, i64 8}
!6 = !{!"_ZTSN3vox10NodeEditor6Detail11NodeBuilderE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 40, !11, i64 56, !11, i64 64, !11, i64 72, !13, i64 80, !13, i64 81, !10, i64 84, !13, i64 100, !14, i64 104, !14, i64 128}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS6ImRect", !11, i64 0, !11, i64 8}
!11 = !{!"_ZTS6ImVec2", !12, i64 0, !12, i64 4}
!12 = !{!"float", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"_ZTS18ImDrawListSplitter", !15, i64 0, !15, i64 4, !16, i64 8}
!15 = !{!"int", !8, i64 0}
!16 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !15, i64 0, !15, i64 4, !7, i64 8}
!17 = !{!6, !7, i64 16}
!18 = !{!6, !13, i64 100}
!19 = !{i8 0, i8 2}
!20 = !{}


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