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

; 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::Point" = type { i32, i32 }
%"class.juce::PopupMenu::Options" = type { %"class.juce::Rectangle", ptr, ptr, i32, i32, i32, i32 }
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiEC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiED2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiE11setPositionENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce9PopupMenu7OptionsC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.juce::Point", align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  %7 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 0
  call void @_ZN4juce9RectangleIiEC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %7) #3
  %8 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 1
  store ptr null, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 2
  store ptr null, ptr %9, align 8, !tbaa !14
  %10 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 3
  store i32 0, ptr %10, align 8, !tbaa !15
  %11 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 4
  store i32 0, ptr %11, align 4, !tbaa !16
  %12 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 5
  store i32 0, ptr %12, align 8, !tbaa !17
  %13 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 6
  store i32 0, ptr %13, align 4, !tbaa !18
  %14 = getelementptr inbounds %"class.juce::PopupMenu::Options", ptr %6, i32 0, i32 0
  invoke void @_ZN4juce7Desktop16getMousePositionEv(ptr dead_on_unwind writable sret(%"class.juce::Point") align 4 %3)
          to label %15 unwind label %16

15:                                               ; preds = %1
  call void @_ZN4juce9RectangleIiE11setPositionENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16) %14, ptr noundef %3) #3
  ret void

16:                                               ; preds = %1
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %4, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %5, align 4
  call void @_ZN4juce9RectangleIiED2Ev(ptr noundef nonnull align 4 dereferenceable(16) %7) #3
  br label %20

20:                                               ; preds = %16
  %21 = load ptr, ptr %4, align 8
  %22 = load i32, ptr %5, align 4
  %23 = insertvalue { ptr, i32 } poison, ptr %21, 0
  %24 = insertvalue { ptr, i32 } %23, i32 %22, 1
  resume { ptr, i32 } %24
}

attributes #0 = { 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 = { 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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"_ZTSN4juce9PopupMenu7OptionsE", !11, i64 0, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44}
!11 = !{!"_ZTSN4juce9RectangleIiEE", !12, i64 0, !13, i64 8, !13, i64 12}
!12 = !{!"_ZTSN4juce5PointIiEE", !13, i64 0, !13, i64 4}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !13, i64 32}
!16 = !{!10, !13, i64 36}
!17 = !{!10, !13, i64 40}
!18 = !{!10, !13, i64 44}


; 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::Point" = type { i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiEC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiED2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiE11setPositionENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce9PopupMenu7OptionsC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.juce::Point", align 4
  tail call void @_ZN4juce9RectangleIiEC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %0) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %3, i8 0, i64 32, i1 false)
  invoke void @_ZN4juce7Desktop16getMousePositionEv(ptr dead_on_unwind nonnull writable sret(%"class.juce::Point") align 4 %2)
          to label %4 unwind label %5

4:                                                ; preds = %1
  call void @_ZN4juce9RectangleIiE11setPositionENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull %2) #4
  ret void

5:                                                ; preds = %1
  %6 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce9RectangleIiED2Ev(ptr noundef nonnull align 4 dereferenceable(16) %0) #4
  resume { ptr, i32 } %6
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { 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 = { 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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass