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

; 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::PathConstraintPathHermite" = type { %"class.JPH::PathConstraintPath.base", %"class.JPH::Array" }
%"class.JPH::PathConstraintPath.base" = type <{ %"class.JPH::SerializableObject", %"class.JPH::RefTarget", i8 }>
%"class.JPH::SerializableObject" = type { ptr }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::Array" = type { i64, i64, ptr }
%"struct.JPH::PathConstraintPathHermite::Point" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3" }

; 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
define dso_local noundef float @_ZNK3JPH25PathConstraintPathHermite15GetClosestPointENS_4Vec3Ef(ptr noundef nonnull align 8 dereferenceable(40) %0, double %1, double %2, float noundef %3) unnamed_addr #1 align 2 {
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca %"class.JPH::Vec3", align 16
  %12 = alloca float, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca %"class.JPH::Vec3", align 16
  %19 = alloca %"class.JPH::Vec3", align 16
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  %23 = alloca float, align 4
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca %"class.JPH::Vec3", align 16
  %26 = alloca %"class.JPH::Vec3", align 16
  %27 = alloca %"class.JPH::Vec3", align 16
  %28 = alloca %"class.JPH::Vec3", align 16
  %29 = alloca %"class.JPH::Vec3", align 16
  %30 = alloca %"class.JPH::Vec3", align 16
  %31 = alloca %"class.JPH::Vec3", align 16
  %32 = alloca %"class.JPH::Vec3", align 16
  %33 = alloca %"class.JPH::Vec3", align 16
  %34 = alloca float, align 4
  %35 = alloca %"class.JPH::Vec3", align 16
  %36 = alloca %"class.JPH::Vec3", align 16
  %37 = alloca %"class.JPH::Vec3", align 16
  %38 = alloca %"class.JPH::Vec3", align 16
  %39 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 0
  store double %1, ptr %39, align 16
  %40 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 1
  store double %2, ptr %40, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store float %3, ptr %7, align 4, !tbaa !9
  %41 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %42 = getelementptr inbounds %"class.JPH::PathConstraintPathHermite", ptr %41, i32 0, i32 1
  %43 = call noundef i64 @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %42)
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #8
  %45 = getelementptr inbounds %"class.JPH::PathConstraintPathHermite", ptr %41, i32 0, i32 1
  %46 = load i32, ptr %8, align 4, !tbaa !11
  %47 = sub nsw i32 %46, 1
  %48 = sext i32 %47 to i64
  %49 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %48)
  %50 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %49, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !13
  %51 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %52 = load double, ptr %51, align 16
  %53 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %54 = load double, ptr %53, align 8
  %55 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %50, double %52, double %54)
  %56 = getelementptr inbounds %"class.JPH::Vec3", ptr %10, i32 0, i32 0
  %57 = getelementptr inbounds %union.anon, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds { double, double }, ptr %57, i32 0, i32 0
  %59 = extractvalue { double, double } %55, 0
  store double %59, ptr %58, align 16
  %60 = getelementptr inbounds { double, double }, ptr %57, i32 0, i32 1
  %61 = extractvalue { double, double } %55, 1
  store double %61, ptr %60, align 8
  %62 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %10)
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #8
  store float %62, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %63 = load i32, ptr %8, align 4, !tbaa !11
  %64 = sub nsw i32 %63, 1
  %65 = sitofp i32 %64 to float
  store float %65, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %66 = call noundef zeroext i1 @_ZNK3JPH18PathConstraintPath9IsLoopingEv(ptr noundef nonnull align 8 dereferenceable(13) %41)
  br i1 %66, label %67, label %69

67:                                               ; preds = %4
  %68 = load i32, ptr %8, align 4, !tbaa !11
  br label %72

69:                                               ; preds = %4
  %70 = load i32, ptr %8, align 4, !tbaa !11
  %71 = sub nsw i32 %70, 1
  br label %72

72:                                               ; preds = %69, %67
  %73 = phi i32 [ %68, %67 ], [ %71, %69 ]
  store i32 %73, ptr %14, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %223, %72
  %75 = load i32, ptr %13, align 4, !tbaa !11
  %76 = load i32, ptr %14, align 4, !tbaa !11
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %226

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %80 = getelementptr inbounds %"class.JPH::PathConstraintPathHermite", ptr %41, i32 0, i32 1
  %81 = load i32, ptr %13, align 4, !tbaa !11
  %82 = sext i32 %81 to i64
  %83 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %80, i64 noundef %82)
  store ptr %83, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %84 = getelementptr inbounds %"class.JPH::PathConstraintPathHermite", ptr %41, i32 0, i32 1
  %85 = load i32, ptr %13, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  %87 = load i32, ptr %8, align 4, !tbaa !11
  %88 = srem i32 %86, %87
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %84, i64 noundef %89)
  store ptr %90, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  %91 = load ptr, ptr %15, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %91, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !13
  %93 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %94 = load double, ptr %93, align 16
  %95 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %96 = load double, ptr %95, align 8
  %97 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %92, double %94, double %96)
  %98 = getelementptr inbounds %"class.JPH::Vec3", ptr %17, i32 0, i32 0
  %99 = getelementptr inbounds %union.anon, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds { double, double }, ptr %99, i32 0, i32 0
  %101 = extractvalue { double, double } %97, 0
  store double %101, ptr %100, align 16
  %102 = getelementptr inbounds { double, double }, ptr %99, i32 0, i32 1
  %103 = extractvalue { double, double } %97, 1
  store double %103, ptr %102, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  %104 = load ptr, ptr %16, align 8, !tbaa !5
  %105 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %104, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !13
  %106 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %107 = load double, ptr %106, align 16
  %108 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %109 = load double, ptr %108, align 8
  %110 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %105, double %107, double %109)
  %111 = getelementptr inbounds %"class.JPH::Vec3", ptr %19, i32 0, i32 0
  %112 = getelementptr inbounds %union.anon, ptr %111, i32 0, i32 0
  %113 = getelementptr inbounds { double, double }, ptr %112, i32 0, i32 0
  %114 = extractvalue { double, double } %110, 0
  store double %114, ptr %113, align 16
  %115 = getelementptr inbounds { double, double }, ptr %112, i32 0, i32 1
  %116 = extractvalue { double, double } %110, 1
  store double %116, ptr %115, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %117 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %17)
  store float %117, ptr %21, align 4, !tbaa !9
  %118 = load float, ptr %21, align 4, !tbaa !9
  %119 = load float, ptr %9, align 4, !tbaa !9
  %120 = fcmp olt float %118, %119
  br i1 %120, label %121, label %125

121:                                              ; preds = %79
  %122 = load i32, ptr %13, align 4, !tbaa !11
  %123 = sitofp i32 %122 to float
  store float %123, ptr %12, align 4, !tbaa !9
  %124 = load float, ptr %21, align 4, !tbaa !9
  store float %124, ptr %9, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %121, %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %17, i64 16, i1 false), !tbaa.struct !13
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  %127 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %126, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 %127, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %26, ptr align 16 %19, i64 16, i1 false), !tbaa.struct !13
  %128 = load ptr, ptr %16, align 8, !tbaa !5
  %129 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %128, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %27, ptr align 16 %129, i64 16, i1 false), !tbaa.struct !13
  %130 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %131 = load double, ptr %130, align 16
  %132 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %133 = load double, ptr %132, align 8
  %134 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 0
  %135 = load double, ptr %134, align 16
  %136 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 1
  %137 = load double, ptr %136, align 8
  %138 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 0
  %139 = load double, ptr %138, align 16
  %140 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 1
  %141 = load double, ptr %140, align 8
  %142 = getelementptr inbounds { double, double }, ptr %27, i32 0, i32 0
  %143 = load double, ptr %142, align 16
  %144 = getelementptr inbounds { double, double }, ptr %27, i32 0, i32 1
  %145 = load double, ptr %144, align 8
  call void @_ZN3JPHL38sCalculateClosestPointThroughBisectionENS_4Vec3ES0_S0_S0_RfS1_(double %131, double %133, double %135, double %137, double %139, double %141, double %143, double %145, ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %146 = load float, ptr %22, align 4, !tbaa !9
  %147 = load float, ptr %23, align 4, !tbaa !9
  %148 = fcmp oeq float %146, %147
  br i1 %148, label %149, label %182

149:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %29) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %30, ptr align 16 %17, i64 16, i1 false), !tbaa.struct !13
  %150 = load ptr, ptr %15, align 8, !tbaa !5
  %151 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %150, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %31, ptr align 16 %151, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %32, ptr align 16 %19, i64 16, i1 false), !tbaa.struct !13
  %152 = load ptr, ptr %16, align 8, !tbaa !5
  %153 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %152, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %33, ptr align 16 %153, i64 16, i1 false), !tbaa.struct !13
  %154 = load float, ptr %22, align 4, !tbaa !9
  %155 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 0
  %156 = load double, ptr %155, align 16
  %157 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 1
  %158 = load double, ptr %157, align 8
  %159 = getelementptr inbounds { double, double }, ptr %31, i32 0, i32 0
  %160 = load double, ptr %159, align 16
  %161 = getelementptr inbounds { double, double }, ptr %31, i32 0, i32 1
  %162 = load double, ptr %161, align 8
  %163 = getelementptr inbounds { double, double }, ptr %32, i32 0, i32 0
  %164 = load double, ptr %163, align 16
  %165 = getelementptr inbounds { double, double }, ptr %32, i32 0, i32 1
  %166 = load double, ptr %165, align 8
  %167 = getelementptr inbounds { double, double }, ptr %33, i32 0, i32 0
  %168 = load double, ptr %167, align 16
  %169 = getelementptr inbounds { double, double }, ptr %33, i32 0, i32 1
  %170 = load double, ptr %169, align 8
  call void @_ZN3JPHL28sCalculatePositionAndTangentENS_4Vec3ES0_S0_S0_fRS0_S1_(double %156, double %158, double %160, double %162, double %164, double %166, double %168, double %170, float noundef %154, ptr noundef nonnull align 16 dereferenceable(16) %28, ptr noundef nonnull align 16 dereferenceable(16) %29)
  %171 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %28)
  store float %171, ptr %21, align 4, !tbaa !9
  %172 = load float, ptr %21, align 4, !tbaa !9
  %173 = load float, ptr %9, align 4, !tbaa !9
  %174 = fcmp olt float %172, %173
  br i1 %174, label %175, label %181

175:                                              ; preds = %149
  %176 = load i32, ptr %13, align 4, !tbaa !11
  %177 = sitofp i32 %176 to float
  %178 = load float, ptr %22, align 4, !tbaa !9
  %179 = fadd float %177, %178
  store float %179, ptr %12, align 4, !tbaa !9
  %180 = load float, ptr %21, align 4, !tbaa !9
  store float %180, ptr %9, align 4, !tbaa !9
  br label %181

181:                                              ; preds = %175, %149
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #8
  br label %222

182:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %35, ptr align 16 %17, i64 16, i1 false), !tbaa.struct !13
  %183 = load ptr, ptr %15, align 8, !tbaa !5
  %184 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %183, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %36, ptr align 16 %184, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %37, ptr align 16 %19, i64 16, i1 false), !tbaa.struct !13
  %185 = load ptr, ptr %16, align 8, !tbaa !5
  %186 = getelementptr inbounds %"struct.JPH::PathConstraintPathHermite::Point", ptr %185, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %38, ptr align 16 %186, i64 16, i1 false), !tbaa.struct !13
  %187 = load float, ptr %22, align 4, !tbaa !9
  %188 = load float, ptr %23, align 4, !tbaa !9
  %189 = getelementptr inbounds { double, double }, ptr %35, i32 0, i32 0
  %190 = load double, ptr %189, align 16
  %191 = getelementptr inbounds { double, double }, ptr %35, i32 0, i32 1
  %192 = load double, ptr %191, align 8
  %193 = getelementptr inbounds { double, double }, ptr %36, i32 0, i32 0
  %194 = load double, ptr %193, align 16
  %195 = getelementptr inbounds { double, double }, ptr %36, i32 0, i32 1
  %196 = load double, ptr %195, align 8
  %197 = getelementptr inbounds { double, double }, ptr %37, i32 0, i32 0
  %198 = load double, ptr %197, align 16
  %199 = getelementptr inbounds { double, double }, ptr %37, i32 0, i32 1
  %200 = load double, ptr %199, align 8
  %201 = getelementptr inbounds { double, double }, ptr %38, i32 0, i32 0
  %202 = load double, ptr %201, align 16
  %203 = getelementptr inbounds { double, double }, ptr %38, i32 0, i32 1
  %204 = load double, ptr %203, align 8
  %205 = call noundef float @_ZN3JPHL42sCalculateClosestPointThroughNewtonRaphsonENS_4Vec3ES0_S0_S0_ffRf(double %190, double %192, double %194, double %196, double %198, double %200, double %202, double %204, float noundef %187, float noundef %188, ptr noundef nonnull align 4 dereferenceable(4) %21)
  store float %205, ptr %34, align 4, !tbaa !9
  %206 = load float, ptr %34, align 4, !tbaa !9
  %207 = fcmp oge float %206, 0.000000e+00
  br i1 %207, label %208, label %221

208:                                              ; preds = %182
  %209 = load float, ptr %34, align 4, !tbaa !9
  %210 = fcmp ole float %209, 1.000000e+00
  br i1 %210, label %211, label %221

211:                                              ; preds = %208
  %212 = load float, ptr %21, align 4, !tbaa !9
  %213 = load float, ptr %9, align 4, !tbaa !9
  %214 = fcmp olt float %212, %213
  br i1 %214, label %215, label %221

215:                                              ; preds = %211
  %216 = load i32, ptr %13, align 4, !tbaa !11
  %217 = sitofp i32 %216 to float
  %218 = load float, ptr %34, align 4, !tbaa !9
  %219 = fadd float %217, %218
  store float %219, ptr %12, align 4, !tbaa !9
  %220 = load float, ptr %21, align 4, !tbaa !9
  store float %220, ptr %9, align 4, !tbaa !9
  br label %221

221:                                              ; preds = %215, %211, %208, %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #8
  br label %222

222:                                              ; preds = %221, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %13, align 4, !tbaa !11
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %13, align 4, !tbaa !11
  br label %74, !llvm.loop !15

226:                                              ; preds = %78
  %227 = load float, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  ret float %227
}

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #4 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) #5

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH18PathConstraintPath9IsLoopingEv(ptr noundef nonnull align 8 dereferenceable(13)) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN3JPHL38sCalculateClosestPointThroughBisectionENS_4Vec3ES0_S0_S0_RfS1_(double, double, double, double, double, double, double, double, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN3JPHL28sCalculatePositionAndTangentENS_4Vec3ES0_S0_S0_fRS0_S1_(double, double, double, double, double, double, double, double, float noundef, ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef float @_ZN3JPHL42sCalculateClosestPointThroughNewtonRaphsonENS_4Vec3ES0_S0_S0_ffRf(double, double, double, double, double, double, double, double, float noundef, float noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

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 = { 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 = { 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 #4 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { alwaysinline 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 #7 = { 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 #8 = { 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 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 16, !14}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

; 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
define dso_local noundef float @_ZNK3JPH25PathConstraintPathHermite15GetClosestPointENS_4Vec3Ef(ptr noundef nonnull align 8 dereferenceable(40) %0, double %1, double %2, float noundef %3) unnamed_addr #1 align 2 {
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca %"class.JPH::Vec3", align 16
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = tail call noundef i64 @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %14 = trunc i64 %13 to i32
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %15 = add nsw i32 %14, -1
  %16 = sext i32 %15 to i64
  %17 = tail call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %16)
  %18 = tail call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %17, double %1, double %2)
  %19 = extractvalue { double, double } %18, 0
  store double %19, ptr %5, align 16
  %20 = getelementptr inbounds i8, ptr %5, i64 8
  %21 = extractvalue { double, double } %18, 1
  store double %21, ptr %20, align 8
  %22 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  %23 = sitofp i32 %15 to float
  %24 = call noundef zeroext i1 @_ZNK3JPH18PathConstraintPath9IsLoopingEv(ptr noundef nonnull align 8 dereferenceable(13) %0)
  %25 = select i1 %24, i32 %14, i32 %15
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %27 = getelementptr inbounds i8, ptr %6, i64 8
  %wide.trip.count = zext nneg i32 %25 to i64
  br label %28

._crit_edge:                                      ; preds = %63, %4
  %.059.lcssa = phi float [ %23, %4 ], [ %.463, %63 ]
  ret float %.059.lcssa

28:                                               ; preds = %.lr.ph, %63
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %63 ]
  %.073 = phi float [ %22, %.lr.ph ], [ %.4, %63 ]
  %.05972 = phi float [ %23, %.lr.ph ], [ %.463, %63 ]
  %29 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %indvars.iv)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = trunc nuw nsw i64 %indvars.iv.next to i32
  %31 = srem i32 %30, %14
  %32 = zext nneg i32 %31 to i64
  %33 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_25PathConstraintPathHermite5PointENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %32)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %34 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %29, double %1, double %2)
  %35 = extractvalue { double, double } %34, 0
  store double %35, ptr %6, align 16
  %36 = extractvalue { double, double } %34, 1
  store double %36, ptr %27, align 8
  %37 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %33, double %1, double %2)
  %38 = extractvalue { double, double } %37, 0
  %39 = extractvalue { double, double } %37, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %40 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  store float %40, ptr %7, align 4, !tbaa !5
  %41 = fcmp olt float %40, %.073
  %42 = trunc nuw nsw i64 %indvars.iv to i32
  %43 = uitofp nneg i32 %42 to float
  %.160 = select i1 %41, float %43, float %.05972
  %.1 = select i1 %41, float %40, float %.073
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %.sroa.024.0.copyload = load double, ptr %6, align 16
  %.sroa.225.0.copyload = load double, ptr %27, align 8, !tbaa !9
  %44 = getelementptr inbounds i8, ptr %29, i64 16
  %.sroa.022.0.copyload = load double, ptr %44, align 16
  %.sroa.223.0..sroa_idx = getelementptr inbounds i8, ptr %29, i64 24
  %.sroa.223.0.copyload = load double, ptr %.sroa.223.0..sroa_idx, align 8, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %33, i64 16
  %.sroa.018.0.copyload = load double, ptr %45, align 16
  %.sroa.219.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 24
  %.sroa.219.0.copyload = load double, ptr %.sroa.219.0..sroa_idx, align 8, !tbaa !9
  call void @_ZN3JPHL38sCalculateClosestPointThroughBisectionENS_4Vec3ES0_S0_S0_RfS1_(double %.sroa.024.0.copyload, double %.sroa.225.0.copyload, double %.sroa.022.0.copyload, double %.sroa.223.0.copyload, double %38, double %39, double %.sroa.018.0.copyload, double %.sroa.219.0.copyload, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %46 = load float, ptr %8, align 4, !tbaa !5
  %47 = load float, ptr %9, align 4, !tbaa !5
  %48 = fcmp oeq float %46, %47
  br i1 %48, label %49, label %54

49:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #7
  %.sroa.016.0.copyload = load double, ptr %6, align 16
  %.sroa.217.0.copyload = load double, ptr %27, align 8, !tbaa !9
  %.sroa.014.0.copyload = load double, ptr %44, align 16
  %.sroa.215.0.copyload = load double, ptr %.sroa.223.0..sroa_idx, align 8, !tbaa !9
  %.sroa.010.0.copyload = load double, ptr %45, align 16
  %.sroa.211.0.copyload = load double, ptr %.sroa.219.0..sroa_idx, align 8, !tbaa !9
  call void @_ZN3JPHL28sCalculatePositionAndTangentENS_4Vec3ES0_S0_S0_fRS0_S1_(double %.sroa.016.0.copyload, double %.sroa.217.0.copyload, double %.sroa.014.0.copyload, double %.sroa.215.0.copyload, double %38, double %39, double %.sroa.010.0.copyload, double %.sroa.211.0.copyload, float noundef %46, ptr noundef nonnull align 16 dereferenceable(16) %10, ptr noundef nonnull align 16 dereferenceable(16) %11)
  %50 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %10)
  %51 = fcmp olt float %50, %.1
  %52 = load float, ptr %8, align 4
  %53 = fadd float %52, %43
  %.261 = select i1 %51, float %53, float %.160
  %.2 = select i1 %51, float %50, float %.1
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  br label %63

54:                                               ; preds = %28
  %.sroa.06.0.copyload = load double, ptr %6, align 16
  %.sroa.27.0.copyload = load double, ptr %27, align 8, !tbaa !9
  %.sroa.04.0.copyload = load double, ptr %44, align 16
  %.sroa.25.0.copyload = load double, ptr %.sroa.223.0..sroa_idx, align 8, !tbaa !9
  %.sroa.0.0.copyload = load double, ptr %45, align 16
  %.sroa.2.0.copyload = load double, ptr %.sroa.219.0..sroa_idx, align 8, !tbaa !9
  %55 = call noundef float @_ZN3JPHL42sCalculateClosestPointThroughNewtonRaphsonENS_4Vec3ES0_S0_S0_ffRf(double %.sroa.06.0.copyload, double %.sroa.27.0.copyload, double %.sroa.04.0.copyload, double %.sroa.25.0.copyload, double %38, double %39, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload, float noundef %46, float noundef %47, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %56 = fcmp oge float %55, 0.000000e+00
  %57 = fcmp ole float %55, 1.000000e+00
  %or.cond = and i1 %56, %57
  br i1 %or.cond, label %58, label %63

58:                                               ; preds = %54
  %59 = load float, ptr %7, align 4, !tbaa !5
  %60 = fcmp olt float %59, %.1
  br i1 %60, label %61, label %63

61:                                               ; preds = %58
  %62 = fadd float %55, %43
  br label %63

63:                                               ; preds = %54, %58, %61, %49
  %.463 = phi float [ %.261, %49 ], [ %62, %61 ], [ %.160, %58 ], [ %.160, %54 ]
  %.4 = phi float [ %.2, %49 ], [ %59, %61 ], [ %.1, %58 ], [ %.1, %54 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %28, !llvm.loop !10
}

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH18PathConstraintPath9IsLoopingEv(ptr noundef nonnull align 8 dereferenceable(13)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN3JPHL38sCalculateClosestPointThroughBisectionENS_4Vec3ES0_S0_S0_RfS1_(double, double, double, double, double, double, double, double, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN3JPHL28sCalculatePositionAndTangentENS_4Vec3ES0_S0_S0_fRS0_S1_(double, double, double, double, double, double, double, double, float noundef, ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef float @_ZN3JPHL42sCalculateClosestPointThroughNewtonRaphsonENS_4Vec3ES0_S0_S0_ffRf(double, double, double, double, double, double, double, double, float noundef, float noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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 = { 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 = { 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 #4 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { alwaysinline 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 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass