; 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_wta3Ev(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 double, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  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 %15 unwind label %28

15:                                               ; preds = %1
  %16 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 1
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %14, i32 0, i32 4
  %19 = load i32, ptr %18, 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 %17, i32 noundef %19)
          to label %20 unwind label %32

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

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

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

27:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %173

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

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

36:                                               ; preds = %32, %28
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  br label %182

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

41:                                               ; preds = %22
  store double 0.000000e+00, ptr %10, align 8, !tbaa !54
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %42

42:                                               ; preds = %71, %41
  %43 = load i32, ptr %8, align 4, !tbaa !53
  %44 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp slt i32 %43, %45
  br i1 %46, label %47, label %74

47:                                               ; preds = %42
  %48 = load i32, ptr %8, align 4, !tbaa !53
  %49 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %14, i32 noundef %48)
          to label %50 unwind label %66

50:                                               ; preds = %47
  br i1 %49, label %51, label %70

51:                                               ; preds = %50
  %52 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 3
  %53 = load i32, ptr %8, align 4, !tbaa !53
  %54 = sext i32 %53 to i64
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54)
          to label %56 unwind label %66

56:                                               ; preds = %51
  %57 = load ptr, ptr %55, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %14, i32 0, i32 2
  %59 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %58)
          to label %60 unwind label %66

60:                                               ; preds = %56
  %61 = load i32, ptr %13, align 4, !tbaa !53
  %62 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %57, i32 noundef %59, i32 noundef %61)
          to label %63 unwind label %66

63:                                               ; preds = %60
  %64 = load double, ptr %10, align 8, !tbaa !54
  %65 = fadd double %64, %62
  store double %65, ptr %10, align 8, !tbaa !54
  br label %70

66:                                               ; preds = %159, %155, %136, %130, %126, %104, %101, %97, %92, %88, %60, %56, %51, %47
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %6, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %180

70:                                               ; preds = %63, %50
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %8, align 4, !tbaa !53
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %8, align 4, !tbaa !53
  br label %42, !llvm.loop !55

74:                                               ; preds = %42
  %75 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 2
  %76 = load i32, ptr %75, align 8, !tbaa !57
  %77 = sitofp i32 %76 to double
  %78 = load double, ptr %10, align 8, !tbaa !54
  %79 = fdiv double %78, %77
  store double %79, ptr %10, align 8, !tbaa !54
  %80 = load double, ptr %10, align 8, !tbaa !54
  %81 = fcmp ogt double %80, 1.000000e-13
  br i1 %81, label %82, label %145

82:                                               ; preds = %74
  store double 0.000000e+00, ptr %12, align 8, !tbaa !54
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %83

83:                                               ; preds = %117, %82
  %84 = load i32, ptr %8, align 4, !tbaa !53
  %85 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 1
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = icmp slt i32 %84, %86
  br i1 %87, label %88, label %120

88:                                               ; preds = %83
  %89 = load i32, ptr %8, align 4, !tbaa !53
  %90 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %14, i32 noundef %89)
          to label %91 unwind label %66

91:                                               ; preds = %88
  br i1 %90, label %92, label %116

92:                                               ; preds = %91
  %93 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 3
  %94 = load i32, ptr %8, align 4, !tbaa !53
  %95 = sext i32 %94 to i64
  %96 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %93, i64 noundef %95)
          to label %97 unwind label %66

97:                                               ; preds = %92
  %98 = load ptr, ptr %96, align 8, !tbaa !5
  %99 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %14, i32 0, i32 2
  %100 = invoke noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %99)
          to label %101 unwind label %66

101:                                              ; preds = %97
  %102 = load i32, ptr %13, align 4, !tbaa !53
  %103 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %98, i32 noundef %100, i32 noundef %102)
          to label %104 unwind label %66

104:                                              ; preds = %101
  store double %103, ptr %9, align 8, !tbaa !54
  %105 = load double, ptr %9, align 8, !tbaa !54
  %106 = load double, ptr %10, align 8, !tbaa !54
  %107 = call double @llvm.fmuladd.f64(double 5.000000e-02, double %106, double %105)
  %108 = call double @pow(double noundef %107, double noundef -1.000000e+00) #7
  store double %108, ptr %11, align 8, !tbaa !54
  %109 = load double, ptr %11, align 8, !tbaa !54
  %110 = load double, ptr %12, align 8, !tbaa !54
  %111 = fadd double %110, %109
  store double %111, ptr %12, align 8, !tbaa !54
  %112 = load i32, ptr %8, align 4, !tbaa !53
  %113 = load i32, ptr %13, align 4, !tbaa !53
  %114 = load double, ptr %11, align 8, !tbaa !54
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %112, i32 noundef %113, double noundef %114)
          to label %115 unwind label %66

115:                                              ; preds = %104
  br label %116

116:                                              ; preds = %115, %91
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %8, align 4, !tbaa !53
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %8, align 4, !tbaa !53
  br label %83, !llvm.loop !58

120:                                              ; preds = %83
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %121

121:                                              ; preds = %141, %120
  %122 = load i32, ptr %8, align 4, !tbaa !53
  %123 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !9
  %125 = icmp slt i32 %122, %124
  br i1 %125, label %126, label %144

126:                                              ; preds = %121
  %127 = load i32, ptr %8, align 4, !tbaa !53
  %128 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %14, i32 noundef %127)
          to label %129 unwind label %66

129:                                              ; preds = %126
  br i1 %128, label %130, label %140

130:                                              ; preds = %129
  %131 = load i32, ptr %8, align 4, !tbaa !53
  %132 = load i32, ptr %13, align 4, !tbaa !53
  %133 = load i32, ptr %8, align 4, !tbaa !53
  %134 = load i32, ptr %13, align 4, !tbaa !53
  %135 = invoke noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %133, i32 noundef %134)
          to label %136 unwind label %66

136:                                              ; preds = %130
  %137 = load double, ptr %12, align 8, !tbaa !54
  %138 = fdiv double %135, %137
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %131, i32 noundef %132, double noundef %138)
          to label %139 unwind label %66

139:                                              ; preds = %136
  br label %140

140:                                              ; preds = %139, %129
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %8, align 4, !tbaa !53
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %8, align 4, !tbaa !53
  br label %121, !llvm.loop !59

144:                                              ; preds = %121
  br label %169

145:                                              ; preds = %74
  %146 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble", ptr %14, i32 0, i32 2
  %147 = load i32, ptr %146, align 8, !tbaa !57
  %148 = sitofp i32 %147 to double
  %149 = fdiv double 1.000000e+00, %148
  store double %149, ptr %11, align 8, !tbaa !54
  store i32 0, ptr %8, align 4, !tbaa !53
  br label %150

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

155:                                              ; preds = %150
  %156 = load i32, ptr %8, align 4, !tbaa !53
  %157 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %14, i32 noundef %156)
          to label %158 unwind label %66

158:                                              ; preds = %155
  br i1 %157, label %159, label %164

159:                                              ; preds = %158
  %160 = load i32, ptr %8, align 4, !tbaa !53
  %161 = load i32, ptr %13, align 4, !tbaa !53
  %162 = load double, ptr %11, align 8, !tbaa !54
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef %160, i32 noundef %161, double noundef %162)
          to label %163 unwind label %66

163:                                              ; preds = %159
  br label %164

164:                                              ; preds = %163, %158
  br label %165

165:                                              ; preds = %164
  %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 %150, !llvm.loop !60

168:                                              ; preds = %150
  br label %169

169:                                              ; preds = %168, %144
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %13, align 4, !tbaa !53
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %13, align 4, !tbaa !53
  br label %22, !llvm.loop !61

173:                                              ; preds = %27
  %174 = getelementptr inbounds %"class.SGTELIB::Surrogate", ptr %14, i32 0, i32 2
  invoke void @_ZN7SGTELIB20Surrogate_Parameters10set_weightERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(312) %174, ptr noundef nonnull align 8 dereferenceable(56) %3)
          to label %175 unwind label %176

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

176:                                              ; preds = %173
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %6, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %7, align 4
  br label %180

180:                                              ; preds = %176, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %181

181:                                              ; preds = %180, %37
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #7
  br label %182

182:                                              ; preds = %181, %36
  call void @llvm.lifetime.end.p0(i64 56, ptr %3) #7
  br label %183

183:                                              ; preds = %182
  %184 = load ptr, ptr %6, align 8
  %185 = load i32, ptr %7, align 4
  %186 = insertvalue { ptr, i32 } poison, ptr %184, 0
  %187 = insertvalue { ptr, i32 } %186, i32 %185, 1
  resume { ptr, i32 } %187
}

; 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

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

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #4

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!17, !17, i64 0}
!55 = distinct !{!55, !56}
!56 = !{!"llvm.loop.mustprogress"}
!57 = !{!10, !14, i64 992}
!58 = distinct !{!58, !56}
!59 = distinct !{!59, !56}
!60 = distinct !{!60, !56}
!61 = distinct !{!61, !56}


; 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_wta3Ev(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) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  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 %20

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 %22

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

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

.preheader65.lr.ph:                               ; preds = %.preheader66
  %13 = getelementptr inbounds i8, ptr %0, i64 1000
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = getelementptr inbounds i8, ptr %0, i64 992
  %.pre = load i32, ptr %6, align 4, !tbaa !5
  br label %.preheader65

.preheader65:                                     ; preds = %.preheader65.lr.ph, %.loopexit
  %16 = phi i32 [ %.pre, %.preheader65.lr.ph ], [ %86, %.loopexit ]
  %17 = phi i32 [ %.pre, %.preheader65.lr.ph ], [ %87, %.loopexit ]
  %.080 = phi i32 [ 0, %.preheader65.lr.ph ], [ %88, %.loopexit ]
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge82:                                    ; preds = %.loopexit, %.preheader66
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  invoke void @_ZN7SGTELIB20Surrogate_Parameters10set_weightERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(312) %19, ptr noundef nonnull align 8 dereferenceable(56) %2)
          to label %91 unwind label %92

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

22:                                               ; preds = %5
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  br label %24

24:                                               ; preds = %22, %20
  %.pn = phi { ptr, i32 } [ %23, %22 ], [ %21, %20 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  br label %94

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

.lr.ph:                                           ; preds = %.preheader65, %38
  %indvars.iv = phi i64 [ %indvars.iv.next, %38 ], [ 0, %.preheader65 ]
  %.03970 = phi double [ %.140, %38 ], [ 0.000000e+00, %.preheader65 ]
  %27 = trunc nuw nsw i64 %indvars.iv to i32
  %28 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %27)
          to label %29 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

29:                                               ; preds = %.lr.ph
  br i1 %28, label %30, label %38

30:                                               ; preds = %29
  %31 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %indvars.iv)
          to label %32 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

32:                                               ; preds = %30
  %33 = load ptr, ptr %31, align 8, !tbaa !52
  %34 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %14)
  %35 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %33, i32 noundef %34, i32 noundef %.080)
          to label %36 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

36:                                               ; preds = %32
  %37 = fadd double %.03970, %35
  br label %38

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

.loopexit.split-lp.loopexit:                      ; preds = %60, %56, %54, %.lr.ph76
  %lpad.loopexit59 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

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

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

38:                                               ; preds = %29, %36
  %.140 = phi double [ %37, %36 ], [ %.03970, %29 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = icmp slt i64 %indvars.iv.next, %40
  br i1 %41, label %.lr.ph, label %._crit_edge, !llvm.loop !53

._crit_edge:                                      ; preds = %38, %.preheader65
  %42 = phi i32 [ %16, %.preheader65 ], [ %39, %38 ]
  %43 = phi i32 [ %17, %.preheader65 ], [ %39, %38 ]
  %.039.lcssa = phi double [ 0.000000e+00, %.preheader65 ], [ %.140, %38 ]
  %44 = load i32, ptr %15, align 8, !tbaa !55
  %45 = sitofp i32 %44 to double
  %46 = fdiv double %.039.lcssa, %45
  %47 = fcmp ogt double %46, 1.000000e-13
  br i1 %47, label %.preheader58, label %76

.preheader58:                                     ; preds = %._crit_edge
  %48 = icmp sgt i32 %43, 0
  br i1 %48, label %.lr.ph76, label %.preheader

.preheader:                                       ; preds = %63, %.preheader58
  %49 = phi i32 [ %42, %.preheader58 ], [ %64, %63 ]
  %.038.lcssa = phi double [ 0.000000e+00, %.preheader58 ], [ %.1, %63 ]
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %.lr.ph79, label %.loopexit

.lr.ph76:                                         ; preds = %.preheader58, %63
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %63 ], [ 0, %.preheader58 ]
  %.03875 = phi double [ %.1, %63 ], [ 0.000000e+00, %.preheader58 ]
  %51 = trunc nuw nsw i64 %indvars.iv85 to i32
  %52 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %51)
          to label %53 unwind label %.loopexit.split-lp.loopexit

53:                                               ; preds = %.lr.ph76
  br i1 %52, label %54, label %63

54:                                               ; preds = %53
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %indvars.iv85)
          to label %56 unwind label %.loopexit.split-lp.loopexit

56:                                               ; preds = %54
  %57 = load ptr, ptr %55, align 8, !tbaa !52
  %58 = call noundef i32 @_ZNK7SGTELIB20Surrogate_Parameters15get_metric_typeEv(ptr noundef nonnull align 8 dereferenceable(312) %14)
  %59 = invoke noundef double @_ZN7SGTELIB9Surrogate10get_metricENS_8metric_tEi(ptr noundef nonnull align 8 dereferenceable(985) %57, i32 noundef %58, i32 noundef %.080)
          to label %60 unwind label %.loopexit.split-lp.loopexit

60:                                               ; preds = %56
  %61 = call double @llvm.fmuladd.f64(double %46, double 5.000000e-02, double %59)
  %reciprocal = fdiv double 1.000000e+00, %61
  %62 = fadd double %.03875, %reciprocal
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %51, i32 noundef %.080, double noundef %reciprocal)
          to label %63 unwind label %.loopexit.split-lp.loopexit

63:                                               ; preds = %53, %60
  %.1 = phi double [ %62, %60 ], [ %.03875, %53 ]
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next86, %65
  br i1 %66, label %.lr.ph76, label %.preheader, !llvm.loop !56

.lr.ph79:                                         ; preds = %.preheader, %72
  %.24578 = phi i32 [ %73, %72 ], [ 0, %.preheader ]
  %67 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %.24578)
          to label %68 unwind label %.loopexit57

68:                                               ; preds = %.lr.ph79
  br i1 %67, label %69, label %72

69:                                               ; preds = %68
  %70 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.24578, i32 noundef %.080)
  %71 = fdiv double %70, %.038.lcssa
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.24578, i32 noundef %.080, double noundef %71)
          to label %72 unwind label %.loopexit57

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

76:                                               ; preds = %._crit_edge
  %77 = fdiv double 1.000000e+00, %45
  %78 = icmp sgt i32 %43, 0
  br i1 %78, label %.lr.ph73, label %.loopexit

.lr.ph73:                                         ; preds = %76, %82
  %.34671 = phi i32 [ %83, %82 ], [ 0, %76 ]
  %79 = invoke noundef zeroext i1 @_ZNK7SGTELIB18Surrogate_Ensemble8is_readyEi(ptr noundef nonnull align 8 dereferenceable(1040) %0, i32 noundef %.34671)
          to label %80 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

80:                                               ; preds = %.lr.ph73
  br i1 %79, label %81, label %82

81:                                               ; preds = %80
  invoke void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %2, i32 noundef %.34671, i32 noundef %.080, double noundef %77)
          to label %82 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

82:                                               ; preds = %80, %81
  %83 = add nuw nsw i32 %.34671, 1
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %.lr.ph73, label %.loopexit, !llvm.loop !58

.loopexit:                                        ; preds = %82, %72, %76, %.preheader
  %86 = phi i32 [ %42, %76 ], [ %49, %.preheader ], [ %74, %72 ], [ %84, %82 ]
  %87 = phi i32 [ %43, %76 ], [ %49, %.preheader ], [ %74, %72 ], [ %84, %82 ]
  %88 = add nuw nsw i32 %.080, 1
  %89 = load i32, ptr %8, align 4, !tbaa !51
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %.preheader65, label %._crit_edge82, !llvm.loop !59

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

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

.loopexit.split-lp:                               ; preds = %.loopexit57, %.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit, %92, %25
  %.pn53.pn = phi { ptr, i32 } [ %26, %25 ], [ %93, %92 ], [ %lpad.loopexit, %.loopexit57 ], [ %lpad.loopexit59, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit63, %.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) #7
  br label %94

94:                                               ; preds = %.loopexit.split-lp, %24
  %.pn53.pn.pn = phi { ptr, i32 } [ %.pn53.pn, %.loopexit.split-lp ], [ %.pn, %24 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn53.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

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

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

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!8, !8, i64 0}
!53 = distinct !{!53, !54}
!54 = !{!"llvm.loop.mustprogress"}
!55 = !{!6, !13, i64 992}
!56 = distinct !{!56, !54}
!57 = distinct !{!57, !54}
!58 = distinct !{!58, !54}
!59 = distinct !{!59, !54}


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