; LLVM IR from rvillegasm/NuMath :: src/singleVariableEquations/openMethods (newton)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::initializer_list" = type { ptr, i64 }
%"class.std::allocator" = type { i8 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@_ZTIN6numath19DerivativeExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN6numath13IterExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN6numath23singleVariableEquations6newtonEPFddES2_didPKcRSt6vectorIS5_IdSaIdEESaIS7_EE(ptr noundef %0, ptr noundef %1, double noundef %2, i32 noundef %3, double noundef %4, ptr noundef %5, ptr noundef nonnull align 8 dereferenceable(24) %6) #0 personality ptr @__gxx_personality_v0 {
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca %"class.std::vector", align 8
  %22 = alloca %"class.std::initializer_list", align 8
  %23 = alloca [4 x double], align 8
  %24 = alloca %"class.std::allocator", align 1
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca %"class.std::vector", align 8
  %28 = alloca %"class.std::initializer_list", align 8
  %29 = alloca [4 x double], align 8
  %30 = alloca %"class.std::allocator", align 1
  %31 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store double %2, ptr %11, align 8, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !11
  store double %4, ptr %13, align 8, !tbaa !9
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load double, ptr %11, align 8, !tbaa !9
  %34 = call noundef double %32(double noundef %33)
  store double %34, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = load double, ptr %11, align 8, !tbaa !9
  %37 = call noundef double %35(double noundef %36)
  store double %37, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %38 = load double, ptr %13, align 8, !tbaa !9
  %39 = fadd double %38, 1.000000e+00
  store double %39, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #8
  %40 = load i32, ptr %19, align 4, !tbaa !11
  %41 = sitofp i32 %40 to double
  store double %41, ptr %23, align 8, !tbaa !9
  %42 = getelementptr inbounds double, ptr %23, i64 1
  %43 = load double, ptr %11, align 8, !tbaa !9
  store double %43, ptr %42, align 8, !tbaa !9
  %44 = getelementptr inbounds double, ptr %23, i64 2
  %45 = load double, ptr %16, align 8, !tbaa !9
  store double %45, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds double, ptr %23, i64 3
  %47 = load double, ptr %20, align 8, !tbaa !9
  store double %47, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds %"class.std::initializer_list", ptr %22, i32 0, i32 0
  store ptr %23, ptr %48, align 8, !tbaa !13
  %49 = getelementptr inbounds %"class.std::initializer_list", ptr %22, i32 0, i32 1
  store i64 4, ptr %49, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #8
  call void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #8
  %50 = getelementptr inbounds { ptr, i64 }, ptr %22, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8
  %52 = getelementptr inbounds { ptr, i64 }, ptr %22, i32 0, i32 1
  %53 = load i64, ptr %52, align 8
  invoke void @_ZNSt6vectorIdSaIdEEC2ESt16initializer_listIdERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr %51, i64 %53, ptr noundef nonnull align 1 dereferenceable(1) %24)
          to label %54 unwind label %124

54:                                               ; preds = %7
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #8
  %55 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIS_IdSaIdEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 8 dereferenceable(24) %21)
          to label %56 unwind label %128

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %123, %56
  %58 = load double, ptr %20, align 8, !tbaa !9
  %59 = load double, ptr %13, align 8, !tbaa !9
  %60 = fcmp ogt double %58, %59
  br i1 %60, label %61, label %71

61:                                               ; preds = %57
  %62 = load double, ptr %16, align 8, !tbaa !9
  %63 = fcmp une double %62, 0.000000e+00
  br i1 %63, label %64, label %71

64:                                               ; preds = %61
  %65 = load double, ptr %17, align 8, !tbaa !9
  %66 = fcmp une double %65, 0.000000e+00
  br i1 %66, label %67, label %71

67:                                               ; preds = %64
  %68 = load i32, ptr %19, align 4, !tbaa !11
  %69 = load i32, ptr %12, align 4, !tbaa !11
  %70 = icmp slt i32 %68, %69
  br label %71

71:                                               ; preds = %67, %64, %61, %57
  %72 = phi i1 [ false, %64 ], [ false, %61 ], [ false, %57 ], [ %70, %67 ]
  br i1 %72, label %73, label %141

73:                                               ; preds = %71
  %74 = load double, ptr %11, align 8, !tbaa !9
  %75 = load double, ptr %16, align 8, !tbaa !9
  %76 = load double, ptr %17, align 8, !tbaa !9
  %77 = fdiv double %75, %76
  %78 = fsub double %74, %77
  store double %78, ptr %18, align 8, !tbaa !9
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load double, ptr %18, align 8, !tbaa !9
  %81 = invoke noundef double %79(double noundef %80)
          to label %82 unwind label %128

82:                                               ; preds = %73
  store double %81, ptr %16, align 8, !tbaa !9
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load double, ptr %18, align 8, !tbaa !9
  %85 = invoke noundef double %83(double noundef %84)
          to label %86 unwind label %128

86:                                               ; preds = %82
  store double %85, ptr %17, align 8, !tbaa !9
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = call i32 @strcmp(ptr noundef %87, ptr noundef @.str) #9
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %95

90:                                               ; preds = %86
  %91 = load double, ptr %18, align 8, !tbaa !9
  %92 = load double, ptr %11, align 8, !tbaa !9
  %93 = fsub double %91, %92
  %94 = call double @llvm.fabs.f64(double %93)
  br label %102

95:                                               ; preds = %86
  %96 = load double, ptr %18, align 8, !tbaa !9
  %97 = load double, ptr %11, align 8, !tbaa !9
  %98 = fsub double %96, %97
  %99 = load double, ptr %18, align 8, !tbaa !9
  %100 = fdiv double %98, %99
  %101 = call double @llvm.fabs.f64(double %100)
  br label %102

102:                                              ; preds = %95, %90
  %103 = phi double [ %94, %90 ], [ %101, %95 ]
  store double %103, ptr %20, align 8, !tbaa !9
  %104 = load double, ptr %18, align 8, !tbaa !9
  store double %104, ptr %11, align 8, !tbaa !9
  %105 = load i32, ptr %19, align 4, !tbaa !11
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %27) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %29) #8
  %107 = load i32, ptr %19, align 4, !tbaa !11
  %108 = sitofp i32 %107 to double
  store double %108, ptr %29, align 8, !tbaa !9
  %109 = getelementptr inbounds double, ptr %29, i64 1
  %110 = load double, ptr %18, align 8, !tbaa !9
  store double %110, ptr %109, align 8, !tbaa !9
  %111 = getelementptr inbounds double, ptr %29, i64 2
  %112 = load double, ptr %16, align 8, !tbaa !9
  store double %112, ptr %111, align 8, !tbaa !9
  %113 = getelementptr inbounds double, ptr %29, i64 3
  %114 = load double, ptr %20, align 8, !tbaa !9
  store double %114, ptr %113, align 8, !tbaa !9
  %115 = getelementptr inbounds %"class.std::initializer_list", ptr %28, i32 0, i32 0
  store ptr %29, ptr %115, align 8, !tbaa !13
  %116 = getelementptr inbounds %"class.std::initializer_list", ptr %28, i32 0, i32 1
  store i64 4, ptr %116, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr %30) #8
  call void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %30) #8
  %117 = getelementptr inbounds { ptr, i64 }, ptr %28, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8
  %119 = getelementptr inbounds { ptr, i64 }, ptr %28, i32 0, i32 1
  %120 = load i64, ptr %119, align 8
  invoke void @_ZNSt6vectorIdSaIdEEC2ESt16initializer_listIdERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr %118, i64 %120, ptr noundef nonnull align 1 dereferenceable(1) %30)
          to label %121 unwind label %132

121:                                              ; preds = %102
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %30) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %29) #8
  %122 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIS_IdSaIdEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %122, ptr noundef nonnull align 8 dereferenceable(24) %27)
          to label %123 unwind label %136

123:                                              ; preds = %121
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %27) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %27) #8
  br label %57, !llvm.loop !17

124:                                              ; preds = %7
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %25, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %26, align 4
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #8
  br label %162

128:                                              ; preds = %157, %155, %82, %73, %54
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %25, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %26, align 4
  br label %161

132:                                              ; preds = %102
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %25, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %26, align 4
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %30) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %29) #8
  br label %140

136:                                              ; preds = %121
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %25, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %26, align 4
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %27) #8
  br label %140

140:                                              ; preds = %136, %132
  call void @llvm.lifetime.end.p0(i64 24, ptr %27) #8
  br label %161

141:                                              ; preds = %71
  %142 = load double, ptr %16, align 8, !tbaa !9
  %143 = fcmp oeq double %142, 0.000000e+00
  br i1 %143, label %144, label %146

144:                                              ; preds = %141
  %145 = load double, ptr %11, align 8, !tbaa !9
  store double %145, ptr %8, align 8
  store i32 1, ptr %31, align 4
  br label %159

146:                                              ; preds = %141
  %147 = load double, ptr %20, align 8, !tbaa !9
  %148 = load double, ptr %13, align 8, !tbaa !9
  %149 = fcmp olt double %147, %148
  br i1 %149, label %150, label %152

150:                                              ; preds = %146
  %151 = load double, ptr %18, align 8, !tbaa !9
  store double %151, ptr %8, align 8
  store i32 1, ptr %31, align 4
  br label %159

152:                                              ; preds = %146
  %153 = load double, ptr %17, align 8, !tbaa !9
  %154 = fcmp oeq double %153, 0.000000e+00
  br i1 %154, label %155, label %157

155:                                              ; preds = %152
  %156 = call ptr @__cxa_allocate_exception(i64 8) #8
  call void @llvm.memset.p0.i64(ptr align 16 %156, i8 0, i64 8, i1 false)
  call void @_ZN6numath19DerivativeExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %156) #8
  invoke void @__cxa_throw(ptr %156, ptr @_ZTIN6numath19DerivativeExceptionE, ptr @_ZNSt9exceptionD2Ev) #10
          to label %168 unwind label %128

157:                                              ; preds = %152
  %158 = call ptr @__cxa_allocate_exception(i64 8) #8
  call void @llvm.memset.p0.i64(ptr align 16 %158, i8 0, i64 8, i1 false)
  call void @_ZN6numath13IterExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %158) #8
  invoke void @__cxa_throw(ptr %158, ptr @_ZTIN6numath13IterExceptionE, ptr @_ZNSt9exceptionD2Ev) #10
          to label %168 unwind label %128

159:                                              ; preds = %150, %144
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  %160 = load double, ptr %8, align 8
  ret double %160

161:                                              ; preds = %140, %128
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #8
  br label %162

162:                                              ; preds = %161, %124
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %163

163:                                              ; preds = %162
  %164 = load ptr, ptr %25, align 8
  %165 = load i32, ptr %26, align 4
  %166 = insertvalue { ptr, i32 } poison, ptr %164, 0
  %167 = insertvalue { ptr, i32 } %166, i32 %165, 1
  resume { ptr, i32 } %167

168:                                              ; preds = %157, %155
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEEC2ESt16initializer_listIdERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

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

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

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #7

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

attributes #0 = { 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 #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 = { nounwind willreturn memory(read) "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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, !6, i64 0}
!14 = !{!"_ZTSSt16initializer_listIdE", !6, i64 0, !15, i64 8}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@_ZTIN6numath19DerivativeExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN6numath13IterExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN6numath23singleVariableEquations6newtonEPFddES2_didPKcRSt6vectorIS5_IdSaIdEESaIS7_EE(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, double noundef %2, i32 noundef %3, double noundef %4, ptr nocapture noundef readonly %5, ptr noundef nonnull align 8 dereferenceable(24) %6) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"class.std::vector", align 8
  %9 = alloca [4 x double], align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca %"class.std::vector", align 8
  %12 = alloca [4 x double], align 8
  %13 = alloca %"class.std::allocator", align 1
  %14 = tail call noundef double %0(double noundef %2)
  %15 = tail call noundef double %1(double noundef %2)
  %16 = fadd double %4, 1.000000e+00
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  store double 0.000000e+00, ptr %9, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  store double %2, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %9, i64 16
  store double %14, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %9, i64 24
  store double %16, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #7
  call void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  invoke void @_ZNSt6vectorIdSaIdEEC2ESt16initializer_listIdERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr nonnull %9, i64 4, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %20 unwind label %48

20:                                               ; preds = %7
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  invoke void @_ZNSt6vectorIS_IdSaIdEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %20
  %21 = fcmp ogt double %16, %4
  %22 = fcmp une double %14, 0.000000e+00
  %or.cond78 = and i1 %21, %22
  %23 = fcmp une double %15, 0.000000e+00
  %or.cond379 = and i1 %23, %or.cond78
  %24 = icmp sgt i32 %3, 0
  %or.cond6280 = and i1 %or.cond379, %24
  br i1 %or.cond6280, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader
  %25 = getelementptr inbounds i8, ptr %12, i64 8
  %26 = getelementptr inbounds i8, ptr %12, i64 16
  %27 = getelementptr inbounds i8, ptr %12, i64 24
  br label %28

28:                                               ; preds = %.lr.ph, %43
  %.04984 = phi double [ %2, %.lr.ph ], [ %30, %43 ]
  %.05483 = phi double [ %14, %.lr.ph ], [ %31, %43 ]
  %.05582 = phi double [ %15, %.lr.ph ], [ %33, %43 ]
  %.05781 = phi i32 [ 0, %.lr.ph ], [ %40, %43 ]
  %29 = fdiv double %.05483, %.05582
  %30 = fsub double %.04984, %29
  %31 = invoke noundef double %0(double noundef %30)
          to label %32 unwind label %.loopexit

32:                                               ; preds = %28
  %33 = invoke noundef double %1(double noundef %30)
          to label %34 unwind label %.loopexit

34:                                               ; preds = %32
  %35 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str) #8
  %36 = icmp eq i32 %35, 0
  %37 = fsub double %30, %.04984
  %38 = fdiv double %37, %30
  %.sink = select i1 %36, double %37, double %38
  %39 = call double @llvm.fabs.f64(double %.sink)
  %40 = add nuw nsw i32 %.05781, 1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #7
  %41 = uitofp nneg i32 %40 to double
  store double %41, ptr %12, align 8, !tbaa !5
  store double %30, ptr %25, align 8, !tbaa !5
  store double %31, ptr %26, align 8, !tbaa !5
  store double %39, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #7
  call void @_ZNSaIdEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  invoke void @_ZNSt6vectorIdSaIdEEC2ESt16initializer_listIdERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr nonnull %12, i64 4, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %42 unwind label %50

42:                                               ; preds = %34
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  invoke void @_ZNSt6vectorIS_IdSaIdEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %43 unwind label %52

43:                                               ; preds = %42
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #7
  %44 = fcmp ogt double %39, %4
  %45 = fcmp une double %31, 0.000000e+00
  %or.cond = and i1 %44, %45
  %46 = fcmp une double %33, 0.000000e+00
  %or.cond3 = and i1 %46, %or.cond
  %47 = icmp slt i32 %40, %3
  %or.cond62 = select i1 %or.cond3, i1 %47, i1 false
  br i1 %or.cond62, label %28, label %.critedge, !llvm.loop !9

48:                                               ; preds = %7
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  br label %66

.loopexit:                                        ; preds = %28, %32
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %65

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

50:                                               ; preds = %34
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIdED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  br label %54

52:                                               ; preds = %42
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  br label %54

54:                                               ; preds = %52, %50
  %.pn = phi { ptr, i32 } [ %53, %52 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #7
  br label %65

.critedge:                                        ; preds = %43, %.preheader
  %.058.lcssa = phi double [ undef, %.preheader ], [ %30, %43 ]
  %.056.lcssa = phi double [ %16, %.preheader ], [ %39, %43 ]
  %.055.lcssa = phi double [ %15, %.preheader ], [ %33, %43 ]
  %.054.lcssa = phi double [ %14, %.preheader ], [ %31, %43 ]
  %.049.lcssa = phi double [ %2, %.preheader ], [ %30, %43 ]
  %55 = fcmp oeq double %.054.lcssa, 0.000000e+00
  br i1 %55, label %64, label %56

56:                                               ; preds = %.critedge
  %57 = fcmp olt double %.056.lcssa, %4
  br i1 %57, label %64, label %58

58:                                               ; preds = %56
  %59 = fcmp oeq double %.055.lcssa, 0.000000e+00
  %60 = call ptr @__cxa_allocate_exception(i64 8) #7
  store i64 0, ptr %60, align 16
  br i1 %59, label %61, label %63

61:                                               ; preds = %58
  call void @_ZN6numath19DerivativeExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %60) #7
  br label %.invoke

.invoke:                                          ; preds = %63, %61
  %62 = phi ptr [ @_ZTIN6numath19DerivativeExceptionE, %61 ], [ @_ZTIN6numath13IterExceptionE, %63 ]
  invoke void @__cxa_throw(ptr nonnull %60, ptr nonnull %62, ptr nonnull @_ZNSt9exceptionD2Ev) #9
          to label %.cont unwind label %.loopexit.split-lp

.cont:                                            ; preds = %.invoke
  unreachable

63:                                               ; preds = %58
  call void @_ZN6numath13IterExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %60) #7
  br label %.invoke

64:                                               ; preds = %56, %.critedge
  %.0 = phi double [ %.049.lcssa, %.critedge ], [ %.058.lcssa, %56 ]
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  ret double %.0

65:                                               ; preds = %.loopexit, %.loopexit.split-lp, %54
  %.pn.pn = phi { ptr, i32 } [ %.pn, %54 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  br label %66

66:                                               ; preds = %65, %48
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %65 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  resume { ptr, i32 } %.pn.pn.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEEC2ESt16initializer_listIdERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) 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.end.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

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

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

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

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

attributes #0 = { 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 #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 nofree nounwind willreturn memory(argmem: read) "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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind "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 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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