; LLVM IR from Simple-XX/SimplePhysicsEngine :: test/system_test/demo_old/RigidBodySimulation/cbody.ll (ZN4clib5cbodyC2Etd)

; 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.clib::mat22" = type { %"struct.std::array" }
%"struct.std::array" = type { [2 x %"struct.clib::vec2"] }
%"struct.clib::vec2" = type { double, double }
%"class.clib::cbody" = type { ptr, i16, double, double, double, double, %"struct.clib::vec2", %"struct.clib::vec2", %"struct.clib::mat22", %"struct.clib::vec2", double, %"struct.clib::vec2", double, double }

@_ZTVN4clib5cbodyE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8
@_ZN4clib5mat221IE = external global %"struct.clib::mat22", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4clib5cbodyC2Etd(ptr noundef nonnull align 8 dereferenceable(168) %0, i16 noundef zeroext %1, double noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i16, align 2
  %6 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i16 %1, ptr %5, align 2, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !11
  %7 = load ptr, ptr %4, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN4clib5cbodyE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !13
  %8 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 1
  %9 = load i16, ptr %5, align 2, !tbaa !9
  store i16 %9, ptr %8, align 8, !tbaa !15
  %10 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 6
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %11 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 7
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %12 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 @_ZN4clib5mat221IE, i64 32, i1 false), !tbaa.struct !20
  %13 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 9
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %13)
  %14 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 10
  store double 0.000000e+00, ptr %14, align 8, !tbaa !22
  %15 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 11
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %15)
  %16 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 12
  store double 0.000000e+00, ptr %16, align 8, !tbaa !23
  %17 = getelementptr inbounds %"class.clib::cbody", ptr %7, i32 0, i32 13
  store double 1.000000e+00, ptr %17, align 8, !tbaa !24
  %18 = load double, ptr %6, align 8, !tbaa !11
  call void @_ZN4clib5cbody8set_massEd(ptr noundef nonnull align 8 dereferenceable(168) %7, double noundef %18)
  ret void
}

declare void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4clib5cbody8set_massEd(ptr noundef nonnull align 8 dereferenceable(168), double noundef) #3 align 2

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

!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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{!16, !10, i64 8}
!16 = !{!"_ZTSN4clib5cbodyE", !10, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !17, i64 48, !17, i64 64, !18, i64 80, !17, i64 112, !12, i64 128, !17, i64 136, !12, i64 152, !12, i64 160}
!17 = !{!"_ZTSN4clib4vec2E", !12, i64 0, !12, i64 8}
!18 = !{!"_ZTSN4clib5mat22E", !19, i64 0}
!19 = !{!"_ZTSSt5arrayIN4clib4vec2ELm2EE", !7, i64 0}
!20 = !{i64 0, i64 32, !21}
!21 = !{!7, !7, i64 0}
!22 = !{!16, !12, i64 128}
!23 = !{!16, !12, i64 152}
!24 = !{!16, !12, i64 160}


; 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.clib::mat22" = type { %"struct.std::array" }
%"struct.std::array" = type { [2 x %"struct.clib::vec2"] }
%"struct.clib::vec2" = type { double, double }

@_ZTVN4clib5cbodyE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8
@_ZN4clib5mat221IE = external local_unnamed_addr global %"struct.clib::mat22", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4clib5cbodyC2Etd(ptr noundef nonnull align 8 dereferenceable(168) %0, i16 noundef zeroext %1, double noundef %2) unnamed_addr #0 align 2 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN4clib5cbodyE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store i16 %1, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) @_ZN4clib5mat221IE, i64 32, i1 false), !tbaa.struct !16
  %8 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 128
  store double 0.000000e+00, ptr %9, align 8, !tbaa !18
  %10 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 152
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %11, align 8, !tbaa !19
  tail call void @_ZN4clib5cbody8set_massEd(ptr noundef nonnull align 8 dereferenceable(168) %0, double noundef %2)
  ret void
}

declare void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; Function Attrs: mustprogress 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4clib5cbody8set_massEd(ptr noundef nonnull align 8 dereferenceable(168), double noundef) local_unnamed_addr #3 align 2

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN4clib5cbodyE", !10, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !13, i64 48, !13, i64 64, !14, i64 80, !13, i64 112, !12, i64 128, !13, i64 136, !12, i64 152, !12, i64 160}
!10 = !{!"short", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"double", !11, i64 0}
!13 = !{!"_ZTSN4clib4vec2E", !12, i64 0, !12, i64 8}
!14 = !{!"_ZTSN4clib5mat22E", !15, i64 0}
!15 = !{!"_ZTSSt5arrayIN4clib4vec2ELm2EE", !11, i64 0}
!16 = !{i64 0, i64 32, !17}
!17 = !{!11, !11, i64 0}
!18 = !{!9, !12, i64 128}
!19 = !{!12, !12, i64 0}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass