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

; 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::Surrogate_Ensemble_Stat" = type { %"class.SGTELIB::Surrogate.base", i32, i32, %"class.std::vector", ptr, ptr, %"class.SGTELIB::Matrix", i32, double, double, double, double }
%"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::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::__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::Matrix" = type { ptr, %"class.std::__cxx11::basic_string", i32, i32, ptr }

@_ZTVN7SGTELIB23Surrogate_Ensemble_StatE = external dso_local unnamed_addr constant { [15 x ptr] }, align 8

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: nounwind
declare void @_ZN7SGTELIB9SurrogateD2Ev(ptr noundef nonnull align 8 dereferenceable(985)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7SGTELIB23Surrogate_Ensemble_StatD2Ev(ptr noundef nonnull align 8 dereferenceable(1136) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 104) ({ [15 x ptr] }, ptr @_ZTVN7SGTELIB23Surrogate_Ensemble_StatE, i32 0, i32 0, i32 2), ptr %4, align 8, !tbaa !9
  %5 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 4
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %7 = icmp eq ptr %6, null
  br i1 %7, label %9, label %8

8:                                                ; preds = %1
  call void @_ZdaPv(ptr noundef %6) #7
  br label %9

9:                                                ; preds = %8, %1
  %10 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 5
  %11 = load ptr, ptr %10, align 8, !tbaa !54
  %12 = icmp eq ptr %11, null
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @_ZdaPv(ptr noundef %11) #7
  br label %14

14:                                               ; preds = %13, %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 0, ptr %3, align 4, !tbaa !55
  br label %15

15:                                               ; preds = %38, %14
  %16 = load i32, ptr %3, align 4, !tbaa !55
  %17 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !56
  %19 = icmp slt i32 %16, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %41

21:                                               ; preds = %15
  %22 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 3
  %23 = load i32, ptr %3, align 4, !tbaa !55
  %24 = sext i32 %23 to i64
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %24)
          to label %26 unwind label %45

26:                                               ; preds = %21
  %27 = load ptr, ptr %25, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %37

29:                                               ; preds = %26
  %30 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 3
  %31 = load i32, ptr %3, align 4, !tbaa !55
  %32 = sext i32 %31 to i64
  %33 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %32)
          to label %34 unwind label %45

34:                                               ; preds = %29
  %35 = load ptr, ptr %33, align 8, !tbaa !5
  invoke void @_ZN7SGTELIB16surrogate_deleteEPNS_9SurrogateE(ptr noundef %35)
          to label %36 unwind label %45

36:                                               ; preds = %34
  br label %37

37:                                               ; preds = %36, %26
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %3, align 4, !tbaa !55
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %3, align 4, !tbaa !55
  br label %15, !llvm.loop !57

41:                                               ; preds = %20
  %42 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 3
  call void @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %42) #8
  %43 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 6
  call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %43) #8
  %44 = getelementptr inbounds %"class.SGTELIB::Surrogate_Ensemble_Stat", ptr %4, i32 0, i32 3
  call void @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %44) #8
  call void @_ZN7SGTELIB9SurrogateD2Ev(ptr noundef nonnull align 8 dereferenceable(985) %4) #8
  ret void

45:                                               ; preds = %34, %29, %21
  %46 = landingpad { ptr, i32 }
          catch ptr null
  %47 = extractvalue { ptr, i32 } %46, 0
  call void @__clang_call_terminate(ptr %47) #9
  unreachable
}

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

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

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #5

declare void @_ZN7SGTELIB16surrogate_deleteEPNS_9SurrogateE(ptr noundef) #6

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

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


; 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"

@_ZTVN7SGTELIB23Surrogate_Ensemble_StatE = external dso_local unnamed_addr constant { [15 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nounwind
declare void @_ZN7SGTELIB9SurrogateD2Ev(ptr noundef nonnull align 8 dereferenceable(985)) unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7SGTELIB23Surrogate_Ensemble_StatD2Ev(ptr noundef nonnull align 8 dereferenceable(1136) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 104) (i8, ptr @_ZTVN7SGTELIB23Surrogate_Ensemble_StatE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 1024
  %3 = load ptr, ptr %2, align 8, !tbaa !8
  %4 = icmp eq ptr %3, null
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @_ZdaPv(ptr noundef nonnull %3) #6
  br label %6

6:                                                ; preds = %5, %1
  %7 = getelementptr inbounds i8, ptr %0, i64 1032
  %8 = load ptr, ptr %7, align 8, !tbaa !53
  %9 = icmp eq ptr %8, null
  br i1 %9, label %11, label %10

10:                                               ; preds = %6
  tail call void @_ZdaPv(ptr noundef nonnull %8) #6
  br label %11

11:                                               ; preds = %10, %6
  %12 = getelementptr inbounds i8, ptr %0, i64 988
  %13 = load i32, ptr %12, align 4, !tbaa !54
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 1000
  br label %18

._crit_edge:                                      ; preds = %26, %11
  %16 = getelementptr inbounds i8, ptr %0, i64 1000
  tail call void @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  %17 = getelementptr inbounds i8, ptr %0, i64 1040
  tail call void @_ZN7SGTELIB6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(56) %17) #7
  tail call void @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  tail call void @_ZN7SGTELIB9SurrogateD2Ev(ptr noundef nonnull align 8 dereferenceable(985) %0) #7
  ret void

18:                                               ; preds = %.lr.ph, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %26 ]
  %19 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %indvars.iv)
          to label %20 unwind label %30

20:                                               ; preds = %18
  %21 = load ptr, ptr %19, align 8, !tbaa !55
  %.not = icmp eq ptr %21, null
  br i1 %.not, label %26, label %22

22:                                               ; preds = %20
  %23 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %indvars.iv)
          to label %24 unwind label %30

24:                                               ; preds = %22
  %25 = load ptr, ptr %23, align 8, !tbaa !55
  invoke void @_ZN7SGTELIB16surrogate_deleteEPNS_9SurrogateE(ptr noundef %25)
          to label %26 unwind label %30

26:                                               ; preds = %20, %24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr %12, align 4, !tbaa !54
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %18, label %._crit_edge, !llvm.loop !56

30:                                               ; preds = %24, %22, %18
  %31 = landingpad { ptr, i32 }
          catch ptr null
  %32 = extractvalue { ptr, i32 } %31, 0
  tail call void @__clang_call_terminate(ptr %32) #8
  unreachable
}

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

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

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #4

declare void @_ZN7SGTELIB16surrogate_deleteEPNS_9SurrogateE(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIPN7SGTELIB9SurrogateESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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


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