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

; 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::SoftBodySharedSettings" = type { %"class.JPH::RefTarget", %"class.JPH::Array", %"class.JPH::Array.38", %"class.JPH::Array.41", %"class.JPH::Array.44", %"class.JPH::Array.47", %"class.JPH::Array.50", %"class.JPH::Array.53", %"class.JPH::Array.56", %"class.JPH::Array.59", float, %"class.JPH::Array.62", %"class.JPH::Array.65", %"class.JPH::Array.68" }
%"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 }
%"class.JPH::Array.38" = type { i64, i64, ptr }
%"class.JPH::Array.41" = type { i64, i64, ptr }
%"class.JPH::Array.44" = type { i64, i64, ptr }
%"class.JPH::Array.47" = type { i64, i64, ptr }
%"class.JPH::Array.50" = type { i64, i64, ptr }
%"class.JPH::Array.53" = type { i64, i64, ptr }
%"class.JPH::Array.56" = type { i64, i64, ptr }
%"class.JPH::Array.59" = type { i64, i64, ptr }
%"class.JPH::Array.62" = type { i64, i64, ptr }
%"class.JPH::Array.65" = type { i64, i64, ptr }
%"class.JPH::Array.68" = type { i64, i64, ptr }
%"struct.JPH::SoftBodySharedSettings::DihedralBend" = type { [4 x i32], float, float }
%"struct.JPH::SoftBodySharedSettings::Vertex" = type { %"class.JPH::Float3", %"class.JPH::Float3", float }
%"class.JPH::Float3" = type { float, 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(12)) 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) #3 align 2

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH22SoftBodySharedSettings32CalculateBendConstraintConstantsEv(ptr noundef nonnull align 8 dereferenceable(304) %0) #5 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca %"class.JPH::Vec3", align 16
  %12 = alloca %"class.JPH::Vec3", align 16
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca %"class.JPH::Vec3", align 16
  %16 = alloca %"class.JPH::Vec3", align 16
  %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 %"class.JPH::Vec3", align 16
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca %"class.JPH::Vec3", align 16
  %26 = alloca %"class.JPH::Vec3", align 16
  store ptr %0, ptr %2, align 8, !tbaa !5
  %27 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  %28 = getelementptr inbounds %"class.JPH::SoftBodySharedSettings", ptr %27, i32 0, i32 4
  store ptr %28, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = call noundef ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings12DihedralBendENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  store ptr %30, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = call noundef ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings12DihedralBendENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %31)
  store ptr %32, ptr %5, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %167, %1
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = icmp ne ptr %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  br label %170

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %39, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #8
  %40 = getelementptr inbounds %"class.JPH::SoftBodySharedSettings", ptr %27, i32 0, i32 1
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds [4 x i32], ptr %42, i64 0, i64 0
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %45)
  %47 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Vertex", ptr %46, i32 0, i32 0
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(12) %47)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #8
  %48 = getelementptr inbounds %"class.JPH::SoftBodySharedSettings", ptr %27, i32 0, i32 1
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds [4 x i32], ptr %50, i64 0, i64 1
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %53)
  %55 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Vertex", ptr %54, i32 0, i32 0
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(12) %55)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  %56 = getelementptr inbounds %"class.JPH::SoftBodySharedSettings", ptr %27, i32 0, i32 1
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds [4 x i32], ptr %58, i64 0, i64 2
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %56, i64 noundef %61)
  %63 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Vertex", ptr %62, i32 0, i32 0
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(12) %63)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #8
  %64 = getelementptr inbounds %"class.JPH::SoftBodySharedSettings", ptr %27, i32 0, i32 1
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds [4 x i32], ptr %66, i64 0, i64 3
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %69)
  %71 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Vertex", ptr %70, i32 0, i32 0
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(12) %71)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %7, i64 16, i1 false), !tbaa.struct !11
  %72 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
  %73 = load double, ptr %72, align 16
  %74 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
  %75 = load double, ptr %74, align 8
  %76 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %8, double %73, double %75)
  %77 = getelementptr inbounds %"class.JPH::Vec3", ptr %11, i32 0, i32 0
  %78 = getelementptr inbounds %union.anon, ptr %77, i32 0, i32 0
  %79 = getelementptr inbounds { double, double }, ptr %78, i32 0, i32 0
  %80 = extractvalue { double, double } %76, 0
  store double %80, ptr %79, align 16
  %81 = getelementptr inbounds { double, double }, ptr %78, i32 0, i32 1
  %82 = extractvalue { double, double } %76, 1
  store double %82, ptr %81, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 %7, i64 16, i1 false), !tbaa.struct !11
  %83 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %84 = load double, ptr %83, align 16
  %85 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %86 = load double, ptr %85, align 8
  %87 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %9, double %84, double %86)
  %88 = getelementptr inbounds %"class.JPH::Vec3", ptr %13, i32 0, i32 0
  %89 = getelementptr inbounds %union.anon, ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds { double, double }, ptr %89, i32 0, i32 0
  %91 = extractvalue { double, double } %87, 0
  store double %91, ptr %90, align 16
  %92 = getelementptr inbounds { double, double }, ptr %89, i32 0, i32 1
  %93 = extractvalue { double, double } %87, 1
  store double %93, ptr %92, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 %7, i64 16, i1 false), !tbaa.struct !11
  %94 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %95 = load double, ptr %94, align 16
  %96 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %97 = load double, ptr %96, align 8
  %98 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %10, double %95, double %97)
  %99 = getelementptr inbounds %"class.JPH::Vec3", ptr %15, i32 0, i32 0
  %100 = getelementptr inbounds %union.anon, ptr %99, i32 0, i32 0
  %101 = getelementptr inbounds { double, double }, ptr %100, i32 0, i32 0
  %102 = extractvalue { double, double } %98, 0
  store double %102, ptr %101, align 16
  %103 = getelementptr inbounds { double, double }, ptr %100, i32 0, i32 1
  %104 = extractvalue { double, double } %98, 1
  store double %104, ptr %103, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 %13, i64 16, i1 false), !tbaa.struct !11
  %105 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %106 = load double, ptr %105, align 16
  %107 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %108 = load double, ptr %107, align 8
  %109 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %11, double %106, double %108)
  %110 = getelementptr inbounds %"class.JPH::Vec3", ptr %17, i32 0, i32 0
  %111 = getelementptr inbounds %union.anon, ptr %110, i32 0, i32 0
  %112 = getelementptr inbounds { double, double }, ptr %111, i32 0, i32 0
  %113 = extractvalue { double, double } %109, 0
  store double %113, ptr %112, align 16
  %114 = getelementptr inbounds { double, double }, ptr %111, i32 0, i32 1
  %115 = extractvalue { double, double } %109, 1
  store double %115, ptr %114, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 %11, i64 16, i1 false), !tbaa.struct !11
  %116 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %117 = load double, ptr %116, align 16
  %118 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %119 = load double, ptr %118, align 8
  %120 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %15, double %117, double %119)
  %121 = getelementptr inbounds %"class.JPH::Vec3", ptr %19, i32 0, i32 0
  %122 = getelementptr inbounds %union.anon, ptr %121, i32 0, i32 0
  %123 = getelementptr inbounds { double, double }, ptr %122, i32 0, i32 0
  %124 = extractvalue { double, double } %120, 0
  store double %124, ptr %123, align 16
  %125 = getelementptr inbounds { double, double }, ptr %122, i32 0, i32 1
  %126 = extractvalue { double, double } %120, 1
  store double %126, ptr %125, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %127 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %17)
  %128 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %19)
  %129 = fmul float %127, %128
  %130 = call noundef float @_ZSt4sqrtf(float noundef %129)
  store float %130, ptr %21, align 4, !tbaa !13
  %131 = load float, ptr %21, align 4, !tbaa !13
  %132 = fcmp olt float %131, 0x3D71979980000000
  br i1 %132, label %133, label %136

133:                                              ; preds = %38
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %134, i32 0, i32 2
  store float 0.000000e+00, ptr %135, align 4, !tbaa !15
  br label %166

136:                                              ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %17, i64 16, i1 false), !tbaa.struct !11
  %137 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %138 = load double, ptr %137, align 16
  %139 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %140 = load double, ptr %139, align 8
  %141 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %19, double %138, double %140)
  %142 = getelementptr inbounds %"class.JPH::Vec3", ptr %23, i32 0, i32 0
  %143 = getelementptr inbounds %union.anon, ptr %142, i32 0, i32 0
  %144 = getelementptr inbounds { double, double }, ptr %143, i32 0, i32 0
  %145 = extractvalue { double, double } %141, 0
  store double %145, ptr %144, align 16
  %146 = getelementptr inbounds { double, double }, ptr %143, i32 0, i32 1
  %147 = extractvalue { double, double } %141, 1
  store double %147, ptr %146, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 %11, i64 16, i1 false), !tbaa.struct !11
  %148 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 0
  %149 = load double, ptr %148, align 16
  %150 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 1
  %151 = load double, ptr %150, align 8
  %152 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %23, double %149, double %151)
  %153 = call noundef float @_ZN3JPH4SignIfEET_S1_(float noundef %152)
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  store float %153, ptr %22, align 4, !tbaa !13
  %154 = load float, ptr %22, align 4, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %26, ptr align 16 %19, i64 16, i1 false), !tbaa.struct !11
  %155 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 0
  %156 = load double, ptr %155, align 16
  %157 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 1
  %158 = load double, ptr %157, align 8
  %159 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %17, double %156, double %158)
  %160 = load float, ptr %21, align 4, !tbaa !13
  %161 = fdiv float %159, %160
  %162 = call noundef float @_ZN3JPH15ACosApproximateEf(float noundef %161)
  %163 = fmul float %154, %162
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %164, i32 0, i32 2
  store float %163, ptr %165, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %166

166:                                              ; preds = %136, %133
  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 16, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %167

167:                                              ; preds = %166
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::DihedralBend", ptr %168, i32 1
  store ptr %169, ptr %4, align 8, !tbaa !5
  br label %33

170:                                              ; preds = %37
  ret void
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) #6

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH4SignIfEET_S1_(float noundef) #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN3JPH15ACosApproximateEf(float noundef) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { alwaysinline 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 #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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 16, !12}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !14, i64 20}
!16 = !{!"_ZTSN3JPH22SoftBodySharedSettings12DihedralBendE", !7, i64 0, !14, i64 16, !14, i64 20}


; 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 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 #2 align 2

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH22SoftBodySharedSettings32CalculateBendConstraintConstantsEv(ptr noundef nonnull align 8 dereferenceable(304) %0) local_unnamed_addr #4 align 2 {
  %2 = alloca %"class.JPH::Vec3", align 16
  %3 = alloca %"class.JPH::Vec3", align 16
  %4 = alloca %"class.JPH::Vec3", align 16
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = tail call noundef ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings12DihedralBendENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  %13 = tail call noundef ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings12DihedralBendENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  %.not32 = icmp eq ptr %12, %13
  br i1 %.not32, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.217.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %15 = getelementptr inbounds i8, ptr %6, i64 8
  %16 = getelementptr inbounds i8, ptr %7, i64 8
  %17 = getelementptr inbounds i8, ptr %8, i64 8
  %18 = getelementptr inbounds i8, ptr %9, i64 8
  %19 = getelementptr inbounds i8, ptr %10, i64 8
  br label %20

._crit_edge:                                      ; preds = %66, %1
  ret void

20:                                               ; preds = %.lr.ph, %66
  %.033 = phi ptr [ %12, %.lr.ph ], [ %68, %66 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #7
  %21 = load i32, ptr %.033, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %22)
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(12) %23)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  %24 = getelementptr inbounds i8, ptr %.033, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %26)
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(12) %27)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  %28 = getelementptr inbounds i8, ptr %.033, i64 8
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = zext i32 %29 to i64
  %31 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %30)
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(12) %31)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %32 = getelementptr inbounds i8, ptr %.033, i64 12
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = zext i32 %33 to i64
  %35 = call noundef nonnull align 4 dereferenceable(28) ptr @_ZN3JPH5ArrayINS_22SoftBodySharedSettings6VertexENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %34)
  call void @_ZN3JPH4Vec3C2ERKNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(12) %35)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %.sroa.016.0.copyload = load double, ptr %2, align 16
  %.sroa.217.0.copyload = load double, ptr %.sroa.217.0..sroa_idx, align 8, !tbaa !9
  %36 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %3, double %.sroa.016.0.copyload, double %.sroa.217.0.copyload)
  %37 = extractvalue { double, double } %36, 0
  store double %37, ptr %6, align 16
  %38 = extractvalue { double, double } %36, 1
  store double %38, ptr %15, align 8
  %.sroa.013.0.copyload = load double, ptr %2, align 16
  %.sroa.214.0.copyload = load double, ptr %.sroa.217.0..sroa_idx, align 8, !tbaa !9
  %39 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %4, double %.sroa.013.0.copyload, double %.sroa.214.0.copyload)
  %40 = extractvalue { double, double } %39, 0
  %41 = extractvalue { double, double } %39, 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  %.sroa.011.0.copyload = load double, ptr %2, align 16
  %.sroa.212.0.copyload = load double, ptr %.sroa.217.0..sroa_idx, align 8, !tbaa !9
  %42 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.011.0.copyload, double %.sroa.212.0.copyload)
  %43 = extractvalue { double, double } %42, 0
  store double %43, ptr %7, align 16
  %44 = extractvalue { double, double } %42, 1
  store double %44, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  %45 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %6, double %40, double %41)
  %46 = extractvalue { double, double } %45, 0
  store double %46, ptr %8, align 16
  %47 = extractvalue { double, double } %45, 1
  store double %47, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #7
  %.sroa.07.0.copyload = load double, ptr %6, align 16
  %.sroa.28.0.copyload = load double, ptr %15, align 8, !tbaa !9
  %48 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %7, double %.sroa.07.0.copyload, double %.sroa.28.0.copyload)
  %49 = extractvalue { double, double } %48, 0
  store double %49, ptr %9, align 16
  %50 = extractvalue { double, double } %48, 1
  store double %50, ptr %18, align 8
  %51 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %8)
  %52 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %9)
  %53 = fmul float %51, %52
  %54 = call noundef float @_ZSt4sqrtf(float noundef %53)
  %55 = fcmp olt float %54, 0x3D71979980000000
  br i1 %55, label %66, label %56

56:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  %.sroa.03.0.copyload = load double, ptr %8, align 16
  %.sroa.24.0.copyload = load double, ptr %17, align 8, !tbaa !9
  %57 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %9, double %.sroa.03.0.copyload, double %.sroa.24.0.copyload)
  %58 = extractvalue { double, double } %57, 0
  store double %58, ptr %10, align 16
  %59 = extractvalue { double, double } %57, 1
  store double %59, ptr %19, align 8
  %.sroa.01.0.copyload = load double, ptr %6, align 16
  %.sroa.22.0.copyload = load double, ptr %15, align 8, !tbaa !9
  %60 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %10, double %.sroa.01.0.copyload, double %.sroa.22.0.copyload)
  %61 = call noundef float @_ZN3JPH4SignIfEET_S1_(float noundef %60)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  %.sroa.0.0.copyload = load double, ptr %9, align 16
  %.sroa.2.0.copyload = load double, ptr %18, align 8, !tbaa !9
  %62 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %8, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %63 = fdiv float %62, %54
  %64 = call noundef float @_ZN3JPH15ACosApproximateEf(float noundef %63)
  %65 = fmul float %61, %64
  br label %66

66:                                               ; preds = %20, %56
  %.sink = phi float [ %65, %56 ], [ 0.000000e+00, %20 ]
  %67 = getelementptr inbounds i8, ptr %.033, i64 20
  store float %.sink, ptr %67, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #7
  %68 = getelementptr inbounds i8, ptr %.033, i64 24
  %.not = icmp eq ptr %68, %13
  br i1 %.not, label %._crit_edge, label %20
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) local_unnamed_addr #5

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH4SignIfEET_S1_(float noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZN3JPH15ACosApproximateEf(float noundef) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 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 = { alwaysinline 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}


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