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

; 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::CodeDocument::Position" = type <{ ptr, i32, i32, i32, i8, [3 x i8] }>
%"class.juce::CodeDocument" = type { %"class.juce::OwnedArray", %"class.juce::Array.8", %"class.juce::UndoManager", i32, i32, i32, [4 x i8], %"class.juce::ListenerList.18", %"class.juce::String" }
%"class.juce::OwnedArray" = type { %"class.juce::ArrayAllocationBase.5", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.5" = type <{ %"class.juce::HeapBlock.6", i32, [4 x i8] }>
%"class.juce::HeapBlock.6" = type { ptr }
%"class.juce::Array.8" = type { %"class.juce::ArrayAllocationBase.9", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.9" = type <{ %"class.juce::HeapBlock.10", i32, [4 x i8] }>
%"class.juce::HeapBlock.10" = type { ptr }
%"class.juce::UndoManager" = type <{ %"class.juce::ChangeBroadcaster", %"class.juce::OwnedArray.13", %"class.juce::OwnedArray.13", %"class.juce::String", i32, i32, i32, i32, i8, i8, [6 x i8] }>
%"class.juce::ChangeBroadcaster" = type { ptr, %"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback", %"class.juce::ListenerList" }
%"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback" = type { %"class.juce::AsyncUpdater", ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }
%"class.juce::ListenerList" = type { %"class.juce::Array" }
%"class.juce::Array" = type { %"class.juce::ArrayAllocationBase", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase" = type <{ %"class.juce::HeapBlock", i32, [4 x i8] }>
%"class.juce::HeapBlock" = type { ptr }
%"class.juce::OwnedArray.13" = type { %"class.juce::ArrayAllocationBase.14", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.14" = type <{ %"class.juce::HeapBlock.15", i32, [4 x i8] }>
%"class.juce::HeapBlock.15" = type { ptr }
%"class.juce::ListenerList.18" = type { %"class.juce::Array.19" }
%"class.juce::Array.19" = type { %"class.juce::ArrayAllocationBase.20", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.20" = type <{ %"class.juce::HeapBlock.21", i32, [4 x i8] }>
%"class.juce::HeapBlock.21" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::CodeDocumentLine" = type <{ %"class.juce::String", i32, i32, i32, [4 x i8] }>

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

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

10:                                               ; preds = %3
  br label %11

11:                                               ; preds = %10
  %12 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = getelementptr inbounds %"class.juce::CodeDocument", ptr %13, i32 0, i32 0
  %15 = call noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %14) #4
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %21

17:                                               ; preds = %11
  %18 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 2
  store i32 0, ptr %18, align 4, !tbaa !14
  %19 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 3
  store i32 0, ptr %19, align 8, !tbaa !15
  %20 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 1
  store i32 0, ptr %20, align 8, !tbaa !16
  br label %84

21:                                               ; preds = %11
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = getelementptr inbounds %"class.juce::CodeDocument", ptr %24, i32 0, i32 0
  %26 = call noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %25) #4
  %27 = icmp sge i32 %22, %26
  br i1 %27, label %28, label %52

28:                                               ; preds = %21
  %29 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %"class.juce::CodeDocument", ptr %30, i32 0, i32 0
  %32 = call noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %31) #4
  %33 = sub nsw i32 %32, 1
  %34 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 2
  store i32 %33, ptr %34, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %35 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds %"class.juce::CodeDocument", ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 2
  %39 = load i32, ptr %38, align 4, !tbaa !14
  %40 = call noundef ptr @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %37, i32 noundef %39) #4
  store ptr %40, ptr %7, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.juce::CodeDocumentLine", ptr %41, i32 0, i32 3
  %43 = load i32, ptr %42, align 8, !tbaa !17
  %44 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 3
  store i32 %43, ptr %44, align 8, !tbaa !15
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.juce::CodeDocumentLine", ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 8, !tbaa !21
  %48 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 3
  %49 = load i32, ptr %48, align 8, !tbaa !15
  %50 = add nsw i32 %47, %49
  %51 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 1
  store i32 %50, ptr %51, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %83

52:                                               ; preds = %21
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = call noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef 0, i32 noundef %53)
  %55 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 2
  store i32 %54, ptr %55, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %56 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !11
  %58 = getelementptr inbounds %"class.juce::CodeDocument", ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 2
  %60 = load i32, ptr %59, align 4, !tbaa !14
  %61 = call noundef ptr @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %58, i32 noundef %60) #4
  store ptr %61, ptr %8, align 8, !tbaa !5
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.juce::CodeDocumentLine", ptr %62, i32 0, i32 3
  %64 = load i32, ptr %63, align 8, !tbaa !17
  %65 = icmp sgt i32 %64, 0
  br i1 %65, label %66, label %73

66:                                               ; preds = %52
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.juce::CodeDocumentLine", ptr %67, i32 0, i32 3
  %69 = load i32, ptr %68, align 8, !tbaa !17
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = call noundef i32 @_ZN4juce6jlimitIiEET_S1_S1_S1_(i32 noundef 0, i32 noundef %69, i32 noundef %70) #4
  %72 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 3
  store i32 %71, ptr %72, align 8, !tbaa !15
  br label %75

73:                                               ; preds = %52
  %74 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 3
  store i32 0, ptr %74, align 8, !tbaa !15
  br label %75

75:                                               ; preds = %73, %66
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %"class.juce::CodeDocumentLine", ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 8, !tbaa !21
  %79 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 3
  %80 = load i32, ptr %79, align 8, !tbaa !15
  %81 = add nsw i32 %78, %80
  %82 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %9, i32 0, i32 1
  store i32 %81, ptr %82, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %83

83:                                               ; preds = %75, %28
  br label %84

84:                                               ; preds = %83, %17
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce6jlimitIiEET_S1_S1_S1_(i32 noundef, i32 noundef, i32 noundef) #3

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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN4juce12CodeDocument8PositionE", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 20}
!13 = !{!"bool", !7, i64 0}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 8}
!17 = !{!18, !10, i64 16}
!18 = !{!"_ZTSN4juce16CodeDocumentLineE", !19, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!19 = !{!"_ZTSN4juce6StringE", !20, i64 0}
!20 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!21 = !{!18, !10, i64 8}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce12CodeDocument8Position15setLineAndIndexEii(ptr nocapture noundef nonnull align 8 dereferenceable(21) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 {
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #2
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %10

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 0, ptr %8, align 4, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 0, ptr %9, align 8, !tbaa !13
  br label %41

10:                                               ; preds = %3
  %11 = load ptr, ptr %0, align 8, !tbaa !5
  %12 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %11) #2
  %.not = icmp sgt i32 %12, %1
  br i1 %.not, label %26, label %13

13:                                               ; preds = %10
  %14 = load ptr, ptr %0, align 8, !tbaa !5
  %15 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %14) #2
  %16 = add nsw i32 %15, -1
  %17 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %16, ptr %17, align 4, !tbaa !12
  %18 = load ptr, ptr %0, align 8, !tbaa !5
  %19 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %18, i32 noundef %16) #2
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %21, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %19, i64 8
  %24 = load i32, ptr %23, align 8, !tbaa !18
  %25 = add nsw i32 %24, %21
  br label %41

26:                                               ; preds = %10
  %27 = tail call noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef 0, i32 noundef %1)
  %28 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %27, ptr %28, align 4, !tbaa !12
  %29 = load ptr, ptr %0, align 8, !tbaa !5
  %30 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_16CodeDocumentLineENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %29, i32 noundef %27) #2
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  %32 = load i32, ptr %31, align 8, !tbaa !14
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %34, label %36

34:                                               ; preds = %26
  %35 = tail call noundef i32 @_ZN4juce6jlimitIiEET_S1_S1_S1_(i32 noundef 0, i32 noundef %32, i32 noundef %2) #2
  br label %36

36:                                               ; preds = %26, %34
  %.sink = phi i32 [ %35, %34 ], [ 0, %26 ]
  %37 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %.sink, ptr %37, align 8
  %38 = getelementptr inbounds i8, ptr %30, i64 8
  %39 = load i32, ptr %38, align 8, !tbaa !18
  %40 = add nsw i32 %.sink, %39
  br label %41

41:                                               ; preds = %13, %36, %7
  %.sink9 = phi i32 [ %25, %13 ], [ %40, %36 ], [ 0, %7 ]
  %42 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %.sink9, ptr %42, align 8, !tbaa !19
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce6jlimitIiEET_S1_S1_S1_(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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 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 = { 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 = !{!"_ZTSN4juce12CodeDocument8PositionE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!6, !10, i64 12}
!13 = !{!6, !10, i64 16}
!14 = !{!15, !10, i64 16}
!15 = !{!"_ZTSN4juce16CodeDocumentLineE", !16, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!16 = !{!"_ZTSN4juce6StringE", !17, i64 0}
!17 = !{!"_ZTSN4juce16CharPointer_UTF8E", !7, i64 0}
!18 = !{!15, !10, i64 8}
!19 = !{!6, !10, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass