; LLVM IR from zig-gamedev/zphysics :: libs/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.110", %"class.JPH::RefConst.111", %"class.JPH::Array.112", %"class.JPH::Array.115", ptr }
%"class.JPH::RefTarget.110" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::RefConst.111" = type { ptr }
%"class.JPH::Array.112" = type { i64, i64, ptr }
%"class.JPH::Array.115" = 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 [92 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 %"struct.JPH::AssertLastParam", align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8
  br label %15

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

23:                                               ; preds = %15
  %24 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.7, ptr noundef @.str.4, i32 noundef 617)
  br i1 %24, label %25, label %26

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

26:                                               ; preds = %25, %23, %15
  br label %27

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

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

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

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

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

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

70:                                               ; preds = %43
  br label %71

71:                                               ; preds = %70
  %72 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jS1_NS_15AssertLastParamE(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 639, ptr noundef @.str.9)
  br i1 %72, label %73, label %74

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

74:                                               ; preds = %73, %71
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76, %59
  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 %78

78:                                               ; preds = %77, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %6, align 4, !tbaa !10
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %6, align 4, !tbaa !10
  br label %28, !llvm.loop !19

82:                                               ; preds = %35
  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

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 2159594907}
!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 2159595252}
!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 [92 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 617)
  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
  %.017 = 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 %.017)
  %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 %.017)
  %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)
  %31 = icmp eq i32 %30, 6
  br i1 %31, label %32, label %33

32:                                               ; 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.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 @_ZN3JPH20SwingTwistConstraint22SetTargetOrientationBSENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(944) %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 639, 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 = %32, %35, %33, %18
  %37 = add nuw nsw i32 %.017, 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

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 2159594907}
!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 2159595252}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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