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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK4juce9Component7getPeerEv(ptr noundef nonnull align 8 dereferenceable(197)) #1 align 2

; 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
define dso_local void @_ZN4juce21ModalComponentManager27bringModalComponentsToFrontEb(ptr noundef nonnull align 8 dereferenceable(48) %0, i1 noundef zeroext %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = zext i1 %1 to i8
  store i8 %10, ptr %4, align 1, !tbaa !9
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %62, %2
  %13 = load i32, ptr %6, align 4, !tbaa !11
  %14 = call noundef i32 @_ZNK4juce21ModalComponentManager21getNumModalComponentsEv(ptr noundef nonnull align 8 dereferenceable(48) %11)
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  store i32 2, ptr %7, align 4
  br label %65

17:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %18 = load i32, ptr %6, align 4, !tbaa !11
  %19 = call noundef ptr @_ZNK4juce21ModalComponentManager17getModalComponentEi(ptr noundef nonnull align 8 dereferenceable(48) %11, i32 noundef %18)
  store ptr %19, ptr %8, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  store i32 2, ptr %7, align 4
  br label %59

23:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = call noundef ptr @_ZNK4juce9Component7getPeerEv(ptr noundef nonnull align 8 dereferenceable(197) %24)
  store ptr %25, ptr %9, align 8, !tbaa !5
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %58

28:                                               ; preds = %23
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = icmp ne ptr %29, %30
  br i1 %31, label %32, label %58

32:                                               ; preds = %28
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %50

35:                                               ; preds = %32
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = load i8, ptr %4, align 1, !tbaa !9, !range !13, !noundef !14
  %38 = trunc i8 %37 to i1
  %39 = load ptr, ptr %36, align 8, !tbaa !15
  %40 = getelementptr inbounds ptr, ptr %39, i64 23
  %41 = load ptr, ptr %40, align 8
  call void %41(ptr noundef nonnull align 8 dereferenceable(77) %36, i1 noundef zeroext %38)
  %42 = load i8, ptr %4, align 1, !tbaa !9, !range !13, !noundef !14
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %49

44:                                               ; preds = %35
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  %47 = getelementptr inbounds ptr, ptr %46, i64 26
  %48 = load ptr, ptr %47, align 8
  call void %48(ptr noundef nonnull align 8 dereferenceable(77) %45)
  br label %49

49:                                               ; preds = %44, %35
  br label %56

50:                                               ; preds = %32
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load ptr, ptr %51, align 8, !tbaa !15
  %54 = getelementptr inbounds ptr, ptr %53, i64 24
  %55 = load ptr, ptr %54, align 8
  call void %55(ptr noundef nonnull align 8 dereferenceable(77) %51, ptr noundef %52)
  br label %56

56:                                               ; preds = %50, %49
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %57, ptr %5, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %56, %28, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  store i32 0, ptr %7, align 4
  br label %59

59:                                               ; preds = %58, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %60 = load i32, ptr %7, align 4
  switch i32 %60, label %65 [
    i32 0, label %61
  ]

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %6, align 4, !tbaa !11
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %6, align 4, !tbaa !11
  br label %12, !llvm.loop !17

65:                                               ; preds = %59, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %66

66:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce21ModalComponentManager17getModalComponentEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #2 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 = { 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, !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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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 uwtable
declare dso_local noundef ptr @_ZNK4juce9Component7getPeerEv(ptr noundef nonnull align 8 dereferenceable(197)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce21ModalComponentManager27bringModalComponentsToFrontEb(ptr noundef nonnull align 8 dereferenceable(48) %0, i1 noundef zeroext %1) local_unnamed_addr #0 align 2 {
  %3 = tail call noundef i32 @_ZNK4juce21ModalComponentManager21getNumModalComponentsEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  br i1 %1, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %20
  %.026.us = phi ptr [ %.2.ph.us, %20 ], [ null, %.lr.ph ]
  %.01725.us = phi i32 [ %21, %20 ], [ 0, %.lr.ph ]
  %5 = tail call noundef ptr @_ZNK4juce21ModalComponentManager17getModalComponentEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %.01725.us)
  %.not22.us = icmp eq ptr %5, null
  br i1 %.not22.us, label %._crit_edge, label %6

6:                                                ; preds = %.lr.ph.split.us
  %7 = tail call noundef ptr @_ZNK4juce9Component7getPeerEv(ptr noundef nonnull align 8 dereferenceable(197) %5)
  %.not.us = icmp eq ptr %7, null
  %.not21.us = icmp eq ptr %7, %.026.us
  %or.cond.us = select i1 %.not.us, i1 true, i1 %.not21.us
  br i1 %or.cond.us, label %20, label %8

8:                                                ; preds = %6
  %9 = icmp eq ptr %.026.us, null
  %10 = load ptr, ptr %7, align 8, !tbaa !5
  br i1 %9, label %14, label %11

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %10, i64 192
  %13 = load ptr, ptr %12, align 8
  tail call void %13(ptr noundef nonnull align 8 dereferenceable(77) %7, ptr noundef nonnull %.026.us)
  br label %20

14:                                               ; preds = %8
  %15 = getelementptr inbounds i8, ptr %10, i64 184
  %16 = load ptr, ptr %15, align 8
  tail call void %16(ptr noundef nonnull align 8 dereferenceable(77) %7, i1 noundef zeroext true)
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 208
  %19 = load ptr, ptr %18, align 8
  tail call void %19(ptr noundef nonnull align 8 dereferenceable(77) %7)
  br label %20

20:                                               ; preds = %14, %11, %6
  %.2.ph.us = phi ptr [ %7, %11 ], [ %7, %14 ], [ %.026.us, %6 ]
  %21 = add nuw nsw i32 %.01725.us, 1
  %22 = tail call noundef i32 @_ZNK4juce21ModalComponentManager21getNumModalComponentsEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !8

.lr.ph.split:                                     ; preds = %.lr.ph, %36
  %.026 = phi ptr [ %.2.ph, %36 ], [ null, %.lr.ph ]
  %.01725 = phi i32 [ %37, %36 ], [ 0, %.lr.ph ]
  %24 = tail call noundef ptr @_ZNK4juce21ModalComponentManager17getModalComponentEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %.01725)
  %.not22 = icmp eq ptr %24, null
  br i1 %.not22, label %._crit_edge, label %25

25:                                               ; preds = %.lr.ph.split
  %26 = tail call noundef ptr @_ZNK4juce9Component7getPeerEv(ptr noundef nonnull align 8 dereferenceable(197) %24)
  %.not = icmp eq ptr %26, null
  %.not21 = icmp eq ptr %26, %.026
  %or.cond = select i1 %.not, i1 true, i1 %.not21
  br i1 %or.cond, label %36, label %27

27:                                               ; preds = %25
  %28 = icmp eq ptr %.026, null
  %29 = load ptr, ptr %26, align 8, !tbaa !5
  br i1 %28, label %30, label %33

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %29, i64 184
  %32 = load ptr, ptr %31, align 8
  tail call void %32(ptr noundef nonnull align 8 dereferenceable(77) %26, i1 noundef zeroext false)
  br label %36

33:                                               ; preds = %27
  %34 = getelementptr inbounds i8, ptr %29, i64 192
  %35 = load ptr, ptr %34, align 8
  tail call void %35(ptr noundef nonnull align 8 dereferenceable(77) %26, ptr noundef nonnull %.026)
  br label %36

36:                                               ; preds = %30, %25, %33
  %.2.ph = phi ptr [ %26, %33 ], [ %26, %30 ], [ %.026, %25 ]
  %37 = add nuw nsw i32 %.01725, 1
  %38 = tail call noundef i32 @_ZNK4juce21ModalComponentManager21getNumModalComponentsEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %.lr.ph.split, label %._crit_edge, !llvm.loop !8

._crit_edge:                                      ; preds = %36, %.lr.ph.split, %20, %.lr.ph.split.us, %2
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce21ModalComponentManager21getNumModalComponentsEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

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

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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