; 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::ModifierKeys" = type { i32 }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

@_ZTIN4juce9ComponentE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN4juce13TooltipClientE = external dso_local constant { ptr, ptr }, align 8

; Function Attrs: nounwind
declare void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce12ModifierKeys19getCurrentModifiersEv(ptr dead_on_unwind noalias writable sret(%"class.juce::ModifierKeys") align 4) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce12ModifierKeys20isAnyMouseButtonDownEv(ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

; Function Attrs: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce7Process19isForegroundProcessEv() #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce13TooltipWindow9getTipForEPNS_9ComponentE(ptr dead_on_unwind noalias writable sret(%"class.juce::String") align 8 %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.juce::ModifierKeys", align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  br i1 %9, label %10, label %15

10:                                               ; preds = %2
  %11 = call noundef zeroext i1 @_ZN4juce7Process19isForegroundProcessEv()
  br i1 %11, label %12, label %15

12:                                               ; preds = %10
  call void @_ZN4juce12ModifierKeys19getCurrentModifiersEv(ptr dead_on_unwind writable sret(%"class.juce::ModifierKeys") align 4 %5) #6
  %13 = call noundef zeroext i1 @_ZNK4juce12ModifierKeys20isAnyMouseButtonDownEv(ptr noundef nonnull align 4 dereferenceable(4) %5) #6
  %14 = xor i1 %13, true
  br label %15

15:                                               ; preds = %12, %10, %2
  %16 = phi i1 [ false, %10 ], [ false, %2 ], [ %14, %12 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br i1 %16, label %17, label %40

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %22, label %20

20:                                               ; preds = %17
  %21 = call ptr @__dynamic_cast(ptr %18, ptr @_ZTIN4juce9ComponentE, ptr @_ZTIN4juce13TooltipClientE, i64 -2) #6
  br label %23

22:                                               ; preds = %17
  br label %23

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

27:                                               ; preds = %23
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = call noundef zeroext i1 @_ZNK4juce9Component41isCurrentlyBlockedByAnotherModalComponentEv(ptr noundef nonnull align 8 dereferenceable(197) %28)
  br i1 %29, label %35, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 2
  %34 = load ptr, ptr %33, align 8
  call void %34(ptr dead_on_unwind writable sret(%"class.juce::String") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %31)
  store i32 1, ptr %7, align 4
  br label %37

35:                                               ; preds = %27
  br label %36

36:                                               ; preds = %35, %23
  store i32 0, ptr %7, align 4
  br label %37

37:                                               ; preds = %36, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %38 = load i32, ptr %7, align 4
  switch i32 %38, label %42 [
    i32 0, label %39
    i32 1, label %41
  ]

39:                                               ; preds = %37
  br label %40

40:                                               ; preds = %39, %15
  call void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  br label %41

41:                                               ; preds = %40, %37
  ret void

42:                                               ; preds = %37
  unreachable
}

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


; 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::ModifierKeys" = type { i32 }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

@_ZTIN4juce9ComponentE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN4juce13TooltipClientE = external dso_local constant { ptr, ptr }, align 8

; Function Attrs: nounwind
declare void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce9Component41isCurrentlyBlockedByAnotherModalComponentEv(ptr noundef nonnull align 8 dereferenceable(197)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce12ModifierKeys19getCurrentModifiersEv(ptr dead_on_unwind noalias writable sret(%"class.juce::ModifierKeys") align 4) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce12ModifierKeys20isAnyMouseButtonDownEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce7Process19isForegroundProcessEv() local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce13TooltipWindow9getTipForEPNS_9ComponentE(ptr dead_on_unwind noalias writable sret(%"class.juce::String") align 8 %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"class.juce::ModifierKeys", align 4
  %.not = icmp eq ptr %1, null
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  br i1 %.not, label %.critedge, label %4

4:                                                ; preds = %2
  %5 = tail call noundef zeroext i1 @_ZN4juce7Process19isForegroundProcessEv()
  br i1 %5, label %6, label %.critedge

6:                                                ; preds = %4
  call void @_ZN4juce12ModifierKeys19getCurrentModifiersEv(ptr dead_on_unwind nonnull writable sret(%"class.juce::ModifierKeys") align 4 %3) #6
  %7 = call noundef zeroext i1 @_ZNK4juce12ModifierKeys20isAnyMouseButtonDownEv(ptr noundef nonnull align 4 dereferenceable(4) %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br i1 %7, label %.thread, label %8

8:                                                ; preds = %6
  %9 = call ptr @__dynamic_cast(ptr nonnull %1, ptr nonnull @_ZTIN4juce9ComponentE, ptr nonnull @_ZTIN4juce13TooltipClientE, i64 -2) #6
  %.not7 = icmp eq ptr %9, null
  br i1 %.not7, label %.thread, label %10

10:                                               ; preds = %8
  %11 = call noundef zeroext i1 @_ZNK4juce9Component41isCurrentlyBlockedByAnotherModalComponentEv(ptr noundef nonnull align 8 dereferenceable(197) %1)
  br i1 %11, label %.thread, label %12

12:                                               ; preds = %10
  %13 = load ptr, ptr %9, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  %15 = load ptr, ptr %14, align 8
  call void %15(ptr dead_on_unwind writable sret(%"class.juce::String") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %9)
  br label %16

.critedge:                                        ; preds = %2, %4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %.thread

.thread:                                          ; preds = %8, %10, %.critedge, %6
  call void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  br label %16

16:                                               ; preds = %12, %.thread
  ret void
}

attributes #0 = { nounwind "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(read) }
attributes #6 = { 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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass