; LLVM IR from hlzz/libvot :: src/vocab_tree/clustering.ll (ZN3vot6KmeansEmiiPPhPdPii)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [69 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vot6KmeansEmiiPPhPdPii = external hidden unnamed_addr constant [77 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vot16GetIntialCentersEmiPm(i64 noundef, i32 noundef, ptr noundef) #0

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

; 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 double @_ZNSt14numeric_limitsIdE3maxEv() #0 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vot12ComputeMeansEmiiPPhPiPdi(i64 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN3vot12ComputeErrorEmiiPPhPdPi(i64 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vot6KmeansEmiiPPhPdPii(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6) #2 {
  %8 = alloca double, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca double, align 8
  %24 = alloca i32, align 4
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca double, align 8
  store i64 %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !9
  store ptr %3, ptr %12, align 8, !tbaa !11
  store ptr %4, ptr %13, align 8, !tbaa !11
  store ptr %5, ptr %14, align 8, !tbaa !11
  store i32 %6, ptr %15, align 4, !tbaa !9
  %28 = load i64, ptr %9, align 8, !tbaa !5
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = icmp ult i64 %28, %30
  br i1 %31, label %32, label %34

32:                                               ; preds = %7
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
  store double -1.000000e+00, ptr %8, align 8
  br label %207

34:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #10
  %35 = call noundef double @_ZNSt14numeric_limitsIdE3maxEv() #10
  store double %35, ptr %16, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #10
  store double 5.000000e-02, ptr %20, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #10
  store i32 1, ptr %21, align 4, !tbaa !9
  %36 = load i32, ptr %11, align 4, !tbaa !9
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = mul nsw i32 %36, %37
  %39 = sext i32 %38 to i64
  %40 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %39, i64 8)
  %41 = extractvalue { i64, i1 } %40, 1
  %42 = extractvalue { i64, i1 } %40, 0
  %43 = select i1 %41, i64 -1, i64 %42
  %44 = call noalias noundef nonnull ptr @_Znam(i64 noundef %43) #11
  store ptr %44, ptr %17, align 8, !tbaa !11
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %46, i64 8)
  %48 = extractvalue { i64, i1 } %47, 1
  %49 = extractvalue { i64, i1 } %47, 0
  %50 = select i1 %48, i64 -1, i64 %49
  %51 = call noalias noundef nonnull ptr @_Znam(i64 noundef %50) #11
  store ptr %51, ptr %18, align 8, !tbaa !11
  %52 = load i64, ptr %9, align 8, !tbaa !5
  %53 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %52, i64 4)
  %54 = extractvalue { i64, i1 } %53, 1
  %55 = extractvalue { i64, i1 } %53, 0
  %56 = select i1 %54, i64 -1, i64 %55
  %57 = call noalias noundef nonnull ptr @_Znam(i64 noundef %56) #11
  store ptr %57, ptr %19, align 8, !tbaa !11
  %58 = load ptr, ptr %17, align 8, !tbaa !11
  %59 = icmp eq ptr %58, null
  br i1 %59, label %66, label %60

60:                                               ; preds = %34
  %61 = load ptr, ptr %18, align 8, !tbaa !11
  %62 = icmp eq ptr %61, null
  br i1 %62, label %66, label %63

63:                                               ; preds = %60
  %64 = load ptr, ptr %19, align 8, !tbaa !11
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %68

66:                                               ; preds = %63, %60, %34
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.1)
  store double -1.000000e+00, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %206

68:                                               ; preds = %63
  br label %69

69:                                               ; preds = %185, %68
  %70 = load i32, ptr %21, align 4, !tbaa !9
  %71 = add nsw i32 %70, -1
  store i32 %71, ptr %21, align 4, !tbaa !9
  %72 = icmp ne i32 %70, 0
  br i1 %72, label %73, label %186

73:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #10
  store double 0.000000e+00, ptr %23, align 8, !tbaa !13
  %74 = load i64, ptr %9, align 8, !tbaa !5
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = load ptr, ptr %18, align 8, !tbaa !11
  call void @_ZN3vot16GetIntialCentersEmiPm(i64 noundef %74, i32 noundef %75, ptr noundef %76)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #10
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %98, %73
  %78 = load i32, ptr %24, align 4, !tbaa !9
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 4, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #10
  br label %101

82:                                               ; preds = %77
  %83 = load ptr, ptr %17, align 8, !tbaa !11
  %84 = load i32, ptr %24, align 4, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = mul nsw i32 %84, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds double, ptr %83, i64 %87
  %89 = load ptr, ptr %12, align 8, !tbaa !11
  %90 = load ptr, ptr %18, align 8, !tbaa !11
  %91 = load i32, ptr %24, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i64, ptr %90, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = getelementptr inbounds ptr, ptr %89, i64 %94
  %96 = load ptr, ptr %95, align 8, !tbaa !11
  %97 = load i32, ptr %10, align 4, !tbaa !9
  call void @_ZN3vot14CopyDes2DoubleEPdPhi(ptr noundef %88, ptr noundef %96, i32 noundef %97)
  br label %98

98:                                               ; preds = %82
  %99 = load i32, ptr %24, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %24, align 4, !tbaa !9
  br label %77, !llvm.loop !15

101:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #10
  store i64 0, ptr %25, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %111, %101
  %103 = load i64, ptr %25, align 8, !tbaa !5
  %104 = load i64, ptr %9, align 8, !tbaa !5
  %105 = icmp ult i64 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 7, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #10
  br label %114

107:                                              ; preds = %102
  %108 = load ptr, ptr %19, align 8, !tbaa !11
  %109 = load i64, ptr %25, align 8, !tbaa !5
  %110 = getelementptr inbounds i32, ptr %108, i64 %109
  store i32 -1, ptr %110, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %107
  %112 = load i64, ptr %25, align 8, !tbaa !5
  %113 = add i64 %112, 1
  store i64 %113, ptr %25, align 8, !tbaa !5
  br label %102, !llvm.loop !17

114:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #10
  %115 = load i64, ptr %9, align 8, !tbaa !5
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = load ptr, ptr %12, align 8, !tbaa !11
  %119 = load ptr, ptr %17, align 8, !tbaa !11
  %120 = load ptr, ptr %19, align 8, !tbaa !11
  %121 = load i32, ptr %15, align 4, !tbaa !9
  %122 = call noundef i64 @_ZN3vot17ComputeAssignmentEmiiPPhPdPiRdi(i64 noundef %115, i32 noundef %116, i32 noundef %117, ptr noundef %118, ptr noundef %119, ptr noundef %120, ptr noundef nonnull align 8 dereferenceable(8) %23, i32 noundef %121)
  store i64 %122, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #10
  %123 = load i64, ptr %26, align 8, !tbaa !5
  %124 = uitofp i64 %123 to double
  %125 = load i64, ptr %9, align 8, !tbaa !5
  %126 = uitofp i64 %125 to double
  %127 = fdiv double %124, %126
  store double %127, ptr %27, align 8, !tbaa !13
  %128 = load i64, ptr %26, align 8, !tbaa !5
  %129 = load i64, ptr %9, align 8, !tbaa !5
  %130 = icmp eq i64 %128, %129
  br i1 %130, label %131, label %132

131:                                              ; preds = %114
  br label %134

132:                                              ; preds = %114
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 318, ptr noundef @__PRETTY_FUNCTION__._ZN3vot6KmeansEmiiPPhPdPii) #12
  unreachable

133:                                              ; No predecessors!
  br label %134

134:                                              ; preds = %133, %131
  br label %135

135:                                              ; preds = %139, %134
  %136 = load double, ptr %27, align 8, !tbaa !13
  %137 = load double, ptr %20, align 8, !tbaa !13
  %138 = fcmp ogt double %136, %137
  br i1 %138, label %139, label %160

139:                                              ; preds = %135
  %140 = load i64, ptr %9, align 8, !tbaa !5
  %141 = load i32, ptr %10, align 4, !tbaa !9
  %142 = load i32, ptr %11, align 4, !tbaa !9
  %143 = load ptr, ptr %12, align 8, !tbaa !11
  %144 = load ptr, ptr %19, align 8, !tbaa !11
  %145 = load ptr, ptr %17, align 8, !tbaa !11
  %146 = load i32, ptr %15, align 4, !tbaa !9
  call void @_ZN3vot12ComputeMeansEmiiPPhPiPdi(i64 noundef %140, i32 noundef %141, i32 noundef %142, ptr noundef %143, ptr noundef %144, ptr noundef %145, i32 noundef %146)
  %147 = load i64, ptr %9, align 8, !tbaa !5
  %148 = load i32, ptr %10, align 4, !tbaa !9
  %149 = load i32, ptr %11, align 4, !tbaa !9
  %150 = load ptr, ptr %12, align 8, !tbaa !11
  %151 = load ptr, ptr %17, align 8, !tbaa !11
  %152 = load ptr, ptr %19, align 8, !tbaa !11
  %153 = load i32, ptr %15, align 4, !tbaa !9
  %154 = call noundef i64 @_ZN3vot17ComputeAssignmentEmiiPPhPdPiRdi(i64 noundef %147, i32 noundef %148, i32 noundef %149, ptr noundef %150, ptr noundef %151, ptr noundef %152, ptr noundef nonnull align 8 dereferenceable(8) %23, i32 noundef %153)
  store i64 %154, ptr %26, align 8, !tbaa !5
  %155 = load i64, ptr %26, align 8, !tbaa !5
  %156 = uitofp i64 %155 to double
  %157 = load i64, ptr %9, align 8, !tbaa !5
  %158 = uitofp i64 %157 to double
  %159 = fdiv double %156, %158
  store double %159, ptr %27, align 8, !tbaa !13
  br label %135, !llvm.loop !18

160:                                              ; preds = %135
  %161 = load i64, ptr %9, align 8, !tbaa !5
  %162 = load i32, ptr %10, align 4, !tbaa !9
  %163 = load i32, ptr %11, align 4, !tbaa !9
  %164 = load ptr, ptr %12, align 8, !tbaa !11
  %165 = load ptr, ptr %19, align 8, !tbaa !11
  %166 = load ptr, ptr %17, align 8, !tbaa !11
  %167 = load i32, ptr %15, align 4, !tbaa !9
  call void @_ZN3vot12ComputeMeansEmiiPPhPiPdi(i64 noundef %161, i32 noundef %162, i32 noundef %163, ptr noundef %164, ptr noundef %165, ptr noundef %166, i32 noundef %167)
  %168 = load double, ptr %23, align 8, !tbaa !13
  %169 = load double, ptr %16, align 8, !tbaa !13
  %170 = fcmp olt double %168, %169
  br i1 %170, label %171, label %185

171:                                              ; preds = %160
  %172 = load double, ptr %23, align 8, !tbaa !13
  store double %172, ptr %16, align 8, !tbaa !13
  %173 = load ptr, ptr %13, align 8, !tbaa !11
  %174 = load ptr, ptr %17, align 8, !tbaa !11
  %175 = load i32, ptr %11, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = mul i64 8, %176
  %178 = load i32, ptr %10, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = mul i64 %177, %179
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %173, ptr align 8 %174, i64 %180, i1 false)
  %181 = load ptr, ptr %14, align 8, !tbaa !11
  %182 = load ptr, ptr %19, align 8, !tbaa !11
  %183 = load i64, ptr %9, align 8, !tbaa !5
  %184 = mul i64 4, %183
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %181, ptr align 4 %182, i64 %184, i1 false)
  br label %185

185:                                              ; preds = %171, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #10
  br label %69, !llvm.loop !19

186:                                              ; preds = %69
  %187 = load ptr, ptr %17, align 8, !tbaa !11
  %188 = icmp eq ptr %187, null
  br i1 %188, label %190, label %189

189:                                              ; preds = %186
  call void @_ZdaPv(ptr noundef %187) #13
  br label %190

190:                                              ; preds = %189, %186
  %191 = load ptr, ptr %18, align 8, !tbaa !11
  %192 = icmp eq ptr %191, null
  br i1 %192, label %194, label %193

193:                                              ; preds = %190
  call void @_ZdaPv(ptr noundef %191) #13
  br label %194

194:                                              ; preds = %193, %190
  %195 = load ptr, ptr %19, align 8, !tbaa !11
  %196 = icmp eq ptr %195, null
  br i1 %196, label %198, label %197

197:                                              ; preds = %194
  call void @_ZdaPv(ptr noundef %195) #13
  br label %198

198:                                              ; preds = %197, %194
  %199 = load i64, ptr %9, align 8, !tbaa !5
  %200 = load i32, ptr %10, align 4, !tbaa !9
  %201 = load i32, ptr %11, align 4, !tbaa !9
  %202 = load ptr, ptr %12, align 8, !tbaa !11
  %203 = load ptr, ptr %13, align 8, !tbaa !11
  %204 = load ptr, ptr %14, align 8, !tbaa !11
  %205 = call noundef double @_ZN3vot12ComputeErrorEmiiPPhPdPi(i64 noundef %199, i32 noundef %200, i32 noundef %201, ptr noundef %202, ptr noundef %203, ptr noundef %204)
  store double %205, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %206

206:                                              ; preds = %198, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #10
  br label %207

207:                                              ; preds = %206, %32
  %208 = load double, ptr %8, align 8
  ret double %208
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3vot14CopyDes2DoubleEPdPhi(ptr noundef, ptr noundef, i32 noundef) #7

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #8

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nobuiltin allocsize(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 = { nobuiltin 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 #6 = { 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 #7 = { 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 #8 = { noreturn 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 #9 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { noreturn nounwind }
attributes #13 = { builtin 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [69 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vot6KmeansEmiiPPhPdPii = external hidden unnamed_addr constant [77 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vot16GetIntialCentersEmiPm(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress 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 double @_ZNSt14numeric_limitsIdE3maxEv() local_unnamed_addr #0 align 2

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vot12ComputeMeansEmiiPPhPiPdi(i64 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN3vot12ComputeErrorEmiiPPhPdPi(i64 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vot6KmeansEmiiPPhPdPii(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6) local_unnamed_addr #2 {
  %8 = alloca double, align 8
  %9 = sext i32 %2 to i64
  %10 = icmp ugt i64 %9, %0
  br i1 %10, label %11, label %13

11:                                               ; preds = %7
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
  br label %50

13:                                               ; preds = %7
  %14 = tail call noundef double @_ZNSt14numeric_limitsIdE3maxEv() #10
  %15 = mul nsw i32 %2, %1
  %16 = zext nneg i32 %15 to i64
  %17 = icmp slt i32 %15, 0
  %18 = shl nuw nsw i64 %16, 3
  %19 = select i1 %17, i64 -1, i64 %18
  %20 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %19) #11
  %21 = icmp slt i32 %2, 0
  %22 = shl nsw i64 %9, 3
  %23 = select i1 %21, i64 -1, i64 %22
  %24 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %23) #11
  %25 = icmp ugt i64 %0, 4611686018427387903
  %26 = shl i64 %0, 2
  %27 = select i1 %25, i64 -1, i64 %26
  %28 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %27) #11
  %29 = icmp sgt i32 %2, 0
  %.not103 = icmp eq i64 %0, 0
  %30 = uitofp i64 %0 to double
  %31 = sext i32 %1 to i64
  %32 = mul i64 %22, %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #10
  store double 0.000000e+00, ptr %8, align 8, !tbaa !5
  tail call void @_ZN3vot16GetIntialCentersEmiPm(i64 noundef %0, i32 noundef %2, ptr noundef nonnull %24)
  br i1 %29, label %.lr.ph.preheader, label %.preheader94

.lr.ph.preheader:                                 ; preds = %13
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph

.preheader94:                                     ; preds = %.lr.ph, %13
  br i1 %.not103, label %._crit_edge, label %.lr.ph97.preheader

.lr.ph97.preheader:                               ; preds = %.preheader94
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %28, i8 -1, i64 %26, i1 false), !tbaa !9
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %33 = mul nsw i64 %indvars.iv, %31
  %34 = getelementptr inbounds double, ptr %20, i64 %33
  %35 = getelementptr inbounds i64, ptr %24, i64 %indvars.iv
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds ptr, ptr %3, i64 %36
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  tail call void @_ZN3vot14CopyDes2DoubleEPdPhi(ptr noundef nonnull %34, ptr noundef %38, i32 noundef %1)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader94, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph97.preheader, %.preheader94
  %39 = call noundef i64 @_ZN3vot17ComputeAssignmentEmiiPPhPdPiRdi(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef nonnull %20, ptr noundef nonnull %28, ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef %6)
  %40 = icmp eq i64 %39, %0
  br i1 %40, label %.preheader, label %42

.preheader:                                       ; preds = %._crit_edge
  %.099 = fdiv double %30, %30
  %41 = fcmp ogt double %.099, 5.000000e-02
  br i1 %41, label %.lr.ph100, label %._crit_edge101

42:                                               ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 318, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vot6KmeansEmiiPPhPdPii) #12
  unreachable

.lr.ph100:                                        ; preds = %.preheader, %.lr.ph100
  call void @_ZN3vot12ComputeMeansEmiiPPhPiPdi(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef nonnull %28, ptr noundef nonnull %20, i32 noundef %6)
  %43 = call noundef i64 @_ZN3vot17ComputeAssignmentEmiiPPhPdPiRdi(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef nonnull %20, ptr noundef nonnull %28, ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef %6)
  %.pn = uitofp i64 %43 to double
  %.0 = fdiv double %.pn, %30
  %44 = fcmp ogt double %.0, 5.000000e-02
  br i1 %44, label %.lr.ph100, label %._crit_edge101, !llvm.loop !17

._crit_edge101:                                   ; preds = %.lr.ph100, %.preheader
  call void @_ZN3vot12ComputeMeansEmiiPPhPiPdi(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef nonnull %28, ptr noundef nonnull %20, i32 noundef %6)
  %45 = load double, ptr %8, align 8, !tbaa !5
  %46 = fcmp olt double %45, %14
  br i1 %46, label %47, label %48

47:                                               ; preds = %._crit_edge101
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr nonnull align 8 %20, i64 %32, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr nonnull align 4 %28, i64 %26, i1 false)
  br label %48

48:                                               ; preds = %47, %._crit_edge101
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #10
  call void @_ZdaPv(ptr noundef nonnull %20) #13
  call void @_ZdaPv(ptr noundef nonnull %24) #13
  call void @_ZdaPv(ptr noundef nonnull %28) #13
  %49 = call noundef double @_ZN3vot12ComputeErrorEmiiPPhPdPi(i64 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  br label %50

50:                                               ; preds = %48, %11
  %.1 = phi double [ -1.000000e+00, %11 ], [ %49, %48 ]
  ret double %.1
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3vot14CopyDes2DoubleEPdPhi(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #7

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nobuiltin allocsize(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 = { nobuiltin 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 #5 = { 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 #6 = { 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 #7 = { noreturn 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { noreturn nounwind }
attributes #13 = { builtin 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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