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

@_ZTIN4juce9ComponentE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN4juce12TableListBox7RowCompE = external dso_local constant { ptr, ptr, i32, i32, ptr, i64, ptr, i64 }, align 8

; 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: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce12TableListBox22updateColumnComponentsEv(ptr noundef nonnull align 8 dereferenceable(333) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %7 = call noundef i32 @_ZNK4juce7ListBox24getRowContainingPositionEii(ptr noundef nonnull align 8 dereferenceable(296) %6, i32 noundef 0, i32 noundef 0) #4
  store i32 %7, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %8 = load i32, ptr %3, align 4, !tbaa !9
  %9 = call noundef i32 @_ZNK4juce7ListBox18getNumRowsOnScreenEv(ptr noundef nonnull align 8 dereferenceable(296) %6) #4
  %10 = add nsw i32 %8, %9
  %11 = add nsw i32 %10, 2
  store i32 %11, ptr %4, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %34, %1
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %4, align 4, !tbaa !9
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = icmp sge i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %35

18:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = call noundef ptr @_ZNK4juce7ListBox24getComponentForRowNumberEi(ptr noundef nonnull align 8 dereferenceable(296) %6, i32 noundef %19) #4
  %21 = icmp eq ptr %20, null
  br i1 %21, label %24, label %22

22:                                               ; preds = %18
  %23 = call ptr @__dynamic_cast(ptr %20, ptr @_ZTIN4juce9ComponentE, ptr @_ZTIN4juce12TableListBox7RowCompE, i64 0) #4
  br label %25

24:                                               ; preds = %18
  br label %25

25:                                               ; preds = %24, %22
  %26 = phi ptr [ %23, %22 ], [ null, %24 ]
  store ptr %26, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %34

29:                                               ; preds = %25
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds ptr, ptr %31, i64 34
  %33 = load ptr, ptr %32, align 8
  call void %33(ptr noundef nonnull align 8 dereferenceable(247) %30)
  br label %34

34:                                               ; preds = %29, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %12, !llvm.loop !13

35:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(read) }
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 = !{!"vtable pointer", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@_ZTIN4juce9ComponentE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN4juce12TableListBox7RowCompE = external dso_local constant { ptr, ptr, i32, i32, ptr, i64, ptr, i64 }, align 8

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce12TableListBox22updateColumnComponentsEv(ptr noundef nonnull align 8 dereferenceable(333) %0) local_unnamed_addr #2 align 2 {
  %2 = tail call noundef i32 @_ZNK4juce7ListBox24getRowContainingPositionEii(ptr noundef nonnull align 8 dereferenceable(296) %0, i32 noundef 0, i32 noundef 0) #3
  %3 = tail call noundef i32 @_ZNK4juce7ListBox18getNumRowsOnScreenEv(ptr noundef nonnull align 8 dereferenceable(296) %0) #3
  %4 = add i32 %2, 2
  %5 = add i32 %4, %3
  %.not.not10 = icmp sgt i32 %5, %2
  br i1 %.not.not10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.thread, %1
  ret void

.lr.ph:                                           ; preds = %1, %.thread
  %.in = phi i32 [ %6, %.thread ], [ %5, %1 ]
  %6 = add nsw i32 %.in, -1
  %7 = tail call noundef ptr @_ZNK4juce7ListBox24getComponentForRowNumberEi(ptr noundef nonnull align 8 dereferenceable(296) %0, i32 noundef %6) #3
  %8 = icmp eq ptr %7, null
  br i1 %8, label %.thread, label %9

9:                                                ; preds = %.lr.ph
  %10 = tail call ptr @__dynamic_cast(ptr nonnull %7, ptr nonnull @_ZTIN4juce9ComponentE, ptr nonnull @_ZTIN4juce12TableListBox7RowCompE, i64 0) #3
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %.thread, label %11

11:                                               ; preds = %9
  %12 = load ptr, ptr %10, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 272
  %14 = load ptr, ptr %13, align 8
  tail call void %14(ptr noundef nonnull align 8 dereferenceable(247) %10)
  br label %.thread

.thread:                                          ; preds = %.lr.ph, %11, %9
  %.not.not = icmp sgt i32 %6, %2
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !8
}

attributes #0 = { mustprogress nofree nounwind willreturn memory(read) }
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, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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