; 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::TableHeaderComponent" = type <{ %"class.juce::Component.base", [3 x i8], %"class.juce::AsyncUpdater", %"class.juce::OwnedArray.407", %"class.juce::Array.412", %"class.juce::ScopedPointer.159", i8, i8, i8, i8, i8, [3 x i8], i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.juce::Component.base" = type <{ %"class.juce::MouseListener", %"class.juce::String", %"class.juce::String", ptr, %"class.juce::Rectangle", %"class.juce::ScopedPointer", %"class.juce::ScopedPointer.0", %"class.juce::Array", ptr, %"class.juce::MouseCursor", ptr, %"class.juce::ScopedPointer.1", %"class.juce::ScopedPointer.2", %"class.juce::ScopedPointer.3", %"class.juce::ListenerList", %"class.juce::NamedValueSet", %"class.juce::WeakReference<juce::Component>::Master", %union.anon, i8 }>
%"class.juce::MouseListener" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }
%"class.juce::Point" = type { i32, i32 }
%"class.juce::ScopedPointer" = type { ptr }
%"class.juce::ScopedPointer.0" = type { ptr }
%"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::MouseCursor" = type { ptr }
%"class.juce::ScopedPointer.1" = type { ptr }
%"class.juce::ScopedPointer.2" = type { ptr }
%"class.juce::ScopedPointer.3" = type { ptr }
%"class.juce::ListenerList" = type { %"class.juce::Array.4" }
%"class.juce::Array.4" = 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::NamedValueSet" = type { %"class.juce::Array.9" }
%"class.juce::Array.9" = type { %"class.juce::ArrayAllocationBase.10", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.10" = type <{ %"class.juce::HeapBlock.11", i32, [4 x i8] }>
%"class.juce::HeapBlock.11" = type { ptr }
%"class.juce::WeakReference<juce::Component>::Master" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }
%union.anon = type { i32 }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr.15" }
%"class.juce::ReferenceCountedObjectPtr.15" = type { ptr }
%"class.juce::OwnedArray.407" = type { %"class.juce::ArrayAllocationBase.408", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.408" = type <{ %"class.juce::HeapBlock.409", i32, [4 x i8] }>
%"class.juce::HeapBlock.409" = type { ptr }
%"class.juce::Array.412" = type { %"class.juce::ArrayAllocationBase.413", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.413" = type <{ %"class.juce::HeapBlock.414", i32, [4 x i8] }>
%"class.juce::HeapBlock.414" = type { ptr }
%"class.juce::ScopedPointer.159" = type { ptr }
%"struct.juce::TableHeaderComponent::ColumnInfo" = type { %"class.juce::String", i32, i32, i32, i32, i32, double }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce20TableHeaderComponent15setSortColumnIdEib(ptr noundef nonnull align 8 dereferenceable(308) %0, i32 noundef %1, i1 noundef zeroext %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %9 = zext i1 %2 to i8
  store i8 %9, ptr %6, align 1, !tbaa !11
  %10 = load ptr, ptr %4, align 8
  %11 = call noundef i32 @_ZNK4juce20TableHeaderComponent15getSortColumnIdEv(ptr noundef nonnull align 8 dereferenceable(308) %10)
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = icmp ne i32 %11, %12
  br i1 %13, label %21, label %14

14:                                               ; preds = %3
  %15 = call noundef zeroext i1 @_ZNK4juce20TableHeaderComponent16isSortedForwardsEv(ptr noundef nonnull align 8 dereferenceable(308) %10)
  %16 = zext i1 %15 to i32
  %17 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %18 = trunc i8 %17 to i1
  %19 = zext i1 %18 to i32
  %20 = icmp ne i32 %16, %19
  br i1 %20, label %21, label %51

21:                                               ; preds = %14, %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %22 = getelementptr inbounds %"class.juce::TableHeaderComponent", ptr %10, i32 0, i32 3
  %23 = call noundef i32 @_ZNK4juce10OwnedArrayINS_20TableHeaderComponent10ColumnInfoENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %22) #4
  store i32 %23, ptr %7, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %29, %21
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %7, align 4, !tbaa !9
  %27 = icmp sge i32 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %36

29:                                               ; preds = %24
  %30 = getelementptr inbounds %"class.juce::TableHeaderComponent", ptr %10, i32 0, i32 3
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = call noundef ptr @_ZNK4juce10OwnedArrayINS_20TableHeaderComponent10ColumnInfoENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %30, i32 noundef %31) #4
  %33 = getelementptr inbounds %"struct.juce::TableHeaderComponent::ColumnInfo", ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 4, !tbaa !15
  %35 = and i32 %34, -97
  store i32 %35, ptr %33, align 4, !tbaa !15
  br label %24, !llvm.loop !20

36:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = call noundef ptr @_ZNK4juce20TableHeaderComponent12getInfoForIdEi(ptr noundef nonnull align 8 dereferenceable(308) %10, i32 noundef %37)
  store ptr %38, ptr %8, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %50

41:                                               ; preds = %36
  %42 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %43 = trunc i8 %42 to i1
  %44 = zext i1 %43 to i64
  %45 = select i1 %43, i32 32, i32 64
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.juce::TableHeaderComponent::ColumnInfo", ptr %46, i32 0, i32 2
  %48 = load i32, ptr %47, align 4, !tbaa !15
  %49 = or i32 %48, %45
  store i32 %49, ptr %47, align 4, !tbaa !15
  br label %50

50:                                               ; preds = %41, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @_ZN4juce20TableHeaderComponent11reSortTableEv(ptr noundef nonnull align 8 dereferenceable(308) %10)
  br label %51

51:                                               ; preds = %50, %14
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce20TableHeaderComponent16isSortedForwardsEv(ptr noundef nonnull align 8 dereferenceable(308)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce20TableHeaderComponent11reSortTableEv(ptr noundef nonnull align 8 dereferenceable(308)) #3 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 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 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 12}
!16 = !{!"_ZTSN4juce20TableHeaderComponent10ColumnInfoE", !17, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !19, i64 32}
!17 = !{!"_ZTSN4juce6StringE", !18, i64 0}
!18 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce10OwnedArrayINS_20TableHeaderComponent10ColumnInfoENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce10OwnedArrayINS_20TableHeaderComponent10ColumnInfoENS_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 ptr @_ZNK4juce20TableHeaderComponent12getInfoForIdEi(ptr noundef nonnull align 8 dereferenceable(308), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce20TableHeaderComponent15setSortColumnIdEib(ptr noundef nonnull align 8 dereferenceable(308) %0, i32 noundef %1, i1 noundef zeroext %2) local_unnamed_addr #2 align 2 {
  %4 = tail call noundef i32 @_ZNK4juce20TableHeaderComponent15getSortColumnIdEv(ptr noundef nonnull align 8 dereferenceable(308) %0)
  %.not = icmp eq i32 %4, %1
  br i1 %.not, label %5, label %8

5:                                                ; preds = %3
  %6 = tail call noundef zeroext i1 @_ZNK4juce20TableHeaderComponent16isSortedForwardsEv(ptr noundef nonnull align 8 dereferenceable(308) %0)
  %7 = xor i1 %6, %2
  br i1 %7, label %8, label %25

8:                                                ; preds = %5, %3
  %9 = getelementptr inbounds i8, ptr %0, i64 216
  %10 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_20TableHeaderComponent10ColumnInfoENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %9) #3
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %8
  %12 = tail call noundef ptr @_ZNK4juce20TableHeaderComponent12getInfoForIdEi(ptr noundef nonnull align 8 dereferenceable(308) %0, i32 noundef %1)
  %.not11 = icmp eq ptr %12, null
  br i1 %.not11, label %24, label %19

.lr.ph:                                           ; preds = %8, %.lr.ph
  %.012 = phi i32 [ %13, %.lr.ph ], [ %10, %8 ]
  %13 = add nsw i32 %.012, -1
  %14 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_20TableHeaderComponent10ColumnInfoENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %9, i32 noundef %13) #3
  %15 = getelementptr inbounds i8, ptr %14, i64 12
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = and i32 %16, -97
  store i32 %17, ptr %15, align 4, !tbaa !5
  %18 = icmp ugt i32 %.012, 1
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !14

19:                                               ; preds = %._crit_edge
  %20 = select i1 %2, i32 32, i32 64
  %21 = getelementptr inbounds i8, ptr %12, i64 12
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = or i32 %22, %20
  store i32 %23, ptr %21, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %19, %._crit_edge
  tail call void @_ZN4juce20TableHeaderComponent11reSortTableEv(ptr noundef nonnull align 8 dereferenceable(308) %0)
  br label %25

25:                                               ; preds = %24, %5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce20TableHeaderComponent16isSortedForwardsEv(ptr noundef nonnull align 8 dereferenceable(308)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce20TableHeaderComponent11reSortTableEv(ptr noundef nonnull align 8 dereferenceable(308)) local_unnamed_addr #2 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 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 = { 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, !12, i64 12}
!6 = !{!"_ZTSN4juce20TableHeaderComponent10ColumnInfoE", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !13, i64 32}
!7 = !{!"_ZTSN4juce6StringE", !8, i64 0}
!8 = !{!"_ZTSN4juce16CharPointer_UTF8E", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"double", !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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