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

%"class.juce::RectangleList" = type { %"class.juce::Array.49" }
%"class.juce::Array.49" = type { %"class.juce::ArrayAllocationBase.50", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.50" = type <{ %"class.juce::HeapBlock.51", i32, [4 x i8] }>
%"class.juce::HeapBlock.51" = type { ptr }
%"class.juce::Desktop::Displays" = type { %"class.juce::Array.54" }
%"class.juce::Array.54" = type { %"class.juce::ArrayAllocationBase.55", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.55" = type <{ %"class.juce::HeapBlock.56", i32, [4 x i8] }>
%"class.juce::HeapBlock.56" = type { ptr }
%"struct.juce::Desktop::Displays::Display" = type <{ %"class.juce::Rectangle", %"class.juce::Rectangle", double, double, i8, [7 x i8] }>
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }
%"class.juce::Point" = type { i32, i32 }

declare i32 @__gxx_personality_v0(...)

; 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 nonnull align 8 dereferenceable(49) ptr @_ZNK4juce5ArrayINS_7Desktop8Displays7DisplayENS_20DummyCriticalSectionELi0EE12getReferenceEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce7Desktop8Displays16getRectangleListEb(ptr dead_on_unwind noalias writable sret(%"class.juce::RectangleList") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i1 noundef zeroext %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i1, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = zext i1 %2 to i8
  store i8 %12, ptr %6, align 1, !tbaa !9
  %13 = load ptr, ptr %5, align 8
  br label %14

14:                                               ; preds = %3
  br label %15

15:                                               ; preds = %14
  store i1 false, ptr %7, align 1
  call void @_ZN4juce13RectangleListIiEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %16

16:                                               ; preds = %37, %15
  %17 = load i32, ptr %8, align 4, !tbaa !11
  %18 = getelementptr inbounds %"class.juce::Desktop::Displays", ptr %13, i32 0, i32 0
  %19 = call noundef i32 @_ZNK4juce5ArrayINS_7Desktop8Displays7DisplayENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %18) #4
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %44

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %23 = getelementptr inbounds %"class.juce::Desktop::Displays", ptr %13, i32 0, i32 0
  %24 = load i32, ptr %8, align 4, !tbaa !11
  %25 = call noundef nonnull align 8 dereferenceable(49) ptr @_ZNK4juce5ArrayINS_7Desktop8Displays7DisplayENS_20DummyCriticalSectionELi0EE12getReferenceEi(ptr noundef nonnull align 8 dereferenceable(20) %23, i32 noundef %24) #4
  store ptr %25, ptr %9, align 8, !tbaa !5
  %26 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %27 = trunc i8 %26 to i1
  br i1 %27, label %28, label %31

28:                                               ; preds = %22
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.juce::Desktop::Displays::Display", ptr %29, i32 0, i32 0
  br label %34

31:                                               ; preds = %22
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.juce::Desktop::Displays::Display", ptr %32, i32 0, i32 1
  br label %34

34:                                               ; preds = %31, %28
  %35 = phi ptr [ %30, %28 ], [ %33, %31 ]
  invoke void @_ZN4juce13RectangleListIiE17addWithoutMergingERKNS_9RectangleIiEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(16) %35)
          to label %36 unwind label %40

36:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %8, align 4, !tbaa !11
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %8, align 4, !tbaa !11
  br label %16, !llvm.loop !15

40:                                               ; preds = %34
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %10, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @_ZN4juce13RectangleListIiED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %48

44:                                               ; preds = %21
  store i1 true, ptr %7, align 1
  %45 = load i1, ptr %7, align 1
  br i1 %45, label %47, label %46

46:                                               ; preds = %44
  call void @_ZN4juce13RectangleListIiED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %47

47:                                               ; preds = %46, %44
  ret void

48:                                               ; preds = %40
  %49 = load ptr, ptr %10, align 8
  %50 = load i32, ptr %11, align 4
  %51 = insertvalue { ptr, i32 } poison, ptr %49, 0
  %52 = insertvalue { ptr, i32 } %51, i32 %50, 1
  resume { ptr, i32 } %52
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce13RectangleListIiE17addWithoutMergingERKNS_9RectangleIiEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce13RectangleListIiED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #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 = { 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 #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, !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 = distinct !{!15, !16}
!16 = !{!"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"

%"class.juce::RectangleList" = type { %"class.juce::Array.49" }
%"class.juce::Array.49" = type { %"class.juce::ArrayAllocationBase.50", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.50" = type <{ %"class.juce::HeapBlock.51", i32, [4 x i8] }>
%"class.juce::HeapBlock.51" = type { ptr }

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce7Desktop8Displays16getRectangleListEb(ptr dead_on_unwind noalias nonnull writable sret(%"class.juce::RectangleList") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i1 noundef zeroext %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4juce13RectangleListIiEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %4 = tail call noundef i32 @_ZNK4juce5ArrayINS_7Desktop8Displays7DisplayENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %1) #3
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %.idx = select i1 %2, i64 0, i64 16
  br label %6

6:                                                ; preds = %.lr.ph, %9
  %.09 = phi i32 [ 0, %.lr.ph ], [ %10, %9 ]
  %7 = tail call noundef nonnull align 8 dereferenceable(49) ptr @_ZNK4juce5ArrayINS_7Desktop8Displays7DisplayENS_20DummyCriticalSectionELi0EE12getReferenceEi(ptr noundef nonnull align 8 dereferenceable(20) %1, i32 noundef %.09) #3
  %8 = getelementptr inbounds i8, ptr %7, i64 %.idx
  invoke void @_ZN4juce13RectangleListIiE17addWithoutMergingERKNS_9RectangleIiEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(16) %8)
          to label %9 unwind label %13

9:                                                ; preds = %6
  %10 = add nuw nsw i32 %.09, 1
  %11 = tail call noundef i32 @_ZNK4juce5ArrayINS_7Desktop8Displays7DisplayENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %1) #3
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %6, label %._crit_edge, !llvm.loop !5

13:                                               ; preds = %6
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4juce13RectangleListIiED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  resume { ptr, i32 } %14

._crit_edge:                                      ; preds = %9, %3
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce13RectangleListIiE17addWithoutMergingERKNS_9RectangleIiEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce13RectangleListIiED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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