; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/juce_gui_basics.ll (ZNK4juce9Component17isMouseButtonDownEv)

; 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::MouseInputSource" = type { ptr }

; 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: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(360) ptr @_ZN4juce7Desktop11getInstanceEv() #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(20) ptr @_ZNK4juce7Desktop15getMouseSourcesEv(ptr noundef nonnull align 8 dereferenceable(360)) #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4juce9Component17isMouseButtonDownEv(ptr noundef nonnull align 8 dereferenceable(197) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %9 = call noundef nonnull align 8 dereferenceable(360) ptr @_ZN4juce7Desktop11getInstanceEv()
  %10 = call noundef nonnull align 8 dereferenceable(20) ptr @_ZNK4juce7Desktop15getMouseSourcesEv(ptr noundef nonnull align 8 dereferenceable(360) %9) #4
  store ptr %10, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = call noundef ptr @_ZNK4juce5ArrayINS_16MouseInputSourceENS_20DummyCriticalSectionELi0EE5beginEv(ptr noundef nonnull align 8 dereferenceable(20) %11) #4
  store ptr %12, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noundef ptr @_ZNK4juce5ArrayINS_16MouseInputSourceENS_20DummyCriticalSectionELi0EE3endEv(ptr noundef nonnull align 8 dereferenceable(20) %13) #4
  store ptr %14, ptr %6, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %29, %1
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  store i32 2, ptr %7, align 4
  br label %32

20:                                               ; preds = %15
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call noundef zeroext i1 @_ZNK4juce16MouseInputSource10isDraggingEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #4
  br i1 %22, label %23, label %28

23:                                               ; preds = %20
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call noundef ptr @_ZNK4juce16MouseInputSource22getComponentUnderMouseEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = icmp eq ptr %25, %8
  br i1 %26, label %27, label %28

27:                                               ; preds = %23
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %32

28:                                               ; preds = %23, %20
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.juce::MouseInputSource", ptr %30, i32 1
  store ptr %31, ptr %5, align 8, !tbaa !5
  br label %15, !llvm.loop !9

32:                                               ; preds = %27, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %33 = load i32, ptr %7, align 4
  switch i32 %33, label %35 [
    i32 2, label %34
  ]

34:                                               ; preds = %32
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %35

35:                                               ; preds = %34, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %36 = load i1, ptr %2, align 1
  ret i1 %36
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"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: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(360) ptr @_ZN4juce7Desktop11getInstanceEv() local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(20) ptr @_ZNK4juce7Desktop15getMouseSourcesEv(ptr noundef nonnull align 8 dereferenceable(360)) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4juce9Component17isMouseButtonDownEv(ptr noundef nonnull readnone align 8 dereferenceable(197) %0) local_unnamed_addr #0 align 2 {
  %2 = tail call noundef nonnull align 8 dereferenceable(360) ptr @_ZN4juce7Desktop11getInstanceEv()
  %3 = tail call noundef nonnull align 8 dereferenceable(20) ptr @_ZNK4juce7Desktop15getMouseSourcesEv(ptr noundef nonnull align 8 dereferenceable(360) %2) #3
  %4 = tail call noundef ptr @_ZNK4juce5ArrayINS_16MouseInputSourceENS_20DummyCriticalSectionELi0EE5beginEv(ptr noundef nonnull align 8 dereferenceable(20) %3) #3
  %5 = tail call noundef ptr @_ZNK4juce5ArrayINS_16MouseInputSourceENS_20DummyCriticalSectionELi0EE3endEv(ptr noundef nonnull align 8 dereferenceable(20) %3) #3
  %.not11.not = icmp eq ptr %4, %5
  br i1 %.not11.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %10
  %.01012 = phi ptr [ %11, %10 ], [ %4, %1 ]
  %6 = tail call noundef zeroext i1 @_ZNK4juce16MouseInputSource10isDraggingEv(ptr noundef nonnull align 8 dereferenceable(8) %.01012) #3
  br i1 %6, label %7, label %10

7:                                                ; preds = %.lr.ph
  %8 = tail call noundef ptr @_ZNK4juce16MouseInputSource22getComponentUnderMouseEv(ptr noundef nonnull align 8 dereferenceable(8) %.01012)
  %9 = icmp eq ptr %8, %0
  br i1 %9, label %.critedge, label %10

10:                                               ; preds = %.lr.ph, %7
  %11 = getelementptr inbounds i8, ptr %.01012, i64 8
  %.not.not = icmp eq ptr %11, %5
  br i1 %.not.not, label %.critedge, label %.lr.ph, !llvm.loop !5

.critedge:                                        ; preds = %7, %10, %1
  %.not.lcssa = phi i1 [ false, %1 ], [ false, %10 ], [ true, %7 ]
  ret i1 %.not.lcssa
}

attributes #0 = { 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 #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 = { 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 #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: GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass