; LLVM IR from HRI-EU/Rcs :: src/RcsCore/ViaPointSequence.ll (ZN3Rcs16ViaPointSequence11addViaPointEddddi)

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

%struct._MatNd = type { ptr, i32, i32, i32, i8 }
%"class.Rcs::ViaPointSequence" = type { ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, %"class.std::vector", %"class.std::vector.0" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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 }

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

declare double @MatNd_get(ptr noundef, i32 noundef, i32 noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Rcs16ViaPointSequence11addViaPointEddddi(ptr noundef nonnull align 8 dereferenceable(104) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, i32 noundef %5) unnamed_addr #2 align 2 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store double %1, ptr %9, align 8, !tbaa !9
  store double %2, ptr %10, align 8, !tbaa !9
  store double %3, ptr %11, align 8, !tbaa !9
  store double %4, ptr %12, align 8, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !11
  %20 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 5, ptr %15, align 4, !tbaa !11
  %21 = load i32, ptr %15, align 4, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = mul i64 %22, 8
  %24 = add i64 24, %23
  %25 = alloca i8, i64 %24, align 16
  store ptr %25, ptr %14, align 8, !tbaa !5
  %26 = load ptr, ptr %14, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._MatNd, ptr %26, i64 1
  %28 = load ptr, ptr %14, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._MatNd, ptr %28, i32 0, i32 0
  store ptr %27, ptr %29, align 8, !tbaa !13
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._MatNd, ptr %30, i32 0, i32 1
  store i32 1, ptr %31, align 8, !tbaa !16
  %32 = load ptr, ptr %14, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._MatNd, ptr %32, i32 0, i32 2
  store i32 5, ptr %33, align 4, !tbaa !17
  %34 = load i32, ptr %15, align 4, !tbaa !11
  %35 = load ptr, ptr %14, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._MatNd, ptr %35, i32 0, i32 3
  store i32 %34, ptr %36, align 8, !tbaa !18
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._MatNd, ptr %37, i32 0, i32 4
  store i8 1, ptr %38, align 4, !tbaa !19
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._MatNd, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  %42 = load i32, ptr %15, align 4, !tbaa !11
  %43 = zext i32 %42 to i64
  %44 = mul i64 %43, 8
  call void @llvm.memset.p0.i64(ptr align 8 %41, i8 0, i64 %44, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %45 = load double, ptr %9, align 8, !tbaa !9
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._MatNd, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = getelementptr inbounds double, ptr %48, i64 0
  store double %45, ptr %49, align 8, !tbaa !9
  %50 = load double, ptr %10, align 8, !tbaa !9
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._MatNd, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !13
  %54 = getelementptr inbounds double, ptr %53, i64 1
  store double %50, ptr %54, align 8, !tbaa !9
  %55 = load double, ptr %11, align 8, !tbaa !9
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._MatNd, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = getelementptr inbounds double, ptr %58, i64 2
  store double %55, ptr %59, align 8, !tbaa !9
  %60 = load double, ptr %12, align 8, !tbaa !9
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._MatNd, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !13
  %64 = getelementptr inbounds double, ptr %63, i64 3
  store double %60, ptr %64, align 8, !tbaa !9
  %65 = load i32, ptr %13, align 4, !tbaa !11
  %66 = sitofp i32 %65 to double
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._MatNd, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = getelementptr inbounds double, ptr %69, i64 4
  store double %66, ptr %70, align 8, !tbaa !9
  %71 = load double, ptr %9, align 8, !tbaa !9
  %72 = call noundef double @_ZNK3Rcs16ViaPointSequence2t0Ev(ptr noundef nonnull align 8 dereferenceable(104) %20)
  %73 = fcmp olt double %71, %72
  br i1 %73, label %74, label %82

74:                                               ; preds = %6
  %75 = load i32, ptr %13, align 4, !tbaa !11
  %76 = icmp ne i32 %75, 7
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  store i1 false, ptr %7, align 1
  store i32 1, ptr %16, align 4
  br label %194

78:                                               ; preds = %74
  %79 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !20
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  call void @MatNd_prependRows(ptr noundef %80, ptr noundef %81)
  br label %193

82:                                               ; preds = %6
  %83 = load double, ptr %9, align 8, !tbaa !9
  %84 = call noundef double @_ZNK3Rcs16ViaPointSequence2t0Ev(ptr noundef nonnull align 8 dereferenceable(104) %20)
  %85 = fcmp oeq double %83, %84
  br i1 %85, label %86, label %95

86:                                               ; preds = %82
  %87 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !20
  %89 = getelementptr inbounds %struct._MatNd, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !13
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._MatNd, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !13
  %94 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %90, ptr noundef %93)
  br label %192

95:                                               ; preds = %82
  %96 = load double, ptr %9, align 8, !tbaa !9
  %97 = call noundef double @_ZNK3Rcs16ViaPointSequence2t1Ev(ptr noundef nonnull align 8 dereferenceable(104) %20)
  %98 = fcmp oeq double %96, %97
  br i1 %98, label %99, label %112

99:                                               ; preds = %95
  %100 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %101 = load ptr, ptr %100, align 8, !tbaa !20
  %102 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !20
  %104 = getelementptr inbounds %struct._MatNd, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 8, !tbaa !16
  %106 = sub i32 %105, 1
  %107 = call ptr @MatNd_getRowPtr(ptr noundef %101, i32 noundef %106)
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._MatNd, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !13
  %111 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %107, ptr noundef %110)
  br label %191

112:                                              ; preds = %95
  %113 = load double, ptr %9, align 8, !tbaa !9
  %114 = call noundef double @_ZNK3Rcs16ViaPointSequence2t1Ev(ptr noundef nonnull align 8 dereferenceable(104) %20)
  %115 = fcmp ogt double %113, %114
  br i1 %115, label %116, label %124

116:                                              ; preds = %112
  %117 = load i32, ptr %13, align 4, !tbaa !11
  %118 = icmp ne i32 %117, 7
  br i1 %118, label %119, label %120

119:                                              ; preds = %116
  store i1 false, ptr %7, align 1
  store i32 1, ptr %16, align 4
  br label %194

120:                                              ; preds = %116
  %121 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !20
  %123 = load ptr, ptr %14, align 8, !tbaa !5
  call void @MatNd_appendRows(ptr noundef %122, ptr noundef %123)
  br label %190

124:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %125

125:                                              ; preds = %186, %124
  %126 = load i32, ptr %17, align 4, !tbaa !11
  %127 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %128 = load ptr, ptr %127, align 8, !tbaa !20
  %129 = getelementptr inbounds %struct._MatNd, ptr %128, i32 0, i32 1
  %130 = load i32, ptr %129, align 8, !tbaa !16
  %131 = sub i32 %130, 1
  %132 = icmp ult i32 %126, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %125
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %189

134:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %135 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !20
  %137 = load i32, ptr %17, align 4, !tbaa !11
  %138 = call double @MatNd_get(ptr noundef %136, i32 noundef %137, i32 noundef 0)
  store double %138, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %139 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %140 = load ptr, ptr %139, align 8, !tbaa !20
  %141 = load i32, ptr %17, align 4, !tbaa !11
  %142 = add i32 %141, 1
  %143 = call double @MatNd_get(ptr noundef %140, i32 noundef %142, i32 noundef 0)
  store double %143, ptr %19, align 8, !tbaa !9
  %144 = load double, ptr %9, align 8, !tbaa !9
  %145 = load double, ptr %18, align 8, !tbaa !9
  %146 = fcmp ogt double %144, %145
  br i1 %146, label %147, label %156

147:                                              ; preds = %134
  %148 = load double, ptr %9, align 8, !tbaa !9
  %149 = load double, ptr %19, align 8, !tbaa !9
  %150 = fcmp olt double %148, %149
  br i1 %150, label %151, label %156

151:                                              ; preds = %147
  %152 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !20
  %154 = load i32, ptr %17, align 4, !tbaa !11
  %155 = load ptr, ptr %14, align 8, !tbaa !5
  call void @MatNd_insertRows(ptr noundef %153, i32 noundef %154, ptr noundef %155, i32 noundef 0, i32 noundef 1)
  br label %185

156:                                              ; preds = %147, %134
  %157 = load double, ptr %9, align 8, !tbaa !9
  %158 = load double, ptr %18, align 8, !tbaa !9
  %159 = fcmp oeq double %157, %158
  br i1 %159, label %160, label %169

160:                                              ; preds = %156
  %161 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %162 = load ptr, ptr %161, align 8, !tbaa !20
  %163 = load i32, ptr %17, align 4, !tbaa !11
  %164 = call ptr @MatNd_getRowPtr(ptr noundef %162, i32 noundef %163)
  %165 = load ptr, ptr %14, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._MatNd, ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !13
  %168 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %164, ptr noundef %167)
  br label %184

169:                                              ; preds = %156
  %170 = load double, ptr %9, align 8, !tbaa !9
  %171 = load double, ptr %19, align 8, !tbaa !9
  %172 = fcmp oeq double %170, %171
  br i1 %172, label %173, label %183

173:                                              ; preds = %169
  %174 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %175 = load ptr, ptr %174, align 8, !tbaa !20
  %176 = load i32, ptr %17, align 4, !tbaa !11
  %177 = add i32 %176, 1
  %178 = call ptr @MatNd_getRowPtr(ptr noundef %175, i32 noundef %177)
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._MatNd, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !13
  %182 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %178, ptr noundef %181)
  br label %183

183:                                              ; preds = %173, %169
  br label %184

184:                                              ; preds = %183, %160
  br label %185

185:                                              ; preds = %184, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %186

186:                                              ; preds = %185
  %187 = load i32, ptr %17, align 4, !tbaa !11
  %188 = add i32 %187, 1
  store i32 %188, ptr %17, align 4, !tbaa !11
  br label %125, !llvm.loop !31

189:                                              ; preds = %133
  br label %190

190:                                              ; preds = %189, %120
  br label %191

191:                                              ; preds = %190, %99
  br label %192

192:                                              ; preds = %191, %86
  br label %193

193:                                              ; preds = %192, %78
  store i1 true, ptr %7, align 1
  store i32 1, ptr %16, align 4
  br label %194

194:                                              ; preds = %193, %119, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %195 = load i1, ptr %7, align 1
  ret i1 %195
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3Rcs16ViaPointSequence2t0Ev(ptr noundef nonnull align 8 dereferenceable(104)) #4 align 2

declare void @MatNd_prependRows(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3Rcs16ViaPointSequence2t1Ev(ptr noundef nonnull align 8 dereferenceable(104)) #4 align 2

declare ptr @MatNd_getRowPtr(ptr noundef, i32 noundef) #1

declare void @MatNd_appendRows(ptr noundef, ptr noundef) #1

declare void @MatNd_insertRows(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS6_MatNd", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !15, i64 20}
!15 = !{!"bool", !7, i64 0}
!16 = !{!14, !12, i64 8}
!17 = !{!14, !12, i64 12}
!18 = !{!14, !12, i64 16}
!19 = !{!14, !15, i64 20}
!20 = !{!21, !6, i64 8}
!21 = !{!"_ZTSN3Rcs16ViaPointSequenceE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !22, i64 52, !23, i64 56, !27, i64 80}
!22 = !{!"_ZTSN3Rcs16ViaPointSequence12ViaPointTypeE", !7, i64 0}
!23 = !{!"_ZTSSt6vectorIiSaIiEE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"_ZTSSt6vectorIdSaIdEE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!31 = distinct !{!31, !32}
!32 = !{!"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"

declare double @MatNd_get(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Rcs16ViaPointSequence11addViaPointEddddi(ptr noundef nonnull align 8 dereferenceable(104) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, i32 noundef %5) unnamed_addr #1 align 2 {
  %7 = alloca [64 x i8], align 16
  %8 = getelementptr inbounds i8, ptr %7, i64 24
  store ptr %8, ptr %7, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 1, ptr %9, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %7, i64 12
  store i32 5, ptr %10, align 4, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %7, i64 16
  store i32 5, ptr %11, align 16, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %7, i64 20
  store i8 1, ptr %12, align 4, !tbaa !15
  store double %1, ptr %8, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %7, i64 32
  store double %2, ptr %13, align 16, !tbaa !16
  %14 = getelementptr inbounds i8, ptr %7, i64 40
  store double %3, ptr %14, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %7, i64 48
  store double %4, ptr %15, align 16, !tbaa !16
  %16 = sitofp i32 %5 to double
  %17 = getelementptr inbounds i8, ptr %7, i64 56
  store double %16, ptr %17, align 8, !tbaa !16
  %18 = call noundef double @_ZNK3Rcs16ViaPointSequence2t0Ev(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %19 = fcmp ogt double %18, %1
  br i1 %19, label %20, label %24

20:                                               ; preds = %6
  %.not51 = icmp eq i32 %5, 7
  br i1 %.not51, label %21, label %.loopexit

21:                                               ; preds = %20
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  call void @MatNd_prependRows(ptr noundef %23, ptr noundef nonnull %7)
  br label %.loopexit

24:                                               ; preds = %6
  %25 = call noundef double @_ZNK3Rcs16ViaPointSequence2t0Ev(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %26 = fcmp oeq double %25, %1
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = load ptr, ptr %7, align 16, !tbaa !5
  %32 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %30, ptr noundef %31)
  br label %.loopexit

33:                                               ; preds = %24
  %34 = call noundef double @_ZNK3Rcs16ViaPointSequence2t1Ev(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %35 = fcmp oeq double %34, %1
  br i1 %35, label %36, label %45

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %0, i64 8
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds i8, ptr %38, i64 8
  %40 = load i32, ptr %39, align 8, !tbaa !12
  %41 = add i32 %40, -1
  %42 = call ptr @MatNd_getRowPtr(ptr noundef %38, i32 noundef %41)
  %43 = load ptr, ptr %7, align 16, !tbaa !5
  %44 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %42, ptr noundef %43)
  br label %.loopexit

45:                                               ; preds = %33
  %46 = call noundef double @_ZNK3Rcs16ViaPointSequence2t1Ev(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %47 = fcmp olt double %46, %1
  br i1 %47, label %52, label %.preheader

.preheader:                                       ; preds = %45
  %48 = getelementptr inbounds i8, ptr %0, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = load i32, ptr %50, align 8, !tbaa !12
  %.not53 = icmp eq i32 %51, 1
  br i1 %.not53, label %.loopexit, label %.lr.ph

52:                                               ; preds = %45
  %.not = icmp eq i32 %5, 7
  br i1 %.not, label %53, label %.loopexit

53:                                               ; preds = %52
  %54 = getelementptr inbounds i8, ptr %0, i64 8
  %55 = load ptr, ptr %54, align 8, !tbaa !18
  call void @MatNd_appendRows(ptr noundef %55, ptr noundef nonnull %7)
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %79
  %56 = phi ptr [ %80, %79 ], [ %49, %.preheader ]
  %.04952 = phi i32 [ %59, %79 ], [ 0, %.preheader ]
  %57 = call double @MatNd_get(ptr noundef nonnull %56, i32 noundef %.04952, i32 noundef 0)
  %58 = load ptr, ptr %48, align 8, !tbaa !18
  %59 = add nuw i32 %.04952, 1
  %60 = call double @MatNd_get(ptr noundef %58, i32 noundef %59, i32 noundef 0)
  %61 = fcmp olt double %57, %1
  %62 = fcmp ogt double %60, %1
  %or.cond = select i1 %61, i1 %62, i1 false
  br i1 %or.cond, label %63, label %65

63:                                               ; preds = %.lr.ph
  %64 = load ptr, ptr %48, align 8, !tbaa !18
  call void @MatNd_insertRows(ptr noundef %64, i32 noundef %.04952, ptr noundef nonnull %7, i32 noundef 0, i32 noundef 1)
  br label %79

65:                                               ; preds = %.lr.ph
  %66 = fcmp oeq double %57, %1
  br i1 %66, label %67, label %72

67:                                               ; preds = %65
  %68 = load ptr, ptr %48, align 8, !tbaa !18
  %69 = call ptr @MatNd_getRowPtr(ptr noundef %68, i32 noundef %.04952)
  %70 = load ptr, ptr %7, align 16, !tbaa !5
  %71 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %69, ptr noundef %70)
  br label %79

72:                                               ; preds = %65
  %73 = fcmp oeq double %60, %1
  br i1 %73, label %74, label %79

74:                                               ; preds = %72
  %75 = load ptr, ptr %48, align 8, !tbaa !18
  %76 = call ptr @MatNd_getRowPtr(ptr noundef %75, i32 noundef %59)
  %77 = load ptr, ptr %7, align 16, !tbaa !5
  %78 = call noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef %76, ptr noundef %77)
  br label %79

79:                                               ; preds = %67, %74, %72, %63
  %80 = load ptr, ptr %48, align 8, !tbaa !18
  %81 = getelementptr inbounds i8, ptr %80, i64 8
  %82 = load i32, ptr %81, align 8, !tbaa !12
  %83 = add i32 %82, -1
  %84 = icmp ult i32 %59, %83
  br i1 %84, label %.lr.ph, label %.loopexit, !llvm.loop !29

.loopexit:                                        ; preds = %79, %.preheader, %21, %36, %53, %27, %52, %20
  %.0 = phi i1 [ false, %20 ], [ false, %52 ], [ true, %27 ], [ true, %53 ], [ true, %36 ], [ true, %21 ], [ true, %.preheader ], [ true, %79 ]
  ret i1 %.0
}

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

declare void @MatNd_prependRows(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL14mergeViaPointsPdPKd(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare ptr @MatNd_getRowPtr(ptr noundef, i32 noundef) local_unnamed_addr #0

declare void @MatNd_appendRows(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @MatNd_insertRows(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

attributes #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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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" }

!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 0}
!6 = !{!"_ZTS6_MatNd", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !10, i64 12}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !11, i64 20}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = !{!19, !7, i64 8}
!19 = !{!"_ZTSN3Rcs16ViaPointSequenceE", !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !11, i64 48, !20, i64 52, !21, i64 56, !25, i64 80}
!20 = !{!"_ZTSN3Rcs16ViaPointSequence12ViaPointTypeE", !8, i64 0}
!21 = !{!"_ZTSSt6vectorIiSaIiEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!25 = !{!"_ZTSSt6vectorIdSaIdEE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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