; LLVM IR from hadryansalles/Luz :: deps/imgui/imgui.ll (ZN5ImGui16DebugNodeStorageEP12ImGuiStoragePKc)

; 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.ImGuiStorage = type { %struct.ImVector.6 }
%struct.ImVector.6 = type { i32, i32, ptr }
%"struct.ImGuiStorage::ImGuiStoragePair" = type { i32, %union.anon.36 }
%union.anon.36 = type { ptr }

@.str.694 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.695 = external hidden unnamed_addr constant [27 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

declare void @_ZN5ImGui7TreePopEv() #2

declare noundef zeroext i1 @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef, ptr noundef, ...) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui16DebugNodeStorageEP12ImGuiStoragePKc(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ImGuiStorage, ptr %11, i32 0, i32 0
  %13 = getelementptr inbounds %struct.ImVector.6, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ImGuiStorage, ptr %15, i32 0, i32 0
  %17 = call noundef i32 @_ZNK8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  %18 = call noundef zeroext i1 (ptr, ptr, ...) @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef %9, ptr noundef @.str.694, ptr noundef %10, i32 noundef %14, i32 noundef %17)
  br i1 %18, label %20, label %19

19:                                               ; preds = %2
  br label %44

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ImGuiStorage, ptr %21, i32 0, i32 0
  store ptr %22, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
  store ptr %24, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %25)
  store ptr %26, ptr %7, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %40, %20
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = icmp ne ptr %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %43

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %33, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.ImGuiStorage::ImGuiStoragePair", ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !13
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.ImGuiStorage::ImGuiStoragePair", ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !15
  call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef @.str.695, i32 noundef %36, i32 noundef %39)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %40

40:                                               ; preds = %32
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.ImGuiStorage::ImGuiStoragePair", ptr %41, i32 1
  store ptr %42, ptr %6, align 8, !tbaa !5
  br label %27

43:                                               ; preds = %31
  call void @_ZN5ImGui7TreePopEv()
  br label %44

44:                                               ; preds = %43, %19
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #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 = { 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 0}
!10 = !{!"_ZTS12ImGuiStorage", !11, i64 0}
!11 = !{!"_ZTS8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE", !12, i64 0, !12, i64 4, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSN12ImGuiStorage16ImGuiStoragePairE", !12, i64 0, !7, i64 8}
!15 = !{!7, !7, 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"

@.str.694 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.695 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

declare void @_ZN5ImGui7TreePopEv() local_unnamed_addr #1

declare noundef zeroext i1 @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui16DebugNodeStorageEP12ImGuiStoragePKc(ptr noundef nonnull %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = tail call noundef i32 @_ZNK8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %5 = tail call noundef zeroext i1 (ptr, ptr, ...) @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef %1, ptr noundef nonnull @.str.694, ptr noundef %1, i32 noundef %3, i32 noundef %4)
  br i1 %5, label %6, label %13

6:                                                ; preds = %2
  %7 = tail call noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %8 = tail call noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %.not13 = icmp eq ptr %7, %8
  br i1 %.not13, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %6
  tail call void @_ZN5ImGui7TreePopEv()
  br label %13

.lr.ph:                                           ; preds = %6, %.lr.ph
  %.014 = phi ptr [ %12, %.lr.ph ], [ %7, %6 ]
  %9 = load i32, ptr %.014, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %.014, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !14
  tail call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef nonnull @.str.695, i32 noundef %9, i32 noundef %11)
  %12 = getelementptr inbounds i8, ptr %.014, i64 16
  %.not = icmp eq ptr %12, %8
  br i1 %.not, label %._crit_edge, label %.lr.ph

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

!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, !8, i64 0}
!6 = !{!"_ZTS12ImGuiStorage", !7, i64 0}
!7 = !{!"_ZTS8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE", !8, i64 0, !8, i64 4, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!13, !8, i64 0}
!13 = !{!"_ZTSN12ImGuiStorage16ImGuiStoragePairE", !8, i64 0, !9, i64 8}
!14 = !{!9, !9, i64 0}


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