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

; 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.vox::NodeEditor::Detail::Style" = type { %"struct.vox::NodeEditor::Style", %"class.std::vector", %"class.std::vector.8" }
%"struct.vox::NodeEditor::Style" = type { %struct.ImVec4, float, float, float, float, float, float, float, %struct.ImVec2, %struct.ImVec2, float, float, float, float, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, float, float, float, float, float, [18 x %struct.ImVec4] }
%struct.ImVec4 = type { float, float, float, float }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::ColorModifier, std::allocator<vox::NodeEditor::Detail::Style::ColorModifier>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::ColorModifier, std::allocator<vox::NodeEditor::Detail::Style::ColorModifier>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::ColorModifier, std::allocator<vox::NodeEditor::Detail::Style::ColorModifier>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::ColorModifier, std::allocator<vox::NodeEditor::Detail::Style::ColorModifier>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.8" = type { %"struct.std::_Vector_base.9" }
%"struct.std::_Vector_base.9" = type { %"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::VarModifier, std::allocator<vox::NodeEditor::Detail::Style::VarModifier>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::VarModifier, std::allocator<vox::NodeEditor::Detail::Style::VarModifier>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::VarModifier, std::allocator<vox::NodeEditor::Detail::Style::VarModifier>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::NodeEditor::Detail::Style::VarModifier, std::allocator<vox::NodeEditor::Detail::Style::VarModifier>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.vox::NodeEditor::Detail::Style::VarModifier" = type { i32, %struct.ImVec4 }

; 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 nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail5Style15GetVarFloatAddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec2AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec4AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail5Style6PopVarEi(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.ImVec2, align 4
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8
  br label %11

11:                                               ; preds = %59, %2
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %14, label %63

14:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %15 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style", ptr %10, i32 0, i32 2
  %16 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  store ptr %16, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = call noundef ptr @_ZN3vox10NodeEditor6Detail5Style15GetVarFloatAddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464) %10, i32 noundef %19)
  store ptr %20, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %29

23:                                               ; preds = %14
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %24, i32 0, i32 1
  %26 = getelementptr inbounds %struct.ImVec4, ptr %25, i32 0, i32 0
  %27 = load float, ptr %26, align 4, !tbaa !16
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  store float %27, ptr %28, align 4, !tbaa !17
  br label %59

29:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = call noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec2AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464) %10, i32 noundef %32)
  store ptr %33, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %46

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %37, i32 0, i32 1
  %39 = getelementptr inbounds %struct.ImVec4, ptr %38, i32 0, i32 0
  %40 = load float, ptr %39, align 4, !tbaa !16
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %struct.ImVec4, ptr %42, i32 0, i32 1
  %44 = load float, ptr %43, align 4, !tbaa !18
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %8, float noundef %40, float noundef %44)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %58

46:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 4, !tbaa !11
  %50 = call noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec4AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464) %10, i32 noundef %49)
  store ptr %50, ptr %9, align 8, !tbaa !5
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %57

53:                                               ; preds = %46
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style::VarModifier", ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %56, ptr align 4 %55, i64 16, i1 false), !tbaa.struct !20
  br label %57

57:                                               ; preds = %53, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %58

58:                                               ; preds = %57, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %59

59:                                               ; preds = %58, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %60 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::Style", ptr %10, i32 0, i32 2
  call void @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #4
  %61 = load i32, ptr %4, align 4, !tbaa !9
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %11, !llvm.loop !21

63:                                               ; preds = %11
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #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 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 = { 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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3vox10NodeEditor6Detail5Style11VarModifierE", !13, i64 0, !14, i64 4}
!13 = !{!"_ZTSN3vox10NodeEditor8StyleVarE", !7, i64 0}
!14 = !{!"_ZTS6ImVec4", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!15 = !{!"float", !7, i64 0}
!16 = !{!12, !15, i64 4}
!17 = !{!15, !15, i64 0}
!18 = !{!12, !15, i64 8}
!19 = !{i64 0, i64 4, !17, i64 4, i64 4, !17}
!20 = !{i64 0, i64 4, !17, i64 4, i64 4, !17, i64 8, i64 4, !17, i64 12, i64 4, !17}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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

; 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 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 nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail5Style15GetVarFloatAddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec2AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec4AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3vox10NodeEditor6Detail5Style6PopVarEi(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %struct.ImVec2, align 8
  %4 = icmp sgt i32 %1, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 440
  br label %6

6:                                                ; preds = %.lr.ph, %27
  %.020 = phi i32 [ %1, %.lr.ph ], [ %28, %27 ]
  %7 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = call noundef ptr @_ZN3vox10NodeEditor6Detail5Style15GetVarFloatAddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %8)
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %13, label %10

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %7, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !12
  store float %12, ptr %9, align 4, !tbaa !13
  br label %27

13:                                               ; preds = %6
  %14 = load i32, ptr %7, align 4, !tbaa !5
  %15 = call noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec2AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %14)
  %.not18 = icmp eq ptr %15, null
  br i1 %.not18, label %22, label %16

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %17 = getelementptr inbounds i8, ptr %7, i64 4
  %18 = load float, ptr %17, align 4, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %7, i64 8
  %20 = load float, ptr %19, align 4, !tbaa !14
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %3, float noundef %18, float noundef %20)
  %21 = load i64, ptr %3, align 8
  store i64 %21, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %27

22:                                               ; preds = %13
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = call noundef ptr @_ZN3vox10NodeEditor6Detail5Style14GetVarVec4AddrENS0_8StyleVarE(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %23)
  %.not19 = icmp eq ptr %24, null
  br i1 %.not19, label %27, label %25

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %7, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(16) %26, i64 16, i1 false), !tbaa.struct !15
  br label %27

27:                                               ; preds = %16, %25, %22, %10
  call void @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %28 = add nsw i32 %.020, -1
  %29 = icmp sgt i32 %.020, 1
  br i1 %29, label %6, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %27, %2
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorIN3vox10NodeEditor6Detail5Style11VarModifierESaIS4_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 0}
!6 = !{!"_ZTSN3vox10NodeEditor6Detail5Style11VarModifierE", !7, i64 0, !10, i64 4}
!7 = !{!"_ZTSN3vox10NodeEditor8StyleVarE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS6ImVec4", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !11, i64 4}
!13 = !{!11, !11, i64 0}
!14 = !{!6, !11, i64 8}
!15 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13, i64 12, i64 4, !13}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass