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

; 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.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::HingeConstraint" = type { %"class.JPH::TwoBodyConstraint", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", i8, float, float, %"class.JPH::SpringSettings", float, %"class.JPH::MotorSettings", i32, float, float, float, %"class.JPH::Vec3", %"class.JPH::PointConstraintPart", %"class.JPH::HingeRotationConstraintPart", %"class.JPH::AngleConstraintPart", %"class.JPH::AngleConstraintPart" }
%"class.JPH::TwoBodyConstraint" = type { %"class.JPH::Constraint", ptr, ptr }
%"class.JPH::Constraint" = type { ptr, %"class.JPH::RefTarget.3", i32, i32, i8, i8, i8, i64 }
%"class.JPH::RefTarget.3" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.4 }
%union.anon.4 = type { <4 x float> }
%"class.JPH::SpringSettings" = type { i8, %union.anon.2, float }
%union.anon.2 = type { float }
%"class.JPH::MotorSettings" = type { %"class.JPH::SpringSettings", float, float, float, float }
%"class.JPH::PointConstraintPart" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Vec3" }
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::HingeRotationConstraintPart" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Matrix", %"class.JPH::Vector", [8 x i8] }>
%"class.JPH::Matrix" = type { [2 x %"class.JPH::Vector"] }
%"class.JPH::Vector" = type { [2 x float] }
%"class.JPH::AngleConstraintPart" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", float, %"class.JPH::SpringPart", float }
%"class.JPH::SpringPart" = type { float, float }

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH15HingeConstraint23SolveVelocityConstraintEf(ptr noundef nonnull align 16 dereferenceable(832) %0, float noundef %1) unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca i8, align 1
  %6 = alloca float, align 4
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca %"class.JPH::Vec3", align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %15 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  store i8 0, ptr %5, align 1, !tbaa !11
  %16 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 22
  %17 = call noundef zeroext i1 @_ZNK3JPH19AngleConstraintPart8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(48) %16)
  br i1 %17, label %18, label %65

18:                                               ; preds = %2
  %19 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 14
  %20 = load i32, ptr %19, align 8, !tbaa !13
  switch i32 %20, label %64 [
    i32 0, label %21
    i32 1, label %41
    i32 2, label %41
  ]

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %22 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 12
  %23 = load float, ptr %22, align 8, !tbaa !36
  %24 = load float, ptr %4, align 4, !tbaa !9
  %25 = fmul float %23, %24
  store float %25, ptr %6, align 4, !tbaa !9
  %26 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 22
  %27 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 1
  %28 = load ptr, ptr %27, align 16, !tbaa !37
  %29 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !38
  %31 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 %31, i64 16, i1 false), !tbaa.struct !39
  %32 = load float, ptr %6, align 4, !tbaa !9
  %33 = fneg float %32
  %34 = load float, ptr %6, align 4, !tbaa !9
  %35 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 0
  %36 = load double, ptr %35, align 16
  %37 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 1
  %38 = load double, ptr %37, align 8
  %39 = call noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48) %26, ptr noundef nonnull align 16 dereferenceable(122) %28, ptr noundef nonnull align 16 dereferenceable(122) %30, double %36, double %38, float noundef %33, float noundef %34)
  %40 = zext i1 %39 to i8
  store i8 %40, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %64

41:                                               ; preds = %18, %18
  %42 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 22
  %43 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 1
  %44 = load ptr, ptr %43, align 16, !tbaa !37
  %45 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !38
  %47 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %8, ptr align 16 %47, i64 16, i1 false), !tbaa.struct !39
  %48 = load float, ptr %4, align 4, !tbaa !9
  %49 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 13
  %50 = getelementptr inbounds %"class.JPH::MotorSettings", ptr %49, i32 0, i32 3
  %51 = load float, ptr %50, align 4, !tbaa !41
  %52 = fmul float %48, %51
  %53 = load float, ptr %4, align 4, !tbaa !9
  %54 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 13
  %55 = getelementptr inbounds %"class.JPH::MotorSettings", ptr %54, i32 0, i32 4
  %56 = load float, ptr %55, align 4, !tbaa !42
  %57 = fmul float %53, %56
  %58 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  %59 = load double, ptr %58, align 16
  %60 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  %61 = load double, ptr %60, align 8
  %62 = call noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48) %42, ptr noundef nonnull align 16 dereferenceable(122) %44, ptr noundef nonnull align 16 dereferenceable(122) %46, double %59, double %61, float noundef %52, float noundef %57)
  %63 = zext i1 %62 to i8
  store i8 %63, ptr %5, align 1, !tbaa !11
  br label %64

64:                                               ; preds = %41, %21, %18
  br label %65

65:                                               ; preds = %64, %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  %66 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 19
  %67 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 1
  %68 = load ptr, ptr %67, align 16, !tbaa !37
  %69 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !38
  %71 = call noundef zeroext i1 @_ZN3JPH19PointConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(240) %66, ptr noundef nonnull align 16 dereferenceable(122) %68, ptr noundef nonnull align 16 dereferenceable(122) %70)
  %72 = zext i1 %71 to i8
  store i8 %72, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #6
  %73 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 20
  %74 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 1
  %75 = load ptr, ptr %74, align 16, !tbaa !37
  %76 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !38
  %78 = call noundef zeroext i1 @_ZN3JPH27HingeRotationConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(232) %73, ptr noundef nonnull align 16 dereferenceable(122) %75, ptr noundef nonnull align 16 dereferenceable(122) %77)
  %79 = zext i1 %78 to i8
  store i8 %79, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  store i8 0, ptr %11, align 1, !tbaa !11
  %80 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 21
  %81 = call noundef zeroext i1 @_ZNK3JPH19AngleConstraintPart8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(48) %80)
  br i1 %81, label %82, label %109

82:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %83 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 9
  %84 = load float, ptr %83, align 4, !tbaa !43
  %85 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 10
  %86 = load float, ptr %85, align 8, !tbaa !44
  %87 = fcmp oeq float %84, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %82
  store float 0xC7EFFFFFE0000000, ptr %12, align 4, !tbaa !9
  store float 0x47EFFFFFE0000000, ptr %13, align 4, !tbaa !9
  br label %94

89:                                               ; preds = %82
  %90 = call noundef zeroext i1 @_ZNK3JPH15HingeConstraint17IsMinLimitClosestEv(ptr noundef nonnull align 16 dereferenceable(832) %15)
  br i1 %90, label %91, label %92

91:                                               ; preds = %89
  store float 0.000000e+00, ptr %12, align 4, !tbaa !9
  store float 0x47EFFFFFE0000000, ptr %13, align 4, !tbaa !9
  br label %93

92:                                               ; preds = %89
  store float 0xC7EFFFFFE0000000, ptr %12, align 4, !tbaa !9
  store float 0.000000e+00, ptr %13, align 4, !tbaa !9
  br label %93

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

94:                                               ; preds = %93, %88
  %95 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 21
  %96 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 1
  %97 = load ptr, ptr %96, align 16, !tbaa !37
  %98 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %15, i32 0, i32 2
  %99 = load ptr, ptr %98, align 8, !tbaa !38
  %100 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %15, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 %100, i64 16, i1 false), !tbaa.struct !39
  %101 = load float, ptr %12, align 4, !tbaa !9
  %102 = load float, ptr %13, align 4, !tbaa !9
  %103 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %104 = load double, ptr %103, align 16
  %105 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %106 = load double, ptr %105, align 8
  %107 = call noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48) %95, ptr noundef nonnull align 16 dereferenceable(122) %97, ptr noundef nonnull align 16 dereferenceable(122) %99, double %104, double %106, float noundef %101, float noundef %102)
  %108 = zext i1 %107 to i8
  store i8 %108, ptr %11, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %109

109:                                              ; preds = %94, %65
  %110 = load i8, ptr %5, align 1, !tbaa !11, !range !45, !noundef !46
  %111 = trunc i8 %110 to i1
  br i1 %111, label %121, label %112

112:                                              ; preds = %109
  %113 = load i8, ptr %9, align 1, !tbaa !11, !range !45, !noundef !46
  %114 = trunc i8 %113 to i1
  br i1 %114, label %121, label %115

115:                                              ; preds = %112
  %116 = load i8, ptr %10, align 1, !tbaa !11, !range !45, !noundef !46
  %117 = trunc i8 %116 to i1
  br i1 %117, label %121, label %118

118:                                              ; preds = %115
  %119 = load i8, ptr %11, align 1, !tbaa !11, !range !45, !noundef !46
  %120 = trunc i8 %119 to i1
  br label %121

121:                                              ; preds = %118, %115, %112, %109
  %122 = phi i1 [ true, %115 ], [ true, %112 ], [ true, %109 ], [ %120, %118 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  ret i1 %122
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH19AngleConstraintPart8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(48)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 16 dereferenceable(122), double, double, float noundef, float noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH19PointConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(240), ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 16 dereferenceable(122)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH27HingeRotationConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(232), ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 16 dereferenceable(122)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH15HingeConstraint17IsMinLimitClosestEv(ptr noundef nonnull align 16 dereferenceable(832)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { 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 #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !28, i64 216}
!14 = !{!"_ZTSN3JPH15HingeConstraintE", !15, i64 0, !22, i64 48, !22, i64 64, !22, i64 80, !22, i64 96, !22, i64 112, !22, i64 128, !23, i64 144, !12, i64 160, !10, i64 164, !10, i64 168, !25, i64 172, !10, i64 184, !27, i64 188, !28, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !22, i64 240, !29, i64 256, !31, i64 496, !34, i64 736, !34, i64 784}
!15 = !{!"_ZTSN3JPH17TwoBodyConstraintE", !16, i64 0, !6, i64 32, !6, i64 40}
!16 = !{!"_ZTSN3JPH10ConstraintE", !17, i64 8, !20, i64 12, !20, i64 16, !7, i64 20, !7, i64 21, !12, i64 22, !21, i64 24}
!17 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !18, i64 0}
!18 = !{!"_ZTSSt6atomicIjE", !19, i64 0}
!19 = !{!"_ZTSSt13__atomic_baseIjE", !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!23 = !{!"_ZTSN3JPH4QuatE", !24, i64 0}
!24 = !{!"_ZTSN3JPH4Vec4E", !7, i64 0}
!25 = !{!"_ZTSN3JPH14SpringSettingsE", !26, i64 0, !7, i64 4, !10, i64 8}
!26 = !{!"_ZTSN3JPH11ESpringModeE", !7, i64 0}
!27 = !{!"_ZTSN3JPH13MotorSettingsE", !25, i64 0, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!28 = !{!"_ZTSN3JPH11EMotorStateE", !7, i64 0}
!29 = !{!"_ZTSN3JPH19PointConstraintPartE", !22, i64 0, !22, i64 16, !30, i64 32, !30, i64 96, !30, i64 160, !22, i64 224}
!30 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!31 = !{!"_ZTSN3JPH27HingeRotationConstraintPartE", !22, i64 0, !22, i64 16, !22, i64 32, !30, i64 48, !30, i64 112, !22, i64 176, !22, i64 192, !32, i64 208, !33, i64 224}
!32 = !{!"_ZTSN3JPH6MatrixILj2ELj2EEE", !7, i64 0}
!33 = !{!"_ZTSN3JPH6VectorILj2EEE", !7, i64 0}
!34 = !{!"_ZTSN3JPH19AngleConstraintPartE", !22, i64 0, !22, i64 16, !10, i64 32, !35, i64 36, !10, i64 44}
!35 = !{!"_ZTSN3JPH10SpringPartE", !10, i64 0, !10, i64 4}
!36 = !{!14, !10, i64 184}
!37 = !{!15, !6, i64 32}
!38 = !{!15, !6, i64 40}
!39 = !{i64 0, i64 16, !40}
!40 = !{!7, !7, i64 0}
!41 = !{!14, !10, i64 208}
!42 = !{!14, !10, i64 212}
!43 = !{!14, !10, i64 164}
!44 = !{!14, !10, i64 168}
!45 = !{i8 0, i8 2}
!46 = !{}


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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH15HingeConstraint23SolveVelocityConstraintEf(ptr noundef nonnull align 16 dereferenceable(832) %0, float noundef %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 784
  %4 = tail call noundef zeroext i1 @_ZNK3JPH19AngleConstraintPart8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(48) %3)
  br i1 %4, label %5, label %32

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 216
  %7 = load i32, ptr %6, align 8, !tbaa !5
  switch i32 %7, label %32 [
    i32 0, label %8
    i32 1, label %19
    i32 2, label %19
  ]

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 184
  %10 = load float, ptr %9, align 8, !tbaa !33
  %11 = fmul float %10, %1
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load ptr, ptr %12, align 16, !tbaa !34
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !35
  %16 = getelementptr inbounds i8, ptr %0, i64 240
  %.sroa.06.0.copyload = load double, ptr %16, align 16
  %.sroa.27.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 248
  %.sroa.27.0.copyload = load double, ptr %.sroa.27.0..sroa_idx, align 8, !tbaa !36
  %17 = fneg float %11
  %18 = tail call noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48) %3, ptr noundef nonnull align 16 dereferenceable(122) %13, ptr noundef nonnull align 16 dereferenceable(122) %15, double %.sroa.06.0.copyload, double %.sroa.27.0.copyload, float noundef %17, float noundef %11)
  br label %32

19:                                               ; preds = %5, %5
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  %21 = load ptr, ptr %20, align 16, !tbaa !34
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  %23 = load ptr, ptr %22, align 8, !tbaa !35
  %24 = getelementptr inbounds i8, ptr %0, i64 240
  %.sroa.04.0.copyload = load double, ptr %24, align 16
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 248
  %.sroa.25.0.copyload = load double, ptr %.sroa.25.0..sroa_idx, align 8, !tbaa !36
  %25 = getelementptr inbounds i8, ptr %0, i64 208
  %26 = load float, ptr %25, align 16, !tbaa !37
  %27 = fmul float %26, %1
  %28 = getelementptr inbounds i8, ptr %0, i64 212
  %29 = load float, ptr %28, align 4, !tbaa !38
  %30 = fmul float %29, %1
  %31 = tail call noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48) %3, ptr noundef nonnull align 16 dereferenceable(122) %21, ptr noundef nonnull align 16 dereferenceable(122) %23, double %.sroa.04.0.copyload, double %.sroa.25.0.copyload, float noundef %27, float noundef %30)
  br label %32

32:                                               ; preds = %5, %8, %19, %2
  %.0.shrunk = phi i1 [ false, %5 ], [ %31, %19 ], [ %18, %8 ], [ false, %2 ]
  %33 = getelementptr inbounds i8, ptr %0, i64 256
  %34 = getelementptr inbounds i8, ptr %0, i64 32
  %35 = load ptr, ptr %34, align 16, !tbaa !34
  %36 = getelementptr inbounds i8, ptr %0, i64 40
  %37 = load ptr, ptr %36, align 8, !tbaa !35
  %38 = tail call noundef zeroext i1 @_ZN3JPH19PointConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(240) %33, ptr noundef nonnull align 16 dereferenceable(122) %35, ptr noundef nonnull align 16 dereferenceable(122) %37)
  %39 = getelementptr inbounds i8, ptr %0, i64 496
  %40 = load ptr, ptr %34, align 16, !tbaa !34
  %41 = load ptr, ptr %36, align 8, !tbaa !35
  %42 = tail call noundef zeroext i1 @_ZN3JPH27HingeRotationConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(232) %39, ptr noundef nonnull align 16 dereferenceable(122) %40, ptr noundef nonnull align 16 dereferenceable(122) %41)
  %43 = getelementptr inbounds i8, ptr %0, i64 736
  %44 = tail call noundef zeroext i1 @_ZNK3JPH19AngleConstraintPart8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(48) %43)
  br i1 %44, label %45, label %58

45:                                               ; preds = %32
  %46 = getelementptr inbounds i8, ptr %0, i64 164
  %47 = load float, ptr %46, align 4, !tbaa !39
  %48 = getelementptr inbounds i8, ptr %0, i64 168
  %49 = load float, ptr %48, align 8, !tbaa !40
  %50 = fcmp oeq float %47, %49
  br i1 %50, label %53, label %51

51:                                               ; preds = %45
  %52 = tail call noundef zeroext i1 @_ZNK3JPH15HingeConstraint17IsMinLimitClosestEv(ptr noundef nonnull align 16 dereferenceable(832) %0)
  %. = select i1 %52, float 0.000000e+00, float 0xC7EFFFFFE0000000
  %.18 = select i1 %52, float 0x47EFFFFFE0000000, float 0.000000e+00
  br label %53

53:                                               ; preds = %51, %45
  %.017 = phi float [ 0xC7EFFFFFE0000000, %45 ], [ %., %51 ]
  %.016 = phi float [ 0x47EFFFFFE0000000, %45 ], [ %.18, %51 ]
  %54 = load ptr, ptr %34, align 16, !tbaa !34
  %55 = load ptr, ptr %36, align 8, !tbaa !35
  %56 = getelementptr inbounds i8, ptr %0, i64 240
  %.sroa.0.0.copyload = load double, ptr %56, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 248
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !36
  %57 = tail call noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48) %43, ptr noundef nonnull align 16 dereferenceable(122) %54, ptr noundef nonnull align 16 dereferenceable(122) %55, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload, float noundef %.017, float noundef %.016)
  br label %58

58:                                               ; preds = %53, %32
  %.015 = phi i1 [ %57, %53 ], [ false, %32 ]
  %brmerge = or i1 %.0.shrunk, %38
  br i1 %brmerge, label %60, label %59

59:                                               ; preds = %58
  %spec.select = or i1 %42, %.015
  br label %60

60:                                               ; preds = %59, %58
  %61 = phi i1 [ true, %58 ], [ %spec.select, %59 ]
  ret i1 %61
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH19AngleConstraintPart8IsActiveEv(ptr noundef nonnull align 16 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH19AngleConstraintPart23SolveVelocityConstraintERNS_4BodyES2_NS_4Vec3Eff(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 16 dereferenceable(122), double, double, float noundef, float noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH19PointConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(240), ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH27HingeRotationConstraintPart23SolveVelocityConstraintERNS_4BodyES2_(ptr noundef nonnull align 16 dereferenceable(232), ptr noundef nonnull align 16 dereferenceable(122), ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH15HingeConstraint17IsMinLimitClosestEv(ptr noundef nonnull align 16 dereferenceable(832)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !25, i64 216}
!6 = !{!"_ZTSN3JPH15HingeConstraintE", !7, i64 0, !18, i64 48, !18, i64 64, !18, i64 80, !18, i64 96, !18, i64 112, !18, i64 128, !19, i64 144, !15, i64 160, !21, i64 164, !21, i64 168, !22, i64 172, !21, i64 184, !24, i64 188, !25, i64 216, !21, i64 220, !21, i64 224, !21, i64 228, !18, i64 240, !26, i64 256, !28, i64 496, !31, i64 736, !31, i64 784}
!7 = !{!"_ZTSN3JPH17TwoBodyConstraintE", !8, i64 0, !17, i64 32, !17, i64 40}
!8 = !{!"_ZTSN3JPH10ConstraintE", !9, i64 8, !12, i64 12, !12, i64 16, !13, i64 20, !13, i64 21, !15, i64 22, !16, i64 24}
!9 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !10, i64 0}
!10 = !{!"_ZTSSt6atomicIjE", !11, i64 0}
!11 = !{!"_ZTSSt13__atomic_baseIjE", !12, i64 0}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"bool", !13, i64 0}
!16 = !{!"long", !13, i64 0}
!17 = !{!"any pointer", !13, i64 0}
!18 = !{!"_ZTSN3JPH4Vec3E", !13, i64 0}
!19 = !{!"_ZTSN3JPH4QuatE", !20, i64 0}
!20 = !{!"_ZTSN3JPH4Vec4E", !13, i64 0}
!21 = !{!"float", !13, i64 0}
!22 = !{!"_ZTSN3JPH14SpringSettingsE", !23, i64 0, !13, i64 4, !21, i64 8}
!23 = !{!"_ZTSN3JPH11ESpringModeE", !13, i64 0}
!24 = !{!"_ZTSN3JPH13MotorSettingsE", !22, i64 0, !21, i64 12, !21, i64 16, !21, i64 20, !21, i64 24}
!25 = !{!"_ZTSN3JPH11EMotorStateE", !13, i64 0}
!26 = !{!"_ZTSN3JPH19PointConstraintPartE", !18, i64 0, !18, i64 16, !27, i64 32, !27, i64 96, !27, i64 160, !18, i64 224}
!27 = !{!"_ZTSN3JPH5Mat44E", !13, i64 0}
!28 = !{!"_ZTSN3JPH27HingeRotationConstraintPartE", !18, i64 0, !18, i64 16, !18, i64 32, !27, i64 48, !27, i64 112, !18, i64 176, !18, i64 192, !29, i64 208, !30, i64 224}
!29 = !{!"_ZTSN3JPH6MatrixILj2ELj2EEE", !13, i64 0}
!30 = !{!"_ZTSN3JPH6VectorILj2EEE", !13, i64 0}
!31 = !{!"_ZTSN3JPH19AngleConstraintPartE", !18, i64 0, !18, i64 16, !21, i64 32, !32, i64 36, !21, i64 44}
!32 = !{!"_ZTSN3JPH10SpringPartE", !21, i64 0, !21, i64 4}
!33 = !{!6, !21, i64 184}
!34 = !{!7, !17, i64 32}
!35 = !{!7, !17, i64 40}
!36 = !{!13, !13, i64 0}
!37 = !{!6, !21, i64 208}
!38 = !{!6, !21, i64 212}
!39 = !{!6, !21, i64 164}
!40 = !{!6, !21, i64 168}


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