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

; 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", %"class.std::vector.0", i64, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN13Rasterization23findHeightValByScanlineEP8ParticleR5Cloth(ptr noundef, ptr noundef nonnull align 8 dereferenceable(128)) #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 ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef, i32 noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Rasterization13RasterTerrianER5ClothRN3csf10PointCloudERSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  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 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %20

20:                                               ; preds = %133, %3
  %21 = load i64, ptr %7, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call noundef i64 @_ZNKSt6vectorIN3csf5PointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #4
  %24 = icmp ult i64 %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %136

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %28) #4
  %30 = getelementptr inbounds %"struct.csf::Point", ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %struct.anon, ptr %30, i32 0, i32 0
  %32 = load double, ptr %31, align 8, !tbaa !11
  store double %32, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %34) #4
  %36 = getelementptr inbounds %"struct.csf::Point", ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds %struct.anon, ptr %36, i32 0, i32 2
  %38 = load double, ptr %37, align 8, !tbaa !11
  store double %38, ptr %9, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %39 = load double, ptr %8, align 8, !tbaa !12
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %class.Cloth, ptr %40, i32 0, i32 6
  %42 = getelementptr inbounds %class.Vec3, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds [3 x double], ptr %42, i64 0, i64 0
  %44 = load double, ptr %43, align 8, !tbaa !12
  %45 = fsub double %39, %44
  store double %45, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %46 = load double, ptr %9, align 8, !tbaa !12
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %class.Cloth, ptr %47, i32 0, i32 6
  %49 = getelementptr inbounds %class.Vec3, ptr %48, i32 0, i32 0
  %50 = getelementptr inbounds [3 x double], ptr %49, i64 0, i64 2
  %51 = load double, ptr %50, align 8, !tbaa !12
  %52 = fsub double %46, %51
  store double %52, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %53 = load double, ptr %10, align 8, !tbaa !12
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %class.Cloth, ptr %54, i32 0, i32 7
  %56 = load double, ptr %55, align 8, !tbaa !14
  %57 = fdiv double %53, %56
  %58 = fadd double %57, 5.000000e-01
  %59 = fptosi double %58 to i32
  store i32 %59, ptr %12, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %60 = load double, ptr %11, align 8, !tbaa !12
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %class.Cloth, ptr %61, i32 0, i32 8
  %63 = load double, ptr %62, align 8, !tbaa !27
  %64 = fdiv double %60, %63
  %65 = fadd double %64, 5.000000e-01
  %66 = fptosi double %65 to i32
  store i32 %66, ptr %13, align 4, !tbaa !26
  %67 = load i32, ptr %12, align 4, !tbaa !26
  %68 = icmp sge i32 %67, 0
  br i1 %68, label %69, label %132

69:                                               ; preds = %26
  %70 = load i32, ptr %13, align 4, !tbaa !26
  %71 = icmp sge i32 %70, 0
  br i1 %71, label %72, label %132

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = load i32, ptr %12, align 4, !tbaa !26
  %75 = load i32, ptr %13, align 4, !tbaa !26
  %76 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %73, i32 noundef %74, i32 noundef %75)
  store ptr %76, ptr %14, align 8, !tbaa !5
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = getelementptr inbounds %class.Particle, ptr %77, i32 0, i32 13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %79 = load i64, ptr %7, align 8, !tbaa !9
  %80 = trunc i64 %79 to i32
  store i32 %80, ptr %15, align 4, !tbaa !26
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %78, ptr noundef nonnull align 4 dereferenceable(4) %15)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %81 = load double, ptr %8, align 8, !tbaa !12
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %82)
  %84 = getelementptr inbounds %class.Vec3, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds [3 x double], ptr %84, i64 0, i64 0
  %86 = load double, ptr %85, align 8, !tbaa !12
  %87 = fsub double %81, %86
  %88 = load double, ptr %8, align 8, !tbaa !12
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %89)
  %91 = getelementptr inbounds %class.Vec3, ptr %90, i32 0, i32 0
  %92 = getelementptr inbounds [3 x double], ptr %91, i64 0, i64 0
  %93 = load double, ptr %92, align 8, !tbaa !12
  %94 = fsub double %88, %93
  %95 = load double, ptr %9, align 8, !tbaa !12
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %96)
  %98 = getelementptr inbounds %class.Vec3, ptr %97, i32 0, i32 0
  %99 = getelementptr inbounds [3 x double], ptr %98, i64 0, i64 2
  %100 = load double, ptr %99, align 8, !tbaa !12
  %101 = fsub double %95, %100
  %102 = load double, ptr %9, align 8, !tbaa !12
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %103)
  %105 = getelementptr inbounds %class.Vec3, ptr %104, i32 0, i32 0
  %106 = getelementptr inbounds [3 x double], ptr %105, i64 0, i64 2
  %107 = load double, ptr %106, align 8, !tbaa !12
  %108 = fsub double %102, %107
  %109 = fmul double %101, %108
  %110 = call double @llvm.fmuladd.f64(double %87, double %94, double %109)
  store double %110, ptr %16, align 8, !tbaa !12
  %111 = load double, ptr %16, align 8, !tbaa !12
  %112 = load ptr, ptr %14, align 8, !tbaa !5
  %113 = getelementptr inbounds %class.Particle, ptr %112, i32 0, i32 16
  %114 = load double, ptr %113, align 8, !tbaa !28
  %115 = fcmp olt double %111, %114
  br i1 %115, label %116, label %131

116:                                              ; preds = %72
  %117 = load double, ptr %16, align 8, !tbaa !12
  %118 = load ptr, ptr %14, align 8, !tbaa !5
  %119 = getelementptr inbounds %class.Particle, ptr %118, i32 0, i32 16
  store double %117, ptr %119, align 8, !tbaa !28
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = load i64, ptr %7, align 8, !tbaa !9
  %122 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef %121) #4
  %123 = getelementptr inbounds %"struct.csf::Point", ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds %struct.anon, ptr %123, i32 0, i32 1
  %125 = load double, ptr %124, align 8, !tbaa !11
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = getelementptr inbounds %class.Particle, ptr %126, i32 0, i32 15
  store double %125, ptr %127, align 8, !tbaa !39
  %128 = load i64, ptr %7, align 8, !tbaa !9
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = getelementptr inbounds %class.Particle, ptr %129, i32 0, i32 14
  store i64 %128, ptr %130, align 8, !tbaa !40
  br label %131

131:                                              ; preds = %116, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %132

132:                                              ; preds = %131, %69, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %133

133:                                              ; preds = %132
  %134 = load i64, ptr %7, align 8, !tbaa !9
  %135 = add i64 %134, 1
  store i64 %135, ptr %7, align 8, !tbaa !9
  br label %20, !llvm.loop !41

136:                                              ; preds = %25
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = call noundef i32 @_ZN5Cloth7getSizeEv(ptr noundef nonnull align 8 dereferenceable(128) %138)
  %140 = sext i32 %139 to i64
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %137, i64 noundef %140)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !26
  br label %141

141:                                              ; preds = %171, %136
  %142 = load i32, ptr %17, align 4, !tbaa !26
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = call noundef i32 @_ZN5Cloth7getSizeEv(ptr noundef nonnull align 8 dereferenceable(128) %143)
  %145 = icmp slt i32 %142, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %174

147:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = load i32, ptr %17, align 4, !tbaa !26
  %150 = call noundef ptr @_ZN5Cloth13getParticle1dEi(ptr noundef nonnull align 8 dereferenceable(128) %148, i32 noundef %149)
  store ptr %150, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %151 = load ptr, ptr %18, align 8, !tbaa !5
  %152 = getelementptr inbounds %class.Particle, ptr %151, i32 0, i32 15
  %153 = load double, ptr %152, align 8, !tbaa !39
  store double %153, ptr %19, align 8, !tbaa !12
  %154 = load double, ptr %19, align 8, !tbaa !12
  %155 = fcmp ogt double %154, 0xC202A05F1FF80000
  br i1 %155, label %156, label %162

156:                                              ; preds = %147
  %157 = load double, ptr %19, align 8, !tbaa !12
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = load i32, ptr %17, align 4, !tbaa !26
  %160 = sext i32 %159 to i64
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %158, i64 noundef %160) #4
  store double %157, ptr %161, align 8, !tbaa !12
  br label %170

162:                                              ; preds = %147
  %163 = load ptr, ptr %18, align 8, !tbaa !5
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = call noundef double @_ZN13Rasterization23findHeightValByScanlineEP8ParticleR5Cloth(ptr noundef %163, ptr noundef nonnull align 8 dereferenceable(128) %164)
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = load i32, ptr %17, align 4, !tbaa !26
  %168 = sext i32 %167 to i64
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %166, i64 noundef %168) #4
  store double %165, ptr %169, align 8, !tbaa !12
  br label %170

170:                                              ; preds = %162, %156
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %17, align 4, !tbaa !26
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %17, align 4, !tbaa !26
  br label %141, !llvm.loop !43

174:                                              ; preds = %146
  ret void
}

; 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: 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216)) #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 uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

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

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

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 208}
!29 = !{!"_ZTS8Particle", !30, i64 0, !13, i64 8, !21, i64 16, !21, i64 40, !13, i64 64, !21, i64 72, !21, i64 96, !30, i64 120, !16, i64 124, !16, i64 128, !16, i64 132, !16, i64 136, !31, i64 144, !35, i64 168, !10, i64 192, !13, i64 200, !13, i64 208}
!30 = !{!"bool", !7, i64 0}
!31 = !{!"_ZTSSt6vectorIP8ParticleSaIS1_EE", !32, i64 0}
!32 = !{!"_ZTSSt12_Vector_baseIP8ParticleSaIS1_EE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE12_Vector_implE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!35 = !{!"_ZTSSt6vectorIiSaIiEE", !36, i64 0}
!36 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!39 = !{!29, !13, i64 200}
!40 = !{!29, !10, i64 192}
!41 = distinct !{!41, !42}
!42 = !{!"llvm.loop.mustprogress"}
!43 = distinct !{!43, !42}


; 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
declare dso_local noundef double @_ZN13Rasterization23findHeightValByScanlineEP8ParticleR5Cloth(ptr noundef, ptr noundef nonnull align 8 dereferenceable(128)) 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 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

.lr.ph:                                           ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  br label %13

._crit_edge:                                      ; preds = %63, %3
  %9 = call noundef i32 @_ZN5Cloth7getSizeEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %10 = sext i32 %9 to i64
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %10)
  %11 = call noundef i32 @_ZN5Cloth7getSizeEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph63, label %._crit_edge64

13:                                               ; preds = %.lr.ph, %63
  %.060 = phi i64 [ 0, %.lr.ph ], [ %64, %63 ]
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.060) #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) %1, i64 noundef %.060) #4
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = load <2 x double>, ptr %6, align 8
  %20 = load double, ptr %7, align 8, !tbaa !8
  %21 = insertelement <2 x double> poison, double %15, i64 0
  %22 = insertelement <2 x double> %21, double %18, i64 1
  %23 = insertelement <2 x double> %19, double %20, i64 1
  %24 = fsub <2 x double> %22, %23
  %25 = load <2 x double>, ptr %8, align 8, !tbaa !8
  %26 = fdiv <2 x double> %24, %25
  %27 = fadd <2 x double> %26, <double 5.000000e-01, double 5.000000e-01>
  %28 = fptosi <2 x double> %27 to <2 x i32>
  %29 = icmp sgt <2 x i32> %28, <i32 -1, i32 -1>
  %30 = extractelement <2 x i1> %29, i64 0
  %31 = extractelement <2 x i1> %29, i64 1
  %or.cond = select i1 %30, i1 %31, i1 false
  br i1 %or.cond, label %32, label %63

32:                                               ; preds = %13
  %33 = extractelement <2 x i32> %28, i64 0
  %34 = extractelement <2 x i32> %28, i64 1
  %35 = call noundef ptr @_ZN5Cloth11getParticleEii(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %33, i32 noundef %34)
  %36 = getelementptr inbounds i8, ptr %35, i64 168
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %37 = trunc i64 %.060 to i32
  store i32 %37, ptr %4, align 4, !tbaa !10
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %38 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %35)
  %39 = load double, ptr %38, align 8, !tbaa !8
  %40 = fsub double %15, %39
  %41 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %35)
  %42 = load double, ptr %41, align 8, !tbaa !8
  %43 = fsub double %15, %42
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %35)
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load double, ptr %45, align 8, !tbaa !8
  %47 = fsub double %18, %46
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216) %35)
  %49 = getelementptr inbounds i8, ptr %48, i64 16
  %50 = load double, ptr %49, align 8, !tbaa !8
  %51 = fsub double %18, %50
  %52 = fmul double %47, %51
  %53 = call double @llvm.fmuladd.f64(double %40, double %43, double %52)
  %54 = getelementptr inbounds i8, ptr %35, i64 208
  %55 = load double, ptr %54, align 8, !tbaa !12
  %56 = fcmp olt double %53, %55
  br i1 %56, label %57, label %63

57:                                               ; preds = %32
  store double %53, ptr %54, align 8, !tbaa !12
  %58 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN3csf5PointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.060) #4
  %59 = getelementptr inbounds i8, ptr %58, i64 8
  %60 = load double, ptr %59, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %35, i64 200
  store double %60, ptr %61, align 8, !tbaa !26
  %62 = getelementptr inbounds i8, ptr %35, i64 192
  store i64 %.060, ptr %62, align 8, !tbaa !27
  br label %63

63:                                               ; preds = %32, %57, %13
  %64 = add nuw i64 %.060, 1
  %65 = call noundef i64 @_ZNKSt6vectorIN3csf5PointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %66 = icmp ult i64 %64, %65
  br i1 %66, label %13, label %._crit_edge, !llvm.loop !28

._crit_edge64:                                    ; preds = %74, %._crit_edge
  ret void

.lr.ph63:                                         ; preds = %._crit_edge, %74
  %indvars.iv = phi i64 [ %indvars.iv.next, %74 ], [ 0, %._crit_edge ]
  %67 = trunc nuw nsw i64 %indvars.iv to i32
  %68 = call noundef ptr @_ZN5Cloth13getParticle1dEi(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %67)
  %69 = getelementptr inbounds i8, ptr %68, i64 200
  %70 = load double, ptr %69, align 8, !tbaa !26
  %71 = fcmp ogt double %70, 0xC202A05F1FF80000
  br i1 %71, label %74, label %72

72:                                               ; preds = %.lr.ph63
  %73 = call noundef double @_ZN13Rasterization23findHeightValByScanlineEP8ParticleR5Cloth(ptr noundef nonnull %68, ptr noundef nonnull align 8 dereferenceable(128) %0)
  br label %74

74:                                               ; preds = %.lr.ph63, %72
  %.sink = phi double [ %73, %72 ], [ %70, %.lr.ph63 ]
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv) #4
  store double %.sink, ptr %75, align 8, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %76 = call noundef i32 @_ZN5Cloth7getSizeEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next, %77
  br i1 %78, label %.lr.ph63, label %._crit_edge64, !llvm.loop !30
}

; 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 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN8Particle6getPosEv(ptr noundef nonnull align 8 dereferenceable(216)) 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 uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!13, !9, i64 208}
!13 = !{!"_ZTS8Particle", !14, i64 0, !9, i64 8, !15, i64 16, !15, i64 40, !9, i64 64, !15, i64 72, !15, i64 96, !14, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !16, i64 144, !21, i64 168, !25, i64 192, !9, i64 200, !9, i64 208}
!14 = !{!"bool", !6, i64 0}
!15 = !{!"_ZTS4Vec3", !6, i64 0}
!16 = !{!"_ZTSSt6vectorIP8ParticleSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIP8ParticleSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE17_Vector_impl_dataE", !20, i64 0, !20, i64 8, !20, i64 16}
!20 = !{!"any pointer", !6, i64 0}
!21 = !{!"_ZTSSt6vectorIiSaIiEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !20, i64 0, !20, i64 8, !20, i64 16}
!25 = !{!"long", !6, i64 0}
!26 = !{!13, !9, i64 200}
!27 = !{!13, !25, i64 192}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass