; LLVM IR from Whittler23/A-star-algorithm-SFML :: src/Gui/button.ll (ZN6Button15getTextPositionEv)

; 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.sf::Vector2" = type { float, float }
%"class.sf::Rect.0" = type { float, float, float, float }
%class.Button = type { %"class.sf::Drawable", i32, %"class.sf::RectangleShape", %"class.sf::Text", %"class.sf::Font", %"class.sf::Vector2" }
%"class.sf::Drawable" = type { ptr }
%"class.sf::RectangleShape" = type { %"class.sf::Shape", %"class.sf::Vector2" }
%"class.sf::Shape" = type { %"class.sf::Drawable", %"class.sf::Transformable.base", ptr, %"class.sf::Rect", %"class.sf::Color", %"class.sf::Color", float, [4 x i8], %"class.sf::VertexArray", %"class.sf::VertexArray", %"class.sf::Rect.0", %"class.sf::Rect.0" }
%"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::Transform" = type { [16 x float] }
%"class.sf::Rect" = type { i32, i32, i32, i32 }
%"class.sf::Color" = type { i8, i8, i8, i8 }
%"class.sf::VertexArray" = type <{ %"class.sf::Drawable", %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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::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.0", i8, i64 }
%"class.sf::String" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<unsigned int>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<unsigned int>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.sf::Font" = type { ptr, ptr, ptr, ptr, ptr, %"struct.sf::Font::Info", %"class.std::map", %"class.std::vector.12" }
%"struct.sf::Font::Info" = type { %"class.std::__cxx11::basic_string.4" }
%"class.std::__cxx11::basic_string.4" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.8 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.8 = 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.12" = type { %"struct.std::_Vector_base.13" }
%"struct.std::_Vector_base.13" = 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 }

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf14RectangleShape7getSizeEv(ptr noundef nonnull align 8 dereferenceable(344)) #3

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN6Button15getTextPositionEv(ptr noundef nonnull align 8 dereferenceable(880) %0) #4 align 2 {
  %2 = alloca %"class.sf::Vector2", align 4
  %3 = alloca ptr, align 8
  %4 = alloca %"class.sf::Rect.0", align 4
  %5 = alloca %"class.sf::Vector2", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  %7 = getelementptr inbounds %class.Button, ptr %6, i32 0, i32 3
  %8 = call { <2 x float>, <2 x float> } @_ZNK2sf4Text15getGlobalBoundsEv(ptr noundef nonnull align 8 dereferenceable(368) %7)
  %9 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 0
  %10 = extractvalue { <2 x float>, <2 x float> } %8, 0
  store <2 x float> %10, ptr %9, align 4
  %11 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 1
  %12 = extractvalue { <2 x float>, <2 x float> } %8, 1
  store <2 x float> %12, ptr %11, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %13 = getelementptr inbounds %class.Button, ptr %6, i32 0, i32 2
  %14 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf14RectangleShape7getSizeEv(ptr noundef nonnull align 8 dereferenceable(344) %13)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %14, i64 8, i1 false), !tbaa.struct !9
  %15 = getelementptr inbounds %class.Button, ptr %6, i32 0, i32 3
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = getelementptr inbounds %"class.sf::Rect.0", ptr %4, i32 0, i32 2
  %18 = load float, ptr %17, align 4, !tbaa !12
  %19 = getelementptr inbounds %"class.sf::Vector2", ptr %5, i32 0, i32 0
  %20 = load float, ptr %19, align 4, !tbaa !14
  %21 = fsub float %18, %20
  %22 = fdiv float %21, 2.000000e+00
  %23 = getelementptr inbounds %"class.sf::Rect.0", ptr %4, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !16
  %25 = fadd float %22, %24
  %26 = getelementptr inbounds %"class.sf::Rect.0", ptr %4, i32 0, i32 3
  %27 = load float, ptr %26, align 4, !tbaa !17
  %28 = getelementptr inbounds %"class.sf::Vector2", ptr %5, i32 0, i32 1
  %29 = load float, ptr %28, align 4, !tbaa !18
  %30 = fsub float %27, %29
  %31 = fdiv float %30, 2.000000e+00
  %32 = getelementptr inbounds %"class.sf::Rect.0", ptr %4, i32 0, i32 1
  %33 = load float, ptr %32, align 4, !tbaa !19
  %34 = fadd float %31, %33
  call void @_ZN2sf13Transformable9setOriginEff(ptr noundef nonnull align 8 dereferenceable(169) %16, float noundef %25, float noundef %34)
  %35 = getelementptr inbounds %class.Button, ptr %6, i32 0, i32 2
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  %37 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf13Transformable11getPositionEv(ptr noundef nonnull align 8 dereferenceable(169) %36)
  %38 = getelementptr inbounds %"class.sf::Vector2", ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 4, !tbaa !14
  %40 = getelementptr inbounds %class.Button, ptr %6, i32 0, i32 2
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf13Transformable11getPositionEv(ptr noundef nonnull align 8 dereferenceable(169) %41)
  %43 = getelementptr inbounds %"class.sf::Vector2", ptr %42, i32 0, i32 1
  %44 = load float, ptr %43, align 4, !tbaa !18
  call void @_ZN2sf7Vector2IfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef %39, float noundef %44)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  %45 = load <2 x float>, ptr %2, align 4
  ret <2 x float> %45
}

declare { <2 x float>, <2 x float> } @_ZNK2sf4Text15getGlobalBoundsEv(ptr noundef nonnull align 8 dereferenceable(368)) #3

declare void @_ZN2sf13Transformable9setOriginEff(ptr noundef nonnull align 8 dereferenceable(169), float noundef, float noundef) #3

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf13Transformable11getPositionEv(ptr noundef nonnull align 8 dereferenceable(169)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 }

!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 = !{i64 0, i64 4, !10, i64 4, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"_ZTSN2sf4RectIfEE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!14 = !{!15, !11, i64 0}
!15 = !{!"_ZTSN2sf7Vector2IfEE", !11, i64 0, !11, i64 4}
!16 = !{!13, !11, i64 0}
!17 = !{!13, !11, i64 12}
!18 = !{!15, !11, i64 4}
!19 = !{!13, !11, i64 4}


; 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.sf::Vector2" = type { float, float }

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

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf14RectangleShape7getSizeEv(ptr noundef nonnull align 8 dereferenceable(344)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN6Button15getTextPositionEv(ptr noundef nonnull align 8 dereferenceable(880) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %"class.sf::Vector2", align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 360
  %4 = tail call { <2 x float>, <2 x float> } @_ZNK2sf4Text15getGlobalBoundsEv(ptr noundef nonnull align 8 dereferenceable(368) %3)
  %5 = extractvalue { <2 x float>, <2 x float> } %4, 0
  %6 = extractvalue { <2 x float>, <2 x float> } %4, 1
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf14RectangleShape7getSizeEv(ptr noundef nonnull align 8 dereferenceable(344) %7)
  %.sroa.0.0.copyload = load float, ptr %8, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 4
  %.sroa.4.0.copyload = load float, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 368
  %.sroa.5.8.vec.extract = extractelement <2 x float> %6, i64 0
  %10 = fsub float %.sroa.5.8.vec.extract, %.sroa.0.0.copyload
  %11 = fmul float %10, 5.000000e-01
  %.sroa.01.0.vec.extract = extractelement <2 x float> %5, i64 0
  %12 = fadd float %.sroa.01.0.vec.extract, %11
  %.sroa.5.12.vec.extract = extractelement <2 x float> %6, i64 1
  %13 = fsub float %.sroa.5.12.vec.extract, %.sroa.4.0.copyload
  %14 = fmul float %13, 5.000000e-01
  %.sroa.01.4.vec.extract = extractelement <2 x float> %5, i64 1
  %15 = fadd float %.sroa.01.4.vec.extract, %14
  tail call void @_ZN2sf13Transformable9setOriginEff(ptr noundef nonnull align 8 dereferenceable(169) %9, float noundef %12, float noundef %15)
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf13Transformable11getPositionEv(ptr noundef nonnull align 8 dereferenceable(169) %16)
  %18 = load float, ptr %17, align 4, !tbaa !9
  %19 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf13Transformable11getPositionEv(ptr noundef nonnull align 8 dereferenceable(169) %16)
  %20 = getelementptr inbounds i8, ptr %19, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !11
  call void @_ZN2sf7Vector2IfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef %18, float noundef %21)
  %22 = load <2 x float>, ptr %2, align 8
  ret <2 x float> %22
}

declare { <2 x float>, <2 x float> } @_ZNK2sf4Text15getGlobalBoundsEv(ptr noundef nonnull align 8 dereferenceable(368)) local_unnamed_addr #1

declare void @_ZN2sf13Transformable9setOriginEff(ptr noundef nonnull align 8 dereferenceable(169), float noundef, float noundef) local_unnamed_addr #1

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZNK2sf13Transformable11getPositionEv(ptr noundef nonnull align 8 dereferenceable(169)) local_unnamed_addr #1

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 = { "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"="64" "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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSN2sf7Vector2IfEE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,TailCallElimPass