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

; 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::SoftBodyShape" = type { %"class.JPH::Shape.base", ptr }
%"class.JPH::Shape.base" = type <{ ptr, %"class.JPH::RefTarget", [4 x i8], i64, i8, i8 }>
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.JPH::SoftBodyShape::SBSGetTrianglesContext" = type <{ %"class.JPH::Mat44", i32, [12 x i8] }>
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::Vec4" = type { %union.anon.0 }
%union.anon.0 = type { <4 x float> }
%"struct.JPH::SoftBodySharedSettings::Face" = type { [3 x i32], i32 }
%"class.JPH::SoftBodyVertex" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Plane", i32, i8, float, float }
%"class.JPH::Plane" = type { %"class.JPH::Vec4" }
%"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: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties8GetFacesEv(ptr noundef nonnull align 16 dereferenceable(372)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3JPH5ArrayINS_22SoftBodySharedSettings4FaceENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 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) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties11GetVerticesEv(ptr noundef nonnull align 16 dereferenceable(372)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties12GetMaterialsEv(ptr noundef nonnull align 16 dereferenceable(372)) #4 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK3JPH13SoftBodyShape16GetTrianglesNextERNS_5Shape19GetTrianglesContextEiPNS_6Float3EPPKNS_15PhysicsMaterialE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 16 dereferenceable(4288) %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) unnamed_addr #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca %"class.JPH::Vec3", align 16
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = alloca %"class.JPH::Vec3", align 16
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca %"class.JPH::Vec3", align 16
  %24 = alloca %"class.JPH::Vec3", align 16
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %26, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %27 = getelementptr inbounds %"class.JPH::SoftBodyShape", ptr %25, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties8GetFacesEv(ptr noundef nonnull align 16 dereferenceable(372) %28)
  store ptr %29, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %30 = getelementptr inbounds %"class.JPH::SoftBodyShape", ptr %25, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties11GetVerticesEv(ptr noundef nonnull align 16 dereferenceable(372) %31)
  store ptr %32, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %33 = getelementptr inbounds %"class.JPH::SoftBodyShape", ptr %25, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties12GetMaterialsEv(ptr noundef nonnull align 16 dereferenceable(372) %34)
  store ptr %35, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = call noundef i64 @_ZNK3JPH5ArrayINS_22SoftBodySharedSettings4FaceENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36)
  %38 = trunc i64 %37 to i32
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.JPH::SoftBodyShape::SBSGetTrianglesContext", ptr %39, i32 0, i32 1
  %41 = load i32, ptr %40, align 16, !tbaa !20
  %42 = sub nsw i32 %38, %41
  store i32 %42, ptr %16, align 4, !tbaa !9
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %44 = load i32, ptr %43, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  store i32 %44, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %141, %5
  %46 = load i32, ptr %17, align 4, !tbaa !9
  %47 = load i32, ptr %15, align 4, !tbaa !9
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %144

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.JPH::SoftBodyShape::SBSGetTrianglesContext", ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 16, !tbaa !20
  %55 = load i32, ptr %17, align 4, !tbaa !9
  %56 = add nsw i32 %54, %55
  %57 = sext i32 %56 to i64
  %58 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_22SoftBodySharedSettings4FaceENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %57)
  store ptr %58, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.JPH::SoftBodyShape::SBSGetTrianglesContext", ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = load ptr, ptr %18, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Face", ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds [3 x i32], ptr %63, i64 0, i64 0
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = call noundef nonnull align 16 dereferenceable(80) ptr @_ZNK3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %66)
  %68 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %67, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 %68, i64 16, i1 false), !tbaa.struct !23
  %69 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %70 = load double, ptr %69, align 16
  %71 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %72 = load double, ptr %71, align 8
  %73 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %60, double %70, double %72)
  %74 = getelementptr inbounds %"class.JPH::Vec3", ptr %19, i32 0, i32 0
  %75 = getelementptr inbounds %union.anon, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds { double, double }, ptr %75, i32 0, i32 0
  %77 = extractvalue { double, double } %73, 0
  store double %77, ptr %76, align 16
  %78 = getelementptr inbounds { double, double }, ptr %75, i32 0, i32 1
  %79 = extractvalue { double, double } %73, 1
  store double %79, ptr %78, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #7
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.JPH::SoftBodyShape::SBSGetTrianglesContext", ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = load ptr, ptr %18, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Face", ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds [3 x i32], ptr %84, i64 0, i64 1
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = call noundef nonnull align 16 dereferenceable(80) ptr @_ZNK3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %82, i64 noundef %87)
  %89 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %88, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %89, i64 16, i1 false), !tbaa.struct !23
  %90 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %91 = load double, ptr %90, align 16
  %92 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %93 = load double, ptr %92, align 8
  %94 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %81, double %91, double %93)
  %95 = getelementptr inbounds %"class.JPH::Vec3", ptr %21, i32 0, i32 0
  %96 = getelementptr inbounds %union.anon, ptr %95, i32 0, i32 0
  %97 = getelementptr inbounds { double, double }, ptr %96, i32 0, i32 0
  %98 = extractvalue { double, double } %94, 0
  store double %98, ptr %97, align 16
  %99 = getelementptr inbounds { double, double }, ptr %96, i32 0, i32 1
  %100 = extractvalue { double, double } %94, 1
  store double %100, ptr %99, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #7
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.JPH::SoftBodyShape::SBSGetTrianglesContext", ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = load ptr, ptr %18, align 8, !tbaa !5
  %105 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Face", ptr %104, i32 0, i32 0
  %106 = getelementptr inbounds [3 x i32], ptr %105, i64 0, i64 2
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = zext i32 %107 to i64
  %109 = call noundef nonnull align 16 dereferenceable(80) ptr @_ZNK3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %108)
  %110 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %109, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %110, i64 16, i1 false), !tbaa.struct !23
  %111 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %112 = load double, ptr %111, align 16
  %113 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %114 = load double, ptr %113, align 8
  %115 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %102, double %112, double %114)
  %116 = getelementptr inbounds %"class.JPH::Vec3", ptr %23, i32 0, i32 0
  %117 = getelementptr inbounds %union.anon, ptr %116, i32 0, i32 0
  %118 = getelementptr inbounds { double, double }, ptr %117, i32 0, i32 0
  %119 = extractvalue { double, double } %115, 0
  store double %119, ptr %118, align 16
  %120 = getelementptr inbounds { double, double }, ptr %117, i32 0, i32 1
  %121 = extractvalue { double, double } %115, 1
  store double %121, ptr %120, align 8
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = getelementptr inbounds %"class.JPH::Float3", ptr %122, i32 1
  store ptr %123, ptr %9, align 8, !tbaa !5
  call void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %19, ptr noundef %122)
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %"class.JPH::Float3", ptr %124, i32 1
  store ptr %125, ptr %9, align 8, !tbaa !5
  call void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %21, ptr noundef %124)
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %"class.JPH::Float3", ptr %126, i32 1
  store ptr %127, ptr %9, align 8, !tbaa !5
  call void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %23, ptr noundef %126)
  %128 = load ptr, ptr %10, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %140

130:                                              ; preds = %50
  %131 = load ptr, ptr %14, align 8, !tbaa !5
  %132 = load ptr, ptr %18, align 8, !tbaa !5
  %133 = getelementptr inbounds %"struct.JPH::SoftBodySharedSettings::Face", ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !25
  %135 = zext i32 %134 to i64
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3JPH5ArrayINS_8RefConstINS_15PhysicsMaterialEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %131, i64 noundef %135)
  %137 = call noundef ptr @_ZNK3JPH8RefConstINS_15PhysicsMaterialEEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %136)
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = getelementptr inbounds ptr, ptr %138, i32 1
  store ptr %139, ptr %10, align 8, !tbaa !5
  store ptr %137, ptr %138, align 8, !tbaa !5
  br label %140

140:                                              ; preds = %130, %50
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %17, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %17, align 4, !tbaa !9
  br label %45, !llvm.loop !27

144:                                              ; preds = %49
  %145 = load i32, ptr %15, align 4, !tbaa !9
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = getelementptr inbounds %"struct.JPH::SoftBodyShape::SBSGetTrianglesContext", ptr %146, i32 0, i32 1
  %148 = load i32, ptr %147, align 16, !tbaa !20
  %149 = add nsw i32 %148, %145
  store i32 %149, ptr %147, align 16, !tbaa !20
  %150 = load i32, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  ret i32 %150
}

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef) #6 align 2

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { 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 #6 = { 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 #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_ZTSN3JPH13SoftBodyShapeE", !13, i64 0, !6, i64 32}
!13 = !{!"_ZTSN3JPH5ShapeE", !14, i64 8, !17, i64 16, !18, i64 24, !19, i64 25}
!14 = !{!"_ZTSN3JPH9RefTargetINS_5ShapeEEE", !15, i64 0}
!15 = !{!"_ZTSSt6atomicIjE", !16, i64 0}
!16 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSN3JPH10EShapeTypeE", !7, i64 0}
!19 = !{!"_ZTSN3JPH13EShapeSubTypeE", !7, i64 0}
!20 = !{!21, !10, i64 64}
!21 = !{!"_ZTSN3JPH13SoftBodyShape22SBSGetTrianglesContextE", !22, i64 0, !10, i64 64}
!22 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!23 = !{i64 0, i64 16, !24}
!24 = !{!7, !7, i64 0}
!25 = !{!26, !10, i64 12}
!26 = !{!"_ZTSN3JPH22SoftBodySharedSettings4FaceE", !7, i64 0, !10, i64 12}
!27 = distinct !{!27, !28}
!28 = !{!"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
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties8GetFacesEv(ptr noundef nonnull align 16 dereferenceable(372)) local_unnamed_addr #1 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK3JPH13SoftBodyShape16GetTrianglesNextERNS_5Shape19GetTrianglesContextEiPNS_6Float3EPPKNS_15PhysicsMaterialE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(40) %0, ptr noundef nonnull align 16 dereferenceable(4288) %1, i32 noundef %2, ptr noundef %3, ptr noundef writeonly %4) unnamed_addr #1 align 2 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  store i32 %2, ptr %6, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties8GetFacesEv(ptr noundef nonnull align 16 dereferenceable(372) %12)
  %14 = load ptr, ptr %11, align 8, !tbaa !9
  %15 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties11GetVerticesEv(ptr noundef nonnull align 16 dereferenceable(372) %14)
  %16 = load ptr, ptr %11, align 8, !tbaa !9
  %17 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH24SoftBodyMotionProperties12GetMaterialsEv(ptr noundef nonnull align 16 dereferenceable(372) %16)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %18 = tail call noundef i64 @_ZNK3JPH5ArrayINS_22SoftBodySharedSettings4FaceENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %19 = trunc i64 %18 to i32
  %20 = getelementptr inbounds i8, ptr %1, i64 64
  %21 = load i32, ptr %20, align 16, !tbaa !19
  %22 = sub nsw i32 %19, %21
  store i32 %22, ptr %7, align 4, !tbaa !5
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5
  %26 = getelementptr inbounds i8, ptr %8, i64 8
  %27 = getelementptr inbounds i8, ptr %9, i64 8
  %28 = getelementptr inbounds i8, ptr %10, i64 8
  br label %31

._crit_edge:                                      ; preds = %69, %5
  %29 = load i32, ptr %20, align 16, !tbaa !19
  %30 = add nsw i32 %29, %24
  store i32 %30, ptr %20, align 16, !tbaa !19
  ret i32 %24

31:                                               ; preds = %.lr.ph, %69
  %.037 = phi ptr [ %3, %.lr.ph ], [ %61, %69 ]
  %.03236 = phi ptr [ %4, %.lr.ph ], [ %.1, %69 ]
  %.03335 = phi i32 [ 0, %.lr.ph ], [ %70, %69 ]
  %32 = load i32, ptr %20, align 16, !tbaa !19
  %33 = add nsw i32 %32, %.03335
  %34 = sext i32 %33 to i64
  %35 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_22SoftBodySharedSettings4FaceENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %34)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = zext i32 %36 to i64
  %38 = call noundef nonnull align 16 dereferenceable(80) ptr @_ZNK3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %37)
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %.sroa.03.0.copyload = load double, ptr %39, align 16
  %.sroa.24.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 24
  %.sroa.24.0.copyload = load double, ptr %.sroa.24.0..sroa_idx, align 8, !tbaa !22
  %40 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %1, double %.sroa.03.0.copyload, double %.sroa.24.0.copyload)
  %41 = extractvalue { double, double } %40, 0
  store double %41, ptr %8, align 16
  %42 = extractvalue { double, double } %40, 1
  store double %42, ptr %26, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  %43 = getelementptr inbounds i8, ptr %35, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = call noundef nonnull align 16 dereferenceable(80) ptr @_ZNK3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %45)
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  %.sroa.01.0.copyload = load double, ptr %47, align 16
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %46, i64 24
  %.sroa.22.0.copyload = load double, ptr %.sroa.22.0..sroa_idx, align 8, !tbaa !22
  %48 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %1, double %.sroa.01.0.copyload, double %.sroa.22.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 %27, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #6
  %51 = getelementptr inbounds i8, ptr %35, i64 8
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = zext i32 %52 to i64
  %54 = call noundef nonnull align 16 dereferenceable(80) ptr @_ZNK3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %53)
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  %.sroa.0.0.copyload = load double, ptr %55, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %54, i64 24
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !22
  %56 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %1, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %57 = extractvalue { double, double } %56, 0
  store double %57, ptr %10, align 16
  %58 = extractvalue { double, double } %56, 1
  store double %58, ptr %28, align 8
  %59 = getelementptr inbounds i8, ptr %.037, i64 12
  call void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %8, ptr noundef %.037)
  %60 = getelementptr inbounds i8, ptr %.037, i64 24
  call void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %9, ptr noundef nonnull %59)
  %61 = getelementptr inbounds i8, ptr %.037, i64 36
  call void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16) %10, ptr noundef nonnull %60)
  %.not = icmp eq ptr %.03236, null
  br i1 %.not, label %69, label %62

62:                                               ; preds = %31
  %63 = getelementptr inbounds i8, ptr %35, i64 12
  %64 = load i32, ptr %63, align 4, !tbaa !23
  %65 = zext i32 %64 to i64
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3JPH5ArrayINS_8RefConstINS_15PhysicsMaterialEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %65)
  %67 = call noundef ptr @_ZNK3JPH8RefConstINS_15PhysicsMaterialEEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %66)
  %68 = getelementptr inbounds i8, ptr %.03236, i64 8
  store ptr %67, ptr %.03236, align 8, !tbaa !25
  br label %69

69:                                               ; preds = %62, %31
  %.1 = phi ptr [ %68, %62 ], [ null, %31 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  %70 = add nuw nsw i32 %.03335, 1
  %exitcond.not = icmp eq i32 %70, %24
  br i1 %exitcond.not, label %._crit_edge, label %31, !llvm.loop !26
}

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZNK3JPH4Vec311StoreFloat3EPNS_6Float3E(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef) local_unnamed_addr #5 align 2

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 = { 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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !18, i64 32}
!10 = !{!"_ZTSN3JPH13SoftBodyShapeE", !11, i64 0, !18, i64 32}
!11 = !{!"_ZTSN3JPH5ShapeE", !12, i64 8, !15, i64 16, !16, i64 24, !17, i64 25}
!12 = !{!"_ZTSN3JPH9RefTargetINS_5ShapeEEE", !13, i64 0}
!13 = !{!"_ZTSSt6atomicIjE", !14, i64 0}
!14 = !{!"_ZTSSt13__atomic_baseIjE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSN3JPH10EShapeTypeE", !7, i64 0}
!17 = !{!"_ZTSN3JPH13EShapeSubTypeE", !7, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!20, !6, i64 64}
!20 = !{!"_ZTSN3JPH13SoftBodyShape22SBSGetTrianglesContextE", !21, i64 0, !6, i64 64}
!21 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !6, i64 12}
!24 = !{!"_ZTSN3JPH22SoftBodySharedSettings4FaceE", !7, i64 0, !6, i64 12}
!25 = !{!18, !18, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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