; LLVM IR from cieslarmichal/rpg :: src/Menu.ll (ZN4MenuD2Ev)

; 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.Menu = type { ptr, %"class.sf::Event", %"class.sf::Font", [3 x %"class.sf::Text"], i32, i32 }
%"class.sf::Event" = type { i32, %union.anon }
%union.anon = type { %"struct.sf::Event::MouseWheelScrollEvent" }
%"struct.sf::Event::MouseWheelScrollEvent" = type { i32, float, i32, i32 }
%"class.sf::Font" = type { ptr, ptr, ptr, ptr, ptr, %"struct.sf::Font::Info", %"class.std::map", %"class.std::vector" }
%"struct.sf::Font::Info" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned int, std::pair<const unsigned int, sf::Font::Page>, std::_Select1st<std::pair<const unsigned int, sf::Font::Page>>, std::less<unsigned int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned int, std::pair<const unsigned int, sf::Font::Page>, std::_Select1st<std::pair<const unsigned int, sf::Font::Page>>, std::less<unsigned int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.sf::Text" = type { %"class.sf::Drawable", %"class.sf::Transformable.base", %"class.sf::String", ptr, i32, float, float, i32, %"class.sf::Color", %"class.sf::Color", float, [4 x i8], %"class.sf::VertexArray", %"class.sf::VertexArray", %"class.sf::Rect", i8, i64 }
%"class.sf::Drawable" = type { ptr }
%"class.sf::Transformable.base" = type <{ ptr, %"class.sf::Vector2", %"class.sf::Vector2", float, %"class.sf::Vector2", %"class.sf::Transform", i8, [3 x i8], %"class.sf::Transform", i8 }>
%"class.sf::Vector2" = type { float, float }
%"class.sf::Transform" = type { [16 x float] }
%"class.sf::String" = type { %"class.std::__cxx11::basic_string.7" }
%"class.std::__cxx11::basic_string.7" = type { %"struct.std::__cxx11::basic_string<unsigned int>::_Alloc_hider", i64, %union.anon.11 }
%"struct.std::__cxx11::basic_string<unsigned int>::_Alloc_hider" = type { ptr }
%union.anon.11 = type { i64, [8 x i8] }
%"class.sf::Color" = type { i8, i8, i8, i8 }
%"class.sf::VertexArray" = type <{ %"class.sf::Drawable", %"class.std::vector.12", i32, [4 x i8] }>
%"class.std::vector.12" = type { %"struct.std::_Vector_base.13" }
%"struct.std::_Vector_base.13" = type { %"struct.std::_Vector_base<sf::Vertex, std::allocator<sf::Vertex>>::_Vector_impl" }
%"struct.std::_Vector_base<sf::Vertex, std::allocator<sf::Vertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<sf::Vertex, std::allocator<sf::Vertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sf::Vertex, std::allocator<sf::Vertex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.sf::Rect" = type { float, float, float, float }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN2sf4TextD2Ev(ptr noundef nonnull align 8 dereferenceable(368)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZN2sf4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4MenuD2Ev(ptr noundef nonnull align 8 dereferenceable(1288) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.Menu, ptr %3, i32 0, i32 0
  store ptr null, ptr %4, align 8, !tbaa !9
  %5 = getelementptr inbounds %class.Menu, ptr %3, i32 0, i32 3
  %6 = getelementptr inbounds [3 x %"class.sf::Text"], ptr %5, i32 0, i32 0
  %7 = getelementptr inbounds %"class.sf::Text", ptr %6, i64 3
  br label %8

8:                                                ; preds = %8, %1
  %9 = phi ptr [ %7, %1 ], [ %10, %8 ]
  %10 = getelementptr inbounds %"class.sf::Text", ptr %9, i64 -1
  call void @_ZN2sf4TextD2Ev(ptr noundef nonnull align 8 dereferenceable(368) %10) #3
  %11 = icmp eq ptr %10, %6
  br i1 %11, label %12, label %8

12:                                               ; preds = %8
  %13 = getelementptr inbounds %class.Menu, ptr %3, i32 0, i32 2
  call void @_ZN2sf4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(144) %13) #3
  ret void
}

attributes #0 = { 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 #1 = { 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 #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 = { 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 0}
!10 = !{!"_ZTS4Menu", !6, i64 0, !11, i64 8, !13, i64 32, !7, i64 176, !30, i64 1280, !30, i64 1284}
!11 = !{!"_ZTSN2sf5EventE", !12, i64 0, !7, i64 4}
!12 = !{!"_ZTSN2sf5Event9EventTypeE", !7, i64 0}
!13 = !{!"_ZTSN2sf4FontE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !18, i64 72, !26, i64 120}
!14 = !{!"_ZTSN2sf4Font4InfoE", !15, i64 0}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSSt3mapIjN2sf4Font4PageESt4lessIjESaISt4pairIKjS2_EEE", !19, i64 0}
!19 = !{!"_ZTSSt8_Rb_treeIjSt4pairIKjN2sf4Font4PageEESt10_Select1stIS5_ESt4lessIjESaIS5_EE", !20, i64 0}
!20 = !{!"_ZTSNSt8_Rb_treeIjSt4pairIKjN2sf4Font4PageEESt10_Select1stIS5_ESt4lessIjESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !21, i64 0, !23, i64 8}
!21 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIjEE", !22, i64 0}
!22 = !{!"_ZTSSt4lessIjE"}
!23 = !{!"_ZTSSt15_Rb_tree_header", !24, i64 0, !17, i64 32}
!24 = !{!"_ZTSSt18_Rb_tree_node_base", !25, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!25 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!26 = !{!"_ZTSSt6vectorIhSaIhEE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!"int", !7, 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"

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN2sf4TextD2Ev(ptr noundef nonnull align 8 dereferenceable(368)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZN2sf4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4MenuD2Ev(ptr noundef nonnull align 8 dereferenceable(1288) %0) unnamed_addr #2 align 2 {
  store ptr null, ptr %0, align 8, !tbaa !5
  %.ptr1 = getelementptr inbounds i8, ptr %0, i64 912
  tail call void @_ZN2sf4TextD2Ev(ptr noundef nonnull align 8 dereferenceable(368) %.ptr1) #3
  %.ptr1.1 = getelementptr inbounds i8, ptr %0, i64 544
  tail call void @_ZN2sf4TextD2Ev(ptr noundef nonnull align 8 dereferenceable(368) %.ptr1.1) #3
  %.ptr1.2 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @_ZN2sf4TextD2Ev(ptr noundef nonnull align 8 dereferenceable(368) %.ptr1.2) #3
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN2sf4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(144) %2) #3
  ret void
}

attributes #0 = { 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 #1 = { 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 #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 = { 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, !7, i64 0}
!6 = !{!"_ZTS4Menu", !7, i64 0, !10, i64 8, !12, i64 32, !8, i64 176, !29, i64 1280, !29, i64 1284}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN2sf5EventE", !11, i64 0, !8, i64 4}
!11 = !{!"_ZTSN2sf5Event9EventTypeE", !8, i64 0}
!12 = !{!"_ZTSN2sf4FontE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !13, i64 40, !17, i64 72, !25, i64 120}
!13 = !{!"_ZTSN2sf4Font4InfoE", !14, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!"_ZTSSt3mapIjN2sf4Font4PageESt4lessIjESaISt4pairIKjS2_EEE", !18, i64 0}
!18 = !{!"_ZTSSt8_Rb_treeIjSt4pairIKjN2sf4Font4PageEESt10_Select1stIS5_ESt4lessIjESaIS5_EE", !19, i64 0}
!19 = !{!"_ZTSNSt8_Rb_treeIjSt4pairIKjN2sf4Font4PageEESt10_Select1stIS5_ESt4lessIjESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !20, i64 0, !22, i64 8}
!20 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIjEE", !21, i64 0}
!21 = !{!"_ZTSSt4lessIjE"}
!22 = !{!"_ZTSSt15_Rb_tree_header", !23, i64 0, !16, i64 32}
!23 = !{!"_ZTSSt18_Rb_tree_node_base", !24, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!24 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!25 = !{!"_ZTSSt6vectorIhSaIhEE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!29 = !{!"int", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,InstCombinePass,SROAPass,TailCallElimPass