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

; 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_Ensemble" = type { %"class.SGTELIB::Surrogate.base", i32, i32, %"class.std::vector", ptr, ptr }
%"class.SGTELIB::Surrogate.base" = 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 }>
%"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 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<SGTELIB::Surrogate *, std::allocator<SGTELIB::Surrogate *>>::_Vector_impl" }
%"struct.std::_Vector_base<SGTELIB::Surrogate *, std::allocator<SGTELIB::Surrogate *>>::_Vector_impl" = type { %"struct.std::_Vector_base<SGTELIB::Surrogate *, std::allocator<SGTELIB::Surrogate *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SGTELIB::Surrogate *, std::allocator<SGTELIB::Surrogate *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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] }>

@.str = external hidden unnamed_addr constant [2 x i8], align 1

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) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 void @_ZN7SGTELIB6MatrixC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) unnamed_addr #3

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

declare void @_ZN7SGTELIB6Matrix4fillEd(ptr noundef nonnull align 8 dereferenceable(56), double noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7SGTELIB20Surrogate_Parameters10set_weightERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(312), ptr noundef nonnull align 8 dereferenceable(56)) #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB18Surrogate_Ensemble17compute_W_by_wta1Ev(ptr noundef nonnull align 8 dereferenceable(1040) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.SGTELIB::Matrix", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %13 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef @.str, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %14 unwind label %27

14:                                               ; preds = %1
  %15 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %13, i32 0, i32 4
  %18 = load i32, ptr %17, align 4, !tbaa !52
  invoke void @_ZN7SGTELIB6MatrixC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr noundef nonnull align 8 dereferenceable(56) %3, ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef %16, i32 noundef %18)
          to label %19 unwind label %31

19:                                               ; preds = %14
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #6
  invoke void @_ZN7SGTELIB6Matrix4fillEd(ptr noundef nonnull align 8 dereferenceable(56) %3, double noundef 0.000000e+00)
          to label %20 unwind label %36

20:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !53
  br label %21

21:                                               ; preds = %174, %20
  %22 = load i32, ptr %12, align 4, !tbaa !53
  %23 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %13, i32 0, i32 4
  %24 = load i32, ptr %23, align 4, !tbaa !52
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %40, label %26

26:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %177

27:                                               ; preds = %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %6, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %7, align 4
  br label %35

31:                                               ; preds = %14
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %6, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  br label %35

35:                                               ; preds = %31, %27
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #6
  br label %186

36:                                               ; preds = %19
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %6, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %7, align 4
  br label %185

40:                                               ; preds = %21
  %41 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %13, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !54
  %43 = load i32, ptr %12, align 4, !tbaa !53
  %44 = invoke noundef i32 @_ZNK7SGTELIB11TrainingSet7get_bboEi(ptr noundef nonnull align 8 dereferenceable(504) %42, i32 noundef %43)
          to label %45 unwind label %77

45:                                               ; preds = %40
  %46 = icmp ne i32 %44, 2
  br i1 %46, label %47, label %173

47:                                               ; preds = %45
  store double 0.000000e+00, ptr %10, align 8, !tbaa !55
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %48

48:                                               ; preds = %83, %47
  %49 = load i32, ptr %8, align 4, !tbaa !53
  %50 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = icmp slt i32 %49, %51
  br i1 %52, label %53, label %86

53:                                               ; preds = %48
  %54 = load i32, ptr %8, align 4, !tbaa !53
  %55 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %13, i32 noundef %54)
          to label %56 unwind label %77

56:                                               ; preds = %53
  br i1 %55, label %57, label %82

57:                                               ; preds = %56
  %58 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 3
  %59 = load i32, ptr %8, align 4, !tbaa !53
  %60 = sext i32 %59 to i64
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef %60)
          to label %62 unwind label %77

62:                                               ; preds = %57
  %63 = load ptr, ptr %61, align 8, !tbaa !5
  %64 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %13, i32 0, i32 2
  %65 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %64)
          to label %66 unwind label %77

66:                                               ; preds = %62
  %67 = load i32, ptr %12, align 4, !tbaa !53
  %68 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %63, i32 noundef %65, i32 noundef %67)
          to label %69 unwind label %77

69:                                               ; preds = %66
  store double %68, ptr %9, align 8, !tbaa !55
  %70 = load double, ptr %9, align 8, !tbaa !55
  %71 = invoke noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %70)
          to label %72 unwind label %77

72:                                               ; preds = %69
  br i1 %71, label %73, label %81

73:                                               ; preds = %72
  %74 = load double, ptr %9, align 8, !tbaa !55
  %75 = load double, ptr %10, align 8, !tbaa !55
  %76 = fadd double %75, %74
  store double %76, ptr %10, align 8, !tbaa !55
  br label %81

77:                                               ; preds = %168, %158, %143, %139, %123, %115, %111, %108, %104, %99, %95, %69, %66, %62, %57, %53, %40
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %6, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %184

81:                                               ; preds = %73, %72
  br label %82

82:                                               ; preds = %81, %56
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %8, align 4, !tbaa !53
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !53
  br label %48, !llvm.loop !56

86:                                               ; preds = %48
  %87 = load double, ptr %10, align 8, !tbaa !55
  %88 = fcmp ogt double %87, 1.000000e-13
  br i1 %88, label %89, label %133

89:                                               ; preds = %86
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %90

90:                                               ; preds = %129, %89
  %91 = load i32, ptr %8, align 4, !tbaa !53
  %92 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !9
  %94 = icmp slt i32 %91, %93
  br i1 %94, label %95, label %132

95:                                               ; preds = %90
  %96 = load i32, ptr %8, align 4, !tbaa !53
  %97 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %13, i32 noundef %96)
          to label %98 unwind label %77

98:                                               ; preds = %95
  br i1 %97, label %99, label %128

99:                                               ; preds = %98
  %100 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 3
  %101 = load i32, ptr %8, align 4, !tbaa !53
  %102 = sext i32 %101 to i64
  %103 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %100, i64 noundef %102)
          to label %104 unwind label %77

104:                                              ; preds = %99
  %105 = load ptr, ptr %103, align 8, !tbaa !5
  %106 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %13, i32 0, i32 2
  %107 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %106)
          to label %108 unwind label %77

108:                                              ; preds = %104
  %109 = load i32, ptr %12, align 4, !tbaa !53
  %110 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %105, i32 noundef %107, i32 noundef %109)
          to label %111 unwind label %77

111:                                              ; preds = %108
  store double %110, ptr %9, align 8, !tbaa !55
  %112 = load double, ptr %9, align 8, !tbaa !55
  %113 = invoke noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %112)
          to label %114 unwind label %77

114:                                              ; preds = %111
  br i1 %113, label %115, label %123

115:                                              ; preds = %114
  %116 = load i32, ptr %8, align 4, !tbaa !53
  %117 = load i32, ptr %12, align 4, !tbaa !53
  %118 = load double, ptr %9, align 8, !tbaa !55
  %119 = load double, ptr %10, align 8, !tbaa !55
  %120 = fdiv double %118, %119
  %121 = fsub double 1.000000e+00, %120
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %116, i32 noundef %117, double noundef %121)
          to label %122 unwind label %77

122:                                              ; preds = %115
  br label %127

123:                                              ; preds = %114
  %124 = load i32, ptr %8, align 4, !tbaa !53
  %125 = load i32, ptr %12, align 4, !tbaa !53
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %124, i32 noundef %125, double noundef 0.000000e+00)
          to label %126 unwind label %77

126:                                              ; preds = %123
  br label %127

127:                                              ; preds = %126, %122
  br label %128

128:                                              ; preds = %127, %98
  br label %129

129:                                              ; preds = %128
  %130 = load i32, ptr %8, align 4, !tbaa !53
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %8, align 4, !tbaa !53
  br label %90, !llvm.loop !58

132:                                              ; preds = %90
  br label %152

133:                                              ; preds = %86
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %134

134:                                              ; preds = %148, %133
  %135 = load i32, ptr %8, align 4, !tbaa !53
  %136 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !9
  %138 = icmp slt i32 %135, %137
  br i1 %138, label %139, label %151

139:                                              ; preds = %134
  %140 = load i32, ptr %8, align 4, !tbaa !53
  %141 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %13, i32 noundef %140)
          to label %142 unwind label %77

142:                                              ; preds = %139
  br i1 %141, label %143, label %147

143:                                              ; preds = %142
  %144 = load i32, ptr %8, align 4, !tbaa !53
  %145 = load i32, ptr %12, align 4, !tbaa !53
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %144, i32 noundef %145, double noundef 1.000000e+00)
          to label %146 unwind label %77

146:                                              ; preds = %143
  br label %147

147:                                              ; preds = %146, %142
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %8, align 4, !tbaa !53
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %8, align 4, !tbaa !53
  br label %134, !llvm.loop !59

151:                                              ; preds = %134
  br label %152

152:                                              ; preds = %151, %132
  store double 0.000000e+00, ptr %11, align 8, !tbaa !55
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %153

153:                                              ; preds = %165, %152
  %154 = load i32, ptr %8, align 4, !tbaa !53
  %155 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %13, i32 0, i32 1
  %156 = load i32, ptr %155, align 4, !tbaa !9
  %157 = icmp slt i32 %154, %156
  br i1 %157, label %158, label %168

158:                                              ; preds = %153
  %159 = load i32, ptr %8, align 4, !tbaa !53
  %160 = load i32, ptr %12, align 4, !tbaa !53
  %161 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %159, i32 noundef %160)
          to label %162 unwind label %77

162:                                              ; preds = %158
  %163 = load double, ptr %11, align 8, !tbaa !55
  %164 = fadd double %163, %161
  store double %164, ptr %11, align 8, !tbaa !55
  br label %165

165:                                              ; preds = %162
  %166 = load i32, ptr %8, align 4, !tbaa !53
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %8, align 4, !tbaa !53
  br label %153, !llvm.loop !60

168:                                              ; preds = %153
  %169 = load double, ptr %11, align 8, !tbaa !55
  %170 = fdiv double 1.000000e+00, %169
  %171 = load i32, ptr %12, align 4, !tbaa !53
  invoke void @_ZN7SGTELIB6Matrix12multiply_colEdi(ptr noundef nonnull align 8 dereferenceable(56) %3, double noundef %170, i32 noundef %171)
          to label %172 unwind label %77

172:                                              ; preds = %168
  br label %173

173:                                              ; preds = %172, %45
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %12, align 4, !tbaa !53
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %12, align 4, !tbaa !53
  br label %21, !llvm.loop !61

177:                                              ; preds = %26
  %178 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %13, i32 0, i32 2
  invoke void @_ZN7SGTELIB20Surrogate_Parameters10set_weightERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(312) %178, ptr noundef nonnull align 8 dereferenceable(56) %3)
          to label %179 unwind label %180

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

180:                                              ; preds = %177
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %6, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %7, align 4
  br label %184

184:                                              ; preds = %180, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %185

185:                                              ; preds = %184, %36
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #6
  br label %186

186:                                              ; preds = %185, %35
  call void @llvm.lifetime.end.p0(i64 56, ptr %3) #6
  br label %187

187:                                              ; preds = %186
  %188 = load ptr, ptr %6, align 8
  %189 = load i32, ptr %7, align 4
  %190 = insertvalue { ptr, i32 } poison, ptr %188, 0
  %191 = insertvalue { ptr, i32 } %190, i32 %189, 1
  resume { ptr, i32 } %191
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040), i32 noundef) #2 align 2

declare noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985), i32 noundef, i32 noundef) #3

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

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

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

declare noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef) #3

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !14, i64 988}
!10 = !{!"_ZTSN7SGTELIB18Surrogate_EnsembleE", !11, i64 0, !14, i64 988, !14, i64 992, !48, i64 1000, !6, i64 1024, !6, i64 1032}
!11 = !{!"_ZTSN7SGTELIB9SurrogateE", !6, i64 8, !12, i64 16, !14, i64 328, !14, i64 332, !14, i64 336, !14, i64 340, !14, i64 344, !14, 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}
!12 = !{!"_ZTSN7SGTELIB20Surrogate_ParametersE", !13, i64 8, !14, 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, !14, i64 304, !14, i64 308}
!13 = !{!"_ZTSN7SGTELIB7model_tE", !7, i64 0}
!14 = !{!"int", !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, !14, i64 40, !14, 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", !14, i64 0, !7, i64 4}
!48 = !{!"_ZTSSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE", !49, i64 0}
!49 = !{!"_ZTSSt12_Vector_baseIPN7SGTELIB9SurrogateESaIS2_EE", !50, i64 0}
!50 = !{!"_ZTSNSt12_Vector_baseIPN7SGTELIB9SurrogateESaIS2_EE12_Vector_implE", !51, i64 0}
!51 = !{!"_ZTSNSt12_Vector_baseIPN7SGTELIB9SurrogateESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!52 = !{!11, !14, i64 332}
!53 = !{!14, !14, i64 0}
!54 = !{!11, !6, i64 8}
!55 = !{!17, !17, i64 0}
!56 = distinct !{!56, !57}
!57 = !{!"llvm.loop.mustprogress"}
!58 = distinct !{!58, !57}
!59 = distinct !{!59, !57}
!60 = distinct !{!60, !57}
!61 = distinct !{!61, !57}


; 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 = external hidden unnamed_addr constant [2 x i8], align 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) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 void @_ZN7SGTELIB6MatrixC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7SGTELIB20Surrogate_Parameters10set_weightERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(312), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB18Surrogate_Ensemble17compute_W_by_wta1Ev(ptr noundef nonnull align 8 dereferenceable(1040) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.SGTELIB::Matrix", align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull @.str, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %5 unwind label %17

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 988
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 332
  %9 = load i32, ptr %8, align 4, !tbaa !51
  invoke void @_ZN7SGTELIB6MatrixC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef %7, i32 noundef %9)
          to label %10 unwind label %19

10:                                               ; preds = %5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  invoke void @_ZN7SGTELIB6Matrix4fillEd(ptr noundef nonnull align 8 dereferenceable(56) %2, double noundef 0.000000e+00)
          to label %.preheader64 unwind label %22

.preheader64:                                     ; preds = %10
  %11 = load i32, ptr %8, align 4, !tbaa !51
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph81, label %._crit_edge82

.lr.ph81:                                         ; preds = %.preheader64
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = getelementptr inbounds i8, ptr %0, i64 1000
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  br label %24

._crit_edge82:                                    ; preds = %83, %.preheader64
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  invoke void @_ZN7SGTELIB20Surrogate_Parameters10set_weightERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(312) %16, ptr noundef nonnull align 8 dereferenceable(56) %2)
          to label %87 unwind label %88

17:                                               ; preds = %1
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %21

19:                                               ; preds = %5
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  br label %21

21:                                               ; preds = %19, %17
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br label %90

22:                                               ; preds = %10
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

24:                                               ; preds = %.lr.ph81, %83
  %.078 = phi i32 [ 0, %.lr.ph81 ], [ %84, %83 ]
  %25 = load ptr, ptr %13, align 8, !tbaa !52
  %26 = invoke noundef i32 @_ZNK7SGTELIB11TrainingSet7get_bboEi(ptr noundef nonnull align 8 dereferenceable(504) %25, i32 noundef %.078)
          to label %27 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

27:                                               ; preds = %24
  %.not = icmp eq i32 %26, 2
  br i1 %.not, label %83, label %.preheader61

.preheader61:                                     ; preds = %27
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph, label %._crit_edge76

.lr.ph:                                           ; preds = %.preheader61, %44
  %indvars.iv = phi i64 [ %indvars.iv.next, %44 ], [ 0, %.preheader61 ]
  %.03967 = phi double [ %.1, %44 ], [ 0.000000e+00, %.preheader61 ]
  %30 = trunc nuw nsw i64 %indvars.iv to i32
  %31 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %30)
          to label %32 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

32:                                               ; preds = %.lr.ph
  br i1 %31, label %33, label %44

33:                                               ; preds = %32
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %indvars.iv)
          to label %35 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

35:                                               ; preds = %33
  %36 = load ptr, ptr %34, align 8, !tbaa !53
  %37 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %15)
  %38 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %36, i32 noundef %37, i32 noundef %.078)
          to label %39 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

39:                                               ; preds = %35
  %40 = invoke noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %38)
          to label %41 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

41:                                               ; preds = %39
  br i1 %40, label %42, label %44

42:                                               ; preds = %41
  %43 = fadd double %.03967, %38
  br label %44

.loopexit55:                                      ; preds = %.invoke, %.lr.ph71, %53, %55, %59
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

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

.loopexit.split-lp.loopexit.split-lp.loopexit:    ; preds = %.lr.ph, %33, %35, %39
  %lpad.loopexit62 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

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

44:                                               ; preds = %32, %42, %41
  %.1 = phi double [ %43, %42 ], [ %.03967, %41 ], [ %.03967, %32 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next, %46
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !54

._crit_edge:                                      ; preds = %44
  %48 = fcmp ogt double %.1, 1.000000e-13
  %49 = icmp sgt i32 %45, 0
  br i1 %48, label %.preheader, label %.preheader56

.preheader56:                                     ; preds = %._crit_edge
  br i1 %49, label %.lr.ph69, label %._crit_edge76

.preheader:                                       ; preds = %._crit_edge
  br i1 %49, label %.lr.ph71, label %._crit_edge76

.lr.ph71:                                         ; preds = %.preheader, %64
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %64 ], [ 0, %.preheader ]
  %50 = trunc nuw nsw i64 %indvars.iv85 to i32
  %51 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %50)
          to label %52 unwind label %.loopexit55

52:                                               ; preds = %.lr.ph71
  br i1 %51, label %53, label %64

53:                                               ; preds = %52
  %54 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %indvars.iv85)
          to label %55 unwind label %.loopexit55

55:                                               ; preds = %53
  %56 = load ptr, ptr %54, align 8, !tbaa !53
  %57 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %15)
  %58 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %56, i32 noundef %57, i32 noundef %.078)
          to label %59 unwind label %.loopexit55

59:                                               ; preds = %55
  %60 = invoke noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %58)
          to label %.invoke unwind label %.loopexit55

.invoke:                                          ; preds = %59
  %61 = fdiv double %58, %.1
  %62 = fsub double 1.000000e+00, %61
  %63 = select i1 %60, double %62, double 0.000000e+00
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %50, i32 noundef %.078, double noundef %63)
          to label %64 unwind label %.loopexit55

64:                                               ; preds = %.invoke, %52
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next86, %66
  br i1 %67, label %.lr.ph71, label %.loopexit, !llvm.loop !56

.lr.ph69:                                         ; preds = %.preheader56, %71
  %.268 = phi i32 [ %72, %71 ], [ 0, %.preheader56 ]
  %68 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %.268)
          to label %69 unwind label %.loopexit.split-lp.loopexit

69:                                               ; preds = %.lr.ph69
  br i1 %68, label %70, label %71

70:                                               ; preds = %69
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.268, i32 noundef %.078, double noundef 1.000000e+00)
          to label %71 unwind label %.loopexit.split-lp.loopexit

71:                                               ; preds = %69, %70
  %72 = add nuw nsw i32 %.268, 1
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %.lr.ph69, label %.loopexit, !llvm.loop !57

.loopexit:                                        ; preds = %71, %64
  %75 = phi i32 [ %65, %64 ], [ %73, %71 ]
  %76 = icmp sgt i32 %75, 0
  br i1 %76, label %.lr.ph75, label %._crit_edge76

.lr.ph75:                                         ; preds = %.loopexit, %.lr.ph75
  %.03873 = phi double [ %78, %.lr.ph75 ], [ 0.000000e+00, %.loopexit ]
  %.372 = phi i32 [ %79, %.lr.ph75 ], [ 0, %.loopexit ]
  %77 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.372, i32 noundef %.078)
  %78 = fadd double %.03873, %77
  %79 = add nuw nsw i32 %.372, 1
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %.lr.ph75, label %._crit_edge76, !llvm.loop !58

._crit_edge76:                                    ; preds = %.lr.ph75, %.preheader61, %.preheader, %.preheader56, %.loopexit
  %.038.lcssa = phi double [ 0.000000e+00, %.loopexit ], [ 0.000000e+00, %.preheader56 ], [ 0.000000e+00, %.preheader ], [ 0.000000e+00, %.preheader61 ], [ %78, %.lr.ph75 ]
  %82 = fdiv double 1.000000e+00, %.038.lcssa
  invoke void @_ZN7SGTELIB6Matrix12multiply_colEdi(ptr noundef nonnull align 8 dereferenceable(56) %2, double noundef %82, i32 noundef %.078)
          to label %83 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

83:                                               ; preds = %27, %._crit_edge76
  %84 = add nuw nsw i32 %.078, 1
  %85 = load i32, ptr %8, align 4, !tbaa !51
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %24, label %._crit_edge82, !llvm.loop !59

87:                                               ; preds = %._crit_edge82
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %2) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %2) #6
  ret void

88:                                               ; preds = %._crit_edge82
  %89 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp:                               ; preds = %.loopexit55, %.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit, %88, %22
  %.pn51.pn = phi { ptr, i32 } [ %23, %22 ], [ %89, %88 ], [ %lpad.loopexit, %.loopexit55 ], [ %lpad.loopexit58, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit62, %.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp ]
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %2) #6
  br label %90

90:                                               ; preds = %.loopexit.split-lp, %21
  %.pn51.pn.pn = phi { ptr, i32 } [ %.pn51.pn, %.loopexit.split-lp ], [ %.pn, %21 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn51.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040), i32 noundef) local_unnamed_addr #2 align 2

declare noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985), i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

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

declare noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef) local_unnamed_addr #3

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !13, i64 988}
!6 = !{!"_ZTSN7SGTELIB18Surrogate_EnsembleE", !7, i64 0, !13, i64 988, !13, i64 992, !47, i64 1000, !8, i64 1024, !8, i64 1032}
!7 = !{!"_ZTSN7SGTELIB9SurrogateE", !8, i64 8, !11, i64 16, !13, i64 328, !13, i64 332, !13, i64 336, !13, i64 340, !13, i64 344, !13, i64 348, !25, i64 352, !8, i64 360, !8, i64 368, !8, i64 376, !8, i64 384, !26, i64 392, !31, i64 416, !16, i64 464, !39, i64 472, !25, i64 984}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN7SGTELIB20Surrogate_ParametersE", !12, i64 8, !13, i64 12, !14, i64 16, !15, i64 20, !14, i64 24, !16, i64 32, !14, i64 40, !16, i64 48, !14, i64 56, !17, i64 60, !14, i64 64, !18, i64 72, !22, i64 128, !14, i64 132, !23, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !18, i64 176, !14, i64 232, !24, i64 236, !19, i64 240, !19, i64 272, !13, i64 304, !13, i64 308}
!12 = !{!"_ZTSN7SGTELIB7model_tE", !9, i64 0}
!13 = !{!"int", !9, i64 0}
!14 = !{!"_ZTSN7SGTELIB14param_status_tE", !9, i64 0}
!15 = !{!"_ZTSN7SGTELIB8kernel_tE", !9, i64 0}
!16 = !{!"double", !9, i64 0}
!17 = !{!"_ZTSN7SGTELIB10distance_tE", !9, i64 0}
!18 = !{!"_ZTSN7SGTELIB6MatrixE", !19, i64 8, !13, i64 40, !13, i64 44, !8, i64 48}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !21, i64 8, !9, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !8, i64 0}
!21 = !{!"long", !9, i64 0}
!22 = !{!"_ZTSN7SGTELIB8weight_tE", !9, i64 0}
!23 = !{!"_ZTSN7SGTELIB13uncertainty_tE", !9, i64 0}
!24 = !{!"_ZTSN7SGTELIB8metric_tE", !9, i64 0}
!25 = !{!"bool", !9, i64 0}
!26 = !{!"_ZTSNSt7__cxx114listIiSaIiEEE", !27, i64 0}
!27 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEEE", !28, i64 0}
!28 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEE10_List_implE", !29, i64 0}
!29 = !{!"_ZTSNSt8__detail17_List_node_headerE", !30, i64 0, !21, i64 16}
!30 = !{!"_ZTSNSt8__detail15_List_node_baseE", !8, i64 0, !8, i64 8}
!31 = !{!"_ZTSSt3mapIN7SGTELIB8metric_tENS0_6MatrixESt4lessIS1_ESaISt4pairIKS1_S2_EEE", !32, i64 0}
!32 = !{!"_ZTSSt8_Rb_treeIN7SGTELIB8metric_tESt4pairIKS1_NS0_6MatrixEESt10_Select1stIS5_ESt4lessIS1_ESaIS5_EE", !33, i64 0}
!33 = !{!"_ZTSNSt8_Rb_treeIN7SGTELIB8metric_tESt4pairIKS1_NS0_6MatrixEESt10_Select1stIS5_ESt4lessIS1_ESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !34, i64 0, !36, i64 8}
!34 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIN7SGTELIB8metric_tEEE", !35, i64 0}
!35 = !{!"_ZTSSt4lessIN7SGTELIB8metric_tEE"}
!36 = !{!"_ZTSSt15_Rb_tree_header", !37, i64 0, !21, i64 32}
!37 = !{!"_ZTSSt18_Rb_tree_node_base", !38, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!38 = !{!"_ZTSSt14_Rb_tree_color", !9, i64 0}
!39 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !40, i64 0, !41, i64 8}
!40 = !{!"_ZTSSo"}
!41 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !42, i64 0, !9, i64 64, !44, i64 104, !45, i64 120, !46, i64 124, !46, i64 132, !46, i64 140, !8, i64 152, !21, i64 160, !25, i64 168, !25, i64 169, !25, i64 170, !9, i64 171, !8, i64 176, !8, i64 184, !25, i64 192, !8, i64 200, !8, i64 208, !21, i64 216, !8, i64 224, !8, i64 232}
!42 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !43, i64 56}
!43 = !{!"_ZTSSt6locale", !8, i64 0}
!44 = !{!"_ZTSSt12__basic_fileIcE", !8, i64 0, !25, i64 8}
!45 = !{!"_ZTSSt13_Ios_Openmode", !9, i64 0}
!46 = !{!"_ZTS11__mbstate_t", !13, i64 0, !9, i64 4}
!47 = !{!"_ZTSSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE", !48, i64 0}
!48 = !{!"_ZTSSt12_Vector_baseIPN7SGTELIB9SurrogateESaIS2_EE", !49, i64 0}
!49 = !{!"_ZTSNSt12_Vector_baseIPN7SGTELIB9SurrogateESaIS2_EE12_Vector_implE", !50, i64 0}
!50 = !{!"_ZTSNSt12_Vector_baseIPN7SGTELIB9SurrogateESaIS2_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!51 = !{!7, !13, i64 332}
!52 = !{!7, !8, i64 8}
!53 = !{!8, !8, i64 0}
!54 = distinct !{!54, !55}
!55 = !{!"llvm.loop.mustprogress"}
!56 = distinct !{!56, !55}
!57 = distinct !{!57, !55}
!58 = distinct !{!58, !55}
!59 = distinct !{!59, !55}


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