; LLVM IR from VTIvanov20/eight-ball-pool :: src/game_scene.ll (ZN9GameScene13GetTableStateEv)

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

%struct.TableState = type { i32, i32, i8, i32, i32 }
%class.GameScene = type { %"class.DrawableManager::Drawable.base", i32, i32, i8, i8, i32, i32, %"class.std::__cxx11::list", ptr, ptr, ptr, %struct.Vector2, %struct.Vector2 }
%"class.DrawableManager::Drawable.base" = type <{ ptr, i32 }>
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<Ball *, std::allocator<Ball *>>::_List_impl" }
%"struct.std::__cxx11::_List_base<Ball *, std::allocator<Ball *>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%struct.Vector2 = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN9GameScene13GetTableStateEv(ptr dead_on_unwind noalias writable sret(%struct.TableState) align 4 %0, ptr noundef nonnull align 8 dereferenceable(96) %1) #0 align 2 {
  %3 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %struct.TableState, ptr %0, i32 0, i32 0
  %6 = getelementptr inbounds %class.GameScene, ptr %4, i32 0, i32 1
  %7 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %7, ptr %5, align 4, !tbaa !23
  %8 = getelementptr inbounds %struct.TableState, ptr %0, i32 0, i32 1
  %9 = getelementptr inbounds %class.GameScene, ptr %4, i32 0, i32 2
  %10 = load i32, ptr %9, align 8, !tbaa !25
  store i32 %10, ptr %8, align 4, !tbaa !26
  %11 = getelementptr inbounds %struct.TableState, ptr %0, i32 0, i32 2
  %12 = getelementptr inbounds %class.GameScene, ptr %4, i32 0, i32 3
  %13 = load i8, ptr %12, align 4, !tbaa !27, !range !28, !noundef !29
  %14 = trunc i8 %13 to i1
  %15 = zext i1 %14 to i8
  store i8 %15, ptr %11, align 4, !tbaa !30
  %16 = getelementptr inbounds %struct.TableState, ptr %0, i32 0, i32 3
  %17 = getelementptr inbounds %class.GameScene, ptr %4, i32 0, i32 6
  %18 = load i32, ptr %17, align 4, !tbaa !31
  store i32 %18, ptr %16, align 4, !tbaa !32
  %19 = getelementptr inbounds %struct.TableState, ptr %0, i32 0, i32 4
  %20 = getelementptr inbounds %class.GameScene, ptr %4, i32 0, i32 5
  %21 = load i32, ptr %20, align 8, !tbaa !33
  store i32 %21, ptr %19, align 4, !tbaa !34
  ret void
}

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

!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, !13, i64 12}
!10 = !{!"_ZTS9GameScene", !11, i64 0, !13, i64 12, !13, i64 16, !14, i64 20, !14, i64 21, !12, i64 24, !12, i64 28, !15, i64 32, !6, i64 56, !6, i64 64, !6, i64 72, !21, i64 80, !21, i64 88}
!11 = !{!"_ZTSN15DrawableManager8DrawableE", !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS4Turn", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSNSt7__cxx114listIP4BallSaIS2_EEE", !16, i64 0}
!16 = !{!"_ZTSNSt7__cxx1110_List_baseIP4BallSaIS2_EEE", !17, i64 0}
!17 = !{!"_ZTSNSt7__cxx1110_List_baseIP4BallSaIS2_EE10_List_implE", !18, i64 0}
!18 = !{!"_ZTSNSt8__detail17_List_node_headerE", !19, i64 0, !20, i64 16}
!19 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTS7Vector2", !22, i64 0, !22, i64 4}
!22 = !{!"float", !7, i64 0}
!23 = !{!24, !13, i64 0}
!24 = !{!"_ZTS10TableState", !13, i64 0, !13, i64 4, !14, i64 8, !12, i64 12, !12, i64 16}
!25 = !{!10, !13, i64 16}
!26 = !{!24, !13, i64 4}
!27 = !{!10, !14, i64 20}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!24, !14, i64 8}
!31 = !{!10, !12, i64 28}
!32 = !{!24, !12, i64 12}
!33 = !{!10, !12, i64 24}
!34 = !{!24, !12, i64 16}


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

%struct.TableState = type { i32, i32, i8, i32, i32 }

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN9GameScene13GetTableStateEv(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.TableState) align 4 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(96) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 12
  %4 = load <2 x i32>, ptr %3, align 4, !tbaa !5
  store <2 x i32> %4, ptr %0, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = getelementptr inbounds i8, ptr %1, i64 20
  %7 = load i8, ptr %6, align 4, !tbaa !9, !range !23, !noundef !24
  store i8 %7, ptr %5, align 4, !tbaa !25
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = load <2 x i32>, ptr %9, align 8, !tbaa !27
  %11 = shufflevector <2 x i32> %10, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i32> %11, ptr %8, align 4, !tbaa !27
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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" }

!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 = !{!"_ZTS4Turn", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 20}
!10 = !{!"_ZTS9GameScene", !11, i64 0, !6, i64 12, !6, i64 16, !13, i64 20, !13, i64 21, !12, i64 24, !12, i64 28, !14, i64 32, !19, i64 56, !19, i64 64, !19, i64 72, !21, i64 80, !21, i64 88}
!11 = !{!"_ZTSN15DrawableManager8DrawableE", !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSNSt7__cxx114listIP4BallSaIS2_EEE", !15, i64 0}
!15 = !{!"_ZTSNSt7__cxx1110_List_baseIP4BallSaIS2_EEE", !16, i64 0}
!16 = !{!"_ZTSNSt7__cxx1110_List_baseIP4BallSaIS2_EE10_List_implE", !17, i64 0}
!17 = !{!"_ZTSNSt8__detail17_List_node_headerE", !18, i64 0, !20, i64 16}
!18 = !{!"_ZTSNSt8__detail15_List_node_baseE", !19, i64 0, !19, i64 8}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTS7Vector2", !22, i64 0, !22, i64 4}
!22 = !{!"float", !7, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!26, !13, i64 8}
!26 = !{!"_ZTS10TableState", !6, i64 0, !6, i64 4, !13, i64 8, !12, i64 12, !12, i64 16}
!27 = !{!12, !12, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass