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

; 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 }
%"class.SGTELIB::Surrogate" = type <{ ptr, ptr, %"class.SGTELIB::Surrogate_Parameters", i32, i32, i32, i32, i32, i32, i8, [7 x i8], ptr, ptr, ptr, ptr, %"class.std::__cxx11::list", %"class.std::map", double, %"class.std::basic_ofstream", i8, [7 x i8] }>
%"class.SGTELIB::Surrogate_Parameters" = type { ptr, i32, i32, i32, i32, i32, double, i32, double, i32, i32, i32, %"class.SGTELIB::Matrix", i32, i32, i32, double, double, double, double, %"class.SGTELIB::Matrix", i32, i32, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i32 }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" }
%"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<SGTELIB::metric_t, std::pair<const SGTELIB::metric_t, SGTELIB::Matrix>, std::_Select1st<std::pair<const SGTELIB::metric_t, SGTELIB::Matrix>>, std::less<SGTELIB::metric_t>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<SGTELIB::metric_t, std::pair<const SGTELIB::metric_t, SGTELIB::Matrix>, std::_Select1st<std::pair<const SGTELIB::metric_t, SGTELIB::Matrix>>, std::less<SGTELIB::metric_t>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon.6 }
%union.anon.6 = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }

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

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

declare ptr @__cxa_allocate_exception(i64)

; 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 void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

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

declare void @__cxa_free_exception(ptr)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB12Surrogate_KS15predict_privateERKNS_6MatrixEPS1_(ptr noundef nonnull align 8 dereferenceable(985) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.SGTELIB::Matrix", align 8
  %12 = alloca %"class.SGTELIB::Matrix", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca %"class.SGTELIB::Matrix", align 8
  %17 = alloca %"class.SGTELIB::Matrix", align 8
  %18 = alloca ptr, align 8
  %19 = alloca %"class.SGTELIB::Matrix", align 8
  %20 = alloca %"class.SGTELIB::Matrix", align 8
  %21 = alloca %"class.SGTELIB::Matrix", align 8
  %22 = alloca %"class.SGTELIB::Matrix", align 8
  %23 = alloca %"class.SGTELIB::Matrix", align 8
  %24 = alloca %"class.std::__cxx11::basic_string", align 8
  %25 = alloca %"class.std::allocator", align 1
  %26 = alloca %"class.std::__cxx11::basic_string", align 8
  %27 = alloca %"class.std::allocator", align 1
  %28 = alloca i1, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %30)
  store i32 %31, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 56, ptr %11) #6
  %32 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr %12) #6
  call void @_ZN7SGTELIB9Surrogate13get_matrix_XsEv(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %12, ptr noundef nonnull align 8 dereferenceable(985) %29)
  %35 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 2
  %36 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters17get_distance_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %35)
          to label %37 unwind label %79

37:                                               ; preds = %3
  invoke void @_ZNK7SGTELIB11TrainingSet13get_distancesERKNS_6MatrixES3_NS_10distance_tE(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %11, ptr noundef nonnull align 8 dereferenceable(504) %33, ptr noundef nonnull align 8 dereferenceable(56) %34, ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef %36)
          to label %38 unwind label %79

38:                                               ; preds = %37
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %39 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 2
  %40 = invoke noundef double @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_coefEv(ptr noundef nonnull align 8 dereferenceable(312) %39)
          to label %41 unwind label %83

41:                                               ; preds = %38
  %42 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = invoke noundef double @_ZNK7SGTELIB11TrainingSet11get_Ds_meanEv(ptr noundef nonnull align 8 dereferenceable(504) %43)
          to label %45 unwind label %83

45:                                               ; preds = %41
  %46 = fdiv double %40, %44
  store double %46, ptr %15, align 8, !tbaa !48
  call void @llvm.lifetime.start.p0(i64 56, ptr %16) #6
  %47 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 2
  %48 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %47)
          to label %49 unwind label %87

49:                                               ; preds = %45
  %50 = load double, ptr %15, align 8, !tbaa !48
  invoke void @_ZN7SGTELIB6MatrixC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(56) %17, ptr noundef nonnull align 8 dereferenceable(56) %11)
          to label %51 unwind label %87

51:                                               ; preds = %49
  invoke void @_ZN7SGTELIB6kernelENS_8kernel_tEdNS_6MatrixE(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %16, i32 noundef %48, double noundef %50, ptr noundef %17)
          to label %52 unwind label %91

52:                                               ; preds = %51
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 56, ptr %19) #6
  invoke void @_ZN7SGTELIB9Surrogate13get_matrix_ZsEv(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %19, ptr noundef nonnull align 8 dereferenceable(985) %29)
          to label %53 unwind label %95

53:                                               ; preds = %52
  store ptr %19, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr %20) #6
  %54 = load ptr, ptr %18, align 8, !tbaa !5
  invoke void @_ZmlRKN7SGTELIB6MatrixES2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %20, ptr noundef nonnull align 8 dereferenceable(56) %16, ptr noundef nonnull align 8 dereferenceable(56) %54)
          to label %55 unwind label %99

55:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 56, ptr %21) #6
  invoke void @_ZNK7SGTELIB6Matrix3sumEi(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %21, ptr noundef nonnull align 8 dereferenceable(56) %16, i32 noundef 2)
          to label %56 unwind label %103

56:                                               ; preds = %55
  invoke void @_ZN7SGTELIB6Matrix16hadamard_inverseEv(ptr noundef nonnull align 8 dereferenceable(56) %21)
          to label %57 unwind label %107

57:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 56, ptr %22) #6
  invoke void @_ZN7SGTELIB6Matrix13diagA_productERKS0_S2_(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %22, ptr noundef nonnull align 8 dereferenceable(56) %21, ptr noundef nonnull align 8 dereferenceable(56) %20)
          to label %58 unwind label %111

58:                                               ; preds = %57
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = invoke noundef nonnull align 8 dereferenceable(56) ptr @_ZN7SGTELIB6MatrixaSERKS0_(ptr noundef nonnull align 8 dereferenceable(56) %59, ptr noundef nonnull align 8 dereferenceable(56) %22)
          to label %61 unwind label %115

61:                                               ; preds = %58
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %22) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %22) #6
  %62 = invoke noundef zeroext i1 @_ZNK7SGTELIB6Matrix7has_infEv(ptr noundef nonnull align 8 dereferenceable(56) %21)
          to label %63 unwind label %107

63:                                               ; preds = %61
  br i1 %62, label %64, label %187

64:                                               ; preds = %63
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %183, %64
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %186

69:                                               ; preds = %65
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %21, i32 noundef %70, i32 noundef 0)
          to label %72 unwind label %107

72:                                               ; preds = %69
  %73 = invoke noundef zeroext i1 @_ZSt5isinfd(double noundef %71)
          to label %74 unwind label %107

74:                                               ; preds = %72
  br i1 %73, label %75, label %182

75:                                               ; preds = %74
  %76 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 2
  %77 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %76)
          to label %78 unwind label %107

78:                                               ; preds = %75
  switch i32 %77, label %159 [
    i32 0, label %120
    i32 3, label %120
    i32 4, label %120
    i32 1, label %139
    i32 2, label %139
    i32 5, label %139
  ]

79:                                               ; preds = %37, %3
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %13, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %14, align 4
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %12) #6
  br label %194

83:                                               ; preds = %41, %38
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %13, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %14, align 4
  br label %193

87:                                               ; preds = %49, %45
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %13, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %14, align 4
  br label %192

91:                                               ; preds = %51
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %13, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %14, align 4
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %17) #6
  br label %192

95:                                               ; preds = %52
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %13, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %14, align 4
  br label %191

99:                                               ; preds = %53
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %13, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %14, align 4
  br label %190

103:                                              ; preds = %55
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %13, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %14, align 4
  br label %189

107:                                              ; preds = %153, %145, %120, %75, %72, %69, %61, %56
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %13, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %14, align 4
  br label %188

111:                                              ; preds = %57
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %13, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %14, align 4
  br label %119

115:                                              ; preds = %58
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %13, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %14, align 4
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %22) #6
  br label %119

119:                                              ; preds = %115, %111
  call void @llvm.lifetime.end.p0(i64 56, ptr %22) #6
  br label %188

120:                                              ; preds = %78, %78, %78
  %121 = load i32, ptr %8, align 4, !tbaa !9
  %122 = invoke noundef i32 @_ZN7SGTELIB6Matrix17get_min_index_rowEi(ptr noundef nonnull align 8 dereferenceable(56) %11, i32 noundef %121)
          to label %123 unwind label %107

123:                                              ; preds = %120
  store i32 %122, ptr %7, align 4, !tbaa !9
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr %23) #6
  %125 = load ptr, ptr %18, align 8, !tbaa !5
  %126 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_ZNK7SGTELIB6Matrix7get_rowEi(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8 %23, ptr noundef nonnull align 8 dereferenceable(56) %125, i32 noundef %126)
          to label %127 unwind label %130

127:                                              ; preds = %123
  %128 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @_ZN7SGTELIB6Matrix7set_rowERKS0_i(ptr noundef nonnull align 8 dereferenceable(56) %124, ptr noundef nonnull align 8 dereferenceable(56) %23, i32 noundef %128)
          to label %129 unwind label %134

129:                                              ; preds = %127
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %23) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %23) #6
  br label %181

130:                                              ; preds = %123
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %13, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %14, align 4
  br label %138

134:                                              ; preds = %127
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %13, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %14, align 4
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %23) #6
  br label %138

138:                                              ; preds = %134, %130
  call void @llvm.lifetime.end.p0(i64 56, ptr %23) #6
  br label %188

139:                                              ; preds = %78, %78, %78
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %155, %139
  %141 = load i32, ptr %9, align 4, !tbaa !9
  %142 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 4
  %143 = load i32, ptr %142, align 4, !tbaa !49
  %144 = icmp slt i32 %141, %143
  br i1 %144, label %145, label %158

145:                                              ; preds = %140
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = load i32, ptr %8, align 4, !tbaa !9
  %148 = load i32, ptr %9, align 4, !tbaa !9
  %149 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %29, i32 0, i32 1
  %150 = load ptr, ptr %149, align 8, !tbaa !11
  %151 = load i32, ptr %9, align 4, !tbaa !9
  %152 = invoke noundef double @_ZNK7SGTELIB11TrainingSet11get_Zs_meanEi(ptr noundef nonnull align 8 dereferenceable(504) %150, i32 noundef %151)
          to label %153 unwind label %107

153:                                              ; preds = %145
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %146, i32 noundef %147, i32 noundef %148, double noundef %152)
          to label %154 unwind label %107

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %9, align 4, !tbaa !9
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %9, align 4, !tbaa !9
  br label %140, !llvm.loop !50

158:                                              ; preds = %140
  br label %181

159:                                              ; preds = %78
  store i1 true, ptr %28, align 1
  %160 = call ptr @__cxa_allocate_exception(i64 112) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %24) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %25) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %25) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %25)
          to label %161 unwind label %164

161:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 32, ptr %26) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %26, ptr noundef @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %27)
          to label %162 unwind label %168

162:                                              ; preds = %161
  invoke void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112) %160, ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef 125, ptr noundef nonnull align 8 dereferenceable(32) %26)
          to label %163 unwind label %172

163:                                              ; preds = %162
  store i1 false, ptr %28, align 1
  invoke void @__cxa_throw(ptr %160, ptr @_ZTIN7SGTELIB9ExceptionE, ptr @_ZN7SGTELIB9ExceptionD2Ev) #7
          to label %200 unwind label %172

164:                                              ; preds = %159
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %13, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %14, align 4
  br label %177

168:                                              ; preds = %161
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %13, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %14, align 4
  br label %176

172:                                              ; preds = %163, %162
  %173 = landingpad { ptr, i32 }
          cleanup
  %174 = extractvalue { ptr, i32 } %173, 0
  store ptr %174, ptr %13, align 8
  %175 = extractvalue { ptr, i32 } %173, 1
  store i32 %175, ptr %14, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %26) #6
  br label %176

176:                                              ; preds = %172, %168
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %26) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #6
  br label %177

177:                                              ; preds = %176, %164
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %25) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #6
  %178 = load i1, ptr %28, align 1
  br i1 %178, label %179, label %180

179:                                              ; preds = %177
  call void @__cxa_free_exception(ptr %160) #6
  br label %180

180:                                              ; preds = %179, %177
  br label %188

181:                                              ; preds = %158, %129
  br label %182

182:                                              ; preds = %181, %74
  br label %183

183:                                              ; preds = %182
  %184 = load i32, ptr %8, align 4, !tbaa !9
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %8, align 4, !tbaa !9
  br label %65, !llvm.loop !52

186:                                              ; preds = %65
  br label %187

187:                                              ; preds = %186, %63
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %21) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %21) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %20) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %20) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %19) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %16) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %11) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void

188:                                              ; preds = %180, %138, %119, %107
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %21) #6
  br label %189

189:                                              ; preds = %188, %103
  call void @llvm.lifetime.end.p0(i64 56, ptr %21) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %20) #6
  br label %190

190:                                              ; preds = %189, %99
  call void @llvm.lifetime.end.p0(i64 56, ptr %20) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %19) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %19) #6
  br label %191

191:                                              ; preds = %190, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %16) #6
  br label %192

192:                                              ; preds = %191, %91, %87
  call void @llvm.lifetime.end.p0(i64 56, ptr %16) #6
  br label %193

193:                                              ; preds = %192, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %11) #6
  br label %194

194:                                              ; preds = %193, %79
  call void @llvm.lifetime.end.p0(i64 56, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr %13, align 8
  %197 = load i32, ptr %14, align 4
  %198 = insertvalue { ptr, i32 } poison, ptr %196, 0
  %199 = insertvalue { ptr, i32 } %198, i32 %197, 1
  resume { ptr, i32 } %199

200:                                              ; preds = %163
  unreachable
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_coefEv(ptr noundef nonnull align 8 dereferenceable(312)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK7SGTELIB11TrainingSet11get_Ds_meanEv(ptr noundef nonnull align 8 dereferenceable(504)) #2 align 2

declare void @_ZN7SGTELIB6kernelENS_8kernel_tEdNS_6MatrixE(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, i32 noundef, double noundef, ptr noundef) #4

declare void @_ZN7SGTELIB6MatrixC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #4

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

declare void @_ZmlRKN7SGTELIB6MatrixES2_(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)) #4

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

declare void @_ZN7SGTELIB6Matrix16hadamard_inverseEv(ptr noundef nonnull align 8 dereferenceable(56)) #4

declare void @_ZN7SGTELIB6Matrix13diagA_productERKS0_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)) #4

declare noundef nonnull align 8 dereferenceable(56) ptr @_ZN7SGTELIB6MatrixaSERKS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) #4

declare noundef zeroext i1 @_ZNK7SGTELIB6Matrix7has_infEv(ptr noundef nonnull align 8 dereferenceable(56)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isinfd(double noundef) #0

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

declare noundef i32 @_ZN7SGTELIB6Matrix17get_min_index_rowEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) #4

declare void @_ZN7SGTELIB6Matrix7set_rowERKS0_i(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) #4

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

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

declare noundef double @_ZNK7SGTELIB11TrainingSet11get_Zs_meanEi(ptr noundef nonnull align 8 dereferenceable(504), i32 noundef) #4

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "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 = { nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN7SGTELIB9SurrogateE", !6, i64 8, !13, i64 16, !10, i64 328, !10, i64 332, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !26, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !27, i64 392, !32, i64 416, !17, i64 464, !40, i64 472, !26, i64 984}
!13 = !{!"_ZTSN7SGTELIB20Surrogate_ParametersE", !14, i64 8, !10, i64 12, !15, i64 16, !16, i64 20, !15, i64 24, !17, i64 32, !15, i64 40, !17, i64 48, !15, i64 56, !18, i64 60, !15, i64 64, !19, i64 72, !23, i64 128, !15, i64 132, !24, i64 136, !17, i64 144, !17, i64 152, !17, i64 160, !17, i64 168, !19, i64 176, !15, i64 232, !25, i64 236, !20, i64 240, !20, i64 272, !10, i64 304, !10, i64 308}
!14 = !{!"_ZTSN7SGTELIB7model_tE", !7, i64 0}
!15 = !{!"_ZTSN7SGTELIB14param_status_tE", !7, i64 0}
!16 = !{!"_ZTSN7SGTELIB8kernel_tE", !7, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTSN7SGTELIB10distance_tE", !7, i64 0}
!19 = !{!"_ZTSN7SGTELIB6MatrixE", !20, i64 8, !10, i64 40, !10, i64 44, !6, i64 48}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !21, i64 0, !22, i64 8, !7, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTSN7SGTELIB8weight_tE", !7, i64 0}
!24 = !{!"_ZTSN7SGTELIB13uncertainty_tE", !7, i64 0}
!25 = !{!"_ZTSN7SGTELIB8metric_tE", !7, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTSNSt7__cxx114listIiSaIiEEE", !28, i64 0}
!28 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEEE", !29, i64 0}
!29 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEE10_List_implE", !30, i64 0}
!30 = !{!"_ZTSNSt8__detail17_List_node_headerE", !31, i64 0, !22, i64 16}
!31 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!32 = !{!"_ZTSSt3mapIN7SGTELIB8metric_tENS0_6MatrixESt4lessIS1_ESaISt4pairIKS1_S2_EEE", !33, i64 0}
!33 = !{!"_ZTSSt8_Rb_treeIN7SGTELIB8metric_tESt4pairIKS1_NS0_6MatrixEESt10_Select1stIS5_ESt4lessIS1_ESaIS5_EE", !34, i64 0}
!34 = !{!"_ZTSNSt8_Rb_treeIN7SGTELIB8metric_tESt4pairIKS1_NS0_6MatrixEESt10_Select1stIS5_ESt4lessIS1_ESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !35, i64 0, !37, i64 8}
!35 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIN7SGTELIB8metric_tEEE", !36, i64 0}
!36 = !{!"_ZTSSt4lessIN7SGTELIB8metric_tEE"}
!37 = !{!"_ZTSSt15_Rb_tree_header", !38, i64 0, !22, i64 32}
!38 = !{!"_ZTSSt18_Rb_tree_node_base", !39, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!39 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!40 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !41, i64 0, !42, i64 8}
!41 = !{!"_ZTSSo"}
!42 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !43, i64 0, !7, i64 64, !45, i64 104, !46, i64 120, !47, i64 124, !47, i64 132, !47, i64 140, !6, i64 152, !22, i64 160, !26, i64 168, !26, i64 169, !26, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !26, i64 192, !6, i64 200, !6, i64 208, !22, i64 216, !6, i64 224, !6, i64 232}
!43 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !44, i64 56}
!44 = !{!"_ZTSSt6locale", !6, i64 0}
!45 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !26, i64 8}
!46 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!47 = !{!"_ZTS11__mbstate_t", !10, i64 0, !7, i64 4}
!48 = !{!17, !17, i64 0}
!49 = !{!12, !10, i64 332}
!50 = distinct !{!50, !51}
!51 = !{!"llvm.loop.mustprogress"}
!52 = distinct !{!52, !51}


; 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.1 = external hidden unnamed_addr constant [91 x i8], align 1
@_ZTIN7SGTELIB9ExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.3 = external hidden unnamed_addr constant [56 x i8], align 1

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB12Surrogate_KS15predict_privateERKNS_6MatrixEPS1_(ptr noundef nonnull align 8 dereferenceable(985) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.SGTELIB::Matrix", align 8
  %5 = alloca %"class.SGTELIB::Matrix", align 8
  %6 = alloca %"class.SGTELIB::Matrix", align 8
  %7 = alloca %"class.SGTELIB::Matrix", align 8
  %8 = alloca %"class.SGTELIB::Matrix", align 8
  %9 = alloca %"class.SGTELIB::Matrix", align 8
  %10 = alloca %"class.SGTELIB::Matrix", align 8
  %11 = alloca %"class.SGTELIB::Matrix", align 8
  %12 = alloca %"class.SGTELIB::Matrix", align 8
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca %"class.std::allocator", align 1
  %15 = alloca %"class.std::__cxx11::basic_string", align 8
  %16 = alloca %"class.std::allocator", align 1
  %17 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %4) #6
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %5) #6
  call void @_ZN7SGTELIB9Surrogate13get_matrix_XsEv(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %5, ptr noundef nonnull align 8 dereferenceable(985) %0)
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters17get_distance_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %20)
  invoke void @_ZNK7SGTELIB11TrainingSet13get_distancesERKNS_6MatrixES3_NS_10distance_tE(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %4, ptr noundef nonnull align 8 dereferenceable(504) %19, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull align 8 dereferenceable(56) %5, i32 noundef %21)
          to label %22 unwind label %47

22:                                               ; preds = %3
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %5) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %5) #6
  %23 = call noundef double @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_coefEv(ptr noundef nonnull align 8 dereferenceable(312) %20)
  %24 = load ptr, ptr %18, align 8, !tbaa !5
  %25 = invoke noundef double @_ZNK7SGTELIB11TrainingSet11get_Ds_meanEv(ptr noundef nonnull align 8 dereferenceable(504) %24)
          to label %26 unwind label %49

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %6) #6
  %27 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %20)
  invoke void @_ZN7SGTELIB6MatrixC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(56) %7, ptr noundef nonnull align 8 dereferenceable(56) %4)
          to label %28 unwind label %51

28:                                               ; preds = %26
  %29 = fdiv double %23, %25
  invoke void @_ZN7SGTELIB6kernelENS_8kernel_tEdNS_6MatrixE(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %6, i32 noundef %27, double noundef %29, ptr noundef nonnull %7)
          to label %30 unwind label %53

30:                                               ; preds = %28
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #6
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %8) #6
  invoke void @_ZN7SGTELIB9Surrogate13get_matrix_ZsEv(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %8, ptr noundef nonnull align 8 dereferenceable(985) %0)
          to label %31 unwind label %55

31:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %9) #6
  invoke void @_ZmlRKN7SGTELIB6MatrixES2_(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %9, ptr noundef nonnull align 8 dereferenceable(56) %6, ptr noundef nonnull align 8 dereferenceable(56) %8)
          to label %32 unwind label %57

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %10) #6
  invoke void @_ZNK7SGTELIB6Matrix3sumEi(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %10, ptr noundef nonnull align 8 dereferenceable(56) %6, i32 noundef 2)
          to label %33 unwind label %59

33:                                               ; preds = %32
  invoke void @_ZN7SGTELIB6Matrix16hadamard_inverseEv(ptr noundef nonnull align 8 dereferenceable(56) %10)
          to label %34 unwind label %.loopexit.split-lp.loopexit.split-lp

34:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #6
  invoke void @_ZN7SGTELIB6Matrix13diagA_productERKS0_S2_(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %11, ptr noundef nonnull align 8 dereferenceable(56) %10, ptr noundef nonnull align 8 dereferenceable(56) %9)
          to label %35 unwind label %61

35:                                               ; preds = %34
  %36 = invoke noundef nonnull align 8 dereferenceable(56) ptr @_ZN7SGTELIB6MatrixaSERKS0_(ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %11)
          to label %37 unwind label %63

37:                                               ; preds = %35
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %11) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #6
  %38 = invoke noundef zeroext i1 @_ZNK7SGTELIB6Matrix7has_infEv(ptr noundef nonnull align 8 dereferenceable(56) %10)
          to label %39 unwind label %.loopexit.split-lp.loopexit.split-lp

39:                                               ; preds = %37
  %40 = icmp sgt i32 %17, 0
  %or.cond = and i1 %38, %40
  br i1 %or.cond, label %.lr.ph63, label %.loopexit56

.lr.ph63:                                         ; preds = %39
  %41 = getelementptr inbounds i8, ptr %0, i64 332
  br label %42

42:                                               ; preds = %.lr.ph63, %.loopexit
  %.02361 = phi i32 [ 0, %.lr.ph63 ], [ %98, %.loopexit ]
  %43 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %10, i32 noundef %.02361, i32 noundef 0)
  %44 = call noundef zeroext i1 @_ZSt5isinfd(double noundef %43)
  br i1 %44, label %45, label %.loopexit

45:                                               ; preds = %42
  %46 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %20)
  switch i32 %46, label %86 [
    i32 0, label %66
    i32 3, label %66
    i32 4, label %66
    i32 1, label %76
    i32 2, label %76
    i32 5, label %76
  ]

47:                                               ; preds = %3
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %5) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %5) #6
  br label %104

49:                                               ; preds = %22
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %103

51:                                               ; preds = %26
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %102

53:                                               ; preds = %28
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #6
  br label %102

55:                                               ; preds = %30
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %101

57:                                               ; preds = %31
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %100

59:                                               ; preds = %32
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %99

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

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

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

61:                                               ; preds = %34
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %65

63:                                               ; preds = %35
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %11) #6
  br label %65

65:                                               ; preds = %63, %61
  %.pn = phi { ptr, i32 } [ %64, %63 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #6
  br label %.loopexit.split-lp

66:                                               ; preds = %45, %45, %45
  %67 = invoke noundef i32 @_ZN7SGTELIB6Matrix17get_min_index_rowEi(ptr noundef nonnull align 8 dereferenceable(56) %4, i32 noundef %.02361)
          to label %68 unwind label %.loopexit.split-lp.loopexit

68:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %12) #6
  invoke void @_ZNK7SGTELIB6Matrix7get_rowEi(ptr dead_on_unwind nonnull writable sret(%"class.SGTELIB::Matrix") align 8 %12, ptr noundef nonnull align 8 dereferenceable(56) %8, i32 noundef %67)
          to label %69 unwind label %71

69:                                               ; preds = %68
  invoke void @_ZN7SGTELIB6Matrix7set_rowERKS0_i(ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef %.02361)
          to label %70 unwind label %73

70:                                               ; preds = %69
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #6
  br label %.loopexit

71:                                               ; preds = %68
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %75

73:                                               ; preds = %69
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %12) #6
  br label %75

75:                                               ; preds = %73, %71
  %.pn40 = phi { ptr, i32 } [ %74, %73 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #6
  br label %.loopexit.split-lp

76:                                               ; preds = %45, %45, %45
  %77 = load i32, ptr %41, align 4, !tbaa !46
  %78 = icmp sgt i32 %77, 0
  br i1 %78, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %76, %82
  %.02460 = phi i32 [ %83, %82 ], [ 0, %76 ]
  %79 = load ptr, ptr %18, align 8, !tbaa !5
  %80 = invoke noundef double @_ZNK7SGTELIB11TrainingSet11get_Zs_meanEi(ptr noundef nonnull align 8 dereferenceable(504) %79, i32 noundef %.02460)
          to label %81 unwind label %.loopexit55

81:                                               ; preds = %.lr.ph
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.02361, i32 noundef %.02460, double noundef %80)
          to label %82 unwind label %.loopexit55

82:                                               ; preds = %81
  %83 = add nuw nsw i32 %.02460, 1
  %84 = load i32, ptr %41, align 4, !tbaa !46
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %.lr.ph, label %.loopexit, !llvm.loop !47

86:                                               ; preds = %45
  %87 = call ptr @__cxa_allocate_exception(i64 112) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %14) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %88 unwind label %.thread

88:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %15) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %16) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %16)
          to label %89 unwind label %92

89:                                               ; preds = %88
  invoke void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112) %87, ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 125, ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %90 unwind label %94

90:                                               ; preds = %89
  invoke void @__cxa_throw(ptr nonnull %87, ptr nonnull @_ZTIN7SGTELIB9ExceptionE, ptr nonnull @_ZN7SGTELIB9ExceptionD2Ev) #7
          to label %105 unwind label %94

.thread:                                          ; preds = %86
  %91 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #6
  br label %97

92:                                               ; preds = %88
  %93 = landingpad { ptr, i32 }
          cleanup
  br label %96

94:                                               ; preds = %90, %89
  %.0 = phi i1 [ false, %90 ], [ true, %89 ]
  %95 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #6
  br label %96

96:                                               ; preds = %92, %94
  %.pn42 = phi { ptr, i32 } [ %95, %94 ], [ %93, %92 ]
  %.1 = phi i1 [ %.0, %94 ], [ true, %92 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %15) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #6
  br i1 %.1, label %97, label %.loopexit.split-lp

97:                                               ; preds = %.thread, %96
  %.pn42.pn54 = phi { ptr, i32 } [ %91, %.thread ], [ %.pn42, %96 ]
  call void @__cxa_free_exception(ptr %87) #6
  br label %.loopexit.split-lp

.loopexit:                                        ; preds = %82, %76, %42, %70
  %98 = add nuw nsw i32 %.02361, 1
  %exitcond.not = icmp eq i32 %98, %17
  br i1 %exitcond.not, label %.loopexit56, label %42, !llvm.loop !49

.loopexit56:                                      ; preds = %.loopexit, %39
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %10) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %10) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %9) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %9) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %8) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %6) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %4) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %4) #6
  ret void

.loopexit.split-lp:                               ; preds = %.loopexit55, %.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit, %96, %97, %75, %65
  %.pn42.pn.pn = phi { ptr, i32 } [ %.pn42.pn54, %97 ], [ %.pn42, %96 ], [ %.pn40, %75 ], [ %.pn, %65 ], [ %lpad.loopexit, %.loopexit55 ], [ %lpad.loopexit57, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp58, %.loopexit.split-lp.loopexit.split-lp ]
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %10) #6
  br label %99

99:                                               ; preds = %.loopexit.split-lp, %59
  %.pn42.pn.pn.pn = phi { ptr, i32 } [ %.pn42.pn.pn, %.loopexit.split-lp ], [ %60, %59 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %10) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %9) #6
  br label %100

100:                                              ; preds = %99, %57
  %.pn42.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn42.pn.pn.pn, %99 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %9) #6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %8) #6
  br label %101

101:                                              ; preds = %100, %55
  %.pn42.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn42.pn.pn.pn.pn, %100 ], [ %56, %55 ]
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %6) #6
  br label %102

102:                                              ; preds = %101, %53, %51
  %.pn42.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn42.pn.pn.pn.pn.pn, %101 ], [ %54, %53 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #6
  br label %103

103:                                              ; preds = %102, %49
  %.pn42.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn42.pn.pn.pn.pn.pn.pn, %102 ], [ %50, %49 ]
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %4) #6
  br label %104

104:                                              ; preds = %103, %47
  %.pn42.pn.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn42.pn.pn.pn.pn.pn.pn.pn, %103 ], [ %48, %47 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn42.pn.pn.pn.pn.pn.pn.pn.pn

105:                                              ; preds = %90
  unreachable
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB20Surrogate_Parameters15get_kernel_coefEv(ptr noundef nonnull align 8 dereferenceable(312)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK7SGTELIB11TrainingSet11get_Ds_meanEv(ptr noundef nonnull align 8 dereferenceable(504)) local_unnamed_addr #2 align 2

declare void @_ZN7SGTELIB6kernelENS_8kernel_tEdNS_6MatrixE(ptr dead_on_unwind writable sret(%"class.SGTELIB::Matrix") align 8, i32 noundef, double noundef, ptr noundef) local_unnamed_addr #4

declare void @_ZN7SGTELIB6MatrixC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #4

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

declare void @_ZmlRKN7SGTELIB6MatrixES2_(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 #4

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

declare void @_ZN7SGTELIB6Matrix16hadamard_inverseEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #4

declare void @_ZN7SGTELIB6Matrix13diagA_productERKS0_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 #4

declare noundef nonnull align 8 dereferenceable(56) ptr @_ZN7SGTELIB6MatrixaSERKS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #4

declare noundef zeroext i1 @_ZNK7SGTELIB6Matrix7has_infEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isinfd(double noundef) local_unnamed_addr #0

; 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 #3 align 2

declare noundef i32 @_ZN7SGTELIB6Matrix17get_min_index_rowEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) local_unnamed_addr #4

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

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

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

declare noundef double @_ZNK7SGTELIB11TrainingSet11get_Zs_meanEi(ptr noundef nonnull align 8 dereferenceable(504), i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "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 = { nounwind }
attributes #7 = { 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, !7, i64 8}
!6 = !{!"_ZTSN7SGTELIB9SurrogateE", !7, i64 8, !10, i64 16, !12, i64 328, !12, i64 332, !12, i64 336, !12, i64 340, !12, i64 344, !12, i64 348, !24, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !25, i64 392, !30, i64 416, !15, i64 464, !38, i64 472, !24, i64 984}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN7SGTELIB20Surrogate_ParametersE", !11, i64 8, !12, i64 12, !13, i64 16, !14, i64 20, !13, i64 24, !15, i64 32, !13, i64 40, !15, i64 48, !13, i64 56, !16, i64 60, !13, i64 64, !17, i64 72, !21, i64 128, !13, i64 132, !22, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !15, i64 168, !17, i64 176, !13, i64 232, !23, i64 236, !18, i64 240, !18, i64 272, !12, i64 304, !12, i64 308}
!11 = !{!"_ZTSN7SGTELIB7model_tE", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSN7SGTELIB14param_status_tE", !8, i64 0}
!14 = !{!"_ZTSN7SGTELIB8kernel_tE", !8, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!"_ZTSN7SGTELIB10distance_tE", !8, i64 0}
!17 = !{!"_ZTSN7SGTELIB6MatrixE", !18, i64 8, !12, i64 40, !12, i64 44, !7, i64 48}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !20, i64 8, !8, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!20 = !{!"long", !8, i64 0}
!21 = !{!"_ZTSN7SGTELIB8weight_tE", !8, i64 0}
!22 = !{!"_ZTSN7SGTELIB13uncertainty_tE", !8, i64 0}
!23 = !{!"_ZTSN7SGTELIB8metric_tE", !8, i64 0}
!24 = !{!"bool", !8, i64 0}
!25 = !{!"_ZTSNSt7__cxx114listIiSaIiEEE", !26, i64 0}
!26 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEEE", !27, i64 0}
!27 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEE10_List_implE", !28, i64 0}
!28 = !{!"_ZTSNSt8__detail17_List_node_headerE", !29, i64 0, !20, i64 16}
!29 = !{!"_ZTSNSt8__detail15_List_node_baseE", !7, i64 0, !7, i64 8}
!30 = !{!"_ZTSSt3mapIN7SGTELIB8metric_tENS0_6MatrixESt4lessIS1_ESaISt4pairIKS1_S2_EEE", !31, i64 0}
!31 = !{!"_ZTSSt8_Rb_treeIN7SGTELIB8metric_tESt4pairIKS1_NS0_6MatrixEESt10_Select1stIS5_ESt4lessIS1_ESaIS5_EE", !32, i64 0}
!32 = !{!"_ZTSNSt8_Rb_treeIN7SGTELIB8metric_tESt4pairIKS1_NS0_6MatrixEESt10_Select1stIS5_ESt4lessIS1_ESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !33, i64 0, !35, i64 8}
!33 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIN7SGTELIB8metric_tEEE", !34, i64 0}
!34 = !{!"_ZTSSt4lessIN7SGTELIB8metric_tEE"}
!35 = !{!"_ZTSSt15_Rb_tree_header", !36, i64 0, !20, i64 32}
!36 = !{!"_ZTSSt18_Rb_tree_node_base", !37, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!37 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!38 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !39, i64 0, !40, i64 8}
!39 = !{!"_ZTSSo"}
!40 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !41, i64 0, !8, i64 64, !43, i64 104, !44, i64 120, !45, i64 124, !45, i64 132, !45, i64 140, !7, i64 152, !20, i64 160, !24, i64 168, !24, i64 169, !24, i64 170, !8, i64 171, !7, i64 176, !7, i64 184, !24, i64 192, !7, i64 200, !7, i64 208, !20, i64 216, !7, i64 224, !7, i64 232}
!41 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !42, i64 56}
!42 = !{!"_ZTSSt6locale", !7, i64 0}
!43 = !{!"_ZTSSt12__basic_fileIcE", !7, i64 0, !24, i64 8}
!44 = !{!"_ZTSSt13_Ios_Openmode", !8, i64 0}
!45 = !{!"_ZTS11__mbstate_t", !12, i64 0, !8, i64 4}
!46 = !{!6, !12, i64 332}
!47 = distinct !{!47, !48}
!48 = !{!"llvm.loop.mustprogress"}
!49 = distinct !{!49, !48}


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