; LLVM IR from LiJiangnanBit/path_optimizer :: src/tools/spline.ll (ZNK18PathOptimizationNS2tk6spline5derivEid)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.PathOptimizationNS::tk::spline" = type <{ %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", double, double, i32, i32, double, double, i8, [7 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__._ZNK18PathOptimizationNS2tk6spline5derivEid = external hidden unnamed_addr constant [64 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPKdSt6vectorIdSaIdEEEEdET_S8_S8_RKT0_(ptr, ptr, ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN9__gnu_cxxmiIPKdSt6vectorIdSaIdEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS9_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK18PathOptimizationNS2tk6spline5derivEid(ptr noundef nonnull align 8 dereferenceable(161) %0, i32 noundef %1, double noundef %2) #7 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !11
  %18 = load ptr, ptr %4, align 8
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %3
  br label %24

22:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.1, i32 noundef 274, ptr noundef @__PRETTY_FUNCTION__._ZNK18PathOptimizationNS2tk6spline5derivEid) #8
  unreachable

23:                                               ; No predecessors!
  br label %24

24:                                               ; preds = %23, %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %25 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %26 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #9
  store i64 %26, ptr %7, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKdSt6vectorIdSaIdEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %27 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %28 = call ptr @_ZNKSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #9
  %29 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %28, ptr %29, align 8
  %30 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %31 = call ptr @_ZNKSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %30) #9
  %32 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %31, ptr %32, align 8
  %33 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8
  %35 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8
  %37 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPKdSt6vectorIdSaIdEEEEdET_S8_S8_RKT0_(ptr %34, ptr %36, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %38 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %37, ptr %38, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %39 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %40 = call ptr @_ZNKSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %39) #9
  %41 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %40, ptr %41, align 8
  %42 = call noundef i64 @_ZN9__gnu_cxxmiIPKdSt6vectorIdSaIdEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS9_SC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %14) #9
  %43 = trunc i64 %42 to i32
  %44 = sub nsw i32 %43, 1
  store i32 %44, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 0, ptr %15, align 4, !tbaa !9
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %46 = load i32, ptr %45, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  store i32 %46, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %47 = load double, ptr %6, align 8, !tbaa !11
  %48 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %50) #9
  %52 = load double, ptr %51, align 8, !tbaa !11
  %53 = fsub double %47, %52
  store double %53, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %54 = load double, ptr %6, align 8, !tbaa !11
  %55 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %55, i64 noundef 0) #9
  %57 = load double, ptr %56, align 8, !tbaa !11
  %58 = fcmp olt double %54, %57
  br i1 %58, label %59, label %77

59:                                               ; preds = %24
  %60 = load i32, ptr %5, align 4, !tbaa !9
  switch i32 %60, label %75 [
    i32 1, label %61
    i32 2, label %69
  ]

61:                                               ; preds = %59
  %62 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 5
  %63 = load double, ptr %62, align 8, !tbaa !16
  %64 = fmul double 2.000000e+00, %63
  %65 = load double, ptr %16, align 8, !tbaa !11
  %66 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 6
  %67 = load double, ptr %66, align 8, !tbaa !24
  %68 = call double @llvm.fmuladd.f64(double %64, double %65, double %67)
  store double %68, ptr %17, align 8, !tbaa !11
  br label %76

69:                                               ; preds = %59
  %70 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 5
  %71 = load double, ptr %70, align 8, !tbaa !16
  %72 = fmul double 2.000000e+00, %71
  %73 = load double, ptr %16, align 8, !tbaa !11
  %74 = fmul double %72, %73
  store double %74, ptr %17, align 8, !tbaa !11
  br label %76

75:                                               ; preds = %59
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  br label %76

76:                                               ; preds = %75, %69, %61
  br label %159

77:                                               ; preds = %24
  %78 = load double, ptr %6, align 8, !tbaa !11
  %79 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 0
  %80 = load i64, ptr %7, align 8, !tbaa !13
  %81 = sub i64 %80, 1
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %79, i64 noundef %81) #9
  %83 = load double, ptr %82, align 8, !tbaa !11
  %84 = fcmp ogt double %78, %83
  br i1 %84, label %85, label %110

85:                                               ; preds = %77
  %86 = load i32, ptr %5, align 4, !tbaa !9
  switch i32 %86, label %108 [
    i32 1, label %87
    i32 2, label %101
  ]

87:                                               ; preds = %85
  %88 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 3
  %89 = load i64, ptr %7, align 8, !tbaa !13
  %90 = sub i64 %89, 1
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %88, i64 noundef %90) #9
  %92 = load double, ptr %91, align 8, !tbaa !11
  %93 = fmul double 2.000000e+00, %92
  %94 = load double, ptr %16, align 8, !tbaa !11
  %95 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 4
  %96 = load i64, ptr %7, align 8, !tbaa !13
  %97 = sub i64 %96, 1
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %95, i64 noundef %97) #9
  %99 = load double, ptr %98, align 8, !tbaa !11
  %100 = call double @llvm.fmuladd.f64(double %93, double %94, double %99)
  store double %100, ptr %17, align 8, !tbaa !11
  br label %109

101:                                              ; preds = %85
  %102 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 3
  %103 = load i64, ptr %7, align 8, !tbaa !13
  %104 = sub i64 %103, 1
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %102, i64 noundef %104) #9
  %106 = load double, ptr %105, align 8, !tbaa !11
  %107 = fmul double 2.000000e+00, %106
  store double %107, ptr %17, align 8, !tbaa !11
  br label %109

108:                                              ; preds = %85
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  br label %109

109:                                              ; preds = %108, %101, %87
  br label %158

110:                                              ; preds = %77
  %111 = load i32, ptr %5, align 4, !tbaa !9
  switch i32 %111, label %156 [
    i32 1, label %112
    i32 2, label %134
    i32 3, label %149
  ]

112:                                              ; preds = %110
  %113 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 2
  %114 = load i32, ptr %12, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %113, i64 noundef %115) #9
  %117 = load double, ptr %116, align 8, !tbaa !11
  %118 = fmul double 3.000000e+00, %117
  %119 = load double, ptr %16, align 8, !tbaa !11
  %120 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 3
  %121 = load i32, ptr %12, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef %122) #9
  %124 = load double, ptr %123, align 8, !tbaa !11
  %125 = fmul double 2.000000e+00, %124
  %126 = call double @llvm.fmuladd.f64(double %118, double %119, double %125)
  %127 = load double, ptr %16, align 8, !tbaa !11
  %128 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 4
  %129 = load i32, ptr %12, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %128, i64 noundef %130) #9
  %132 = load double, ptr %131, align 8, !tbaa !11
  %133 = call double @llvm.fmuladd.f64(double %126, double %127, double %132)
  store double %133, ptr %17, align 8, !tbaa !11
  br label %157

134:                                              ; preds = %110
  %135 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 2
  %136 = load i32, ptr %12, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %135, i64 noundef %137) #9
  %139 = load double, ptr %138, align 8, !tbaa !11
  %140 = fmul double 6.000000e+00, %139
  %141 = load double, ptr %16, align 8, !tbaa !11
  %142 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 3
  %143 = load i32, ptr %12, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %142, i64 noundef %144) #9
  %146 = load double, ptr %145, align 8, !tbaa !11
  %147 = fmul double 2.000000e+00, %146
  %148 = call double @llvm.fmuladd.f64(double %140, double %141, double %147)
  store double %148, ptr %17, align 8, !tbaa !11
  br label %157

149:                                              ; preds = %110
  %150 = getelementptr inbounds %"class.PathOptimizationNS::tk::spline", ptr %18, i32 0, i32 2
  %151 = load i32, ptr %12, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %150, i64 noundef %152) #9
  %154 = load double, ptr %153, align 8, !tbaa !11
  %155 = fmul double 6.000000e+00, %154
  store double %155, ptr %17, align 8, !tbaa !11
  br label %157

156:                                              ; preds = %110
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  br label %157

157:                                              ; preds = %156, %149, %134, %112
  br label %158

158:                                              ; preds = %157, %109
  br label %159

159:                                              ; preds = %158, %76
  %160 = load double, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  ret double %160
}

attributes #0 = { noreturn 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 = { 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { inlinehint 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{i64 0, i64 8, !5}
!16 = !{!17, !12, i64 120}
!17 = !{!"_ZTSN18PathOptimizationNS2tk6splineE", !18, i64 0, !18, i64 24, !18, i64 48, !18, i64 72, !18, i64 96, !12, i64 120, !12, i64 128, !22, i64 136, !22, i64 140, !12, i64 144, !12, i64 152, !23, i64 160}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSN18PathOptimizationNS2tk6spline7bd_typeE", !7, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{!17, !12, i64 128}


; 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.__gnu_cxx::__normal_iterator" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__._ZNK18PathOptimizationNS2tk6spline5derivEid = external hidden unnamed_addr constant [64 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPKdSt6vectorIdSaIdEEEEdET_S8_S8_RKT0_(ptr, ptr, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN9__gnu_cxxmiIPKdSt6vectorIdSaIdEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS9_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK18PathOptimizationNS2tk6spline5derivEid(ptr noundef nonnull align 8 dereferenceable(161) %0, i32 noundef %1, double noundef %2) local_unnamed_addr #6 align 2 {
  %4 = alloca double, align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca i32, align 4
  store double %2, ptr %4, align 8, !tbaa !5
  %9 = icmp sgt i32 %1, 0
  br i1 %9, label %11, label %10

10:                                               ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.1, i32 noundef 274, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK18PathOptimizationNS2tk6spline5derivEid) #7
  unreachable

11:                                               ; preds = %3
  %12 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKdSt6vectorIdSaIdEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %13 = call ptr @_ZNKSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #8
  %14 = call ptr @_ZNKSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #8
  %15 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPKdSt6vectorIdSaIdEEEEdET_S8_S8_RKT0_(ptr %13, ptr %14, ptr noundef nonnull align 8 dereferenceable(8) %4)
  store ptr %15, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %16 = call ptr @_ZNKSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #8
  store ptr %16, ptr %7, align 8
  %17 = call noundef i64 @_ZN9__gnu_cxxmiIPKdSt6vectorIdSaIdEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS9_SC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %18 = trunc i64 %17 to i32
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  store i32 0, ptr %8, align 4, !tbaa !11
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %21 = load i32, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  %22 = load double, ptr %4, align 8, !tbaa !5
  %23 = sext i32 %21 to i64
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %23) #8
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = fsub double %22, %25
  %27 = load double, ptr %4, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #8
  %29 = load double, ptr %28, align 8, !tbaa !5
  %30 = fcmp olt double %27, %29
  br i1 %30, label %31, label %44

31:                                               ; preds = %11
  switch i32 %1, label %95 [
    i32 1, label %32
    i32 2, label %39
  ]

32:                                               ; preds = %31
  %33 = getelementptr inbounds i8, ptr %0, i64 120
  %34 = load double, ptr %33, align 8, !tbaa !13
  %35 = fmul double %34, 2.000000e+00
  %36 = getelementptr inbounds i8, ptr %0, i64 128
  %37 = load double, ptr %36, align 8, !tbaa !21
  %38 = call double @llvm.fmuladd.f64(double %35, double %26, double %37)
  br label %95

39:                                               ; preds = %31
  %40 = getelementptr inbounds i8, ptr %0, i64 120
  %41 = load double, ptr %40, align 8, !tbaa !13
  %42 = fmul double %41, 2.000000e+00
  %43 = fmul double %26, %42
  br label %95

44:                                               ; preds = %11
  %45 = load double, ptr %4, align 8, !tbaa !5
  %46 = add i64 %12, -1
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %46) #8
  %48 = load double, ptr %47, align 8, !tbaa !5
  %49 = fcmp ogt double %45, %48
  br i1 %49, label %50, label %65

50:                                               ; preds = %44
  switch i32 %1, label %95 [
    i32 1, label %51
    i32 2, label %60
  ]

51:                                               ; preds = %50
  %52 = getelementptr inbounds i8, ptr %0, i64 72
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %46) #8
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = fmul double %54, 2.000000e+00
  %56 = getelementptr inbounds i8, ptr %0, i64 96
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %56, i64 noundef %46) #8
  %58 = load double, ptr %57, align 8, !tbaa !5
  %59 = call double @llvm.fmuladd.f64(double %55, double %26, double %58)
  br label %95

60:                                               ; preds = %50
  %61 = getelementptr inbounds i8, ptr %0, i64 72
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %46) #8
  %63 = load double, ptr %62, align 8, !tbaa !5
  %64 = fmul double %63, 2.000000e+00
  br label %95

65:                                               ; preds = %44
  switch i32 %1, label %95 [
    i32 1, label %66
    i32 2, label %80
    i32 3, label %90
  ]

66:                                               ; preds = %65
  %67 = getelementptr inbounds i8, ptr %0, i64 48
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %67, i64 noundef %23) #8
  %69 = load double, ptr %68, align 8, !tbaa !5
  %70 = fmul double %69, 3.000000e+00
  %71 = getelementptr inbounds i8, ptr %0, i64 72
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %71, i64 noundef %23) #8
  %73 = load double, ptr %72, align 8, !tbaa !5
  %74 = fmul double %73, 2.000000e+00
  %75 = call double @llvm.fmuladd.f64(double %70, double %26, double %74)
  %76 = getelementptr inbounds i8, ptr %0, i64 96
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %23) #8
  %78 = load double, ptr %77, align 8, !tbaa !5
  %79 = call double @llvm.fmuladd.f64(double %75, double %26, double %78)
  br label %95

80:                                               ; preds = %65
  %81 = getelementptr inbounds i8, ptr %0, i64 48
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %81, i64 noundef %23) #8
  %83 = load double, ptr %82, align 8, !tbaa !5
  %84 = fmul double %83, 6.000000e+00
  %85 = getelementptr inbounds i8, ptr %0, i64 72
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %85, i64 noundef %23) #8
  %87 = load double, ptr %86, align 8, !tbaa !5
  %88 = fmul double %87, 2.000000e+00
  %89 = call double @llvm.fmuladd.f64(double %84, double %26, double %88)
  br label %95

90:                                               ; preds = %65
  %91 = getelementptr inbounds i8, ptr %0, i64 48
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %91, i64 noundef %23) #8
  %93 = load double, ptr %92, align 8, !tbaa !5
  %94 = fmul double %93, 6.000000e+00
  br label %95

95:                                               ; preds = %65, %50, %31, %60, %51, %90, %80, %66, %32, %39
  %.0 = phi double [ %43, %39 ], [ %38, %32 ], [ %64, %60 ], [ %59, %51 ], [ %94, %90 ], [ %89, %80 ], [ %79, %66 ], [ 0.000000e+00, %31 ], [ 0.000000e+00, %50 ], [ 0.000000e+00, %65 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  ret double %.0
}

attributes #0 = { noreturn 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 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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { inlinehint 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 #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 120}
!14 = !{!"_ZTSN18PathOptimizationNS2tk6splineE", !15, i64 0, !15, i64 24, !15, i64 48, !15, i64 72, !15, i64 96, !6, i64 120, !6, i64 128, !19, i64 136, !19, i64 140, !6, i64 144, !6, i64 152, !20, i64 160}
!15 = !{!"_ZTSSt6vectorIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!"_ZTSN18PathOptimizationNS2tk6spline7bd_typeE", !7, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{!14, !6, i64 128}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass