; LLVM IR from Slingshot-Physics/slingshot-community :: common/geometry/src (epa)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.geometry::types::pointBaryCoord_t" = type { %class.Vector3, %class.Vector4 }
%class.Vector3 = type { [3 x float] }
%class.Vector4 = type { [4 x float] }
%"struct.geometry::types::epa::epaMesh_t" = type { %"class.geometry::mesh::TriangleGraphMesh", [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], i32 }
%"class.geometry::mesh::TriangleGraphMesh" = type { i32, [128 x %"struct.geometry::types::leanNeighborTriangle_t"] }
%"struct.geometry::types::leanNeighborTriangle_t" = type { [3 x i32], [3 x i32] }
%"struct.geometry::types::minkowskiDiffVertex_t" = type { i32, i32, %class.Vector3, %class.Vector3, %class.Vector3 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8geometry4mesh17TriangleGraphMeshILj128EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(3076)) #1 align 2

declare void @_ZN8geometry8triangle19closestPointToPointERK7Vector3S3_S3_S3_(ptr dead_on_unwind writable sret(%"struct.geometry::types::pointBaryCoord_t") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2

; 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 i32 @_ZN8geometry3epa22deleteVisibleTrianglesERNS_5types3epa9epaMesh_tERK7Vector3S7_(ptr noundef nonnull align 4 dereferenceable(19976) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %class.Vector3, align 4
  %10 = alloca %class.Vector3, align 4
  %11 = alloca %class.Vector3, align 4
  %12 = alloca %class.Vector3, align 4
  %13 = alloca float, align 4
  %14 = alloca %"struct.geometry::types::pointBaryCoord_t", align 4
  %15 = alloca %class.Vector3, align 4
  %16 = alloca %class.Vector3, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %17, i32 0, i32 0
  %19 = call noundef i32 @_ZNK8geometry4mesh17TriangleGraphMeshILj128EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(3076) %18)
  store i32 %19, ptr %8, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %160, %3
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %163

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %26, i32 0, i32 0
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = sub i32 %28, 1
  %30 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %27, i32 noundef %29)
  %31 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds [3 x i32], ptr %31, i64 0, i64 0
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %25, i64 0, i64 %34
  %36 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %35, i32 0, i32 2
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %37, i32 0, i32 1
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %39, i32 0, i32 0
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = sub i32 %41, 1
  %43 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %40, i32 noundef %42)
  %44 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds [3 x i32], ptr %44, i64 0, i64 1
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %38, i64 0, i64 %47
  %49 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %52, i32 0, i32 0
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = sub i32 %54, 1
  %56 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %53, i32 noundef %55)
  %57 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds [3 x i32], ptr %57, i64 0, i64 2
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %51, i64 0, i64 %60
  %62 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %61, i32 0, i32 2
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN8geometry10calcNormalERK7Vector3S2_S2_S2_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %9, ptr noundef nonnull align 4 dereferenceable(12) %36, ptr noundef nonnull align 4 dereferenceable(12) %49, ptr noundef nonnull align 4 dereferenceable(12) %62, ptr noundef nonnull align 4 dereferenceable(12) %63)
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #4
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %66, i32 0, i32 0
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = sub i32 %68, 1
  %70 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %67, i32 noundef %69)
  %71 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds [3 x i32], ptr %71, i64 0, i64 0
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %65, i64 0, i64 %74
  %76 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %75, i32 0, i32 2
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %79, i32 0, i32 0
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = sub i32 %81, 1
  %83 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %80, i32 noundef %82)
  %84 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", 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 = sext i32 %86 to i64
  %88 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %78, i64 0, i64 %87
  %89 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %88, i32 0, i32 2
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %12, ptr noundef nonnull align 4 dereferenceable(12) %76, ptr noundef nonnull align 4 dereferenceable(12) %89)
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %92, i32 0, i32 0
  %94 = load i32, ptr %8, align 4, !tbaa !9
  %95 = sub i32 %94, 1
  %96 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %93, i32 noundef %95)
  %97 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %96, i32 0, i32 0
  %98 = getelementptr inbounds [3 x i32], ptr %97, i64 0, i64 2
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %91, i64 0, i64 %100
  %102 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %101, i32 0, i32 2
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %11, ptr noundef nonnull align 4 dereferenceable(12) %12, ptr noundef nonnull align 4 dereferenceable(12) %102)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store float 3.000000e+00, ptr %13, align 4, !tbaa !11
  call void @_ZNK7Vector3dvERKf(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %10, ptr noundef nonnull align 4 dereferenceable(12) %11, ptr noundef nonnull align 4 dereferenceable(4) %13)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 28, ptr %14) #4
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %103, i32 0, i32 1
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %105, i32 0, i32 0
  %107 = load i32, ptr %8, align 4, !tbaa !9
  %108 = sub i32 %107, 1
  %109 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %106, i32 noundef %108)
  %110 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds [3 x i32], ptr %110, i64 0, i64 0
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %104, i64 0, i64 %113
  %115 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %114, i32 0, i32 2
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %116, i32 0, i32 1
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %118, i32 0, i32 0
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = sub i32 %120, 1
  %122 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %119, i32 noundef %121)
  %123 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds [3 x i32], ptr %123, i64 0, i64 1
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %117, i64 0, i64 %126
  %128 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %127, i32 0, i32 2
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %129, i32 0, i32 1
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %131, i32 0, i32 0
  %133 = load i32, ptr %8, align 4, !tbaa !9
  %134 = sub i32 %133, 1
  %135 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %132, i32 noundef %134)
  %136 = getelementptr inbounds %"struct.geometry::types::leanNeighborTriangle_t", ptr %135, i32 0, i32 0
  %137 = getelementptr inbounds [3 x i32], ptr %136, i64 0, i64 2
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %130, i64 0, i64 %139
  %141 = getelementptr inbounds %"struct.geometry::types::minkowskiDiffVertex_t", ptr %140, i32 0, i32 2
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN8geometry8triangle19closestPointToPointERK7Vector3S3_S3_S3_(ptr dead_on_unwind writable sret(%"struct.geometry::types::pointBaryCoord_t") align 4 %14, ptr noundef nonnull align 4 dereferenceable(12) %115, ptr noundef nonnull align 4 dereferenceable(12) %128, ptr noundef nonnull align 4 dereferenceable(12) %141, ptr noundef nonnull align 4 dereferenceable(12) %142)
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #4
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %15, ptr noundef nonnull align 4 dereferenceable(12) %143, ptr noundef nonnull align 4 dereferenceable(12) %10)
  %144 = call noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %15)
  %145 = fcmp ogt float %144, 0.000000e+00
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #4
  br i1 %145, label %146, label %151

146:                                              ; preds = %23
  %147 = getelementptr inbounds %"struct.geometry::types::pointBaryCoord_t", ptr %14, i32 0, i32 0
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind writable sret(%class.Vector3) align 4 %16, ptr noundef nonnull align 4 dereferenceable(12) %147, ptr noundef nonnull align 4 dereferenceable(12) %148)
  %149 = call noundef float @_ZNK7Vector39magnitudeEv(ptr noundef nonnull align 4 dereferenceable(12) %16)
  %150 = fcmp ogt float %149, 0x3EE4F8B580000000
  br label %151

151:                                              ; preds = %146, %23
  %152 = phi i1 [ false, %23 ], [ %150, %146 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #4
  br i1 %152, label %153, label %160

153:                                              ; preds = %151
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = getelementptr inbounds %"struct.geometry::types::epa::epaMesh_t", ptr %154, i32 0, i32 0
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = sub i32 %156, 1
  call void @_ZN8geometry4mesh17TriangleGraphMeshILj128EE6removeEi(ptr noundef nonnull align 4 dereferenceable(3076) %155, i32 noundef %157)
  %158 = load i32, ptr %7, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %7, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %153, %151
  %161 = load i32, ptr %8, align 4, !tbaa !9
  %162 = add i32 %161, -1
  store i32 %162, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 28, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #4
  br label %20, !llvm.loop !13

163:                                              ; preds = %20
  %164 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 %164
}

declare void @_ZN8geometry10calcNormalERK7Vector3S2_S2_S2_(ptr dead_on_unwind writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3plERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3dvERKf(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3miERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7Vector39magnitudeEv(ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry4mesh17TriangleGraphMeshILj128EE6removeEi(ptr noundef nonnull align 4 dereferenceable(3076), i32 noundef) #3 align 2

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

%"struct.geometry::types::pointBaryCoord_t" = type { %class.Vector3, %class.Vector4 }
%class.Vector3 = type { [3 x float] }
%class.Vector4 = type { [4 x float] }
%"struct.geometry::types::minkowskiDiffVertex_t" = type { i32, i32, %class.Vector3, %class.Vector3, %class.Vector3 }

; 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK8geometry4mesh17TriangleGraphMeshILj128EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(3076)) local_unnamed_addr #1 align 2

declare void @_ZN8geometry8triangle19closestPointToPointERK7Vector3S3_S3_S3_(ptr dead_on_unwind writable sret(%"struct.geometry::types::pointBaryCoord_t") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2

; 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 i32 @_ZN8geometry3epa22deleteVisibleTrianglesERNS_5types3epa9epaMesh_tERK7Vector3S7_(ptr noundef nonnull align 4 dereferenceable(19976) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) local_unnamed_addr #3 {
  %4 = alloca %class.Vector3, align 4
  %5 = alloca %class.Vector3, align 4
  %6 = alloca %class.Vector3, align 4
  %7 = alloca %class.Vector3, align 4
  %8 = alloca float, align 4
  %9 = alloca %"struct.geometry::types::pointBaryCoord_t", align 4
  %10 = alloca %class.Vector3, align 4
  %11 = alloca %class.Vector3, align 4
  %12 = tail call noundef i32 @_ZNK8geometry4mesh17TriangleGraphMeshILj128EE4sizeEv(ptr noundef nonnull align 4 dereferenceable(3076) %0)
  %.not38 = icmp eq i32 %12, 0
  br i1 %.not38, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 3076
  br label %14

14:                                               ; preds = %.lr.ph, %65
  %.040 = phi i32 [ %12, %.lr.ph ], [ %15, %65 ]
  %.03739 = phi i32 [ 0, %.lr.ph ], [ %.1, %65 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #4
  %15 = add i32 %.040, -1
  %16 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %18, i32 2
  %20 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %23, i32 2
  %25 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %28, i32 2
  call void @_ZN8geometry10calcNormalERK7Vector3S2_S2_S2_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %4, ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %24, ptr noundef nonnull align 4 dereferenceable(12) %29, ptr noundef nonnull align 4 dereferenceable(12) %1)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #4
  %30 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %32, i32 2
  %34 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %37, i32 2
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %7, ptr noundef nonnull align 4 dereferenceable(12) %33, ptr noundef nonnull align 4 dereferenceable(12) %38)
  %39 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %42, i32 2
  call void @_ZNK7Vector3plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %6, ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %43)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  store float 3.000000e+00, ptr %8, align 4, !tbaa !9
  call void @_ZNK7Vector3dvERKf(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %5, ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %9) #4
  %44 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %46, i32 2
  %48 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %51, i32 2
  %53 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %54 = getelementptr inbounds i8, ptr %53, i64 8
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [384 x %"struct.geometry::types::minkowskiDiffVertex_t"], ptr %13, i64 0, i64 %56, i32 2
  call void @_ZN8geometry8triangle19closestPointToPointERK7Vector3S3_S3_S3_(ptr dead_on_unwind nonnull writable sret(%"struct.geometry::types::pointBaryCoord_t") align 4 %9, ptr noundef nonnull align 4 dereferenceable(12) %47, ptr noundef nonnull align 4 dereferenceable(12) %52, ptr noundef nonnull align 4 dereferenceable(12) %57, ptr noundef nonnull align 4 dereferenceable(12) %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #4
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %10, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
  %58 = call noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %10)
  %59 = fcmp ogt float %58, 0.000000e+00
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #4
  br i1 %59, label %60, label %.critedge

60:                                               ; preds = %14
  call void @_ZNK7Vector3miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector3) align 4 %11, ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %2)
  %61 = call noundef float @_ZNK7Vector39magnitudeEv(ptr noundef nonnull align 4 dereferenceable(12) %11)
  %62 = fcmp ogt float %61, 0x3EE4F8B580000000
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  br i1 %62, label %63, label %65

63:                                               ; preds = %60
  call void @_ZN8geometry4mesh17TriangleGraphMeshILj128EE6removeEi(ptr noundef nonnull align 4 dereferenceable(3076) %0, i32 noundef %15)
  %64 = add nsw i32 %.03739, 1
  br label %65

.critedge:                                        ; preds = %14
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  br label %65

65:                                               ; preds = %.critedge, %63, %60
  %.1 = phi i32 [ %64, %63 ], [ %.03739, %60 ], [ %.03739, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #4
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %._crit_edge, label %14, !llvm.loop !11

._crit_edge:                                      ; preds = %65, %3
  %.037.lcssa = phi i32 [ 0, %3 ], [ %.1, %65 ]
  ret i32 %.037.lcssa
}

declare void @_ZN8geometry10calcNormalERK7Vector3S2_S2_S2_(ptr dead_on_unwind writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZN8geometry4mesh17TriangleGraphMeshILj128EEixEj(ptr noundef nonnull align 4 dereferenceable(3076), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3plERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3dvERKf(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7Vector33dotERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Vector3miERKS_(ptr dead_on_unwind noalias writable sret(%class.Vector3) align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7Vector39magnitudeEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8geometry4mesh17TriangleGraphMeshILj128EE6removeEi(ptr noundef nonnull align 4 dereferenceable(3076), i32 noundef) local_unnamed_addr #3 align 2

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


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