; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/juce_gui_basics.ll (ZN4juce9PopupMenu16MenuItemIterator4nextEv)

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

%"class.juce::PopupMenu::MenuItemIterator" = type { i8, [7 x i8], %"class.juce::Array.288", %"class.juce::Array.454", ptr }
%"class.juce::Array.288" = type { %"class.juce::ArrayAllocationBase.289", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.289" = type <{ %"class.juce::HeapBlock.290", i32, [4 x i8] }>
%"class.juce::HeapBlock.290" = type { ptr }
%"class.juce::Array.454" = type { %"class.juce::ArrayAllocationBase.455", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.455" = type <{ %"class.juce::HeapBlock.456", i32, [4 x i8] }>
%"class.juce::HeapBlock.456" = type { ptr }
%"class.juce::PopupMenu" = type { %"class.juce::OwnedArray.239", %"class.juce::WeakReference.37" }
%"class.juce::OwnedArray.239" = type { %"class.juce::ArrayAllocationBase.240", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.240" = type <{ %"class.juce::HeapBlock.241", i32, [4 x i8] }>
%"class.juce::HeapBlock.241" = type { ptr }
%"class.juce::WeakReference.37" = type { %"class.juce::ReferenceCountedObjectPtr.38" }
%"class.juce::ReferenceCountedObjectPtr.38" = type { ptr }
%"struct.juce::PopupMenu::Item" = type { %"class.juce::String", i32, %"class.juce::ScopedPointer.433", %"class.juce::ScopedPointer.89", %"class.juce::ReferenceCountedObjectPtr.434", %"class.juce::ReferenceCountedObjectPtr.435", ptr, %"class.juce::String", %"class.juce::Colour", i8, i8, i8, i8 }
%"class.juce::ScopedPointer.433" = type { ptr }
%"class.juce::ScopedPointer.89" = type { ptr }
%"class.juce::ReferenceCountedObjectPtr.434" = type { ptr }
%"class.juce::ReferenceCountedObjectPtr.435" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::Colour" = type { %"class.juce::PixelARGB" }
%"class.juce::PixelARGB" = type { %union.anon.77 }
%union.anon.77 = type { i32 }

; 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: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE3addEOi(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce9PopupMenu16MenuItemIterator4nextEv(ptr noundef nonnull align 8 dereferenceable(64) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %8 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %16, label %10

10:                                               ; preds = %1
  %11 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 3
  %12 = call noundef ptr @_ZNK4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %11)
  %13 = getelementptr inbounds %"class.juce::PopupMenu", ptr %12, i32 0, i32 0
  %14 = call noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %13) #4
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %10, %1
  store i1 false, ptr %2, align 1
  br label %80

17:                                               ; preds = %10
  %18 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 3
  %19 = call noundef ptr @_ZNK4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %18)
  %20 = getelementptr inbounds %"class.juce::PopupMenu", ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %22 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %21)
  %23 = call noundef ptr @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %20, i32 noundef %22) #4
  %24 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 4
  store ptr %23, ptr %24, align 8, !tbaa !9
  %25 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 0
  %26 = load i8, ptr %25, align 8, !tbaa !19, !range !20, !noundef !21
  %27 = trunc i8 %26 to i1
  br i1 %27, label %28, label %41

28:                                               ; preds = %17
  %29 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds %"struct.juce::PopupMenu::Item", ptr %30, i32 0, i32 2
  %32 = call noundef ptr @_ZNK4juce13ScopedPointerINS_9PopupMenuEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %31) #4
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %41

34:                                               ; preds = %28
  %35 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !22
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE3addEOi(ptr noundef nonnull align 8 dereferenceable(20) %35, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %36 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %37 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 4
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds %"struct.juce::PopupMenu::Item", ptr %38, i32 0, i32 2
  %40 = call noundef ptr @_ZNK4juce13ScopedPointerINS_9PopupMenuEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %39) #4
  store ptr %40, ptr %5, align 8, !tbaa !5
  call void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20) %36, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %49

41:                                               ; preds = %28, %17
  %42 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %43 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %44 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %43) #4
  %45 = sub nsw i32 %44, 1
  %46 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %47 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %46)
  %48 = add nsw i32 %47, 1
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE12setUncheckedEii(ptr noundef nonnull align 8 dereferenceable(20) %42, i32 noundef %45, i32 noundef %48)
  br label %49

49:                                               ; preds = %41, %34
  br label %50

50:                                               ; preds = %78, %49
  %51 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %52 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %51) #4
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %54, label %62

54:                                               ; preds = %50
  %55 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %56 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %55)
  %57 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 3
  %58 = call noundef ptr @_ZNK4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %57)
  %59 = getelementptr inbounds %"class.juce::PopupMenu", ptr %58, i32 0, i32 0
  %60 = call noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %59) #4
  %61 = icmp sge i32 %56, %60
  br label %62

62:                                               ; preds = %54, %50
  %63 = phi i1 [ false, %50 ], [ %61, %54 ]
  br i1 %63, label %64, label %79

64:                                               ; preds = %62
  %65 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20) %65, i32 noundef 1)
  %66 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 3
  call void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20) %66, i32 noundef 1)
  %67 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %68 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %67) #4
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %70, label %78

70:                                               ; preds = %64
  %71 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %72 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %73 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %72) #4
  %74 = sub nsw i32 %73, 1
  %75 = getelementptr inbounds %"class.juce::PopupMenu::MenuItemIterator", ptr %6, i32 0, i32 2
  %76 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %75)
  %77 = add nsw i32 %76, 1
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE12setUncheckedEii(ptr noundef nonnull align 8 dereferenceable(20) %71, i32 noundef %74, i32 noundef %77)
  br label %78

78:                                               ; preds = %70, %64
  br label %50, !llvm.loop !23

79:                                               ; preds = %62
  store i1 true, ptr %2, align 1
  br label %80

80:                                               ; preds = %79, %16
  %81 = load i1, ptr %2, align 1
  ret i1 %81
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE12setUncheckedEii(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 56}
!10 = !{!"_ZTSN4juce9PopupMenu16MenuItemIteratorE", !11, i64 0, !12, i64 8, !16, i64 32, !6, i64 56}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN4juce5ArrayIiNS_20DummyCriticalSectionELi0EEE", !13, i64 0, !15, i64 16}
!13 = !{!"_ZTSN4juce19ArrayAllocationBaseIiNS_20DummyCriticalSectionEEE", !14, i64 0, !15, i64 8}
!14 = !{!"_ZTSN4juce9HeapBlockIiLb0EEE", !6, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EEE", !17, i64 0, !15, i64 16}
!17 = !{!"_ZTSN4juce19ArrayAllocationBaseIPKNS_9PopupMenuENS_20DummyCriticalSectionEEE", !18, i64 0, !15, i64 8}
!18 = !{!"_ZTSN4juce9HeapBlockIPKNS_9PopupMenuELb0EEE", !6, i64 0}
!19 = !{!10, !11, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!15, !15, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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"

; 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 void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE3addEOi(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce9PopupMenu16MenuItemIterator4nextEv(ptr noundef nonnull align 8 dereferenceable(64) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %.critedge, label %7

7:                                                ; preds = %1
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = tail call noundef ptr @_ZNK4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %8)
  %10 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %9) #4
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %.critedge, label %12

12:                                               ; preds = %7
  %13 = tail call noundef ptr @_ZNK4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %8)
  %14 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %4)
  %15 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %13, i32 noundef %14) #4
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %15, ptr %16, align 8, !tbaa !5
  %17 = load i8, ptr %0, align 8, !tbaa !18, !range !19, !noundef !20
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %19, label %26

19:                                               ; preds = %12
  %20 = getelementptr inbounds i8, ptr %15, i64 16
  %21 = tail call noundef ptr @_ZNK4juce13ScopedPointerINS_9PopupMenuEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #4
  %.not = icmp eq ptr %21, null
  br i1 %.not, label %26, label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  store i32 0, ptr %2, align 4, !tbaa !21
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE3addEOi(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %23 = load ptr, ptr %16, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %25 = call noundef ptr @_ZNK4juce13ScopedPointerINS_9PopupMenuEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #4
  store ptr %25, ptr %3, align 8, !tbaa !22
  call void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20) %8, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br label %31

26:                                               ; preds = %19, %12
  %27 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  %28 = add nsw i32 %27, -1
  %29 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %4)
  %30 = add nsw i32 %29, 1
  tail call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE12setUncheckedEii(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %28, i32 noundef %30)
  br label %31

31:                                               ; preds = %26, %22
  %32 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %31, %45
  %34 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %4)
  %35 = call noundef ptr @_ZNK4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %8)
  %36 = call noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %35) #4
  %.not2 = icmp slt i32 %34, %36
  br i1 %.not2, label %.critedge, label %37

37:                                               ; preds = %.lr.ph
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef 1)
  call void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20) %8, i32 noundef 1)
  %38 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  %41 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  %42 = add nsw i32 %41, -1
  %43 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %4)
  %44 = add nsw i32 %43, 1
  call void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE12setUncheckedEii(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %42, i32 noundef %44)
  br label %45

45:                                               ; preds = %40, %37
  %46 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #4
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %.lr.ph, label %.critedge, !llvm.loop !23

.critedge:                                        ; preds = %45, %.lr.ph, %31, %1, %7
  %.0 = phi i1 [ false, %7 ], [ false, %1 ], [ true, %31 ], [ true, %.lr.ph ], [ true, %45 ]
  ret i1 %.0
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE12setUncheckedEii(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIiNS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EE10removeLastEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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, !13, i64 56}
!6 = !{!"_ZTSN4juce9PopupMenu16MenuItemIteratorE", !7, i64 0, !10, i64 8, !15, i64 32, !13, i64 56}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4juce5ArrayIiNS_20DummyCriticalSectionELi0EEE", !11, i64 0, !14, i64 16}
!11 = !{!"_ZTSN4juce19ArrayAllocationBaseIiNS_20DummyCriticalSectionEEE", !12, i64 0, !14, i64 8}
!12 = !{!"_ZTSN4juce9HeapBlockIiLb0EEE", !13, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = !{!"_ZTSN4juce5ArrayIPKNS_9PopupMenuENS_20DummyCriticalSectionELi0EEE", !16, i64 0, !14, i64 16}
!16 = !{!"_ZTSN4juce19ArrayAllocationBaseIPKNS_9PopupMenuENS_20DummyCriticalSectionEEE", !17, i64 0, !14, i64 8}
!17 = !{!"_ZTSN4juce9HeapBlockIPKNS_9PopupMenuELb0EEE", !13, i64 0}
!18 = !{!6, !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!14, !14, i64 0}
!22 = !{!13, !13, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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