; LLVM IR from sp-nitech/SPTK :: src/math (distance_calculation)

; 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.sptk::DistanceCalculation" = type <{ ptr, i32, i32, i8, [7 x i8] }>

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK4sptk19DistanceCalculation3RunERKSt6vectorIdSaIdEES5_Pd(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef %3) #0 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8
  %24 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 3
  %25 = load i8, ptr %24, align 8, !tbaa !9, !range !14, !noundef !15
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %46

27:                                               ; preds = %4
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #4
  %30 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !16
  %32 = add nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = icmp ne i64 %29, %33
  br i1 %34, label %46, label %35

35:                                               ; preds = %27
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #4
  %38 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !16
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = icmp ne i64 %37, %41
  br i1 %42, label %46, label %43

43:                                               ; preds = %35
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = icmp eq ptr null, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %43, %35, %27, %4
  store i1 false, ptr %5, align 1
  br label %199

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef 0) #4
  store ptr %49, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef 0) #4
  store ptr %51, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store double 0.000000e+00, ptr %12, align 8, !tbaa !17
  %52 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !19
  switch i32 %53, label %194 [
    i32 0, label %54
    i32 1, label %81
    i32 2, label %110
    i32 3, label %137
  ]

54:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !20
  br label %55

55:                                               ; preds = %77, %54
  %56 = load i32, ptr %13, align 4, !tbaa !20
  %57 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 1
  %58 = load i32, ptr %57, align 8, !tbaa !16
  %59 = icmp sle i32 %56, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %80

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = load i32, ptr %13, align 4, !tbaa !20
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds double, ptr %62, i64 %64
  %66 = load double, ptr %65, align 8, !tbaa !17
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = load i32, ptr %13, align 4, !tbaa !20
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds double, ptr %67, i64 %69
  %71 = load double, ptr %70, align 8, !tbaa !17
  %72 = fsub double %66, %71
  store double %72, ptr %14, align 8, !tbaa !17
  %73 = load double, ptr %14, align 8, !tbaa !17
  %74 = call double @llvm.fabs.f64(double %73)
  %75 = load double, ptr %12, align 8, !tbaa !17
  %76 = fadd double %75, %74
  store double %76, ptr %12, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %77

77:                                               ; preds = %61
  %78 = load i32, ptr %13, align 4, !tbaa !20
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %13, align 4, !tbaa !20
  br label %55, !llvm.loop !21

80:                                               ; preds = %60
  br label %195

81:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !20
  br label %82

82:                                               ; preds = %104, %81
  %83 = load i32, ptr %15, align 4, !tbaa !20
  %84 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 1
  %85 = load i32, ptr %84, align 8, !tbaa !16
  %86 = icmp sle i32 %83, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %107

88:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = load i32, ptr %15, align 4, !tbaa !20
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds double, ptr %89, i64 %91
  %93 = load double, ptr %92, align 8, !tbaa !17
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = load i32, ptr %15, align 4, !tbaa !20
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds double, ptr %94, i64 %96
  %98 = load double, ptr %97, align 8, !tbaa !17
  %99 = fsub double %93, %98
  store double %99, ptr %16, align 8, !tbaa !17
  %100 = load double, ptr %16, align 8, !tbaa !17
  %101 = load double, ptr %16, align 8, !tbaa !17
  %102 = load double, ptr %12, align 8, !tbaa !17
  %103 = call double @llvm.fmuladd.f64(double %100, double %101, double %102)
  store double %103, ptr %12, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %104

104:                                              ; preds = %88
  %105 = load i32, ptr %15, align 4, !tbaa !20
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %15, align 4, !tbaa !20
  br label %82, !llvm.loop !23

107:                                              ; preds = %87
  %108 = load double, ptr %12, align 8, !tbaa !17
  %109 = call double @sqrt(double noundef %108) #4
  store double %109, ptr %12, align 8, !tbaa !17
  br label %195

110:                                              ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !20
  br label %111

111:                                              ; preds = %133, %110
  %112 = load i32, ptr %17, align 4, !tbaa !20
  %113 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 1
  %114 = load i32, ptr %113, align 8, !tbaa !16
  %115 = icmp sle i32 %112, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %136

117:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = load i32, ptr %17, align 4, !tbaa !20
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds double, ptr %118, i64 %120
  %122 = load double, ptr %121, align 8, !tbaa !17
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = load i32, ptr %17, align 4, !tbaa !20
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds double, ptr %123, i64 %125
  %127 = load double, ptr %126, align 8, !tbaa !17
  %128 = fsub double %122, %127
  store double %128, ptr %18, align 8, !tbaa !17
  %129 = load double, ptr %18, align 8, !tbaa !17
  %130 = load double, ptr %18, align 8, !tbaa !17
  %131 = load double, ptr %12, align 8, !tbaa !17
  %132 = call double @llvm.fmuladd.f64(double %129, double %130, double %131)
  store double %132, ptr %12, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br label %133

133:                                              ; preds = %117
  %134 = load i32, ptr %17, align 4, !tbaa !20
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %17, align 4, !tbaa !20
  br label %111, !llvm.loop !24

136:                                              ; preds = %116
  br label %195

137:                                              ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !20
  br label %138

138:                                              ; preds = %188, %137
  %139 = load i32, ptr %19, align 4, !tbaa !20
  %140 = getelementptr inbounds %"class.sptk::DistanceCalculation", ptr %23, i32 0, i32 1
  %141 = load i32, ptr %140, align 8, !tbaa !16
  %142 = icmp sle i32 %139, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %138
  store i32 12, ptr %20, align 4
  br label %191

144:                                              ; preds = %138
  %145 = load ptr, ptr %10, align 8, !tbaa !5
  %146 = load i32, ptr %19, align 4, !tbaa !20
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds double, ptr %145, i64 %147
  %149 = load double, ptr %148, align 8, !tbaa !17
  %150 = fcmp ole double %149, 0.000000e+00
  br i1 %150, label %158, label %151

151:                                              ; preds = %144
  %152 = load ptr, ptr %11, align 8, !tbaa !5
  %153 = load i32, ptr %19, align 4, !tbaa !20
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds double, ptr %152, i64 %154
  %156 = load double, ptr %155, align 8, !tbaa !17
  %157 = fcmp ole double %156, 0.000000e+00
  br i1 %157, label %158, label %159

158:                                              ; preds = %151, %144
  store i1 false, ptr %5, align 1
  store i32 1, ptr %20, align 4
  br label %191

159:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = load i32, ptr %19, align 4, !tbaa !20
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds double, ptr %160, i64 %162
  %164 = load double, ptr %163, align 8, !tbaa !17
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  %166 = load i32, ptr %19, align 4, !tbaa !20
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds double, ptr %165, i64 %167
  %169 = load double, ptr %168, align 8, !tbaa !17
  %170 = fsub double %164, %169
  store double %170, ptr %21, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = load i32, ptr %19, align 4, !tbaa !20
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds double, ptr %171, i64 %173
  %175 = load double, ptr %174, align 8, !tbaa !17
  %176 = call double @log(double noundef %175) #4
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = load i32, ptr %19, align 4, !tbaa !20
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds double, ptr %177, i64 %179
  %181 = load double, ptr %180, align 8, !tbaa !17
  %182 = call double @log(double noundef %181) #4
  %183 = fsub double %176, %182
  store double %183, ptr %22, align 8, !tbaa !17
  %184 = load double, ptr %21, align 8, !tbaa !17
  %185 = load double, ptr %22, align 8, !tbaa !17
  %186 = load double, ptr %12, align 8, !tbaa !17
  %187 = call double @llvm.fmuladd.f64(double %184, double %185, double %186)
  store double %187, ptr %12, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  br label %188

188:                                              ; preds = %159
  %189 = load i32, ptr %19, align 4, !tbaa !20
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %19, align 4, !tbaa !20
  br label %138, !llvm.loop !25

191:                                              ; preds = %158, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  %192 = load i32, ptr %20, align 4
  switch i32 %192, label %198 [
    i32 12, label %193
  ]

193:                                              ; preds = %191
  br label %195

194:                                              ; preds = %47
  store i1 false, ptr %5, align 1
  store i32 1, ptr %20, align 4
  br label %198

195:                                              ; preds = %193, %136, %107, %80
  %196 = load double, ptr %12, align 8, !tbaa !17
  %197 = load ptr, ptr %9, align 8, !tbaa !5
  store double %196, ptr %197, align 8, !tbaa !17
  store i1 true, ptr %5, align 1
  store i32 1, ptr %20, align 4
  br label %198

198:                                              ; preds = %195, %194, %191
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %199

199:                                              ; preds = %198, %46
  %200 = load i1, ptr %5, align 1
  ret i1 %200
}

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

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

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

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

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

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

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

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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, !13, i64 16}
!10 = !{!"_ZTSN4sptk19DistanceCalculationE", !11, i64 8, !12, i64 12, !13, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN4sptk19DistanceCalculation15DistanceMetricsE", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!10, !11, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!10, !12, i64 12}
!20 = !{!11, !11, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}
!25 = distinct !{!25, !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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK4sptk19DistanceCalculation3RunERKSt6vectorIdSaIdEES5_Pd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef writeonly %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !12, !noundef !13
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %.loopexit

8:                                                ; preds = %4
  %9 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !14
  %12 = add nsw i32 %11, 1
  %13 = sext i32 %12 to i64
  %.not = icmp eq i64 %9, %13
  br i1 %.not, label %14, label %.loopexit

14:                                               ; preds = %8
  %15 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #3
  %16 = load i32, ptr %10, align 8, !tbaa !14
  %17 = add nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = icmp ne i64 %15, %18
  %20 = icmp eq ptr %3, null
  %or.cond = or i1 %20, %19
  br i1 %or.cond, label %.loopexit, label %21

21:                                               ; preds = %14
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %23 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 0) #3
  %24 = getelementptr inbounds i8, ptr %0, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !15
  switch i32 %25, label %.loopexit [
    i32 0, label %.preheader
    i32 1, label %.preheader68
    i32 2, label %.preheader69
    i32 3, label %.preheader71
  ]

.preheader71:                                     ; preds = %21
  %26 = load i32, ptr %10, align 8, !tbaa !14
  %.not6474 = icmp slt i32 %26, 0
  br i1 %.not6474, label %.critedge, label %.lr.ph

.preheader69:                                     ; preds = %21
  %27 = load i32, ptr %10, align 8, !tbaa !14
  %.not6577 = icmp slt i32 %27, 0
  br i1 %.not6577, label %.critedge, label %.lr.ph80.preheader

.lr.ph80.preheader:                               ; preds = %.preheader69
  %28 = add nuw i32 %27, 1
  %wide.trip.count = zext i32 %28 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %29 = icmp ult i32 %27, 3
  br i1 %29, label %.critedge.loopexit122.unr-lcssa, label %.lr.ph80.preheader.new

.lr.ph80.preheader.new:                           ; preds = %.lr.ph80.preheader
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  br label %.lr.ph80

.preheader68:                                     ; preds = %21
  %30 = load i32, ptr %10, align 8, !tbaa !14
  %.not6682 = icmp slt i32 %30, 0
  br i1 %.not6682, label %._crit_edge, label %.lr.ph85.preheader

.lr.ph85.preheader:                               ; preds = %.preheader68
  %31 = add nuw i32 %30, 1
  %wide.trip.count104 = zext i32 %31 to i64
  %xtraiter127 = and i64 %wide.trip.count104, 3
  %32 = icmp ult i32 %30, 3
  br i1 %32, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph85.preheader.new

.lr.ph85.preheader.new:                           ; preds = %.lr.ph85.preheader
  %unroll_iter131 = and i64 %wide.trip.count104, 4294967292
  br label %.lr.ph85

.preheader:                                       ; preds = %21
  %33 = load i32, ptr %10, align 8, !tbaa !14
  %.not6787 = icmp slt i32 %33, 0
  br i1 %.not6787, label %.critedge, label %.lr.ph90.preheader

.lr.ph90.preheader:                               ; preds = %.preheader
  %34 = add nuw i32 %33, 1
  %wide.trip.count109 = zext i32 %34 to i64
  %xtraiter133 = and i64 %wide.trip.count109, 1
  %35 = icmp eq i32 %33, 0
  br i1 %35, label %.critedge.loopexit.unr-lcssa, label %.lr.ph90.preheader.new

.lr.ph90.preheader.new:                           ; preds = %.lr.ph90.preheader
  %unroll_iter137 = and i64 %wide.trip.count109, 4294967294
  br label %.lr.ph90

.lr.ph90:                                         ; preds = %.lr.ph90, %.lr.ph90.preheader.new
  %indvars.iv106 = phi i64 [ 0, %.lr.ph90.preheader.new ], [ %indvars.iv.next107.1, %.lr.ph90 ]
  %.05489 = phi double [ 0.000000e+00, %.lr.ph90.preheader.new ], [ %49, %.lr.ph90 ]
  %niter138 = phi i64 [ 0, %.lr.ph90.preheader.new ], [ %niter138.next.1, %.lr.ph90 ]
  %36 = getelementptr inbounds double, ptr %22, i64 %indvars.iv106
  %37 = load double, ptr %36, align 8, !tbaa !16
  %38 = getelementptr inbounds double, ptr %23, i64 %indvars.iv106
  %39 = load double, ptr %38, align 8, !tbaa !16
  %40 = fsub double %37, %39
  %41 = tail call double @llvm.fabs.f64(double %40)
  %42 = fadd double %.05489, %41
  %indvars.iv.next107 = or disjoint i64 %indvars.iv106, 1
  %43 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next107
  %44 = load double, ptr %43, align 8, !tbaa !16
  %45 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next107
  %46 = load double, ptr %45, align 8, !tbaa !16
  %47 = fsub double %44, %46
  %48 = tail call double @llvm.fabs.f64(double %47)
  %49 = fadd double %42, %48
  %indvars.iv.next107.1 = add nuw nsw i64 %indvars.iv106, 2
  %niter138.next.1 = add i64 %niter138, 2
  %niter138.ncmp.1 = icmp eq i64 %niter138.next.1, %unroll_iter137
  br i1 %niter138.ncmp.1, label %.critedge.loopexit.unr-lcssa, label %.lr.ph90, !llvm.loop !18

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph85, %.lr.ph85.preheader
  %.lcssa121.ph = phi double [ poison, %.lr.ph85.preheader ], [ %80, %.lr.ph85 ]
  %indvars.iv101.unr = phi i64 [ 0, %.lr.ph85.preheader ], [ %indvars.iv.next102.3, %.lr.ph85 ]
  %.15584.unr = phi double [ 0.000000e+00, %.lr.ph85.preheader ], [ %80, %.lr.ph85 ]
  %lcmp.mod129.not = icmp eq i64 %xtraiter127, 0
  br i1 %lcmp.mod129.not, label %._crit_edge, label %.lr.ph85.epil

.lr.ph85.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph85.epil
  %indvars.iv101.epil = phi i64 [ %indvars.iv.next102.epil, %.lr.ph85.epil ], [ %indvars.iv101.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.15584.epil = phi double [ %55, %.lr.ph85.epil ], [ %.15584.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter128 = phi i64 [ %epil.iter128.next, %.lr.ph85.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %50 = getelementptr inbounds double, ptr %22, i64 %indvars.iv101.epil
  %51 = load double, ptr %50, align 8, !tbaa !16
  %52 = getelementptr inbounds double, ptr %23, i64 %indvars.iv101.epil
  %53 = load double, ptr %52, align 8, !tbaa !16
  %54 = fsub double %51, %53
  %55 = tail call double @llvm.fmuladd.f64(double %54, double %54, double %.15584.epil)
  %indvars.iv.next102.epil = add nuw nsw i64 %indvars.iv101.epil, 1
  %epil.iter128.next = add i64 %epil.iter128, 1
  %epil.iter128.cmp.not = icmp eq i64 %epil.iter128.next, %xtraiter127
  br i1 %epil.iter128.cmp.not, label %._crit_edge, label %.lr.ph85.epil, !llvm.loop !20

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph85.epil, %.preheader68
  %.155.lcssa = phi double [ 0.000000e+00, %.preheader68 ], [ %.lcssa121.ph, %._crit_edge.loopexit.unr-lcssa ], [ %55, %.lr.ph85.epil ]
  %56 = tail call double @sqrt(double noundef %.155.lcssa) #3
  br label %.critedge

.lr.ph85:                                         ; preds = %.lr.ph85, %.lr.ph85.preheader.new
  %indvars.iv101 = phi i64 [ 0, %.lr.ph85.preheader.new ], [ %indvars.iv.next102.3, %.lr.ph85 ]
  %.15584 = phi double [ 0.000000e+00, %.lr.ph85.preheader.new ], [ %80, %.lr.ph85 ]
  %niter132 = phi i64 [ 0, %.lr.ph85.preheader.new ], [ %niter132.next.3, %.lr.ph85 ]
  %57 = getelementptr inbounds double, ptr %22, i64 %indvars.iv101
  %58 = load double, ptr %57, align 8, !tbaa !16
  %59 = getelementptr inbounds double, ptr %23, i64 %indvars.iv101
  %60 = load double, ptr %59, align 8, !tbaa !16
  %61 = fsub double %58, %60
  %62 = tail call double @llvm.fmuladd.f64(double %61, double %61, double %.15584)
  %indvars.iv.next102 = or disjoint i64 %indvars.iv101, 1
  %63 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next102
  %64 = load double, ptr %63, align 8, !tbaa !16
  %65 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next102
  %66 = load double, ptr %65, align 8, !tbaa !16
  %67 = fsub double %64, %66
  %68 = tail call double @llvm.fmuladd.f64(double %67, double %67, double %62)
  %indvars.iv.next102.1 = or disjoint i64 %indvars.iv101, 2
  %69 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next102.1
  %70 = load double, ptr %69, align 8, !tbaa !16
  %71 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next102.1
  %72 = load double, ptr %71, align 8, !tbaa !16
  %73 = fsub double %70, %72
  %74 = tail call double @llvm.fmuladd.f64(double %73, double %73, double %68)
  %indvars.iv.next102.2 = or disjoint i64 %indvars.iv101, 3
  %75 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next102.2
  %76 = load double, ptr %75, align 8, !tbaa !16
  %77 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next102.2
  %78 = load double, ptr %77, align 8, !tbaa !16
  %79 = fsub double %76, %78
  %80 = tail call double @llvm.fmuladd.f64(double %79, double %79, double %74)
  %indvars.iv.next102.3 = add nuw nsw i64 %indvars.iv101, 4
  %niter132.next.3 = add i64 %niter132, 4
  %niter132.ncmp.3 = icmp eq i64 %niter132.next.3, %unroll_iter131
  br i1 %niter132.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph85, !llvm.loop !22

.lr.ph80:                                         ; preds = %.lr.ph80, %.lr.ph80.preheader.new
  %indvars.iv98 = phi i64 [ 0, %.lr.ph80.preheader.new ], [ %indvars.iv.next99.3, %.lr.ph80 ]
  %.25679 = phi double [ 0.000000e+00, %.lr.ph80.preheader.new ], [ %104, %.lr.ph80 ]
  %niter = phi i64 [ 0, %.lr.ph80.preheader.new ], [ %niter.next.3, %.lr.ph80 ]
  %81 = getelementptr inbounds double, ptr %22, i64 %indvars.iv98
  %82 = load double, ptr %81, align 8, !tbaa !16
  %83 = getelementptr inbounds double, ptr %23, i64 %indvars.iv98
  %84 = load double, ptr %83, align 8, !tbaa !16
  %85 = fsub double %82, %84
  %86 = tail call double @llvm.fmuladd.f64(double %85, double %85, double %.25679)
  %indvars.iv.next99 = or disjoint i64 %indvars.iv98, 1
  %87 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next99
  %88 = load double, ptr %87, align 8, !tbaa !16
  %89 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next99
  %90 = load double, ptr %89, align 8, !tbaa !16
  %91 = fsub double %88, %90
  %92 = tail call double @llvm.fmuladd.f64(double %91, double %91, double %86)
  %indvars.iv.next99.1 = or disjoint i64 %indvars.iv98, 2
  %93 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next99.1
  %94 = load double, ptr %93, align 8, !tbaa !16
  %95 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next99.1
  %96 = load double, ptr %95, align 8, !tbaa !16
  %97 = fsub double %94, %96
  %98 = tail call double @llvm.fmuladd.f64(double %97, double %97, double %92)
  %indvars.iv.next99.2 = or disjoint i64 %indvars.iv98, 3
  %99 = getelementptr inbounds double, ptr %22, i64 %indvars.iv.next99.2
  %100 = load double, ptr %99, align 8, !tbaa !16
  %101 = getelementptr inbounds double, ptr %23, i64 %indvars.iv.next99.2
  %102 = load double, ptr %101, align 8, !tbaa !16
  %103 = fsub double %100, %102
  %104 = tail call double @llvm.fmuladd.f64(double %103, double %103, double %98)
  %indvars.iv.next99.3 = add nuw nsw i64 %indvars.iv98, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.critedge.loopexit122.unr-lcssa, label %.lr.ph80, !llvm.loop !23

.lr.ph:                                           ; preds = %.preheader71, %112
  %indvars.iv = phi i64 [ %indvars.iv.next, %112 ], [ 0, %.preheader71 ]
  %.376 = phi double [ %118, %112 ], [ 0.000000e+00, %.preheader71 ]
  %105 = getelementptr inbounds double, ptr %22, i64 %indvars.iv
  %106 = load double, ptr %105, align 8, !tbaa !16
  %107 = fcmp ugt double %106, 0.000000e+00
  br i1 %107, label %108, label %.loopexit

108:                                              ; preds = %.lr.ph
  %109 = getelementptr inbounds double, ptr %23, i64 %indvars.iv
  %110 = load double, ptr %109, align 8, !tbaa !16
  %111 = fcmp ugt double %110, 0.000000e+00
  br i1 %111, label %112, label %.loopexit

112:                                              ; preds = %108
  %113 = fsub double %106, %110
  %114 = tail call double @log(double noundef %106) #3
  %115 = load double, ptr %109, align 8, !tbaa !16
  %116 = tail call double @log(double noundef %115) #3
  %117 = fsub double %114, %116
  %118 = tail call double @llvm.fmuladd.f64(double %113, double %117, double %.376)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %119 = load i32, ptr %10, align 8, !tbaa !14
  %120 = sext i32 %119 to i64
  %.not64.not = icmp slt i64 %indvars.iv, %120
  br i1 %.not64.not, label %.lr.ph, label %.critedge, !llvm.loop !24

.critedge.loopexit.unr-lcssa:                     ; preds = %.lr.ph90, %.lr.ph90.preheader
  %.lcssa.ph = phi double [ poison, %.lr.ph90.preheader ], [ %49, %.lr.ph90 ]
  %indvars.iv106.unr = phi i64 [ 0, %.lr.ph90.preheader ], [ %indvars.iv.next107.1, %.lr.ph90 ]
  %.05489.unr = phi double [ 0.000000e+00, %.lr.ph90.preheader ], [ %49, %.lr.ph90 ]
  %lcmp.mod135.not = icmp eq i64 %xtraiter133, 0
  br i1 %lcmp.mod135.not, label %.critedge, label %.lr.ph90.epil

.lr.ph90.epil:                                    ; preds = %.critedge.loopexit.unr-lcssa
  %121 = getelementptr inbounds double, ptr %22, i64 %indvars.iv106.unr
  %122 = load double, ptr %121, align 8, !tbaa !16
  %123 = getelementptr inbounds double, ptr %23, i64 %indvars.iv106.unr
  %124 = load double, ptr %123, align 8, !tbaa !16
  %125 = fsub double %122, %124
  %126 = tail call double @llvm.fabs.f64(double %125)
  %127 = fadd double %.05489.unr, %126
  br label %.critedge

.critedge.loopexit122.unr-lcssa:                  ; preds = %.lr.ph80, %.lr.ph80.preheader
  %.lcssa123.ph = phi double [ poison, %.lr.ph80.preheader ], [ %104, %.lr.ph80 ]
  %indvars.iv98.unr = phi i64 [ 0, %.lr.ph80.preheader ], [ %indvars.iv.next99.3, %.lr.ph80 ]
  %.25679.unr = phi double [ 0.000000e+00, %.lr.ph80.preheader ], [ %104, %.lr.ph80 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.critedge, label %.lr.ph80.epil

.lr.ph80.epil:                                    ; preds = %.critedge.loopexit122.unr-lcssa, %.lr.ph80.epil
  %indvars.iv98.epil = phi i64 [ %indvars.iv.next99.epil, %.lr.ph80.epil ], [ %indvars.iv98.unr, %.critedge.loopexit122.unr-lcssa ]
  %.25679.epil = phi double [ %133, %.lr.ph80.epil ], [ %.25679.unr, %.critedge.loopexit122.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph80.epil ], [ 0, %.critedge.loopexit122.unr-lcssa ]
  %128 = getelementptr inbounds double, ptr %22, i64 %indvars.iv98.epil
  %129 = load double, ptr %128, align 8, !tbaa !16
  %130 = getelementptr inbounds double, ptr %23, i64 %indvars.iv98.epil
  %131 = load double, ptr %130, align 8, !tbaa !16
  %132 = fsub double %129, %131
  %133 = tail call double @llvm.fmuladd.f64(double %132, double %132, double %.25679.epil)
  %indvars.iv.next99.epil = add nuw nsw i64 %indvars.iv98.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.critedge, label %.lr.ph80.epil, !llvm.loop !25

.critedge:                                        ; preds = %112, %.critedge.loopexit122.unr-lcssa, %.lr.ph80.epil, %.lr.ph90.epil, %.critedge.loopexit.unr-lcssa, %.preheader71, %.preheader69, %.preheader, %._crit_edge
  %.4 = phi double [ %56, %._crit_edge ], [ 0.000000e+00, %.preheader ], [ 0.000000e+00, %.preheader69 ], [ 0.000000e+00, %.preheader71 ], [ %.lcssa.ph, %.critedge.loopexit.unr-lcssa ], [ %127, %.lr.ph90.epil ], [ %.lcssa123.ph, %.critedge.loopexit122.unr-lcssa ], [ %133, %.lr.ph80.epil ], [ %118, %112 ]
  store double %.4, ptr %3, align 8, !tbaa !16
  br label %.loopexit

.loopexit:                                        ; preds = %108, %.lr.ph, %.critedge, %21, %4, %8, %14
  %.2 = phi i1 [ false, %14 ], [ false, %8 ], [ false, %4 ], [ true, %.critedge ], [ false, %21 ], [ false, %.lr.ph ], [ false, %108 ]
  ret i1 %.2
}

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

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

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

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

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

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

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 speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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, !11, i64 16}
!6 = !{!"_ZTSN4sptk19DistanceCalculationE", !7, i64 8, !10, i64 12, !11, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4sptk19DistanceCalculation15DistanceMetricsE", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !10, i64 12}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}
!25 = distinct !{!25, !21}


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