; LLVM IR from jianboqi/CSF :: src (c2cdist)

; 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.csf::Point" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { double, double, double }
%class.Cloth = type { i32, i32, double, %"class.std::vector.5", double, double, %class.Vec3, double, double, %"class.std::vector.10", i32, i32 }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Particle, std::allocator<Particle>>::_Vector_impl" }
%"struct.std::_Vector_base<Particle, std::allocator<Particle>>::_Vector_impl" = type { %"struct.std::_Vector_base<Particle, std::allocator<Particle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Particle, std::allocator<Particle>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Vec3 = type { [3 x double] }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Particle = type { i8, double, %class.Vec3, %class.Vec3, double, %class.Vec3, %class.Vec3, i8, i32, i32, i32, i32, %"class.std::vector.15", %"class.std::vector", i64, double, double }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl" }
%"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.c2cdist = type { double }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7c2cdist18calCloud2CloudDistER5ClothRN3csf10PointCloudERSt6vectorIiSaIiEES8_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4) #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca double, align 8
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef 0)
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %186, %5
  %34 = load i64, ptr %11, align 8, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = call noundef i64 @_ZNKSt6vectorIN3csf5PointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #4
  %37 = icmp ult i64 %34, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %189

39:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load i64, ptr %11, align 8, !tbaa !9
  %42 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %41) #4
  %43 = getelementptr inbounds %"struct.csf::Point", ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds %struct.anon, ptr %43, i32 0, i32 0
  %45 = load double, ptr %44, align 8, !tbaa !11
  store double %45, ptr %12, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load i64, ptr %11, align 8, !tbaa !9
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #4
  %49 = getelementptr inbounds %"struct.csf::Point", ptr %48, i32 0, i32 0
  %50 = getelementptr inbounds %struct.anon, ptr %49, i32 0, i32 2
  %51 = load double, ptr %50, align 8, !tbaa !11
  store double %51, ptr %13, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %52 = load double, ptr %12, align 8, !tbaa !12
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %class.Cloth, ptr %53, i32 0, i32 6
  %55 = getelementptr inbounds %class.Vec3, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds [3 x double], ptr %55, i64 0, i64 0
  %57 = load double, ptr %56, align 8, !tbaa !12
  %58 = fsub double %52, %57
  store double %58, ptr %14, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %59 = load double, ptr %13, align 8, !tbaa !12
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %class.Cloth, ptr %60, i32 0, i32 6
  %62 = getelementptr inbounds %class.Vec3, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds [3 x double], ptr %62, i64 0, i64 2
  %64 = load double, ptr %63, align 8, !tbaa !12
  %65 = fsub double %59, %64
  store double %65, ptr %15, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %66 = load double, ptr %14, align 8, !tbaa !12
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = getelementptr inbounds %class.Cloth, ptr %67, i32 0, i32 7
  %69 = load double, ptr %68, align 8, !tbaa !14
  %70 = fdiv double %66, %69
  %71 = fptosi double %70 to i32
  store i32 %71, ptr %16, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %72 = load double, ptr %15, align 8, !tbaa !12
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %class.Cloth, ptr %73, i32 0, i32 8
  %75 = load double, ptr %74, align 8, !tbaa !27
  %76 = fdiv double %72, %75
  %77 = fptosi double %76 to i32
  store i32 %77, ptr %17, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %78 = load i32, ptr %16, align 4, !tbaa !26
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %18, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %80 = load i32, ptr %17, align 4, !tbaa !26
  store i32 %80, ptr %19, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %81 = load i32, ptr %16, align 4, !tbaa !26
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %20, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %83 = load i32, ptr %17, align 4, !tbaa !26
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %21, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %85 = load i32, ptr %16, align 4, !tbaa !26
  store i32 %85, ptr %22, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %86 = load i32, ptr %17, align 4, !tbaa !26
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %23, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %88 = load double, ptr %14, align 8, !tbaa !12
  %89 = load i32, ptr %16, align 4, !tbaa !26
  %90 = sitofp i32 %89 to double
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %class.Cloth, ptr %91, i32 0, i32 7
  %93 = load double, ptr %92, align 8, !tbaa !14
  %94 = fneg double %90
  %95 = call double @llvm.fmuladd.f64(double %94, double %93, double %88)
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds %class.Cloth, ptr %96, i32 0, i32 7
  %98 = load double, ptr %97, align 8, !tbaa !14
  %99 = fdiv double %95, %98
  store double %99, ptr %24, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %100 = load double, ptr %15, align 8, !tbaa !12
  %101 = load i32, ptr %17, align 4, !tbaa !26
  %102 = sitofp i32 %101 to double
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %class.Cloth, ptr %103, i32 0, i32 8
  %105 = load double, ptr %104, align 8, !tbaa !27
  %106 = fneg double %102
  %107 = call double @llvm.fmuladd.f64(double %106, double %105, double %100)
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = getelementptr inbounds %class.Cloth, ptr %108, i32 0, i32 8
  %110 = load double, ptr %109, align 8, !tbaa !27
  %111 = fdiv double %107, %110
  store double %111, ptr %25, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = load i32, ptr %16, align 4, !tbaa !26
  %114 = load i32, ptr %17, align 4, !tbaa !26
  %115 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %112, i32 noundef %113, i32 noundef %114)
  %116 = getelementptr inbounds %class.Particle, ptr %115, i32 0, i32 5
  %117 = getelementptr inbounds %class.Vec3, ptr %116, i32 0, i32 0
  %118 = getelementptr inbounds [3 x double], ptr %117, i64 0, i64 1
  %119 = load double, ptr %118, align 8, !tbaa !12
  %120 = load double, ptr %24, align 8, !tbaa !12
  %121 = fsub double 1.000000e+00, %120
  %122 = fmul double %119, %121
  %123 = load double, ptr %25, align 8, !tbaa !12
  %124 = fsub double 1.000000e+00, %123
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = load i32, ptr %22, align 4, !tbaa !26
  %127 = load i32, ptr %23, align 4, !tbaa !26
  %128 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %125, i32 noundef %126, i32 noundef %127)
  %129 = getelementptr inbounds %class.Particle, ptr %128, i32 0, i32 5
  %130 = getelementptr inbounds %class.Vec3, ptr %129, i32 0, i32 0
  %131 = getelementptr inbounds [3 x double], ptr %130, i64 0, i64 1
  %132 = load double, ptr %131, align 8, !tbaa !12
  %133 = load double, ptr %24, align 8, !tbaa !12
  %134 = fsub double 1.000000e+00, %133
  %135 = fmul double %132, %134
  %136 = load double, ptr %25, align 8, !tbaa !12
  %137 = fmul double %135, %136
  %138 = call double @llvm.fmuladd.f64(double %122, double %124, double %137)
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = load i32, ptr %20, align 4, !tbaa !26
  %141 = load i32, ptr %21, align 4, !tbaa !26
  %142 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %139, i32 noundef %140, i32 noundef %141)
  %143 = getelementptr inbounds %class.Particle, ptr %142, i32 0, i32 5
  %144 = getelementptr inbounds %class.Vec3, ptr %143, i32 0, i32 0
  %145 = getelementptr inbounds [3 x double], ptr %144, i64 0, i64 1
  %146 = load double, ptr %145, align 8, !tbaa !12
  %147 = load double, ptr %24, align 8, !tbaa !12
  %148 = fmul double %146, %147
  %149 = load double, ptr %25, align 8, !tbaa !12
  %150 = call double @llvm.fmuladd.f64(double %148, double %149, double %138)
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = load i32, ptr %18, align 4, !tbaa !26
  %153 = load i32, ptr %19, align 4, !tbaa !26
  %154 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %151, i32 noundef %152, i32 noundef %153)
  %155 = getelementptr inbounds %class.Particle, ptr %154, i32 0, i32 5
  %156 = getelementptr inbounds %class.Vec3, ptr %155, i32 0, i32 0
  %157 = getelementptr inbounds [3 x double], ptr %156, i64 0, i64 1
  %158 = load double, ptr %157, align 8, !tbaa !12
  %159 = load double, ptr %24, align 8, !tbaa !12
  %160 = fmul double %158, %159
  %161 = load double, ptr %25, align 8, !tbaa !12
  %162 = fsub double 1.000000e+00, %161
  %163 = call double @llvm.fmuladd.f64(double %160, double %162, double %150)
  store double %163, ptr %26, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  %164 = load double, ptr %26, align 8, !tbaa !12
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = load i64, ptr %11, align 8, !tbaa !9
  %167 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %165, i64 noundef %166) #4
  %168 = getelementptr inbounds %"struct.csf::Point", ptr %167, i32 0, i32 0
  %169 = getelementptr inbounds %struct.anon, ptr %168, i32 0, i32 1
  %170 = load double, ptr %169, align 8, !tbaa !11
  %171 = fsub double %164, %170
  store double %171, ptr %27, align 8, !tbaa !12
  %172 = load double, ptr %27, align 8, !tbaa !12
  %173 = call double @llvm.fabs.f64(double %172)
  %174 = getelementptr inbounds %class.c2cdist, ptr %30, i32 0, i32 0
  %175 = load double, ptr %174, align 8, !tbaa !28
  %176 = fcmp olt double %173, %175
  br i1 %176, label %177, label %181

177:                                              ; preds = %39
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  %179 = load i64, ptr %11, align 8, !tbaa !9
  %180 = trunc i64 %179 to i32
  store i32 %180, ptr %28, align 4, !tbaa !26
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %178, ptr noundef nonnull align 4 dereferenceable(4) %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  br label %185

181:                                              ; preds = %39
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %183 = load i64, ptr %11, align 8, !tbaa !9
  %184 = trunc i64 %183 to i32
  store i32 %184, ptr %29, align 4, !tbaa !26
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %182, ptr noundef nonnull align 4 dereferenceable(4) %29)
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  br label %185

185:                                              ; preds = %181, %177
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %186

186:                                              ; preds = %185
  %187 = load i64, ptr %11, align 8, !tbaa !9
  %188 = add i64 %187, 1
  store i64 %188, ptr %11, align 8, !tbaa !9
  br label %33, !llvm.loop !30

189:                                              ; preds = %38
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !13, i64 80}
!15 = !{!"_ZTS5Cloth", !16, i64 0, !16, i64 4, !13, i64 8, !17, i64 16, !13, i64 40, !13, i64 48, !21, i64 56, !13, i64 80, !13, i64 88, !22, i64 96, !16, i64 120, !16, i64 124}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSSt6vectorI8ParticleSaIS0_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseI8ParticleSaIS0_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseI8ParticleSaIS0_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseI8ParticleSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTS4Vec3", !7, i64 0}
!22 = !{!"_ZTSSt6vectorIdSaIdEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!16, !16, i64 0}
!27 = !{!15, !13, i64 88}
!28 = !{!29, !13, i64 0}
!29 = !{!"_ZTS7c2cdist", !13, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7c2cdist18calCloud2CloudDistER5ClothRN3csf10PointCloudERSt6vectorIiSaIiEES8_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4) local_unnamed_addr #0 align 2 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0)
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0)
  %8 = tail call noundef i64 @_ZNKSt6vectorIN3csf5PointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %9 = getelementptr inbounds i8, ptr %1, i64 56
  %10 = getelementptr inbounds i8, ptr %1, i64 72
  %11 = getelementptr inbounds i8, ptr %1, i64 80
  %12 = getelementptr inbounds i8, ptr %1, i64 88
  br label %13

._crit_edge:                                      ; preds = %71, %5
  ret void

13:                                               ; preds = %.lr.ph, %71
  %.059 = phi i64 [ 0, %.lr.ph ], [ %72, %71 ]
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.059) #4
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.059) #4
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = load double, ptr %9, align 8, !tbaa !8
  %20 = fsub double %15, %19
  %21 = load double, ptr %10, align 8, !tbaa !8
  %22 = fsub double %18, %21
  %23 = load double, ptr %11, align 8, !tbaa !10
  %24 = fdiv double %20, %23
  %25 = fptosi double %24 to i32
  %26 = load double, ptr %12, align 8, !tbaa !23
  %27 = fdiv double %22, %26
  %28 = fptosi double %27 to i32
  %29 = add nsw i32 %25, 1
  %30 = add nsw i32 %28, 1
  %31 = sitofp i32 %25 to double
  %32 = fneg double %31
  %33 = call double @llvm.fmuladd.f64(double %32, double %23, double %20)
  %34 = fdiv double %33, %23
  %35 = sitofp i32 %28 to double
  %36 = fneg double %35
  %37 = call double @llvm.fmuladd.f64(double %36, double %26, double %22)
  %38 = fdiv double %37, %26
  %39 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef %25, i32 noundef %28)
  %40 = getelementptr inbounds i8, ptr %39, i64 80
  %41 = load double, ptr %40, align 8, !tbaa !8
  %42 = fsub double 1.000000e+00, %34
  %43 = fmul double %41, %42
  %44 = fsub double 1.000000e+00, %38
  %45 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef %25, i32 noundef %30)
  %46 = getelementptr inbounds i8, ptr %45, i64 80
  %47 = load double, ptr %46, align 8, !tbaa !8
  %48 = fmul double %47, %42
  %49 = fmul double %38, %48
  %50 = call double @llvm.fmuladd.f64(double %43, double %44, double %49)
  %51 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef %29, i32 noundef %30)
  %52 = getelementptr inbounds i8, ptr %51, i64 80
  %53 = load double, ptr %52, align 8, !tbaa !8
  %54 = fmul double %34, %53
  %55 = call double @llvm.fmuladd.f64(double %54, double %38, double %50)
  %56 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef %29, i32 noundef %28)
  %57 = getelementptr inbounds i8, ptr %56, i64 80
  %58 = load double, ptr %57, align 8, !tbaa !8
  %59 = fmul double %34, %58
  %60 = call double @llvm.fmuladd.f64(double %59, double %44, double %55)
  %61 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.059) #4
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  %63 = load double, ptr %62, align 8, !tbaa !5
  %64 = fsub double %60, %63
  %65 = call double @llvm.fabs.f64(double %64)
  %66 = load double, ptr %0, align 8, !tbaa !24
  %67 = fcmp olt double %65, %66
  %68 = trunc i64 %.059 to i32
  br i1 %67, label %69, label %70

69:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store i32 %68, ptr %6, align 4, !tbaa !26
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  br label %71

70:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  store i32 %68, ptr %7, align 4, !tbaa !26
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  br label %71

71:                                               ; preds = %70, %69
  %72 = add nuw i64 %.059, 1
  %73 = call noundef i64 @_ZNKSt6vectorIN3csf5PointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  %74 = icmp ult i64 %72, %73
  br i1 %74, label %13, label %._crit_edge, !llvm.loop !27
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"double", !6, i64 0}
!10 = !{!11, !9, i64 80}
!11 = !{!"_ZTS5Cloth", !12, i64 0, !12, i64 4, !9, i64 8, !13, i64 16, !9, i64 40, !9, i64 48, !18, i64 56, !9, i64 80, !9, i64 88, !19, i64 96, !12, i64 120, !12, i64 124}
!12 = !{!"int", !6, i64 0}
!13 = !{!"_ZTSSt6vectorI8ParticleSaIS0_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseI8ParticleSaIS0_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseI8ParticleSaIS0_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseI8ParticleSaIS0_EE17_Vector_impl_dataE", !17, i64 0, !17, i64 8, !17, i64 16}
!17 = !{!"any pointer", !6, i64 0}
!18 = !{!"_ZTS4Vec3", !6, i64 0}
!19 = !{!"_ZTSSt6vectorIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !17, i64 0, !17, i64 8, !17, i64 16}
!23 = !{!11, !9, i64 88}
!24 = !{!25, !9, i64 0}
!25 = !{!"_ZTS7c2cdist", !9, i64 0}
!26 = !{!12, !12, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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