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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.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::TrainingSet" = type { ptr, i32, i32, i32, i8, ptr, i8, i32, double, double, i32, %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double }
%"class.SGTELIB::Matrix" = type { ptr, %"class.std::__cxx11::basic_string", i32, i32, ptr }

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

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

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

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

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

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

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

declare ptr @__cxa_allocate_exception(i64)

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

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

declare void @__cxa_throw(ptr, ptr, ptr)

declare void @__cxa_free_exception(ptr)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK7SGTELIB11TrainingSet14get_d1_over_d2ERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(504) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca i1, align 1
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %22)
  %24 = icmp sgt i32 %23, 1
  br i1 %24, label %25, label %47

25:                                               ; preds = %2
  store i1 true, ptr %12, align 1
  %26 = call ptr @__cxa_allocate_exception(i64 112) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %27 unwind label %30

27:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.35, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %28 unwind label %34

28:                                               ; preds = %27
  invoke void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112) %26, ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 1149, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %29 unwind label %38

29:                                               ; preds = %28
  store i1 false, ptr %12, align 1
  invoke void @__cxa_throw(ptr %26, ptr @_ZTIN7SGTELIB9ExceptionE, ptr @_ZN7SGTELIB9ExceptionD2Ev) #7
          to label %121 unwind label %38

30:                                               ; preds = %25
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %8, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %9, align 4
  br label %43

34:                                               ; preds = %27
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  br label %42

38:                                               ; preds = %29, %28
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %8, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %9, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #6
  br label %42

42:                                               ; preds = %38, %34
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %43

43:                                               ; preds = %42, %30
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  %44 = load i1, ptr %12, align 1
  br i1 %44, label %45, label %46

45:                                               ; preds = %43
  call void @__cxa_free_exception(ptr %26) #6
  br label %46

46:                                               ; preds = %45, %43
  br label %116

47:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store double 0x7FEFFFFFFFFFFFFF, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store double 0x7FEFFFFFFFFFFFFF, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %18, align 4, !tbaa !11
  %48 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %21, i32 0, i32 1
  %49 = load i32, ptr %48, align 8, !tbaa !13
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  store double 1.000000e+00, ptr %3, align 8
  store i32 1, ptr %20, align 4
  br label %114

52:                                               ; preds = %47
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %53

53:                                               ; preds = %106, %52
  %54 = load i32, ptr %17, align 4, !tbaa !11
  %55 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %21, i32 0, i32 1
  %56 = load i32, ptr %55, align 8, !tbaa !13
  %57 = icmp slt i32 %54, %56
  br i1 %57, label %58, label %109

58:                                               ; preds = %53
  store double 0.000000e+00, ptr %15, align 8, !tbaa !9
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %59

59:                                               ; preds = %77, %58
  %60 = load i32, ptr %19, align 4, !tbaa !11
  %61 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %21, i32 0, i32 2
  %62 = load i32, ptr %61, align 4, !tbaa !20
  %63 = icmp slt i32 %60, %62
  br i1 %63, label %64, label %80

64:                                               ; preds = %59
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load i32, ptr %19, align 4, !tbaa !11
  %67 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %65, i32 noundef 0, i32 noundef %66)
  %68 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %21, i32 0, i32 13
  %69 = load i32, ptr %17, align 4, !tbaa !11
  %70 = load i32, ptr %19, align 4, !tbaa !11
  %71 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %68, i32 noundef %69, i32 noundef %70)
  %72 = fsub double %67, %71
  store double %72, ptr %16, align 8, !tbaa !9
  %73 = load double, ptr %16, align 8, !tbaa !9
  %74 = load double, ptr %16, align 8, !tbaa !9
  %75 = load double, ptr %15, align 8, !tbaa !9
  %76 = call double @llvm.fmuladd.f64(double %73, double %74, double %75)
  store double %76, ptr %15, align 8, !tbaa !9
  br label %77

77:                                               ; preds = %64
  %78 = load i32, ptr %19, align 4, !tbaa !11
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %19, align 4, !tbaa !11
  br label %59, !llvm.loop !21

80:                                               ; preds = %59
  %81 = load double, ptr %15, align 8, !tbaa !9
  %82 = fcmp oeq double %81, 0.000000e+00
  br i1 %82, label %83, label %84

83:                                               ; preds = %80
  store double 0.000000e+00, ptr %3, align 8
  store i32 1, ptr %20, align 4
  br label %114

84:                                               ; preds = %80
  %85 = load double, ptr %15, align 8, !tbaa !9
  %86 = load double, ptr %13, align 8, !tbaa !9
  %87 = fcmp olt double %85, %86
  br i1 %87, label %88, label %92

88:                                               ; preds = %84
  %89 = load double, ptr %13, align 8, !tbaa !9
  store double %89, ptr %14, align 8, !tbaa !9
  %90 = load double, ptr %15, align 8, !tbaa !9
  store double %90, ptr %13, align 8, !tbaa !9
  %91 = load i32, ptr %17, align 4, !tbaa !11
  store i32 %91, ptr %18, align 4, !tbaa !11
  br label %105

92:                                               ; preds = %84
  %93 = load double, ptr %15, align 8, !tbaa !9
  %94 = load double, ptr %14, align 8, !tbaa !9
  %95 = fcmp olt double %93, %94
  br i1 %95, label %96, label %104

96:                                               ; preds = %92
  %97 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %21, i32 0, i32 15
  %98 = load i32, ptr %17, align 4, !tbaa !11
  %99 = load i32, ptr %18, align 4, !tbaa !11
  %100 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %97, i32 noundef %98, i32 noundef %99)
  %101 = fcmp ogt double %100, 0.000000e+00
  br i1 %101, label %102, label %104

102:                                              ; preds = %96
  %103 = load double, ptr %15, align 8, !tbaa !9
  store double %103, ptr %14, align 8, !tbaa !9
  br label %104

104:                                              ; preds = %102, %96, %92
  br label %105

105:                                              ; preds = %104, %88
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %17, align 4, !tbaa !11
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %17, align 4, !tbaa !11
  br label %53, !llvm.loop !23

109:                                              ; preds = %53
  %110 = load double, ptr %13, align 8, !tbaa !9
  %111 = load double, ptr %14, align 8, !tbaa !9
  %112 = fdiv double %110, %111
  %113 = call double @sqrt(double noundef %112) #6
  store double %113, ptr %3, align 8
  store i32 1, ptr %20, align 4
  br label %114

114:                                              ; preds = %109, %83, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %115 = load double, ptr %3, align 8
  ret double %115

116:                                              ; preds = %46
  %117 = load ptr, ptr %8, align 8
  %118 = load i32, ptr %9, align 4
  %119 = insertvalue { ptr, i32 } poison, ptr %117, 0
  %120 = insertvalue { ptr, i32 } %119, i32 %118, 1
  resume { ptr, i32 } %120

121:                                              ; preds = %29
  unreachable
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTSN7SGTELIB11TrainingSetE", !12, i64 8, !12, i64 12, !12, i64 16, !15, i64 20, !6, i64 24, !15, i64 32, !12, i64 36, !10, i64 40, !10, i64 48, !12, i64 56, !16, i64 64, !16, i64 120, !16, i64 176, !16, i64 232, !16, i64 288, !12, i64 344, !12, i64 348, !12, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !12, i64 416, !12, i64 420, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !10, i64 496}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN7SGTELIB6MatrixE", !17, i64 8, !12, i64 40, !12, i64 44, !6, i64 48}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !19, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!14, !12, i64 12}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


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

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

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

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

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

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

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

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

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

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK7SGTELIB11TrainingSet14get_d1_over_d2ERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(504) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = tail call noundef i32 @_ZNK7SGTELIB6Matrix11get_nb_rowsEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %8 = icmp sgt i32 %7, 1
  br i1 %8, label %9, label %21

9:                                                ; preds = %2
  %10 = tail call ptr @__cxa_allocate_exception(i64 112) #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.3, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %11 unwind label %.thread

11:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull @.str.35, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %12 unwind label %15

12:                                               ; preds = %11
  invoke void @_ZN7SGTELIB9ExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_(ptr noundef nonnull align 8 dereferenceable(112) %10, ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 1149, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %13 unwind label %17

13:                                               ; preds = %12
  invoke void @__cxa_throw(ptr nonnull %10, ptr nonnull @_ZTIN7SGTELIB9ExceptionE, ptr nonnull @_ZN7SGTELIB9ExceptionD2Ev) #7
          to label %55 unwind label %17

.thread:                                          ; preds = %9
  %14 = landingpad { ptr, i32 }
          cleanup
  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 %20

15:                                               ; preds = %11
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %19

17:                                               ; preds = %13, %12
  %.037 = phi i1 [ false, %13 ], [ true, %12 ]
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  br label %19

19:                                               ; preds = %15, %17
  %.pn = phi { ptr, i32 } [ %18, %17 ], [ %16, %15 ]
  %.138 = phi i1 [ %.037, %17 ], [ true, %15 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  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
  br i1 %.138, label %20, label %54

20:                                               ; preds = %.thread, %19
  %.pn.pn48 = phi { ptr, i32 } [ %14, %.thread ], [ %.pn, %19 ]
  call void @__cxa_free_exception(ptr %10) #6
  br label %54

21:                                               ; preds = %2
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !5
  %24 = icmp eq i32 %23, 1
  br i1 %24, label %.loopexit, label %.preheader49

.preheader49:                                     ; preds = %21
  %25 = icmp sgt i32 %23, 0
  br i1 %25, label %.preheader.lr.ph, label %._crit_edge58

.preheader.lr.ph:                                 ; preds = %.preheader49
  %26 = getelementptr inbounds i8, ptr %0, i64 12
  %27 = getelementptr inbounds i8, ptr %0, i64 176
  %28 = getelementptr inbounds i8, ptr %0, i64 288
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %47
  %.02957 = phi i32 [ 0, %.preheader.lr.ph ], [ %.1, %47 ]
  %.03056 = phi i32 [ 0, %.preheader.lr.ph ], [ %48, %47 ]
  %.03355 = phi double [ 0x7FEFFFFFFFFFFFFF, %.preheader.lr.ph ], [ %.134, %47 ]
  %.03554 = phi double [ 0x7FEFFFFFFFFFFFFF, %.preheader.lr.ph ], [ %.136, %47 ]
  %29 = load i32, ptr %26, align 4, !tbaa !17
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.053 = phi i32 [ %35, %.lr.ph ], [ 0, %.preheader ]
  %.03252 = phi double [ %34, %.lr.ph ], [ 0.000000e+00, %.preheader ]
  %31 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef 0, i32 noundef %.053)
  %32 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %27, i32 noundef %.03056, i32 noundef %.053)
  %33 = fsub double %31, %32
  %34 = tail call double @llvm.fmuladd.f64(double %33, double %33, double %.03252)
  %35 = add nuw nsw i32 %.053, 1
  %36 = load i32, ptr %26, align 4, !tbaa !17
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph
  %38 = fcmp oeq double %34, 0.000000e+00
  br i1 %38, label %.loopexit, label %39

39:                                               ; preds = %._crit_edge
  %40 = fcmp olt double %34, %.03554
  br i1 %40, label %47, label %41

41:                                               ; preds = %39
  %42 = fcmp olt double %34, %.03355
  br i1 %42, label %43, label %47

43:                                               ; preds = %41
  %44 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %28, i32 noundef %.03056, i32 noundef %.02957)
  %45 = fcmp ogt double %44, 0.000000e+00
  br i1 %45, label %46, label %47

46:                                               ; preds = %43
  br label %47

47:                                               ; preds = %39, %46, %43, %41
  %.136 = phi double [ %.03554, %46 ], [ %.03554, %43 ], [ %.03554, %41 ], [ %34, %39 ]
  %.134 = phi double [ %34, %46 ], [ %.03355, %43 ], [ %.03355, %41 ], [ %.03554, %39 ]
  %.1 = phi i32 [ %.02957, %46 ], [ %.02957, %43 ], [ %.02957, %41 ], [ %.03056, %39 ]
  %48 = add nuw nsw i32 %.03056, 1
  %49 = load i32, ptr %22, align 8, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %.preheader, label %._crit_edge58.loopexit, !llvm.loop !20

._crit_edge58.loopexit:                           ; preds = %47
  %51 = fdiv double %.136, %.134
  br label %._crit_edge58

._crit_edge58:                                    ; preds = %._crit_edge58.loopexit, %.preheader49
  %52 = phi double [ 1.000000e+00, %.preheader49 ], [ %51, %._crit_edge58.loopexit ]
  %53 = tail call double @sqrt(double noundef %52) #6
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %._crit_edge, %21, %._crit_edge58
  %.031 = phi double [ %53, %._crit_edge58 ], [ 1.000000e+00, %21 ], [ 0.000000e+00, %._crit_edge ], [ 0.000000e+00, %.preheader ]
  ret double %.031

54:                                               ; preds = %19, %20
  %.pn.pn47 = phi { ptr, i32 } [ %.pn, %19 ], [ %.pn.pn48, %20 ]
  resume { ptr, i32 } %.pn.pn47

55:                                               ; preds = %13
  unreachable
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"_ZTSN7SGTELIB11TrainingSetE", !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 20, !11, i64 24, !10, i64 32, !7, i64 36, !12, i64 40, !12, i64 48, !7, i64 56, !13, i64 64, !13, i64 120, !13, i64 176, !13, i64 232, !13, i64 288, !7, i64 344, !7, i64 348, !7, i64 352, !11, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !11, i64 392, !11, i64 400, !11, i64 408, !7, i64 416, !7, i64 420, !11, i64 424, !11, i64 432, !11, i64 440, !11, i64 448, !11, i64 456, !11, i64 464, !11, i64 472, !11, i64 480, !11, i64 488, !12, i64 496}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTSN7SGTELIB6MatrixE", !14, i64 8, !7, i64 40, !7, i64 44, !11, i64 48}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!6, !7, i64 12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


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