; LLVM IR from idmillington/cyclone-physics :: src/contacts.ll (ZN7cyclone7Contact19applyVelocityChangeEPNS_7Vector3ES2_)

; 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.cyclone::Vector3" = type { double, double, double, double }
%"class.cyclone::Matrix3" = type { [9 x double] }
%"class.cyclone::Contact" = type { [2 x ptr], double, double, %"class.cyclone::Vector3", %"class.cyclone::Vector3", double, %"class.cyclone::Matrix3", %"class.cyclone::Vector3", double, [2 x %"class.cyclone::Vector3"] }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Vector3rmERKS0_(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; 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 uwtable
define dso_local void @_ZN7cyclone7Contact19applyVelocityChangeEPNS_7Vector3ES2_(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [2 x %"class.cyclone::Matrix3"], align 16
  %8 = alloca %"class.cyclone::Vector3", align 8
  %9 = alloca %"class.cyclone::Vector3", align 8
  %10 = alloca %"class.cyclone::Vector3", align 8
  %11 = alloca %"class.cyclone::Vector3", align 8
  %12 = alloca %"class.cyclone::Vector3", align 8
  %13 = alloca %"class.cyclone::Vector3", align 8
  %14 = alloca %"class.cyclone::Vector3", align 8
  %15 = alloca %"class.cyclone::Vector3", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 144, ptr %7) #6
  %17 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i32 0, i32 0
  %18 = getelementptr inbounds %"class.cyclone::Matrix3", ptr %17, i64 2
  br label %19

19:                                               ; preds = %19, %3
  %20 = phi ptr [ %17, %3 ], [ %21, %19 ]
  call void @_ZN7cyclone7Matrix3C2Ev(ptr noundef nonnull align 8 dereferenceable(72) %20)
  %21 = getelementptr inbounds %"class.cyclone::Matrix3", ptr %20, i64 1
  %22 = icmp eq ptr %21, %18
  br i1 %22, label %23, label %19

23:                                               ; preds = %19
  %24 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %25 = getelementptr inbounds [2 x ptr], ptr %24, i64 0, i64 0
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i64 0, i64 0
  call void @_ZNK7cyclone9RigidBody28getInverseInertiaTensorWorldEPNS_7Matrix3E(ptr noundef nonnull align 8 dereferenceable(536) %26, ptr noundef %27)
  %28 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %29 = getelementptr inbounds [2 x ptr], ptr %28, i64 0, i64 1
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %37

32:                                               ; preds = %23
  %33 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %34 = getelementptr inbounds [2 x ptr], ptr %33, i64 0, i64 1
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i64 0, i64 1
  call void @_ZNK7cyclone9RigidBody28getInverseInertiaTensorWorldEPNS_7Matrix3E(ptr noundef nonnull align 8 dereferenceable(536) %35, ptr noundef %36)
  br label %37

37:                                               ; preds = %32, %23
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  call void @_ZN7cyclone7Vector3C2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %38 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 1
  %39 = load double, ptr %38, align 8, !tbaa !9
  %40 = fcmp oeq double %39, 0.000000e+00
  br i1 %40, label %41, label %43

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  %42 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i64 0, i64 0
  call void @_ZN7cyclone7Contact28calculateFrictionlessImpulseEPNS_7Matrix3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %9, ptr noundef nonnull align 8 dereferenceable(280) %16, ptr noundef %42)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %9, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  br label %45

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #6
  %44 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i64 0, i64 0
  call void @_ZN7cyclone7Contact24calculateFrictionImpulseEPNS_7Matrix3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %10, ptr noundef nonnull align 8 dereferenceable(280) %16, ptr noundef %44)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %10, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  br label %45

45:                                               ; preds = %43, %41
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #6
  %46 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 6
  call void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %11, ptr noundef nonnull align 8 dereferenceable(72) %46, ptr noundef nonnull align 8 dereferenceable(32) %8)
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #6
  %47 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 9
  %48 = getelementptr inbounds [2 x %"class.cyclone::Vector3"], ptr %47, i64 0, i64 0
  call void @_ZNK7cyclone7Vector3rmERKS0_(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %12, ptr noundef nonnull align 8 dereferenceable(32) %48, ptr noundef nonnull align 8 dereferenceable(32) %11)
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #6
  %49 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i64 0, i64 0
  call void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %13, ptr noundef nonnull align 8 dereferenceable(72) %49, ptr noundef nonnull align 8 dereferenceable(32) %12)
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.cyclone::Vector3", ptr %50, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %51, ptr align 8 %13, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.cyclone::Vector3", ptr %52, i64 0
  call void @_ZN7cyclone7Vector35clearEv(ptr noundef nonnull align 8 dereferenceable(32) %53)
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.cyclone::Vector3", ptr %54, i64 0
  %56 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %57 = getelementptr inbounds [2 x ptr], ptr %56, i64 0, i64 0
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = call noundef double @_ZNK7cyclone9RigidBody14getInverseMassEv(ptr noundef nonnull align 8 dereferenceable(536) %58)
  call void @_ZN7cyclone7Vector315addScaledVectorERKS0_d(ptr noundef nonnull align 8 dereferenceable(32) %55, ptr noundef nonnull align 8 dereferenceable(32) %11, double noundef %59)
  %60 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %61 = getelementptr inbounds [2 x ptr], ptr %60, i64 0, i64 0
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %"class.cyclone::Vector3", ptr %63, i64 0
  call void @_ZN7cyclone9RigidBody11addVelocityERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %62, ptr noundef nonnull align 8 dereferenceable(32) %64)
  %65 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %66 = getelementptr inbounds [2 x ptr], ptr %65, i64 0, i64 0
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %"class.cyclone::Vector3", ptr %68, i64 0
  call void @_ZN7cyclone9RigidBody11addRotationERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %67, ptr noundef nonnull align 8 dereferenceable(32) %69)
  %70 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %71 = getelementptr inbounds [2 x ptr], ptr %70, i64 0, i64 1
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %99

74:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #6
  %75 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 9
  %76 = getelementptr inbounds [2 x %"class.cyclone::Vector3"], ptr %75, i64 0, i64 1
  call void @_ZNK7cyclone7Vector3rmERKS0_(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %14, ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %76)
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #6
  %77 = getelementptr inbounds [2 x %"class.cyclone::Matrix3"], ptr %7, i64 0, i64 1
  call void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %15, ptr noundef nonnull align 8 dereferenceable(72) %77, ptr noundef nonnull align 8 dereferenceable(32) %14)
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.cyclone::Vector3", ptr %78, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %79, ptr align 8 %15, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #6
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %"class.cyclone::Vector3", ptr %80, i64 1
  call void @_ZN7cyclone7Vector35clearEv(ptr noundef nonnull align 8 dereferenceable(32) %81)
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.cyclone::Vector3", ptr %82, i64 1
  %84 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %85 = getelementptr inbounds [2 x ptr], ptr %84, i64 0, i64 1
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = call noundef double @_ZNK7cyclone9RigidBody14getInverseMassEv(ptr noundef nonnull align 8 dereferenceable(536) %86)
  %88 = fneg double %87
  call void @_ZN7cyclone7Vector315addScaledVectorERKS0_d(ptr noundef nonnull align 8 dereferenceable(32) %83, ptr noundef nonnull align 8 dereferenceable(32) %11, double noundef %88)
  %89 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %90 = getelementptr inbounds [2 x ptr], ptr %89, i64 0, i64 1
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %"class.cyclone::Vector3", ptr %92, i64 1
  call void @_ZN7cyclone9RigidBody11addVelocityERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %91, ptr noundef nonnull align 8 dereferenceable(32) %93)
  %94 = getelementptr inbounds %"class.cyclone::Contact", ptr %16, i32 0, i32 0
  %95 = getelementptr inbounds [2 x ptr], ptr %94, i64 0, i64 1
  %96 = load ptr, ptr %95, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %"class.cyclone::Vector3", ptr %97, i64 1
  call void @_ZN7cyclone9RigidBody11addRotationERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %96, ptr noundef nonnull align 8 dereferenceable(32) %98)
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #6
  br label %99

99:                                               ; preds = %74, %45
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 144, ptr %7) #6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Matrix3C2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #3 align 2

declare void @_ZNK7cyclone9RigidBody28getInverseInertiaTensorWorldEPNS_7Matrix3E(ptr noundef nonnull align 8 dereferenceable(536), ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3C2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7cyclone7Contact28calculateFrictionlessImpulseEPNS_7Matrix3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(280), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7cyclone7Contact24calculateFrictionImpulseEPNS_7Matrix3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(280), ptr noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector35clearEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

declare noundef double @_ZNK7cyclone9RigidBody14getInverseMassEv(ptr noundef nonnull align 8 dereferenceable(536)) #4

declare void @_ZN7cyclone9RigidBody11addVelocityERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536), ptr noundef nonnull align 8 dereferenceable(32)) #4

declare void @_ZN7cyclone9RigidBody11addRotationERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536), ptr noundef nonnull align 8 dereferenceable(32)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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" }
attributes #4 = { "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 = { inlinehint 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, !11, i64 16}
!10 = !{!"_ZTSN7cyclone7ContactE", !7, i64 0, !11, i64 16, !11, i64 24, !12, i64 32, !12, i64 64, !11, i64 96, !13, i64 104, !12, i64 176, !11, i64 208, !7, i64 216}
!11 = !{!"double", !7, i64 0}
!12 = !{!"_ZTSN7cyclone7Vector3E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!13 = !{!"_ZTSN7cyclone7Matrix3E", !7, i64 0}
!14 = !{i64 0, i64 8, !15, i64 8, i64 8, !15, i64 16, i64 8, !15, i64 24, i64 8, !15}
!15 = !{!11, !11, 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"

%"class.cyclone::Vector3" = type { double, double, double, double }
%"class.cyclone::Matrix3" = type { [9 x double] }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Vector3rmERKS0_(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; 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 uwtable
define dso_local void @_ZN7cyclone7Contact19applyVelocityChangeEPNS_7Vector3ES2_(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca [2 x %"class.cyclone::Matrix3"], align 16
  %5 = alloca %"class.cyclone::Vector3", align 8
  %6 = alloca %"class.cyclone::Vector3", align 8
  %7 = alloca %"class.cyclone::Vector3", align 8
  %8 = alloca %"class.cyclone::Vector3", align 8
  %9 = alloca %"class.cyclone::Vector3", align 8
  %10 = alloca %"class.cyclone::Vector3", align 8
  %11 = alloca %"class.cyclone::Vector3", align 8
  %12 = alloca %"class.cyclone::Vector3", align 8
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %4) #6
  call void @_ZN7cyclone7Matrix3C2Ev(ptr noundef nonnull align 8 dereferenceable(72) %4)
  %.ptr.1 = getelementptr inbounds i8, ptr %4, i64 72
  call void @_ZN7cyclone7Matrix3C2Ev(ptr noundef nonnull align 8 dereferenceable(72) %.ptr.1)
  %13 = load ptr, ptr %0, align 8, !tbaa !5
  call void @_ZNK7cyclone9RigidBody28getInverseInertiaTensorWorldEPNS_7Matrix3E(ptr noundef nonnull align 8 dereferenceable(536) %13, ptr noundef nonnull %4)
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %17, label %16

16:                                               ; preds = %3
  call void @_ZNK7cyclone9RigidBody28getInverseInertiaTensorWorldEPNS_7Matrix3E(ptr noundef nonnull align 8 dereferenceable(536) %15, ptr noundef nonnull %.ptr.1)
  br label %17

17:                                               ; preds = %16, %3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  call void @_ZN7cyclone7Vector3C2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = fcmp oeq double %19, 0.000000e+00
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  call void @_ZN7cyclone7Contact28calculateFrictionlessImpulseEPNS_7Matrix3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %6, ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef nonnull %4)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %6, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  br label %23

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #6
  call void @_ZN7cyclone7Contact24calculateFrictionImpulseEPNS_7Matrix3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %7, ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef nonnull %4)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %7, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  br label %23

23:                                               ; preds = %22, %21
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #6
  %24 = getelementptr inbounds i8, ptr %0, i64 104
  call void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %8, ptr noundef nonnull align 8 dereferenceable(72) %24, ptr noundef nonnull align 8 dereferenceable(32) %5)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  %25 = getelementptr inbounds i8, ptr %0, i64 216
  call void @_ZNK7cyclone7Vector3rmERKS0_(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef nonnull align 8 dereferenceable(32) %8)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #6
  call void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %10, ptr noundef nonnull align 8 dereferenceable(72) %4, ptr noundef nonnull align 8 dereferenceable(32) %9)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %10, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #6
  call void @_ZN7cyclone7Vector35clearEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %26 = load ptr, ptr %0, align 8, !tbaa !5
  %27 = call noundef double @_ZNK7cyclone9RigidBody14getInverseMassEv(ptr noundef nonnull align 8 dereferenceable(536) %26)
  call void @_ZN7cyclone7Vector315addScaledVectorERKS0_d(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %8, double noundef %27)
  %28 = load ptr, ptr %0, align 8, !tbaa !5
  call void @_ZN7cyclone9RigidBody11addVelocityERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %28, ptr noundef nonnull align 8 dereferenceable(32) %1)
  %29 = load ptr, ptr %0, align 8, !tbaa !5
  call void @_ZN7cyclone9RigidBody11addRotationERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %29, ptr noundef nonnull align 8 dereferenceable(32) %2)
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %.not12 = icmp eq ptr %30, null
  br i1 %.not12, label %40, label %31

31:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #6
  %32 = getelementptr inbounds i8, ptr %0, i64 248
  call void @_ZNK7cyclone7Vector3rmERKS0_(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %32)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #6
  call void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %12, ptr noundef nonnull align 8 dereferenceable(72) %.ptr.1, ptr noundef nonnull align 8 dereferenceable(32) %11)
  %33 = getelementptr inbounds i8, ptr %2, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %33, ptr noundef nonnull align 8 dereferenceable(32) %12, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #6
  %34 = getelementptr inbounds i8, ptr %1, i64 32
  call void @_ZN7cyclone7Vector35clearEv(ptr noundef nonnull align 8 dereferenceable(32) %34)
  %35 = load ptr, ptr %14, align 8, !tbaa !5
  %36 = call noundef double @_ZNK7cyclone9RigidBody14getInverseMassEv(ptr noundef nonnull align 8 dereferenceable(536) %35)
  %37 = fneg double %36
  call void @_ZN7cyclone7Vector315addScaledVectorERKS0_d(ptr noundef nonnull align 8 dereferenceable(32) %34, ptr noundef nonnull align 8 dereferenceable(32) %8, double noundef %37)
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7cyclone9RigidBody11addVelocityERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %38, ptr noundef nonnull align 8 dereferenceable(32) %34)
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7cyclone9RigidBody11addRotationERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536) %39, ptr noundef nonnull align 8 dereferenceable(32) %33)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #6
  br label %40

40:                                               ; preds = %31, %23
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %4) #6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Matrix3C2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #3 align 2

declare void @_ZNK7cyclone9RigidBody28getInverseInertiaTensorWorldEPNS_7Matrix3E(ptr noundef nonnull align 8 dereferenceable(536), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3C2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7cyclone7Contact28calculateFrictionlessImpulseEPNS_7Matrix3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(280), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7cyclone7Contact24calculateFrictionImpulseEPNS_7Matrix3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(280), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Matrix39transformERKNS_7Vector3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector35clearEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

declare noundef double @_ZNK7cyclone9RigidBody14getInverseMassEv(ptr noundef nonnull align 8 dereferenceable(536)) local_unnamed_addr #4

declare void @_ZN7cyclone9RigidBody11addVelocityERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

declare void @_ZN7cyclone9RigidBody11addRotationERKNS_7Vector3E(ptr noundef nonnull align 8 dereferenceable(536), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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" }
attributes #4 = { "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 = { inlinehint 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, !11, i64 16}
!10 = !{!"_ZTSN7cyclone7ContactE", !7, i64 0, !11, i64 16, !11, i64 24, !12, i64 32, !12, i64 64, !11, i64 96, !13, i64 104, !12, i64 176, !11, i64 208, !7, i64 216}
!11 = !{!"double", !7, i64 0}
!12 = !{!"_ZTSN7cyclone7Vector3E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!13 = !{!"_ZTSN7cyclone7Matrix3E", !7, i64 0}
!14 = !{i64 0, i64 8, !15, i64 8, i64 8, !15, i64 16, i64 8, !15, i64 24, i64 8, !15}
!15 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass