; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Ragdoll (Ragdoll)

; 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.JPH::AssertLastParam" = type { i8 }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.2 }
%union.anon.2 = type { <4 x float> }
%"class.JPH::Ragdoll" = type { %"class.JPH::RefTarget.76", %"class.JPH::RefConst.77", %"class.JPH::Array.78", %"class.JPH::Array.81", ptr }
%"class.JPH::RefTarget.76" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::RefConst.77" = type { ptr }
%"class.JPH::Array.78" = type { i64, i64, ptr }
%"class.JPH::Array.81" = type { i64, i64, ptr }
%"class.JPH::RagdollSettings" = type { %"class.JPH::RefTarget", %"class.JPH::Ref.13", %"class.JPH::Array", %"class.JPH::Array.14", %"class.JPH::Array.17", %"class.JPH::Array.20" }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"class.JPH::Ref.13" = type { ptr }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::Array.14" = type { i64, i64, ptr }
%"class.JPH::Array.17" = type { i64, i64, ptr }
%"class.JPH::Array.20" = type { i64, i64, ptr }
%"class.JPH::SkeletalAnimation::JointState" = type { %"class.JPH::Quat", %"class.JPH::Vec3" }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [33 x i8], align 1

; 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: 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) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK3JPH12SkeletonPose11GetSkeletonEv(ptr noundef nonnull align 16 dereferenceable(80)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH8RefConstINS_15RagdollSettingsEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH3RefINS_8SkeletonEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH12SkeletonPose16GetJointMatricesEv(ptr noundef nonnull align 16 dereferenceable(80)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH3RefINS_17TwoBodyConstraintEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH7Ragdoll22DriveToPoseUsingMotorsERKNS_12SkeletonPoseE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 16 dereferenceable(80) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.JPH::AssertLastParam", align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca %"class.JPH::Quat", align 16
  %13 = alloca ptr, align 8
  %14 = alloca %"class.JPH::Quat", align 16
  %15 = alloca %"struct.JPH::AssertLastParam", align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8
  br label %17

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call noundef ptr @_ZNK3JPH12SkeletonPose11GetSkeletonEv(ptr noundef nonnull align 16 dereferenceable(80) %18)
  %20 = getelementptr inbounds %"class.JPH::Ragdoll", ptr %16, i32 0, i32 1
  %21 = call noundef ptr @_ZNK3JPH8RefConstINS_15RagdollSettingsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %20)
  %22 = getelementptr inbounds %"class.JPH::RagdollSettings", ptr %21, i32 0, i32 1
  %23 = call noundef ptr @_ZNK3JPH3RefINS_8SkeletonEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %22)
  %24 = icmp eq ptr %19, %23
  br i1 %24, label %28, label %25

25:                                               ; preds = %17
  %26 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.7, ptr noundef @.str.4, i32 noundef 618)
  br i1 %26, label %27, label %28

27:                                               ; preds = %25
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !9
  br label %28

28:                                               ; preds = %27, %25, %17
  br label %29

29:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !10
  br label %30

30:                                               ; preds = %95, %29
  %31 = load i32, ptr %6, align 4, !tbaa !10
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH12SkeletonPose16GetJointMatricesEv(ptr noundef nonnull align 16 dereferenceable(80) %32)
  %34 = call noundef i64 @_ZNK3JPH5ArrayINS_5Mat44ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %33)
  %35 = trunc i64 %34 to i32
  %36 = icmp slt i32 %31, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %98

38:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %39 = getelementptr inbounds %"class.JPH::Ragdoll", ptr %16, i32 0, i32 1
  %40 = call noundef ptr @_ZNK3JPH8RefConstINS_15RagdollSettingsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %39)
  %41 = load i32, ptr %6, align 4, !tbaa !10
  %42 = call noundef i32 @_ZNK3JPH15RagdollSettings30GetConstraintIndexForBodyIndexEi(ptr noundef nonnull align 8 dereferenceable(112) %40, i32 noundef %41)
  store i32 %42, ptr %7, align 4, !tbaa !10
  %43 = load i32, ptr %7, align 4, !tbaa !10
  %44 = icmp sge i32 %43, 0
  br i1 %44, label %45, label %94

45:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i32, ptr %6, align 4, !tbaa !10
  %48 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH12SkeletonPose8GetJointEi(ptr noundef nonnull align 16 dereferenceable(80) %46, i32 noundef %47)
  store ptr %48, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %49 = getelementptr inbounds %"class.JPH::Ragdoll", ptr %16, i32 0, i32 3
  %50 = load i32, ptr %7, align 4, !tbaa !10
  %51 = sext i32 %50 to i64
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_17TwoBodyConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %51)
  %53 = call noundef ptr @_ZNK3JPH3RefINS_17TwoBodyConstraintEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %52)
  store ptr %53, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %54, align 8, !tbaa !12
  %56 = getelementptr inbounds ptr, ptr %55, i64 3
  %57 = load ptr, ptr %56, align 8
  %58 = call noundef i32 %57(ptr noundef nonnull align 8 dereferenceable(32) %54)
  store i32 %58, ptr %10, align 4, !tbaa !14
  %59 = load i32, ptr %10, align 4, !tbaa !14
  %60 = icmp eq i32 %59, 6
  br i1 %60, label %61, label %72

61:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %62, ptr %11, align 8, !tbaa !5
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3JPH20SwingTwistConstraint18SetSwingMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944) %63, i32 noundef 2)
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3JPH20SwingTwistConstraint18SetTwistMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944) %64, i32 noundef 2)
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.JPH::SkeletalAnimation::JointState", ptr %66, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %67, i64 16, i1 false), !tbaa.struct !16
  %68 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
  %69 = load double, ptr %68, align 16
  %70 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
  %71 = load double, ptr %70, align 8
  call void @_ZN3JPH20SwingTwistConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(944) %65, double %69, double %71)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %93

72:                                               ; preds = %45
  %73 = load i32, ptr %10, align 4, !tbaa !14
  %74 = icmp eq i32 %73, 2
  br i1 %74, label %75, label %85

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %76, ptr %13, align 8, !tbaa !5
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN3JPH15HingeConstraint13SetMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(832) %77, i32 noundef 2)
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.JPH::SkeletalAnimation::JointState", ptr %79, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 %80, i64 16, i1 false), !tbaa.struct !16
  %81 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %82 = load double, ptr %81, align 16
  %83 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %84 = load double, ptr %83, align 8
  call void @_ZN3JPH15HingeConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(832) %78, double %82, double %84)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %92

85:                                               ; preds = %72
  br label %86

86:                                               ; preds = %85
  %87 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 646, ptr noundef @.str.9)
  br i1 %87, label %88, label %89

88:                                               ; preds = %86
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !18
  br label %89

89:                                               ; preds = %88, %86
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91, %75
  br label %93

93:                                               ; preds = %92, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %94

94:                                               ; preds = %93, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %6, align 4, !tbaa !10
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %6, align 4, !tbaa !10
  br label %30, !llvm.loop !19

98:                                               ; preds = %37
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayINS_5Mat44ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK3JPH15RagdollSettings30GetConstraintIndexForBodyIndexEi(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH12SkeletonPose8GetJointEi(ptr noundef nonnull align 16 dereferenceable(80), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_17TwoBodyConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

declare void @_ZN3JPH20SwingTwistConstraint18SetSwingMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944), i32 noundef) #6

declare void @_ZN3JPH20SwingTwistConstraint18SetTwistMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944), i32 noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH20SwingTwistConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(944), double, double) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH15HingeConstraint13SetMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(832), i32 noundef) #3 align 2

declare void @_ZN3JPH15HingeConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(832), double, double) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { "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 #7 = { 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 2159896977}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"vtable pointer", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTSN3JPH18EConstraintSubTypeE", !7, i64 0}
!16 = !{i64 0, i64 16, !17}
!17 = !{!7, !7, i64 0}
!18 = !{i64 2159897315}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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

@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK3JPH12SkeletonPose11GetSkeletonEv(ptr noundef nonnull align 16 dereferenceable(80)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH8RefConstINS_15RagdollSettingsEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH3RefINS_8SkeletonEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH12SkeletonPose16GetJointMatricesEv(ptr noundef nonnull align 16 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH3RefINS_17TwoBodyConstraintEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH7Ragdoll22DriveToPoseUsingMotorsERKNS_12SkeletonPoseE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 16 dereferenceable(80) %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef ptr @_ZNK3JPH12SkeletonPose11GetSkeletonEv(ptr noundef nonnull align 16 dereferenceable(80) %1)
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = tail call noundef ptr @_ZNK3JPH8RefConstINS_15RagdollSettingsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  %7 = tail call noundef ptr @_ZNK3JPH3RefINS_8SkeletonEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %8 = icmp eq ptr %3, %7
  br i1 %8, label %12, label %9

9:                                                ; preds = %2
  %10 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.4, i32 noundef 618)
  br i1 %10, label %11, label %12

11:                                               ; preds = %9
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !5
  br label %12

12:                                               ; preds = %2, %9, %11
  %13 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH12SkeletonPose16GetJointMatricesEv(ptr noundef nonnull align 16 dereferenceable(80) %1)
  %14 = tail call noundef i64 @_ZNK3JPH5ArrayINS_5Mat44ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %15 = trunc i64 %14 to i32
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 40
  br label %18

._crit_edge:                                      ; preds = %36, %12
  ret void

18:                                               ; preds = %.lr.ph, %36
  %.025 = phi i32 [ 0, %.lr.ph ], [ %37, %36 ]
  %19 = tail call noundef ptr @_ZNK3JPH8RefConstINS_15RagdollSettingsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %20 = tail call noundef i32 @_ZNK3JPH15RagdollSettings30GetConstraintIndexForBodyIndexEi(ptr noundef nonnull align 8 dereferenceable(112) %19, i32 noundef %.025)
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %22, label %36

22:                                               ; preds = %18
  %23 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH12SkeletonPose8GetJointEi(ptr noundef nonnull align 16 dereferenceable(80) %1, i32 noundef %.025)
  %24 = zext nneg i32 %20 to i64
  %25 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_17TwoBodyConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %24)
  %26 = tail call noundef ptr @_ZNK3JPH3RefINS_17TwoBodyConstraintEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %25)
  %27 = load ptr, ptr %26, align 8, !tbaa !6
  %28 = getelementptr inbounds i8, ptr %27, i64 24
  %29 = load ptr, ptr %28, align 8
  %30 = tail call noundef i32 %29(ptr noundef nonnull align 8 dereferenceable(32) %26)
  switch i32 %30, label %33 [
    i32 6, label %31
    i32 2, label %32
  ]

31:                                               ; preds = %22
  tail call void @_ZN3JPH20SwingTwistConstraint18SetSwingMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944) %26, i32 noundef 2)
  tail call void @_ZN3JPH20SwingTwistConstraint18SetTwistMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944) %26, i32 noundef 2)
  %.sroa.02.0.copyload = load double, ptr %23, align 16
  %.sroa.23.0..sroa_idx = getelementptr inbounds i8, ptr %23, i64 8
  %.sroa.23.0.copyload = load double, ptr %.sroa.23.0..sroa_idx, align 8, !tbaa !9
  tail call void @_ZN3JPH20SwingTwistConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(944) %26, double %.sroa.02.0.copyload, double %.sroa.23.0.copyload)
  br label %36

32:                                               ; preds = %22
  tail call void @_ZN3JPH15HingeConstraint13SetMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(832) %26, i32 noundef 2)
  %.sroa.0.0.copyload = load double, ptr %23, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %23, i64 8
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !9
  tail call void @_ZN3JPH15HingeConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(832) %26, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  br label %36

33:                                               ; preds = %22
  %34 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 646, ptr noundef nonnull @.str.9)
  br i1 %34, label %35, label %36

35:                                               ; preds = %33
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !11
  br label %36

36:                                               ; preds = %31, %33, %35, %32, %18
  %37 = add nuw nsw i32 %.025, 1
  %38 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH12SkeletonPose16GetJointMatricesEv(ptr noundef nonnull align 16 dereferenceable(80) %1)
  %39 = tail call noundef i64 @_ZNK3JPH5ArrayINS_5Mat44ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %38)
  %40 = trunc i64 %39 to i32
  %41 = icmp slt i32 %37, %40
  br i1 %41, label %18, label %._crit_edge, !llvm.loop !12
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayINS_5Mat44ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK3JPH15RagdollSettings30GetConstraintIndexForBodyIndexEi(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH12SkeletonPose8GetJointEi(ptr noundef nonnull align 16 dereferenceable(80), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_17TwoBodyConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

declare void @_ZN3JPH20SwingTwistConstraint18SetSwingMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944), i32 noundef) local_unnamed_addr #4

declare void @_ZN3JPH20SwingTwistConstraint18SetTwistMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(944), i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH20SwingTwistConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(944), double, double) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH15HingeConstraint13SetMotorStateENS_11EMotorStateE(ptr noundef nonnull align 16 dereferenceable(832), i32 noundef) local_unnamed_addr #1 align 2

declare void @_ZN3JPH15HingeConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(832), double, double) local_unnamed_addr #4

attributes #0 = { 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 #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 = { 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 #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 = { 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 = !{i64 2159896977}
!6 = !{!7, !7, i64 0}
!7 = !{!"vtable pointer", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"omnipotent char", !8, i64 0}
!11 = !{i64 2159897315}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass