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

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

; 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) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isinfd(double noundef) #1

declare void @_ZN4clibpLERNS_4vec2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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

declare { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4clib5cbody12update_forceERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, double noundef %2) #5 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca %"struct.clib::vec2", align 8
  %8 = alloca %"struct.clib::vec2", align 8
  %9 = alloca %"struct.clib::vec2", align 8
  %10 = alloca %"struct.clib::vec2", align 8
  %11 = alloca %"struct.clib::mat22", align 8
  %12 = alloca %"struct.clib::mat22", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store double %2, ptr %6, align 8, !tbaa !9
  %13 = load ptr, ptr %4, align 8
  %14 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 2
  %15 = load double, ptr %14, align 8, !tbaa !11
  %16 = call noundef zeroext i1 @_ZSt5isinfd(double noundef %15)
  br i1 %16, label %17, label %18

17:                                               ; preds = %3
  br label %63

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %20 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 11
  %21 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 3
  %22 = load double, ptr %21, align 8, !tbaa !17
  %23 = call { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16) %20, double noundef %22)
  %24 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 0
  %25 = extractvalue { double, double } %23, 0
  store double %25, ptr %24, align 8
  %26 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 1
  %27 = extractvalue { double, double } %23, 1
  store double %27, ptr %26, align 8
  %28 = call { double, double } @_ZN4clibplERKNS_4vec2ES2_(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %29 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  %30 = extractvalue { double, double } %28, 0
  store double %30, ptr %29, align 8
  %31 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  %32 = extractvalue { double, double } %28, 1
  store double %32, ptr %31, align 8
  %33 = load double, ptr %6, align 8, !tbaa !9
  %34 = call { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16) %8, double noundef %33)
  %35 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 0
  %36 = extractvalue { double, double } %34, 0
  store double %36, ptr %35, align 8
  %37 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 1
  %38 = extractvalue { double, double } %34, 1
  store double %38, ptr %37, align 8
  %39 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 9
  call void @_ZN4clibpLERNS_4vec2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  %40 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 12
  %41 = load double, ptr %40, align 8, !tbaa !18
  %42 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 5
  %43 = load double, ptr %42, align 8, !tbaa !19
  %44 = fmul double %41, %43
  %45 = load double, ptr %6, align 8, !tbaa !9
  %46 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 10
  %47 = load double, ptr %46, align 8, !tbaa !20
  %48 = call double @llvm.fmuladd.f64(double %44, double %45, double %47)
  store double %48, ptr %46, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %49 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 9
  %50 = load double, ptr %6, align 8, !tbaa !9
  %51 = call { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16) %49, double noundef %50)
  %52 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %53 = extractvalue { double, double } %51, 0
  store double %53, ptr %52, align 8
  %54 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %55 = extractvalue { double, double } %51, 1
  store double %55, ptr %54, align 8
  %56 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 7
  call void @_ZN4clibpLERNS_4vec2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 8 dereferenceable(16) %10)
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #6
  %57 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 10
  %58 = load double, ptr %57, align 8, !tbaa !20
  %59 = load double, ptr %6, align 8, !tbaa !9
  %60 = fmul double %58, %59
  call void @_ZN4clib6rotateEd(ptr dead_on_unwind writable sret(%"struct.clib::mat22") align 8 %12, double noundef %60)
  %61 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 8
  call void @_ZN4clibmlERKNS_5mat22ES2_(ptr dead_on_unwind writable sret(%"struct.clib::mat22") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %61)
  %62 = getelementptr inbounds %"class.clib::cbody", ptr %13, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %62, ptr align 8 %11, i64 32, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  br label %63

63:                                               ; preds = %18, %17
  ret void
}

declare { double, double } @_ZN4clibplERKNS_4vec2ES2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

declare void @_ZN4clibmlERKNS_5mat22ES2_(ptr dead_on_unwind writable sret(%"struct.clib::mat22") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2

declare void @_ZN4clib6rotateEd(ptr dead_on_unwind writable sret(%"struct.clib::mat22") align 8, double noundef) #2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"_ZTSN4clib5cbodyE", !13, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !14, i64 48, !14, i64 64, !15, i64 80, !14, i64 112, !10, i64 128, !14, i64 136, !10, i64 152, !10, i64 160}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ZTSN4clib4vec2E", !10, i64 0, !10, i64 8}
!15 = !{!"_ZTSN4clib5mat22E", !16, i64 0}
!16 = !{!"_ZTSSt5arrayIN4clib4vec2ELm2EE", !7, i64 0}
!17 = !{!12, !10, i64 24}
!18 = !{!12, !10, i64 152}
!19 = !{!12, !10, i64 40}
!20 = !{!12, !10, i64 128}
!21 = !{i64 0, i64 32, !22}
!22 = !{!7, !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"

%"struct.clib::vec2" = type { double, double }
%"struct.clib::mat22" = type { %"struct.std::array" }
%"struct.std::array" = type { [2 x %"struct.clib::vec2"] }

; 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) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isinfd(double noundef) local_unnamed_addr #1

declare void @_ZN4clibpLERNS_4vec2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

declare { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4clib5cbody12update_forceERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, double noundef %2) local_unnamed_addr #5 align 2 {
  %4 = alloca %"struct.clib::vec2", align 8
  %5 = alloca %"struct.clib::vec2", align 8
  %6 = alloca %"struct.clib::vec2", align 8
  %7 = alloca %"struct.clib::vec2", align 8
  %8 = alloca %"struct.clib::mat22", align 8
  %9 = alloca %"struct.clib::mat22", align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = tail call noundef zeroext i1 @_ZSt5isinfd(double noundef %11)
  br i1 %12, label %46, label %13

13:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %14 = getelementptr inbounds i8, ptr %0, i64 136
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = load double, ptr %15, align 8, !tbaa !14
  %17 = tail call { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16) %14, double noundef %16)
  %18 = extractvalue { double, double } %17, 0
  store double %18, ptr %6, align 8
  %19 = getelementptr inbounds i8, ptr %6, i64 8
  %20 = extractvalue { double, double } %17, 1
  store double %20, ptr %19, align 8
  %21 = call { double, double } @_ZN4clibplERKNS_4vec2ES2_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %22 = extractvalue { double, double } %21, 0
  store double %22, ptr %5, align 8
  %23 = getelementptr inbounds i8, ptr %5, i64 8
  %24 = extractvalue { double, double } %21, 1
  store double %24, ptr %23, align 8
  %25 = call { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16) %5, double noundef %2)
  %26 = extractvalue { double, double } %25, 0
  store double %26, ptr %4, align 8
  %27 = getelementptr inbounds i8, ptr %4, i64 8
  %28 = extractvalue { double, double } %25, 1
  store double %28, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr %0, i64 112
  call void @_ZN4clibpLERNS_4vec2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  %30 = getelementptr inbounds i8, ptr %0, i64 152
  %31 = load double, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  %33 = load double, ptr %32, align 8, !tbaa !16
  %34 = fmul double %31, %33
  %35 = getelementptr inbounds i8, ptr %0, i64 128
  %36 = load double, ptr %35, align 8, !tbaa !17
  %37 = call double @llvm.fmuladd.f64(double %34, double %2, double %36)
  store double %37, ptr %35, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %38 = call { double, double } @_ZN4clibmlERKNS_4vec2Ed(ptr noundef nonnull align 8 dereferenceable(16) %29, double noundef %2)
  %39 = extractvalue { double, double } %38, 0
  store double %39, ptr %7, align 8
  %40 = getelementptr inbounds i8, ptr %7, i64 8
  %41 = extractvalue { double, double } %38, 1
  store double %41, ptr %40, align 8
  %42 = getelementptr inbounds i8, ptr %0, i64 64
  call void @_ZN4clibpLERNS_4vec2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  %43 = load double, ptr %35, align 8, !tbaa !17
  %44 = fmul double %43, %2
  call void @_ZN4clib6rotateEd(ptr dead_on_unwind nonnull writable sret(%"struct.clib::mat22") align 8 %9, double noundef %44)
  %45 = getelementptr inbounds i8, ptr %0, i64 80
  call void @_ZN4clibmlERKNS_5mat22ES2_(ptr dead_on_unwind nonnull writable sret(%"struct.clib::mat22") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %45)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %45, ptr noundef nonnull align 8 dereferenceable(32) %8, i64 32, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  br label %46

46:                                               ; preds = %3, %13
  ret void
}

declare { double, double } @_ZN4clibplERKNS_4vec2ES2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

declare void @_ZN4clibmlERKNS_5mat22ES2_(ptr dead_on_unwind writable sret(%"struct.clib::mat22") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

declare void @_ZN4clib6rotateEd(ptr dead_on_unwind writable sret(%"struct.clib::mat22") align 8, double noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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, !10, i64 16}
!6 = !{!"_ZTSN4clib5cbodyE", !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !11, i64 64, !12, i64 80, !11, i64 112, !10, i64 128, !11, i64 136, !10, i64 152, !10, i64 160}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTSN4clib4vec2E", !10, i64 0, !10, i64 8}
!12 = !{!"_ZTSN4clib5mat22E", !13, i64 0}
!13 = !{!"_ZTSSt5arrayIN4clib4vec2ELm2EE", !8, i64 0}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 152}
!16 = !{!6, !10, i64 40}
!17 = !{!6, !10, i64 128}
!18 = !{i64 0, i64 32, !19}
!19 = !{!8, !8, i64 0}


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