; LLVM IR from zeux/meshoptimizer :: tools/vcachetuner.ll (Z14compute_metricPK5StateRK4MeshPf)

; 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.Profile = type { float, i32, i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.meshopt::VertexScoreTable" = type { [17 x float], [9 x float] }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.meshopt_VertexCacheStatistics = type { i32, i32, float, float }
%struct.Mesh = type { ptr, i64, %"class.std::vector", [2 x float] }
%struct.State = type { [16 x float], [8 x float], float }

@profiles = external dso_local global [2 x %struct.Profile], align 16

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14compute_metricPK5StateRK4MeshPf(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef %2) #5 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.std::vector", align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.meshopt::VertexScoreTable", align 4
  %12 = alloca %"class.std::vector.5", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.meshopt_VertexCacheStatistics, align 4
  %16 = alloca i64, 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 24, ptr %7) #7
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.Mesh, ptr %17, i32 0, i32 2
  %19 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  call void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  invoke void @_ZNSt6vectorIjSaIjEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %19, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %20 unwind label %47

20:                                               ; preds = %3
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %55

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 104, ptr %11) #7
  call void @llvm.memset.p0.i64(ptr align 4 %11, i8 0, i64 104, i1 false)
  %24 = getelementptr inbounds %"struct.meshopt::VertexScoreTable", ptr %11, i32 0, i32 0
  %25 = getelementptr inbounds [17 x float], ptr %24, i64 0, i64 0
  %26 = getelementptr inbounds float, ptr %25, i64 1
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.State, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds [16 x float], ptr %28, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %29, i64 64, i1 false)
  %30 = getelementptr inbounds %"struct.meshopt::VertexScoreTable", ptr %11, i32 0, i32 1
  %31 = getelementptr inbounds [9 x float], ptr %30, i64 0, i64 0
  %32 = getelementptr inbounds float, ptr %31, i64 1
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.State, ptr %33, i32 0, i32 1
  %35 = getelementptr inbounds [8 x float], ptr %34, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %35, i64 32, i1 false)
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.Mesh, ptr %37, i32 0, i32 2
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef 0) #7
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Mesh, ptr %40, i32 0, i32 2
  %42 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #7
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.Mesh, ptr %43, i32 0, i32 1
  %45 = load i64, ptr %44, align 8, !tbaa !9
  invoke void @_Z32meshopt_optimizeVertexCacheTablePjPKjmmPKN7meshopt16VertexScoreTableE(ptr noundef %36, ptr noundef %39, i64 noundef %42, i64 noundef %45, ptr noundef %11)
          to label %46 unwind label %51

46:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 104, ptr %11) #7
  br label %71

47:                                               ; preds = %3
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %9, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %10, align 4
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  br label %199

51:                                               ; preds = %23
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %9, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 104, ptr %11) #7
  br label %198

55:                                               ; preds = %20
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.Mesh, ptr %57, i32 0, i32 2
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef 0) #7
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Mesh, ptr %60, i32 0, i32 2
  %62 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %61) #7
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.Mesh, ptr %63, i32 0, i32 1
  %65 = load i64, ptr %64, align 8, !tbaa !9
  invoke void @meshopt_optimizeVertexCache(ptr noundef %56, ptr noundef %59, i64 noundef %62, i64 noundef %65)
          to label %66 unwind label %67

66:                                               ; preds = %55
  br label %71

67:                                               ; preds = %71, %55
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %9, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %10, align 4
  br label %198

71:                                               ; preds = %66, %46
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %73 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.Mesh, ptr %74, i32 0, i32 1
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = invoke i64 @meshopt_optimizeVertexFetch(ptr noundef null, ptr noundef %72, i64 noundef %73, ptr noundef null, i64 noundef %76, i64 noundef 0)
          to label %78 unwind label %67

78:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !16
  br label %79

79:                                               ; preds = %110, %78
  %80 = load i32, ptr %13, align 4, !tbaa !16
  %81 = icmp slt i32 %80, 2
  br i1 %81, label %83, label %82

82:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %113

83:                                               ; preds = %79
  %84 = load i32, ptr %13, align 4, !tbaa !16
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [2 x %struct.Profile], ptr @profiles, i64 0, i64 %85
  %87 = getelementptr inbounds %struct.Profile, ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !18
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %109

90:                                               ; preds = %83
  %91 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.Mesh, ptr %92, i32 0, i32 1
  %94 = load i64, ptr %93, align 8, !tbaa !9
  %95 = invoke i64 @meshopt_encodeIndexBufferBound(i64 noundef %91, i64 noundef %94)
          to label %96 unwind label %105

96:                                               ; preds = %90
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %95)
          to label %97 unwind label %105

97:                                               ; preds = %96
  %98 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef 0) #7
  %99 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %101 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %102 = invoke i64 @meshopt_encodeIndexBuffer(ptr noundef %98, i64 noundef %99, ptr noundef %100, i64 noundef %101)
          to label %103 unwind label %105

103:                                              ; preds = %97
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %102)
          to label %104 unwind label %105

104:                                              ; preds = %103
  br label %109

105:                                              ; preds = %103, %97, %96, %90
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %9, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %197

109:                                              ; preds = %104, %83
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %13, align 4, !tbaa !16
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %13, align 4, !tbaa !16
  br label %79, !llvm.loop !21

113:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !16
  br label %114

114:                                              ; preds = %192, %113
  %115 = load i32, ptr %14, align 4, !tbaa !16
  %116 = icmp slt i32 %115, 2
  br i1 %116, label %118, label %117

117:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %196

118:                                              ; preds = %114
  %119 = load i32, ptr %14, align 4, !tbaa !16
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [2 x %struct.Profile], ptr @profiles, i64 0, i64 %120
  %122 = getelementptr inbounds %struct.Profile, ptr %121, i32 0, i32 1
  %123 = load i32, ptr %122, align 4, !tbaa !18
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %162

125:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %127 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.Mesh, ptr %128, i32 0, i32 1
  %130 = load i64, ptr %129, align 8, !tbaa !9
  %131 = load i32, ptr %14, align 4, !tbaa !16
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [2 x %struct.Profile], ptr @profiles, i64 0, i64 %132
  %134 = getelementptr inbounds %struct.Profile, ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 4, !tbaa !18
  %136 = load i32, ptr %14, align 4, !tbaa !16
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [2 x %struct.Profile], ptr @profiles, i64 0, i64 %137
  %139 = getelementptr inbounds %struct.Profile, ptr %138, i32 0, i32 2
  %140 = load i32, ptr %139, align 4, !tbaa !23
  %141 = load i32, ptr %14, align 4, !tbaa !16
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [2 x %struct.Profile], ptr @profiles, i64 0, i64 %142
  %144 = getelementptr inbounds %struct.Profile, ptr %143, i32 0, i32 3
  %145 = load i32, ptr %144, align 4, !tbaa !24
  %146 = invoke { i64, <2 x float> } @meshopt_analyzeVertexCache(ptr noundef %126, i64 noundef %127, i64 noundef %130, i32 noundef %135, i32 noundef %140, i32 noundef %145)
          to label %147 unwind label %158

147:                                              ; preds = %125
  %148 = getelementptr inbounds { i64, <2 x float> }, ptr %15, i32 0, i32 0
  %149 = extractvalue { i64, <2 x float> } %146, 0
  store i64 %149, ptr %148, align 4
  %150 = getelementptr inbounds { i64, <2 x float> }, ptr %15, i32 0, i32 1
  %151 = extractvalue { i64, <2 x float> } %146, 1
  store <2 x float> %151, ptr %150, align 4
  %152 = getelementptr inbounds %struct.meshopt_VertexCacheStatistics, ptr %15, i32 0, i32 3
  %153 = load float, ptr %152, align 4, !tbaa !25
  %154 = load ptr, ptr %6, align 8, !tbaa !5
  %155 = load i32, ptr %14, align 4, !tbaa !16
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds float, ptr %154, i64 %156
  store float %153, ptr %157, align 4, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %191

158:                                              ; preds = %125
  %159 = landingpad { ptr, i32 }
          cleanup
  %160 = extractvalue { ptr, i32 } %159, 0
  store ptr %160, ptr %9, align 8
  %161 = extractvalue { ptr, i32 } %159, 1
  store i32 %161, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %195

162:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %163 = load i32, ptr %14, align 4, !tbaa !16
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2 x %struct.Profile], ptr @profiles, i64 0, i64 %164
  %166 = getelementptr inbounds %struct.Profile, ptr %165, i32 0, i32 4
  %167 = load i32, ptr %166, align 4, !tbaa !28
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %169, label %172

169:                                              ; preds = %162
  %170 = invoke noundef i64 @_Z8compressIhEmRKSt6vectorIT_SaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 5)
          to label %171 unwind label %187

171:                                              ; preds = %169
  br label %174

172:                                              ; preds = %162
  %173 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  br label %174

174:                                              ; preds = %172, %171
  %175 = phi i64 [ %170, %171 ], [ %173, %172 ]
  store i64 %175, ptr %16, align 8, !tbaa !29
  %176 = load i64, ptr %16, align 8, !tbaa !29
  %177 = uitofp i64 %176 to double
  %178 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %179 = udiv i64 %178, 3
  %180 = uitofp i64 %179 to double
  %181 = fdiv double %177, %180
  %182 = fptrunc double %181 to float
  %183 = load ptr, ptr %6, align 8, !tbaa !5
  %184 = load i32, ptr %14, align 4, !tbaa !16
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds float, ptr %183, i64 %185
  store float %182, ptr %186, align 4, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %191

187:                                              ; preds = %169
  %188 = landingpad { ptr, i32 }
          cleanup
  %189 = extractvalue { ptr, i32 } %188, 0
  store ptr %189, ptr %9, align 8
  %190 = extractvalue { ptr, i32 } %188, 1
  store i32 %190, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %195

191:                                              ; preds = %174, %147
  br label %192

192:                                              ; preds = %191
  %193 = load i32, ptr %14, align 4, !tbaa !16
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %14, align 4, !tbaa !16
  br label %114, !llvm.loop !30

195:                                              ; preds = %187, %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %197

196:                                              ; preds = %117
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #7
  ret void

197:                                              ; preds = %195, %105
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  br label %198

198:                                              ; preds = %197, %67, %51
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  br label %199

199:                                              ; preds = %198, %47
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #7
  br label %200

200:                                              ; preds = %199
  %201 = load ptr, ptr %9, align 8
  %202 = load i32, ptr %10, align 4
  %203 = insertvalue { ptr, i32 } poison, ptr %201, 0
  %204 = insertvalue { ptr, i32 } %203, i32 %202, 1
  resume { ptr, i32 } %204
}

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

declare void @_Z32meshopt_optimizeVertexCacheTablePjPKjmmPKN7meshopt16VertexScoreTableE(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) #6

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

declare void @meshopt_optimizeVertexCache(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #6

declare i64 @meshopt_optimizeVertexFetch(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) #6

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

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

declare i64 @meshopt_encodeIndexBufferBound(i64 noundef, i64 noundef) #6

declare i64 @meshopt_encodeIndexBuffer(ptr noundef, i64 noundef, ptr noundef, i64 noundef) #6

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

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

declare { i64, <2 x float> } @meshopt_analyzeVertexCache(ptr noundef, i64 noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef) #6

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTS4Mesh", !6, i64 0, !11, i64 8, !12, i64 16, !7, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIjSaIjEE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !17, i64 4}
!19 = !{!"_ZTS7Profile", !20, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16}
!20 = !{!"float", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!19, !17, i64 8}
!24 = !{!19, !17, i64 12}
!25 = !{!26, !20, i64 12}
!26 = !{!"_ZTS29meshopt_VertexCacheStatistics", !17, i64 0, !17, i64 4, !20, i64 8, !20, i64 12}
!27 = !{!20, !20, i64 0}
!28 = !{!19, !17, i64 16}
!29 = !{!11, !11, i64 0}
!30 = distinct !{!30, !22}


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

%struct.Profile = type { float, i32, i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.meshopt::VertexScoreTable" = type { [17 x float], [9 x float] }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@profiles = external dso_local local_unnamed_addr global [2 x %struct.Profile], align 16

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14compute_metricPK5StateRK4MeshPf(ptr noundef readonly %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #5 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca %"struct.meshopt::VertexScoreTable", align 4
  %7 = alloca %"class.std::vector.5", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = tail call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #7
  call void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  invoke void @_ZNSt6vectorIjSaIjEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %9, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %10 unwind label %21

10:                                               ; preds = %3
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %25, label %11

11:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %6) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %6, i8 0, i64 72, i1 false)
  %12 = getelementptr inbounds i8, ptr %6, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %12, ptr noundef nonnull align 4 dereferenceable(64) %0, i64 64, i1 false)
  %13 = getelementptr inbounds i8, ptr %6, i64 72
  %14 = getelementptr inbounds i8, ptr %0, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %13, ptr noundef nonnull align 4 dereferenceable(32) %14, i64 32, i1 false)
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 0) #7
  %17 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  %18 = getelementptr inbounds i8, ptr %1, i64 8
  %19 = load i64, ptr %18, align 8, !tbaa !5
  invoke void @_Z32meshopt_optimizeVertexCacheTablePjPKjmmPKN7meshopt16VertexScoreTableE(ptr noundef nonnull %15, ptr noundef nonnull %16, i64 noundef %17, i64 noundef %19, ptr noundef nonnull %6)
          to label %20 unwind label %23

20:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %6) #7
  br label %33

21:                                               ; preds = %3
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  br label %129

23:                                               ; preds = %11
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %6) #7
  br label %128

25:                                               ; preds = %10
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 0) #7
  %28 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  %29 = getelementptr inbounds i8, ptr %1, i64 8
  %30 = load i64, ptr %29, align 8, !tbaa !5
  invoke void @meshopt_optimizeVertexCache(ptr noundef nonnull %26, ptr noundef nonnull %27, i64 noundef %28, i64 noundef %30)
          to label %33 unwind label %31

31:                                               ; preds = %33, %25
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %128

33:                                               ; preds = %25, %20
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %35 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %36 = getelementptr inbounds i8, ptr %1, i64 8
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = invoke i64 @meshopt_optimizeVertexFetch(ptr noundef null, ptr noundef nonnull %34, i64 noundef %35, ptr noundef null, i64 noundef %37, i64 noundef 0)
          to label %39 unwind label %31

39:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 4), align 4, !tbaa !15
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %56

42:                                               ; preds = %39
  %43 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %44 = load i64, ptr %36, align 8, !tbaa !5
  %45 = invoke i64 @meshopt_encodeIndexBufferBound(i64 noundef %43, i64 noundef %44)
          to label %46 unwind label %54

46:                                               ; preds = %42
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %45)
          to label %47 unwind label %54

47:                                               ; preds = %46
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %49 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %51 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %52 = invoke i64 @meshopt_encodeIndexBuffer(ptr noundef nonnull %48, i64 noundef %49, ptr noundef nonnull %50, i64 noundef %51)
          to label %53 unwind label %54

53:                                               ; preds = %47
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %52)
          to label %56 unwind label %54

54:                                               ; preds = %70, %64, %63, %59, %53, %47, %46, %42
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %127

56:                                               ; preds = %39, %53
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 24), align 8, !tbaa !15
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %.preheader.preheader

59:                                               ; preds = %56
  %60 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %61 = load i64, ptr %36, align 8, !tbaa !5
  %62 = invoke i64 @meshopt_encodeIndexBufferBound(i64 noundef %60, i64 noundef %61)
          to label %63 unwind label %54

63:                                               ; preds = %59
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %62)
          to label %64 unwind label %54

64:                                               ; preds = %63
  %65 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %66 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %68 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %69 = invoke i64 @meshopt_encodeIndexBuffer(ptr noundef nonnull %65, i64 noundef %66, ptr noundef nonnull %67, i64 noundef %68)
          to label %70 unwind label %54

70:                                               ; preds = %64
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %69)
          to label %.preheader.preheader unwind label %54

.preheader.preheader:                             ; preds = %70, %56
  %71 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 4), align 4, !tbaa !15
  %.not36 = icmp eq i32 %71, 0
  br i1 %.not36, label %84, label %72

72:                                               ; preds = %.preheader.preheader
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %74 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %75 = load i64, ptr %36, align 8, !tbaa !5
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 4), align 4, !tbaa !15
  %77 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 8), align 8, !tbaa !19
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 12), align 4, !tbaa !20
  %79 = invoke { i64, <2 x float> } @meshopt_analyzeVertexCache(ptr noundef nonnull %73, i64 noundef %74, i64 noundef %75, i32 noundef %76, i32 noundef %77, i32 noundef %78)
          to label %80 unwind label %82

80:                                               ; preds = %72
  %81 = extractvalue { i64, <2 x float> } %79, 1
  %.sroa.4.12.vec.extract = extractelement <2 x float> %81, i64 1
  br label %.preheader.1

82:                                               ; preds = %101, %72
  %83 = landingpad { ptr, i32 }
          cleanup
  br label %127

84:                                               ; preds = %.preheader.preheader
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 16), align 16, !tbaa !21
  %.not37 = icmp eq i32 %85, 0
  br i1 %.not37, label %88, label %86

86:                                               ; preds = %84
  %87 = invoke noundef i64 @_Z8compressIhEmRKSt6vectorIT_SaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 5)
          to label %90 unwind label %98

88:                                               ; preds = %84
  %89 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  br label %90

90:                                               ; preds = %86, %88
  %91 = phi i64 [ %89, %88 ], [ %87, %86 ]
  %92 = uitofp i64 %91 to double
  %93 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %94 = udiv i64 %93, 3
  %95 = uitofp nneg i64 %94 to double
  %96 = fdiv double %92, %95
  %97 = fptrunc double %96 to float
  br label %.preheader.1

98:                                               ; preds = %113, %86
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %127

.preheader.1:                                     ; preds = %80, %90
  %storemerge = phi float [ %.sroa.4.12.vec.extract, %80 ], [ %97, %90 ]
  store float %storemerge, ptr %2, align 4, !tbaa !22
  %100 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 24), align 8, !tbaa !15
  %.not36.1 = icmp eq i32 %100, 0
  br i1 %.not36.1, label %111, label %101

101:                                              ; preds = %.preheader.1
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #7
  %103 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %104 = load i64, ptr %36, align 8, !tbaa !5
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 24), align 8, !tbaa !15
  %106 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 28), align 4, !tbaa !19
  %107 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 32), align 16, !tbaa !20
  %108 = invoke { i64, <2 x float> } @meshopt_analyzeVertexCache(ptr noundef nonnull %102, i64 noundef %103, i64 noundef %104, i32 noundef %105, i32 noundef %106, i32 noundef %107)
          to label %109 unwind label %82

109:                                              ; preds = %101
  %110 = extractvalue { i64, <2 x float> } %108, 1
  %.sroa.4.12.vec.extract.1 = extractelement <2 x float> %110, i64 1
  br label %125

111:                                              ; preds = %.preheader.1
  %112 = load i32, ptr getelementptr inbounds (i8, ptr @profiles, i64 36), align 4, !tbaa !21
  %.not37.1 = icmp eq i32 %112, 0
  br i1 %.not37.1, label %115, label %113

113:                                              ; preds = %111
  %114 = invoke noundef i64 @_Z8compressIhEmRKSt6vectorIT_SaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 5)
          to label %117 unwind label %98

115:                                              ; preds = %111
  %116 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  br label %117

117:                                              ; preds = %115, %113
  %118 = phi i64 [ %116, %115 ], [ %114, %113 ]
  %119 = uitofp i64 %118 to double
  %120 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %121 = udiv i64 %120, 3
  %122 = uitofp nneg i64 %121 to double
  %123 = fdiv double %119, %122
  %124 = fptrunc double %123 to float
  br label %125

125:                                              ; preds = %117, %109
  %.sink = phi float [ %124, %117 ], [ %.sroa.4.12.vec.extract.1, %109 ]
  %126 = getelementptr inbounds i8, ptr %2, i64 4
  store float %.sink, ptr %126, align 4, !tbaa !22
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  ret void

127:                                              ; preds = %82, %98, %54
  %.pn39 = phi { ptr, i32 } [ %55, %54 ], [ %83, %82 ], [ %99, %98 ]
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  br label %128

128:                                              ; preds = %127, %31, %23
  %.pn39.pn = phi { ptr, i32 } [ %.pn39, %127 ], [ %32, %31 ], [ %24, %23 ]
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  br label %129

129:                                              ; preds = %128, %21
  %.pn39.pn.pn = phi { ptr, i32 } [ %.pn39.pn, %128 ], [ %22, %21 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn39.pn.pn
}

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

declare void @_Z32meshopt_optimizeVertexCacheTablePjPKjmmPKN7meshopt16VertexScoreTableE(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #6

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

declare void @meshopt_optimizeVertexCache(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #6

declare i64 @meshopt_optimizeVertexFetch(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #6

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

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

declare i64 @meshopt_encodeIndexBufferBound(i64 noundef, i64 noundef) local_unnamed_addr #6

declare i64 @meshopt_encodeIndexBuffer(ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

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

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

declare { i64, <2 x float> } @meshopt_analyzeVertexCache(ptr noundef, i64 noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 8}
!6 = !{!"_ZTS4Mesh", !7, i64 0, !10, i64 8, !11, i64 16, !8, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"_ZTSSt6vectorIjSaIjEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!16, !18, i64 4}
!16 = !{!"_ZTS7Profile", !17, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16}
!17 = !{!"float", !8, i64 0}
!18 = !{!"int", !8, i64 0}
!19 = !{!16, !18, i64 8}
!20 = !{!16, !18, i64 12}
!21 = !{!16, !18, i64 16}
!22 = !{!17, !17, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass