; 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::PopupMenu" = type { %"class.juce::OwnedArray.239", %"class.juce::WeakReference.37" }
%"class.juce::OwnedArray.239" = type { %"class.juce::ArrayAllocationBase.240", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.240" = type <{ %"class.juce::HeapBlock.241", i32, [4 x i8] }>
%"class.juce::HeapBlock.241" = type { ptr }
%"class.juce::WeakReference.37" = type { %"class.juce::ReferenceCountedObjectPtr.38" }
%"class.juce::ReferenceCountedObjectPtr.38" = type { ptr }
%"class.juce::PopupMenu::Options" = type { %"class.juce::Rectangle", ptr, ptr, i32, i32, i32, i32 }
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }
%"class.juce::Point" = type { i32, i32 }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce9RectangleIiE7isEmptyEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZNK4juce9PopupMenu12createWindowERKNS0_7OptionsEPPNS_25ApplicationCommandManagerE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef %2) #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.juce::ModifierKeys", align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i1, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8
  %13 = getelementptr inbounds %"class.juce::PopupMenu", ptr %12, i32 0, i32 0
  %14 = call noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %13) #6
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %33

16:                                               ; preds = %3
  %17 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 424) #7
  store i1 true, ptr %11, align 1
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %19, i32 0, i32 0
  %21 = call noundef zeroext i1 @_ZNK4juce9RectangleIiE7isEmptyEv(ptr noundef nonnull align 4 dereferenceable(16) %20) #6
  %22 = xor i1 %21, true
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @_ZN4juce12ModifierKeys19getCurrentModifiersEv(ptr dead_on_unwind writable sret(%"class.juce::ModifierKeys") align 4 %8) #6
  %23 = call noundef zeroext i1 @_ZNK4juce12ModifierKeys20isAnyMouseButtonDownEv(ptr noundef nonnull align 4 dereferenceable(4) %8) #6
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZN4juce9PopupMenu13HelperClasses10MenuWindowC2ERKS0_PS2_RKNS0_7OptionsEbbPPNS_25ApplicationCommandManagerE(ptr noundef nonnull align 8 dereferenceable(424) %17, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef null, ptr noundef nonnull align 8 dereferenceable(48) %18, i1 noundef zeroext %22, i1 noundef zeroext %23, ptr noundef %24)
          to label %25 unwind label %26

25:                                               ; preds = %16
  store i1 false, ptr %11, align 1
  store ptr %17, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %34

26:                                               ; preds = %16
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %9, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %30 = load i1, ptr %11, align 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  call void @_ZdlPvm(ptr noundef %17, i64 noundef 424) #8
  br label %32

32:                                               ; preds = %31, %26
  br label %36

33:                                               ; preds = %3
  store ptr null, ptr %4, align 8
  br label %34

34:                                               ; preds = %33, %25
  %35 = load ptr, ptr %4, align 8
  ret ptr %35

36:                                               ; preds = %32
  %37 = load ptr, ptr %9, align 8
  %38 = load i32, ptr %10, align 4
  %39 = insertvalue { ptr, i32 } poison, ptr %37, 0
  %40 = insertvalue { ptr, i32 } %39, i32 %38, 1
  resume { ptr, i32 } %40
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce9PopupMenu13HelperClasses10MenuWindowC2ERKS0_PS2_RKNS0_7OptionsEbbPPNS_25ApplicationCommandManagerE(ptr noundef nonnull align 8 dereferenceable(424), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(48), i1 noundef zeroext, i1 noundef zeroext, ptr noundef) unnamed_addr #5 align 2

attributes #0 = { nobuiltin 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 = { nobuiltin allocsize(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 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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"}


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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce9RectangleIiE7isEmptyEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZNK4juce9PopupMenu12createWindowERKNS0_7OptionsEPPNS_25ApplicationCommandManagerE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef %2) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.juce::ModifierKeys", align 4
  %5 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_9PopupMenu4ItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %0) #6
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %7, label %15

7:                                                ; preds = %3
  %8 = tail call noalias noundef nonnull dereferenceable(424) ptr @_Znwm(i64 noundef 424) #7
  %9 = tail call noundef zeroext i1 @_ZNK4juce9RectangleIiE7isEmptyEv(ptr noundef nonnull align 4 dereferenceable(16) %1) #6
  %10 = xor i1 %9, true
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @_ZN4juce12ModifierKeys19getCurrentModifiersEv(ptr dead_on_unwind nonnull writable sret(%"class.juce::ModifierKeys") align 4 %4) #6
  %11 = call noundef zeroext i1 @_ZNK4juce12ModifierKeys20isAnyMouseButtonDownEv(ptr noundef nonnull align 4 dereferenceable(4) %4) #6
  invoke void @_ZN4juce9PopupMenu13HelperClasses10MenuWindowC2ERKS0_PS2_RKNS0_7OptionsEbbPPNS_25ApplicationCommandManagerE(ptr noundef nonnull align 8 dereferenceable(424) %8, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef null, ptr noundef nonnull align 8 dereferenceable(48) %1, i1 noundef zeroext %10, i1 noundef zeroext %11, ptr noundef %2)
          to label %12 unwind label %13

12:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %15

13:                                               ; preds = %7
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 424) #8
  resume { ptr, i32 } %14

15:                                               ; preds = %3, %12
  %.0 = phi ptr [ %8, %12 ], [ null, %3 ]
  ret ptr %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce9PopupMenu13HelperClasses10MenuWindowC2ERKS0_PS2_RKNS0_7OptionsEbbPPNS_25ApplicationCommandManagerE(ptr noundef nonnull align 8 dereferenceable(424), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(48), i1 noundef zeroext, i1 noundef zeroext, ptr noundef) unnamed_addr #5 align 2

attributes #0 = { nobuiltin 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 = { nobuiltin allocsize(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 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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)"}


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