; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/levelset.ll (ZN8LevelSet27_calculateCurvatureAtVertexEi)

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

%"class.vmath::vec3" = type { float, float, float }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = 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.LevelSet = type { i32, i32, i32, double, i32, %class.TriangleMesh, %class.Array3d.20, %class.Array3d.22, %class.Array3d.24, %"class.std::vector.10", double, i32, %class.Array3d.24 }
%class.TriangleMesh = type { %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector.0", i32, i32, i32, double, %"class.std::vector.5", %"class.std::vector.10", %class.Array3d }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.15", i32, [4 x i8] }>
%class.Array3d.20 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>
%class.Array3d.22 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], i32, i32, [4 x i8] }>
%"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.Array3d.24 = type { i32, i32, i32, ptr, i8, i8, i32 }

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3

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

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

declare void @_ZN5vmathmiERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LevelSet25_getCurvatureSamplePointsEiRSt6vectorIN5vmath4vec3ESaIS2_EERS0_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(448), i32 noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN8LevelSet27_calculateCurvatureAtVertexEi(ptr noundef nonnull align 8 dereferenceable(448) %0, i32 noundef %1) #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca %"class.std::vector.15", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca %"class.vmath::vec3", align 4
  %12 = alloca %"class.vmath::vec3", align 4
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca %"class.vmath::vec3", align 4
  %15 = alloca %"class.vmath::vec3", align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca %"class.vmath::vec3", align 4
  %20 = alloca double, align 8
  %21 = alloca %"class.vmath::vec3", align 4
  %22 = alloca %"class.vmath::vec3", align 4
  %23 = alloca double, align 8
  %24 = alloca %"class.vmath::vec3", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %25 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #8
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #8
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  %26 = load i32, ptr %4, align 4, !tbaa !9
  invoke void @_ZN8LevelSet25_getCurvatureSamplePointsEiRSt6vectorIN5vmath4vec3ESaIS2_EERS0_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(448) %25, i32 noundef %26, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %27 unwind label %55

27:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %28 = getelementptr inbounds %class.LevelSet, ptr %25, i32 0, i32 10
  %29 = load double, ptr %28, align 8, !tbaa !11
  %30 = getelementptr inbounds %class.LevelSet, ptr %25, i32 0, i32 3
  %31 = load double, ptr %30, align 8, !tbaa !41
  %32 = fmul double %29, %31
  store double %32, ptr %9, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %33 = load double, ptr %9, align 8, !tbaa !42
  %34 = load double, ptr %9, align 8, !tbaa !42
  %35 = fmul double %33, %34
  store double %35, ptr %10, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #8
  %36 = getelementptr inbounds %class.LevelSet, ptr %25, i32 0, i32 5
  %37 = getelementptr inbounds %class.TriangleMesh, ptr %36, i32 0, i32 2
  %38 = load i32, ptr %4, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %37, i64 noundef %39) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %40, i64 12, i1 false), !tbaa.struct !43
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12)
          to label %41 unwind label %59

41:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13)
          to label %42 unwind label %63

42:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 12, ptr %14) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %43 unwind label %67

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #8
  %44 = getelementptr inbounds %class.LevelSet, ptr %25, i32 0, i32 5
  %45 = getelementptr inbounds %class.TriangleMesh, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %4, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %47) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %48, i64 12, i1 false), !tbaa.struct !43
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  store double 0.000000e+00, ptr %17, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %137, %43
  %50 = load i32, ptr %18, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  %53 = icmp ult i64 %51, %52
  br i1 %53, label %71, label %54

54:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %142

55:                                               ; preds = %2
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %7, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %8, align 4
  br label %147

59:                                               ; preds = %27
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %7, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %8, align 4
  br label %146

63:                                               ; preds = %41
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %7, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %8, align 4
  br label %145

67:                                               ; preds = %42
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %7, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %8, align 4
  br label %144

71:                                               ; preds = %49
  %72 = load i32, ptr %18, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %73) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %74, i64 12, i1 false), !tbaa.struct !43
  %75 = load i32, ptr %18, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %76) #8
  %78 = load i32, ptr %77, align 4, !tbaa !9
  store i32 %78, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #8
  invoke void @_ZN5vmathmiERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %19, ptr noundef nonnull align 4 dereferenceable(12) %12, ptr noundef nonnull align 4 dereferenceable(12) %15)
          to label %79 unwind label %106

79:                                               ; preds = %71
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %19, i64 12, i1 false), !tbaa.struct !43
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %19) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %80 = invoke noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %14, ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %81 unwind label %110

81:                                               ; preds = %79
  %82 = fpext float %80 to double
  store double %82, ptr %20, align 8, !tbaa !42
  %83 = load double, ptr %20, align 8, !tbaa !42
  %84 = load double, ptr %10, align 8, !tbaa !42
  %85 = fcmp olt double %83, %84
  br i1 %85, label %86, label %136

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #8
  %87 = getelementptr inbounds %class.LevelSet, ptr %25, i32 0, i32 5
  %88 = load i32, ptr %16, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %12, i64 12, i1 false), !tbaa.struct !43
  invoke void @_ZN12TriangleMesh23getTriangleNormalSmoothEjN5vmath4vec3E(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %21, ptr noundef nonnull align 8 dereferenceable(232) %87, i32 noundef %88, ptr noundef %22)
          to label %89 unwind label %114

89:                                               ; preds = %86
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %21, i64 12, i1 false), !tbaa.struct !43
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %21) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %22) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %90 = invoke noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %11, ptr noundef nonnull align 4 dereferenceable(12) %13)
          to label %91 unwind label %118

91:                                               ; preds = %89
  %92 = fsub float 1.000000e+00, %90
  %93 = fpext float %92 to double
  %94 = load double, ptr %20, align 8, !tbaa !42
  %95 = call double @sqrt(double noundef %94) #8
  %96 = load double, ptr %9, align 8, !tbaa !42
  %97 = fdiv double %95, %96
  %98 = fsub double 1.000000e+00, %97
  %99 = fmul double %93, %98
  store double %99, ptr %23, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 12, ptr %24) #8
  invoke void @_ZN5vmath9normalizeERKNS_4vec3E(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %24, ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %100 unwind label %122

100:                                              ; preds = %91
  %101 = invoke noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %24, ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %102 unwind label %126

102:                                              ; preds = %100
  %103 = fpext float %101 to double
  %104 = fcmp ogt double %103, 0.000000e+00
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %24) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  br i1 %104, label %105, label %131

105:                                              ; preds = %102
  store double 0.000000e+00, ptr %23, align 8, !tbaa !42
  br label %131

106:                                              ; preds = %71
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %7, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  br label %141

110:                                              ; preds = %79
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %7, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %8, align 4
  br label %140

114:                                              ; preds = %86
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %7, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %8, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %22) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #8
  br label %140

118:                                              ; preds = %89
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %7, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %8, align 4
  br label %135

122:                                              ; preds = %91
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %7, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %8, align 4
  br label %130

126:                                              ; preds = %100
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %7, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %8, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %24) #8
  br label %130

130:                                              ; preds = %126, %122
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  br label %135

131:                                              ; preds = %105, %102
  %132 = load double, ptr %23, align 8, !tbaa !42
  %133 = load double, ptr %17, align 8, !tbaa !42
  %134 = fadd double %133, %132
  store double %134, ptr %17, align 8, !tbaa !42
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %136

135:                                              ; preds = %130, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %140

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

137:                                              ; preds = %136
  %138 = load i32, ptr %18, align 4, !tbaa !9
  %139 = add i32 %138, 1
  store i32 %139, ptr %18, align 4, !tbaa !9
  br label %49, !llvm.loop !45

140:                                              ; preds = %135, %114, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %141

141:                                              ; preds = %140, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %15) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #8
  br label %144

142:                                              ; preds = %54
  %143 = load double, ptr %17, align 8, !tbaa !42
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %15) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #8
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #8
  ret double %143

144:                                              ; preds = %141, %67
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  br label %145

145:                                              ; preds = %144, %63
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #8
  br label %146

146:                                              ; preds = %145, %59
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %147

147:                                              ; preds = %146, %55
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #8
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #8
  br label %148

148:                                              ; preds = %147
  %149 = load ptr, ptr %7, align 8
  %150 = load i32, ptr %8, align 4
  %151 = insertvalue { ptr, i32 } poison, ptr %149, 0
  %152 = insertvalue { ptr, i32 } %151, i32 %150, 1
  resume { ptr, i32 } %152
}

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

declare void @_ZN12TriangleMesh23getTriangleNormalSmoothEjN5vmath4vec3E(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 8 dereferenceable(232), i32 noundef, ptr noundef) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5vmath9normalizeERKNS_4vec3E(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 4 dereferenceable(12)) #7

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 400}
!12 = !{!"_ZTS8LevelSet", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !10, i64 24, !14, i64 32, !37, i64 264, !39, i64 304, !40, i64 344, !27, i64 376, !13, i64 400, !10, i64 408, !40, i64 416}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_ZTS12TriangleMesh", !15, i64 0, !15, i64 24, !15, i64 48, !19, i64 72, !10, i64 96, !10, i64 100, !10, i64 104, !13, i64 112, !23, i64 120, !27, i64 144, !31, i64 168}
!15 = !{!"_ZTSSt6vectorIN5vmath4vec3ESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN5vmath4vec3ESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt6vectorI8TriangleSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseI8TriangleSaIS0_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"_ZTSSt6vectorIdSaIdEE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!31 = !{!"_ZTS7Array3dISt6vectorIiSaIiEEE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !32, i64 24, !33, i64 32, !10, i64 56}
!32 = !{!"bool", !7, i64 0}
!33 = !{!"_ZTSSt6vectorIiSaIiEE", !34, i64 0}
!34 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!37 = !{!"_ZTS7Array3dIfE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !32, i64 24, !38, i64 28, !10, i64 32}
!38 = !{!"float", !7, i64 0}
!39 = !{!"_ZTS7Array3dIiE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !32, i64 24, !10, i64 28, !10, i64 32}
!40 = !{!"_ZTS7Array3dIbE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !32, i64 24, !32, i64 25, !10, i64 28}
!41 = !{!12, !13, i64 16}
!42 = !{!13, !13, i64 0}
!43 = !{i64 0, i64 4, !44, i64 4, i64 4, !44, i64 8, i64 4, !44}
!44 = !{!38, !38, i64 0}
!45 = distinct !{!45, !46}
!46 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.vmath::vec3" = type { float, float, float }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = 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 }

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3

; 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

declare void @_ZN5vmathmiERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LevelSet25_getCurvatureSamplePointsEiRSt6vectorIN5vmath4vec3ESaIS2_EERS0_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(448), i32 noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN8LevelSet27_calculateCurvatureAtVertexEi(ptr noundef nonnull align 8 dereferenceable(448) %0, i32 noundef %1) local_unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::vector.15", align 8
  %5 = alloca %"class.vmath::vec3", align 4
  %6 = alloca %"class.vmath::vec3", align 4
  %7 = alloca %"class.vmath::vec3", align 4
  %8 = alloca %"class.vmath::vec3", align 4
  %9 = alloca %"class.vmath::vec3", align 4
  %10 = alloca %"class.vmath::vec3", align 4
  %11 = alloca %"class.vmath::vec3", align 4
  %12 = alloca %"class.vmath::vec3", align 4
  %13 = alloca %"class.vmath::vec3", align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #9
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #9
  invoke void @_ZN8LevelSet25_getCurvatureSamplePointsEiRSt6vectorIN5vmath4vec3ESaIS2_EERS0_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(448) %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %14 unwind label %30

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 400
  %16 = load double, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !39
  %19 = fmul double %16, %18
  %20 = fmul double %19, %19
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #9
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  %22 = getelementptr inbounds i8, ptr %0, i64 80
  %23 = sext i32 %1 to i64
  %24 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %23) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %24, i64 12, i1 false), !tbaa.struct !40
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #9
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %25 unwind label %32

25:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #9
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
          to label %26 unwind label %34

26:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #9
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %27 unwind label %36

27:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #9
  %28 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %23) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %28, i64 12, i1 false), !tbaa.struct !40
  %29 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  %.not = icmp eq i64 %29, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %65, %27
  %.021.lcssa = phi double [ 0.000000e+00, %27 ], [ %.122, %65 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #9
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  ret double %.021.lcssa

30:                                               ; preds = %2
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %74

32:                                               ; preds = %14
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %73

34:                                               ; preds = %25
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %72

36:                                               ; preds = %26
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %71

.lr.ph:                                           ; preds = %27, %65
  %38 = phi i64 [ %67, %65 ], [ 0, %27 ]
  %.02041 = phi i32 [ %66, %65 ], [ 0, %27 ]
  %.02140 = phi double [ %.122, %65 ], [ 0.000000e+00, %27 ]
  %39 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %38) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %39, i64 12, i1 false), !tbaa.struct !40
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %38) #9
  %41 = load i32, ptr %40, align 4, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #9
  invoke void @_ZN5vmathmiERKNS_4vec3ES2_(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %10, ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %9)
          to label %42 unwind label %59

42:                                               ; preds = %.lr.ph
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %10, i64 12, i1 false), !tbaa.struct !40
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #9
  %43 = call noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %44 = fpext float %43 to double
  %45 = fcmp ogt double %20, %44
  br i1 %45, label %46, label %65

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %12, ptr noundef nonnull align 4 dereferenceable(12) %6, i64 12, i1 false), !tbaa.struct !40
  invoke void @_ZN12TriangleMesh23getTriangleNormalSmoothEjN5vmath4vec3E(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %11, ptr noundef nonnull align 8 dereferenceable(232) %21, i32 noundef %41, ptr noundef nonnull %12)
          to label %47 unwind label %61

47:                                               ; preds = %46
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %11, i64 12, i1 false), !tbaa.struct !40
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #9
  %48 = call noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %7)
  %49 = call double @sqrt(double noundef %44) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #9
  invoke void @_ZN5vmath9normalizeERKNS_4vec3E(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %13, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %50 unwind label %63

50:                                               ; preds = %47
  %51 = fsub float 1.000000e+00, %48
  %52 = fpext float %51 to double
  %53 = fdiv double %49, %19
  %54 = fsub double 1.000000e+00, %53
  %55 = fmul double %54, %52
  %56 = call noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %5)
  %57 = fcmp ogt float %56, 0.000000e+00
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #9
  %.0 = select i1 %57, double 0.000000e+00, double %55
  %58 = fadd double %.02140, %.0
  br label %65

59:                                               ; preds = %.lr.ph
  %60 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #9
  br label %70

61:                                               ; preds = %46
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #9
  br label %70

63:                                               ; preds = %47
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #9
  br label %70

65:                                               ; preds = %50, %42
  %.122 = phi double [ %58, %50 ], [ %.02140, %42 ]
  %66 = add i32 %.02041, 1
  %67 = zext i32 %66 to i64
  %68 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  %69 = icmp ugt i64 %68, %67
  br i1 %69, label %.lr.ph, label %._crit_edge, !llvm.loop !43

70:                                               ; preds = %61, %63, %59
  %.pn.pn = phi { ptr, i32 } [ %60, %59 ], [ %64, %63 ], [ %62, %61 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #9
  br label %71

71:                                               ; preds = %70, %36
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %70 ], [ %37, %36 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #9
  br label %72

72:                                               ; preds = %71, %34
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %71 ], [ %35, %34 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #9
  br label %73

73:                                               ; preds = %72, %32
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %72 ], [ %33, %32 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #9
  br label %74

74:                                               ; preds = %73, %30
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn, %73 ], [ %31, %30 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  resume { ptr, i32 } %.pn.pn.pn.pn.pn.pn
}

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

declare void @_ZN12TriangleMesh23getTriangleNormalSmoothEjN5vmath4vec3E(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 8 dereferenceable(232), i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5vmath9normalizeERKNS_4vec3E(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #8

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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, !10, i64 400}
!6 = !{!"_ZTS8LevelSet", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !35, i64 264, !37, i64 304, !38, i64 344, !25, i64 376, !10, i64 400, !7, i64 408, !38, i64 416}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTS12TriangleMesh", !12, i64 0, !12, i64 24, !12, i64 48, !17, i64 72, !7, i64 96, !7, i64 100, !7, i64 104, !10, i64 112, !21, i64 120, !25, i64 144, !29, i64 168}
!12 = !{!"_ZTSSt6vectorIN5vmath4vec3ESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIN5vmath4vec3ESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"_ZTSSt6vectorI8TriangleSaIS0_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseI8TriangleSaIS0_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!21 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!25 = !{!"_ZTSSt6vectorIdSaIdEE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!29 = !{!"_ZTS7Array3dISt6vectorIiSaIiEEE", !7, i64 0, !7, i64 4, !7, i64 8, !16, i64 16, !30, i64 24, !31, i64 32, !7, i64 56}
!30 = !{!"bool", !8, i64 0}
!31 = !{!"_ZTSSt6vectorIiSaIiEE", !32, i64 0}
!32 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!35 = !{!"_ZTS7Array3dIfE", !7, i64 0, !7, i64 4, !7, i64 8, !16, i64 16, !30, i64 24, !36, i64 28, !7, i64 32}
!36 = !{!"float", !8, i64 0}
!37 = !{!"_ZTS7Array3dIiE", !7, i64 0, !7, i64 4, !7, i64 8, !16, i64 16, !30, i64 24, !7, i64 28, !7, i64 32}
!38 = !{!"_ZTS7Array3dIbE", !7, i64 0, !7, i64 4, !7, i64 8, !16, i64 16, !30, i64 24, !30, i64 25, !7, i64 28}
!39 = !{!6, !10, i64 16}
!40 = !{i64 0, i64 4, !41, i64 4, i64 4, !41, i64 8, i64 4, !41}
!41 = !{!36, !36, i64 0}
!42 = !{!7, !7, i64 0}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}


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