; LLVM IR from buresjan/optim_lbm :: nomad/ext/sgtelib/src (TrainingSet)

; 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.SGTELIB::Matrix" = type { ptr, %"class.std::__cxx11::basic_string", i32, i32, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@.str.3 = external hidden unnamed_addr constant [90 x i8], align 1
@_ZTIN7SGTELIB9ExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.33 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_colsEv(ptr noundef nonnull align 8 dereferenceable(56)) #0 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

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

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

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

; Function Attrs: nounwind
declare void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #6

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

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

declare void @__cxa_throw(ptr, ptr, ptr)

declare void @__cxa_free_exception(ptr)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef) #0 align 2

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

declare void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef, double noundef) #8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7SGTELIB11TrainingSet13get_distancesERKNS_6MatrixES3_NS_10distance_tE(ptr dead_on_unwind noalias writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(504) %1, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %4) #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i1, align 1
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i1, align 1
  %31 = alloca %"class.std::__cxx11::basic_string", align 8
  %32 = alloca %"class.std::allocator", align 1
  %33 = alloca %"class.std::__cxx11::basic_string", align 8
  %34 = alloca %"class.std::allocator", align 1
  %35 = alloca i1, align 1
  store ptr %0, ptr %6, align 8
  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
  store i32 %4, ptr %10, align 4, !tbaa !9
  %36 = load ptr, ptr %7, align 8
  %37 = load i32, ptr %10, align 4, !tbaa !9
  switch i32 %37, label %227 [
    i32 1, label %38
    i32 0, label %41
    i32 2, label %44
    i32 3, label %47
    i32 4, label %165
  ]

38:                                               ; preds = %5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN7SGTELIB6Matrix19get_distances_norm1ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %39, ptr noundef nonnull align 8 dereferenceable(56) %40)
  br label %249

41:                                               ; preds = %5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %42, ptr noundef nonnull align 8 dereferenceable(56) %43)
  br label %249

44:                                               ; preds = %5
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN7SGTELIB6Matrix21get_distances_norminfERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %45, ptr noundef nonnull align 8 dereferenceable(56) %46)
  br label %249

47:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_colsEv(ptr noundef nonnull align 8 dereferenceable(56) %48)
  store i32 %49, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %50)
  store i32 %51, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %52)
  store i32 %53, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i1 false, ptr %19, align 1
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %54, ptr noundef nonnull align 8 dereferenceable(56) %55)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %56 = load i32, ptr %11, align 4, !tbaa !11
  %57 = sext i32 %56 to i64
  %58 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %57, i64 8)
  %59 = extractvalue { i64, i1 } %58, 1
  %60 = extractvalue { i64, i1 } %58, 0
  %61 = select i1 %59, i64 -1, i64 %60
  %62 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %61) #10
          to label %63 unwind label %79

63:                                               ; preds = %47
  store ptr %62, ptr %20, align 8, !tbaa !5
  store i32 0, ptr %18, align 4, !tbaa !11
  br label %64

64:                                               ; preds = %76, %63
  %65 = load i32, ptr %18, align 4, !tbaa !11
  %66 = load i32, ptr %11, align 4, !tbaa !11
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %68, label %83

68:                                               ; preds = %64
  %69 = load i32, ptr %18, align 4, !tbaa !11
  %70 = invoke noundef double @_ZNK7SGTELIB11TrainingSet7X_scaleEdi(ptr noundef nonnull align 8 dereferenceable(504) %36, double noundef 0.000000e+00, i32 noundef %69)
          to label %71 unwind label %79

71:                                               ; preds = %68
  %72 = load ptr, ptr %20, align 8, !tbaa !5
  %73 = load i32, ptr %18, align 4, !tbaa !11
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds double, ptr %72, i64 %74
  store double %70, ptr %75, align 8, !tbaa !13
  br label %76

76:                                               ; preds = %71
  %77 = load i32, ptr %18, align 4, !tbaa !11
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %18, align 4, !tbaa !11
  br label %64, !llvm.loop !15

79:                                               ; preds = %143, %110, %105, %93, %68, %47
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %21, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %250

83:                                               ; preds = %64
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %84

84:                                               ; preds = %154, %83
  %85 = load i32, ptr %16, align 4, !tbaa !11
  %86 = load i32, ptr %12, align 4, !tbaa !11
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %88, label %157

88:                                               ; preds = %84
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %89

89:                                               ; preds = %150, %88
  %90 = load i32, ptr %17, align 4, !tbaa !11
  %91 = load i32, ptr %13, align 4, !tbaa !11
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %93, label %153

93:                                               ; preds = %89
  %94 = load i32, ptr %16, align 4, !tbaa !11
  %95 = load i32, ptr %17, align 4, !tbaa !11
  %96 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %94, i32 noundef %95)
          to label %97 unwind label %79

97:                                               ; preds = %93
  store double %96, ptr %15, align 8, !tbaa !13
  %98 = load double, ptr %15, align 8, !tbaa !13
  %99 = load double, ptr %15, align 8, !tbaa !13
  %100 = fmul double %98, %99
  store double %100, ptr %14, align 8, !tbaa !13
  store i32 0, ptr %18, align 4, !tbaa !11
  br label %101

101:                                              ; preds = %140, %97
  %102 = load i32, ptr %18, align 4, !tbaa !11
  %103 = load i32, ptr %11, align 4, !tbaa !11
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %143

105:                                              ; preds = %101
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = load i32, ptr %16, align 4, !tbaa !11
  %108 = load i32, ptr %18, align 4, !tbaa !11
  %109 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %106, i32 noundef %107, i32 noundef %108)
          to label %110 unwind label %79

110:                                              ; preds = %105
  %111 = load ptr, ptr %20, align 8, !tbaa !5
  %112 = load i32, ptr %18, align 4, !tbaa !11
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds double, ptr %111, i64 %113
  %115 = load double, ptr %114, align 8, !tbaa !13
  %116 = fsub double %109, %115
  %117 = call double @llvm.fabs.f64(double %116)
  %118 = fcmp olt double %117, 1.000000e-13
  %119 = zext i1 %118 to i32
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = load i32, ptr %17, align 4, !tbaa !11
  %122 = load i32, ptr %18, align 4, !tbaa !11
  %123 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %120, i32 noundef %121, i32 noundef %122)
          to label %124 unwind label %79

124:                                              ; preds = %110
  %125 = load ptr, ptr %20, align 8, !tbaa !5
  %126 = load i32, ptr %18, align 4, !tbaa !11
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds double, ptr %125, i64 %127
  %129 = load double, ptr %128, align 8, !tbaa !13
  %130 = fsub double %123, %129
  %131 = call double @llvm.fabs.f64(double %130)
  %132 = fcmp olt double %131, 1.000000e-13
  %133 = zext i1 %132 to i32
  %134 = xor i32 %119, %133
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %139

136:                                              ; preds = %124
  %137 = load double, ptr %14, align 8, !tbaa !13
  %138 = fadd double %137, 1.000000e+04
  store double %138, ptr %14, align 8, !tbaa !13
  br label %139

139:                                              ; preds = %136, %124
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %18, align 4, !tbaa !11
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %18, align 4, !tbaa !11
  br label %101, !llvm.loop !17

143:                                              ; preds = %101
  %144 = load double, ptr %14, align 8, !tbaa !13
  %145 = call double @sqrt(double noundef %144) #9
  store double %145, ptr %14, align 8, !tbaa !13
  %146 = load i32, ptr %16, align 4, !tbaa !11
  %147 = load i32, ptr %17, align 4, !tbaa !11
  %148 = load double, ptr %14, align 8, !tbaa !13
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %146, i32 noundef %147, double noundef %148)
          to label %149 unwind label %79

149:                                              ; preds = %143
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %17, align 4, !tbaa !11
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %17, align 4, !tbaa !11
  br label %89, !llvm.loop !18

153:                                              ; preds = %89
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %16, align 4, !tbaa !11
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %16, align 4, !tbaa !11
  br label %84, !llvm.loop !19

157:                                              ; preds = %84
  %158 = load ptr, ptr %20, align 8, !tbaa !5
  %159 = icmp eq ptr %158, null
  br i1 %159, label %161, label %160

160:                                              ; preds = %157
  call void @_ZdaPv(ptr noundef %158) #11
  br label %161

161:                                              ; preds = %160, %157
  store i1 true, ptr %19, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  %162 = load i1, ptr %19, align 1
  br i1 %162, label %164, label %163

163:                                              ; preds = %161
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #9
  br label %164

164:                                              ; preds = %163, %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %249

165:                                              ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #9
  %166 = load ptr, ptr %8, align 8, !tbaa !5
  %167 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %166)
  store i32 %167, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %168)
  store i32 %169, ptr %24, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  store i1 false, ptr %30, align 1
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %170, ptr noundef nonnull align 8 dereferenceable(56) %171)
  store i32 0, ptr %29, align 4, !tbaa !11
  store i32 0, ptr %28, align 4, !tbaa !11
  br label %172

172:                                              ; preds = %220, %165
  %173 = load i32, ptr %28, align 4, !tbaa !11
  %174 = load i32, ptr %24, align 4, !tbaa !11
  %175 = icmp slt i32 %173, %174
  br i1 %175, label %176, label %223

176:                                              ; preds = %172
  store i32 0, ptr %27, align 4, !tbaa !11
  br label %177

177:                                              ; preds = %216, %176
  %178 = load i32, ptr %27, align 4, !tbaa !11
  %179 = load i32, ptr %23, align 4, !tbaa !11
  %180 = icmp slt i32 %178, %179
  br i1 %180, label %181, label %219

181:                                              ; preds = %177
  %182 = load i32, ptr %27, align 4, !tbaa !11
  %183 = load i32, ptr %28, align 4, !tbaa !11
  %184 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %182, i32 noundef %183)
          to label %185 unwind label %205

185:                                              ; preds = %181
  store double %184, ptr %26, align 8, !tbaa !13
  %186 = load double, ptr %26, align 8, !tbaa !13
  %187 = load double, ptr %26, align 8, !tbaa !13
  %188 = fmul double %186, %187
  store double %188, ptr %25, align 8, !tbaa !13
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = load i32, ptr %27, align 4, !tbaa !11
  %191 = load i32, ptr %29, align 4, !tbaa !11
  %192 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %189, i32 noundef %190, i32 noundef %191)
          to label %193 unwind label %205

193:                                              ; preds = %185
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  %195 = load i32, ptr %28, align 4, !tbaa !11
  %196 = load i32, ptr %29, align 4, !tbaa !11
  %197 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %194, i32 noundef %195, i32 noundef %196)
          to label %198 unwind label %205

198:                                              ; preds = %193
  %199 = fsub double %192, %197
  %200 = call double @llvm.fabs.f64(double %199)
  %201 = fcmp ogt double %200, 1.000000e-13
  br i1 %201, label %202, label %209

202:                                              ; preds = %198
  %203 = load double, ptr %25, align 8, !tbaa !13
  %204 = fadd double %203, 1.000000e+04
  store double %204, ptr %25, align 8, !tbaa !13
  br label %209

205:                                              ; preds = %209, %193, %185, %181
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %21, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %22, align 4
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  br label %250

209:                                              ; preds = %202, %198
  %210 = load double, ptr %25, align 8, !tbaa !13
  %211 = call double @sqrt(double noundef %210) #9
  store double %211, ptr %25, align 8, !tbaa !13
  %212 = load i32, ptr %27, align 4, !tbaa !11
  %213 = load i32, ptr %28, align 4, !tbaa !11
  %214 = load double, ptr %25, align 8, !tbaa !13
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %212, i32 noundef %213, double noundef %214)
          to label %215 unwind label %205

215:                                              ; preds = %209
  br label %216

216:                                              ; preds = %215
  %217 = load i32, ptr %27, align 4, !tbaa !11
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %27, align 4, !tbaa !11
  br label %177, !llvm.loop !20

219:                                              ; preds = %177
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %28, align 4, !tbaa !11
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %28, align 4, !tbaa !11
  br label %172, !llvm.loop !21

223:                                              ; preds = %172
  store i1 true, ptr %30, align 1
  %224 = load i1, ptr %30, align 1
  br i1 %224, label %226, label %225

225:                                              ; preds = %223
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #9
  br label %226

226:                                              ; preds = %225, %223
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  br label %249

227:                                              ; preds = %5
  store i1 true, ptr %35, align 1
  %228 = call ptr @__cxa_allocate_exception(i64 112) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %31) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %32) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %32) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %31, ptr noundef @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %32)
          to label %229 unwind label %232

229:                                              ; preds = %227
  call void @llvm.lifetime.start.p0(i64 32, ptr %33) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %34) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %34) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %33, ptr noundef @.str.33, ptr noundef nonnull align 1 dereferenceable(1) %34)
          to label %230 unwind label %236

230:                                              ; preds = %229
  invoke void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112) %228, ptr noundef nonnull align 8 dereferenceable(32) %31, i32 noundef 988, ptr noundef nonnull align 8 dereferenceable(32) %33)
          to label %231 unwind label %240

231:                                              ; preds = %230
  store i1 false, ptr %35, align 1
  invoke void @__cxa_throw(ptr %228, ptr @_ZTIN7SGTELIB9ExceptionE, ptr @_ZN7SGTELIB9ExceptionD2Ev) #12
          to label %255 unwind label %240

232:                                              ; preds = %227
  %233 = landingpad { ptr, i32 }
          cleanup
  %234 = extractvalue { ptr, i32 } %233, 0
  store ptr %234, ptr %21, align 8
  %235 = extractvalue { ptr, i32 } %233, 1
  store i32 %235, ptr %22, align 4
  br label %245

236:                                              ; preds = %229
  %237 = landingpad { ptr, i32 }
          cleanup
  %238 = extractvalue { ptr, i32 } %237, 0
  store ptr %238, ptr %21, align 8
  %239 = extractvalue { ptr, i32 } %237, 1
  store i32 %239, ptr %22, align 4
  br label %244

240:                                              ; preds = %231, %230
  %241 = landingpad { ptr, i32 }
          cleanup
  %242 = extractvalue { ptr, i32 } %241, 0
  store ptr %242, ptr %21, align 8
  %243 = extractvalue { ptr, i32 } %241, 1
  store i32 %243, ptr %22, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %33) #9
  br label %244

244:                                              ; preds = %240, %236
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %34) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %34) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %33) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %31) #9
  br label %245

245:                                              ; preds = %244, %232
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %32) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %31) #9
  %246 = load i1, ptr %35, align 1
  br i1 %246, label %247, label %248

247:                                              ; preds = %245
  call void @__cxa_free_exception(ptr %228) #9
  br label %248

248:                                              ; preds = %247, %245
  br label %250

249:                                              ; preds = %226, %164, %44, %41, %38
  ret void

250:                                              ; preds = %248, %205, %79
  %251 = load ptr, ptr %21, align 8
  %252 = load i32, ptr %22, align 4
  %253 = insertvalue { ptr, i32 } poison, ptr %251, 0
  %254 = insertvalue { ptr, i32 } %253, i32 %252, 1
  resume { ptr, i32 } %254

255:                                              ; preds = %231
  unreachable
}

declare void @_ZN7SGTELIB6Matrix19get_distances_norm1ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) #8

declare void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) #8

declare void @_ZN7SGTELIB6Matrix21get_distances_norminfERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB11TrainingSet7X_scaleEdi(ptr noundef nonnull align 8 dereferenceable(504), double noundef, i32 noundef) #4 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN7SGTELIB10distance_tE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !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.SGTELIB::Matrix" = type { ptr, %"class.std::__cxx11::basic_string", i32, i32, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@.str.3 = external hidden unnamed_addr constant [90 x i8], align 1
@_ZTIN7SGTELIB9ExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.33 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_colsEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #5

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

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

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

declare void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef, double noundef) local_unnamed_addr #8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7SGTELIB11TrainingSet13get_distancesERKNS_6MatrixES3_NS_10distance_tE(ptr dead_on_unwind noalias writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(504) %1, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %4) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator", align 1
  switch i32 %4, label %73 [
    i32 1, label %10
    i32 0, label %11
    i32 2, label %12
    i32 3, label %13
    i32 4, label %55
  ]

10:                                               ; preds = %5
  tail call void @_ZN7SGTELIB6Matrix19get_distances_norm1ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3)
  br label %.loopexit103

11:                                               ; preds = %5
  tail call void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3)
  br label %.loopexit103

12:                                               ; preds = %5
  tail call void @_ZN7SGTELIB6Matrix21get_distances_norminfERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3)
  br label %.loopexit103

13:                                               ; preds = %5
  %14 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_colsEv(ptr noundef nonnull align 8 dereferenceable(56) %2)
  %15 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %2)
  %16 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %3)
  tail call void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3)
  %17 = zext i32 %14 to i64
  %18 = icmp slt i32 %14, 0
  %19 = shl nuw nsw i64 %17, 3
  %20 = select i1 %18, i64 -1, i64 %19
  %21 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %20) #11
          to label %.preheader101 unwind label %.loopexit.split-lp

.preheader101:                                    ; preds = %13
  %22 = icmp sgt i32 %14, 0
  br i1 %22, label %.lr.ph, label %.preheader100

.preheader100:                                    ; preds = %.lr.ph, %.preheader101
  %23 = icmp sgt i32 %15, 0
  %24 = icmp sgt i32 %16, 0
  %or.cond = and i1 %23, %24
  br i1 %or.cond, label %.preheader.lr.ph.split.us, label %._crit_edge

.preheader.lr.ph.split.us:                        ; preds = %.preheader100
  br i1 %22, label %.preheader.us.us, label %.preheader.us

.preheader.us.us:                                 ; preds = %.preheader.lr.ph.split.us, %._crit_edge112.split.us.us.us
  %.082114.us.us = phi i32 [ %44, %._crit_edge112.split.us.us.us ], [ 0, %.preheader.lr.ph.split.us ]
  br label %.lr.ph109.us.us.us

.lr.ph109.us.us.us:                               ; preds = %27, %.preheader.us.us
  %.084110.us.us.us = phi i32 [ 0, %.preheader.us.us ], [ %28, %27 ]
  %25 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %.082114.us.us, i32 noundef %.084110.us.us.us)
  %26 = fmul double %25, %25
  br label %29

27:                                               ; preds = %._crit_edge.us113.us.us
  %28 = add nuw nsw i32 %.084110.us.us.us, 1
  %exitcond136.not = icmp eq i32 %28, %16
  br i1 %exitcond136.not, label %._crit_edge112.split.us.us.us, label %.lr.ph109.us.us.us, !llvm.loop !5

29:                                               ; preds = %29, %.lr.ph109.us.us.us
  %indvars.iv131 = phi i64 [ %indvars.iv.next132, %29 ], [ 0, %.lr.ph109.us.us.us ]
  %.078108.us.us.us = phi double [ %.179.us.us.us, %29 ], [ %26, %.lr.ph109.us.us.us ]
  %30 = trunc nuw nsw i64 %indvars.iv131 to i32
  %31 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.082114.us.us, i32 noundef %30)
  %32 = getelementptr inbounds double, ptr %21, i64 %indvars.iv131
  %33 = load double, ptr %32, align 8, !tbaa !7
  %34 = fsub double %31, %33
  %35 = tail call double @llvm.fabs.f64(double %34)
  %36 = fcmp olt double %35, 1.000000e-13
  %37 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %.084110.us.us.us, i32 noundef %30)
  %38 = fsub double %37, %33
  %39 = tail call double @llvm.fabs.f64(double %38)
  %40 = fcmp olt double %39, 1.000000e-13
  %41 = xor i1 %36, %40
  %42 = fadd double %.078108.us.us.us, 1.000000e+04
  %.179.us.us.us = select i1 %41, double %42, double %.078108.us.us.us
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %exitcond135.not = icmp eq i64 %indvars.iv.next132, %17
  br i1 %exitcond135.not, label %._crit_edge.us113.us.us, label %29, !llvm.loop !11

._crit_edge.us113.us.us:                          ; preds = %29
  %43 = tail call double @sqrt(double noundef %.179.us.us.us) #12
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %.082114.us.us, i32 noundef %.084110.us.us.us, double noundef %43)
          to label %27 unwind label %.loopexit.split.us.split.us.split.us

._crit_edge112.split.us.us.us:                    ; preds = %27
  %44 = add nuw nsw i32 %.082114.us.us, 1
  %exitcond137.not = icmp eq i32 %44, %15
  br i1 %exitcond137.not, label %._crit_edge, label %.preheader.us.us, !llvm.loop !12

.loopexit.split.us.split.us.split.us:             ; preds = %._crit_edge.us113.us.us
  %lpad.loopexit.us.us.us = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.preheader.us:                                    ; preds = %.preheader.lr.ph.split.us, %._crit_edge112.split.us117
  %.082114.us = phi i32 [ %51, %._crit_edge112.split.us117 ], [ 0, %.preheader.lr.ph.split.us ]
  br label %45

45:                                               ; preds = %.preheader.us, %49
  %.084110.us116 = phi i32 [ 0, %.preheader.us ], [ %50, %49 ]
  %46 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %.082114.us, i32 noundef %.084110.us116)
  %47 = fmul double %46, %46
  %48 = tail call double @sqrt(double noundef %47) #12
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %.082114.us, i32 noundef %.084110.us116, double noundef %48)
          to label %49 unwind label %.loopexit.split.split.us

49:                                               ; preds = %45
  %50 = add nuw nsw i32 %.084110.us116, 1
  %exitcond129.not = icmp eq i32 %50, %16
  br i1 %exitcond129.not, label %._crit_edge112.split.us117, label %45, !llvm.loop !5

._crit_edge112.split.us117:                       ; preds = %49
  %51 = add nuw nsw i32 %.082114.us, 1
  %exitcond130.not = icmp eq i32 %51, %15
  br i1 %exitcond130.not, label %._crit_edge, label %.preheader.us, !llvm.loop !12

.loopexit.split.split.us:                         ; preds = %45
  %lpad.loopexit.us119 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader101, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader101 ]
  %52 = trunc nuw nsw i64 %indvars.iv to i32
  %53 = tail call noundef double @_ZNK7SGTELIB11TrainingSet7X_scaleEdi(ptr noundef nonnull align 8 dereferenceable(504) %1, double noundef 0.000000e+00, i32 noundef %52)
  %54 = getelementptr inbounds double, ptr %21, i64 %indvars.iv
  store double %53, ptr %54, align 8, !tbaa !7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next, %17
  br i1 %exitcond128.not, label %.preheader100, label %.lr.ph, !llvm.loop !13

.loopexit.split-lp:                               ; preds = %13
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.split.split.us, %.loopexit.split.us.split.us.split.us, %.loopexit.split-lp
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit.split-lp, %.loopexit.split-lp ], [ %lpad.loopexit.us119, %.loopexit.split.split.us ], [ %lpad.loopexit.us.us.us, %.loopexit.split.us.split.us.split.us ]
  tail call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #12
  br label %85

._crit_edge:                                      ; preds = %._crit_edge112.split.us117, %._crit_edge112.split.us.us.us, %.preheader100
  tail call void @_ZdaPv(ptr noundef nonnull %21) #13
  br label %.loopexit103

55:                                               ; preds = %5
  %56 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %2)
  %57 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %3)
  tail call void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %3)
  %58 = icmp sgt i32 %57, 0
  %59 = icmp sgt i32 %56, 0
  %or.cond139 = and i1 %58, %59
  br i1 %or.cond139, label %.preheader102.us, label %.loopexit103

.preheader102.us:                                 ; preds = %55, %._crit_edge.us
  %.080105.us = phi i32 [ %71, %._crit_edge.us ], [ 0, %55 ]
  br label %60

60:                                               ; preds = %.preheader102.us, %69
  %.081104.us = phi i32 [ 0, %.preheader102.us ], [ %70, %69 ]
  %61 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %.081104.us, i32 noundef %.080105.us)
  %62 = fmul double %61, %61
  %63 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.081104.us, i32 noundef 0)
  %64 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %.080105.us, i32 noundef 0)
  %65 = fsub double %63, %64
  %66 = tail call double @llvm.fabs.f64(double %65)
  %67 = fcmp ogt double %66, 1.000000e-13
  %68 = fadd double %62, 1.000000e+04
  %.083.us = select i1 %67, double %68, double %62
  %sqrt.us = tail call double @llvm.sqrt.f64(double %.083.us)
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %.081104.us, i32 noundef %.080105.us, double noundef %sqrt.us)
          to label %69 unwind label %.split.us

69:                                               ; preds = %60
  %70 = add nuw nsw i32 %.081104.us, 1
  %exitcond.not = icmp eq i32 %70, %56
  br i1 %exitcond.not, label %._crit_edge.us, label %60, !llvm.loop !14

._crit_edge.us:                                   ; preds = %69
  %71 = add nuw nsw i32 %.080105.us, 1
  %exitcond126.not = icmp eq i32 %71, %57
  br i1 %exitcond126.not, label %.loopexit103, label %.preheader102.us, !llvm.loop !15

.split.us:                                        ; preds = %60
  %72 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #12
  br label %85

73:                                               ; preds = %5
  %74 = tail call ptr @__cxa_allocate_exception(i64 112) #12
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #12
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #12
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #12
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %75 unwind label %.thread

75:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #12
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #12
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #12
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull @.str.33, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %76 unwind label %79

76:                                               ; preds = %75
  invoke void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112) %74, ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 988, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %77 unwind label %81

77:                                               ; preds = %76
  invoke void @__cxa_throw(ptr nonnull %74, ptr nonnull @_ZTIN7SGTELIB9ExceptionE, ptr nonnull @_ZN7SGTELIB9ExceptionD2Ev) #14
          to label %86 unwind label %81

.thread:                                          ; preds = %73
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #12
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #12
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #12
  br label %84

79:                                               ; preds = %75
  %80 = landingpad { ptr, i32 }
          cleanup
  br label %83

81:                                               ; preds = %77, %76
  %.0 = phi i1 [ false, %77 ], [ true, %76 ]
  %82 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #12
  br label %83

83:                                               ; preds = %79, %81
  %.pn = phi { ptr, i32 } [ %82, %81 ], [ %80, %79 ]
  %.1 = phi i1 [ %.0, %81 ], [ true, %79 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #12
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #12
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #12
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #12
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #12
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #12
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #12
  br i1 %.1, label %84, label %85

84:                                               ; preds = %.thread, %83
  %.pn.pn99 = phi { ptr, i32 } [ %78, %.thread ], [ %.pn, %83 ]
  call void @__cxa_free_exception(ptr %74) #12
  br label %85

.loopexit103:                                     ; preds = %._crit_edge.us, %55, %._crit_edge, %12, %11, %10
  ret void

85:                                               ; preds = %83, %84, %.split.us, %.loopexit
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn99, %84 ], [ %.pn, %83 ], [ %72, %.split.us ], [ %lpad.phi, %.loopexit ]
  resume { ptr, i32 } %.pn.pn.pn

86:                                               ; preds = %77
  unreachable
}

declare void @_ZN7SGTELIB6Matrix19get_distances_norm1ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #8

declare void @_ZN7SGTELIB6Matrix19get_distances_norm2ERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #8

declare void @_ZN7SGTELIB6Matrix21get_distances_norminfERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB11TrainingSet7X_scaleEdi(ptr noundef nonnull align 8 dereferenceable(504), double noundef, i32 noundef) local_unnamed_addr #3 align 2

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync 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 = { 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 = { 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 #7 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { nounwind }
attributes #13 = { builtin nounwind }
attributes #14 = { noreturn }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass