; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_MatNd)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@Rcs_calloc = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [43 x i8], align 1
@__func__.MatNd_interpolateArcLength = external hidden unnamed_addr constant [27 x i8], align 1
@.str.259 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.260 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.261 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.262 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.263 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.264 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.265 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.266 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.267 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

declare void @print_trace() #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @MatNd_create(i32 noundef, i32 noundef) #5

; Function Attrs: noreturn nounwind
declare void @abort() #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @MatNd_destroy(ptr noundef) #5

; Function Attrs: nounwind
declare void @free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @MatNd_getRowPtr(ptr noundef, i32 noundef) #5

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

; Function Attrs: nounwind uwtable
declare dso_local void @MatNd_constMulSelf(ptr noundef, double noundef) #5

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

declare void @VecNd_constMulAndAddSelf(ptr noundef, ptr noundef, double noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local double @MatNd_interpolateArcLength(ptr noundef %0, ptr noundef %1, ptr noundef %2, double noundef %3) #5 {
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca double, align 8
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca ptr, align 8
  %28 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %4
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._MatNd, ptr %30, i32 0, i32 2
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = icmp ugt i32 %32, 0
  br i1 %33, label %37, label %34

34:                                               ; preds = %29
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.5, ptr noundef @.str.1, ptr noundef @__func__.MatNd_interpolateArcLength, i32 noundef 4959, ptr noundef @.str.259) #7
  call void @print_trace()
  call void @abort() #8
  unreachable

37:                                               ; preds = %29
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._MatNd, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !15
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %47, label %44

44:                                               ; preds = %39
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.5, ptr noundef @.str.1, ptr noundef @__func__.MatNd_interpolateArcLength, i32 noundef 4960, ptr noundef @.str.260) #7
  call void @print_trace()
  call void @abort() #8
  unreachable

47:                                               ; preds = %39
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._MatNd, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._MatNd, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 4, !tbaa !11
  %56 = icmp eq i32 %52, %55
  br i1 %56, label %60, label %57

57:                                               ; preds = %49
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.5, ptr noundef @.str.1, ptr noundef @__func__.MatNd_interpolateArcLength, i32 noundef 4961, ptr noundef @.str.261) #7
  call void @print_trace()
  call void @abort() #8
  unreachable

60:                                               ; preds = %49
  br label %61

61:                                               ; preds = %60
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %105

64:                                               ; preds = %61
  br label %65

65:                                               ; preds = %64
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._MatNd, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 8, !tbaa !15
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._MatNd, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 8, !tbaa !15
  %72 = icmp eq i32 %68, %71
  br i1 %72, label %86, label %73

73:                                               ; preds = %65
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_interpolateArcLength, i32 noundef 4965, ptr noundef @.str.262) #7
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._MatNd, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 8, !tbaa !15
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._MatNd, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 8, !tbaa !15
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.263, i32 noundef %79, i32 noundef %82) #7
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.4) #7
  call void @print_trace()
  call void @exit(i32 noundef 1) #8
  unreachable

86:                                               ; preds = %65
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._MatNd, ptr %89, i32 0, i32 2
  %91 = load i32, ptr %90, align 4, !tbaa !11
  %92 = icmp eq i32 %91, 1
  br i1 %92, label %103, label %93

93:                                               ; preds = %88
  %94 = load ptr, ptr @stderr, align 8, !tbaa !5
  %95 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %94, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_interpolateArcLength, i32 noundef 4966, ptr noundef @.str.264) #7
  %96 = load ptr, ptr @stderr, align 8, !tbaa !5
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._MatNd, ptr %97, i32 0, i32 2
  %99 = load i32, ptr %98, align 4, !tbaa !11
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.265, i32 noundef %99) #7
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef @.str.4) #7
  call void @print_trace()
  call void @exit(i32 noundef 1) #8
  unreachable

103:                                              ; preds = %88
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104, %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._MatNd, ptr %106, i32 0, i32 2
  %108 = load i32, ptr %107, align 4, !tbaa !11
  store i32 %108, ptr %10, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._MatNd, ptr %109, i32 0, i32 1
  %111 = load i32, ptr %110, align 8, !tbaa !15
  store i32 %111, ptr %11, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %112 = load i32, ptr %11, align 4, !tbaa !16
  %113 = sub i32 %112, 1
  store i32 %113, ptr %12, align 4, !tbaa !16
  %114 = load double, ptr %9, align 8, !tbaa !9
  %115 = fcmp ole double %114, 0.000000e+00
  br i1 %115, label %116, label %123

116:                                              ; preds = %105
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._MatNd, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !17
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = call ptr @MatNd_getRowPtr(ptr noundef %120, i32 noundef 0)
  %122 = load i32, ptr %10, align 4, !tbaa !16
  call void @VecNd_copy(ptr noundef %119, ptr noundef %121, i32 noundef %122)
  store double 0.000000e+00, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %442

123:                                              ; preds = %105
  %124 = load double, ptr %9, align 8, !tbaa !9
  %125 = fcmp oge double %124, 1.000000e+00
  br i1 %125, label %126, label %135

126:                                              ; preds = %123
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct._MatNd, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !17
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = load i32, ptr %11, align 4, !tbaa !16
  %132 = sub i32 %131, 1
  %133 = call ptr @MatNd_getRowPtr(ptr noundef %130, i32 noundef %132)
  %134 = load i32, ptr %10, align 4, !tbaa !16
  call void @VecNd_copy(ptr noundef %129, ptr noundef %133, i32 noundef %134)
  store double 1.000000e+00, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %442

135:                                              ; preds = %123
  br label %136

136:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %137, ptr %14, align 8, !tbaa !5
  %138 = load ptr, ptr %14, align 8, !tbaa !5
  %139 = icmp eq ptr %138, null
  br i1 %139, label %140, label %272

140:                                              ; preds = %136
  %141 = load i32, ptr %11, align 4, !tbaa !16
  %142 = mul i32 %141, 1
  %143 = icmp ugt i32 %142, 1296
  br i1 %143, label %144, label %147

144:                                              ; preds = %140
  %145 = load i32, ptr %11, align 4, !tbaa !16
  %146 = call ptr @MatNd_create(i32 noundef %145, i32 noundef 1)
  store ptr %146, ptr %14, align 8, !tbaa !5
  br label %182

147:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %148 = load i32, ptr %11, align 4, !tbaa !16
  %149 = mul i32 %148, 1
  %150 = icmp eq i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %147
  br label %155

152:                                              ; preds = %147
  %153 = load i32, ptr %11, align 4, !tbaa !16
  %154 = mul i32 %153, 1
  br label %155

155:                                              ; preds = %152, %151
  %156 = phi i32 [ 1, %151 ], [ %154, %152 ]
  store i32 %156, ptr %15, align 4, !tbaa !16
  %157 = load i32, ptr %15, align 4, !tbaa !16
  %158 = zext i32 %157 to i64
  %159 = mul i64 %158, 8
  %160 = add i64 24, %159
  %161 = alloca i8, i64 %160, align 16
  store ptr %161, ptr %14, align 8, !tbaa !5
  %162 = load ptr, ptr %14, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct._MatNd, ptr %162, i64 1
  %164 = load ptr, ptr %14, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._MatNd, ptr %164, i32 0, i32 0
  store ptr %163, ptr %165, align 8, !tbaa !17
  %166 = load i32, ptr %11, align 4, !tbaa !16
  %167 = load ptr, ptr %14, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct._MatNd, ptr %167, i32 0, i32 1
  store i32 %166, ptr %168, align 8, !tbaa !15
  %169 = load ptr, ptr %14, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._MatNd, ptr %169, i32 0, i32 2
  store i32 1, ptr %170, align 4, !tbaa !11
  %171 = load i32, ptr %15, align 4, !tbaa !16
  %172 = load ptr, ptr %14, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._MatNd, ptr %172, i32 0, i32 3
  store i32 %171, ptr %173, align 8, !tbaa !18
  %174 = load ptr, ptr %14, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct._MatNd, ptr %174, i32 0, i32 4
  store i8 1, ptr %175, align 4, !tbaa !19
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct._MatNd, ptr %176, i32 0, i32 0
  %178 = load ptr, ptr %177, align 8, !tbaa !17
  %179 = load i32, ptr %15, align 4, !tbaa !16
  %180 = zext i32 %179 to i64
  %181 = mul i64 %180, 8
  call void @llvm.memset.p0.i64(ptr align 8 %178, i8 0, i64 %181, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %182

182:                                              ; preds = %155, %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 1, ptr %16, align 4, !tbaa !16
  br label %183

183:                                              ; preds = %247, %182
  %184 = load i32, ptr %16, align 4, !tbaa !16
  %185 = load i32, ptr %11, align 4, !tbaa !16
  %186 = icmp ult i32 %184, %185
  br i1 %186, label %188, label %187

187:                                              ; preds = %183
  store i32 12, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %250

188:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = load i32, ptr %16, align 4, !tbaa !16
  %191 = sub i32 %190, 1
  %192 = call ptr @MatNd_getRowPtr(ptr noundef %189, i32 noundef %191)
  store ptr %192, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %193 = load ptr, ptr %8, align 8, !tbaa !5
  %194 = load i32, ptr %16, align 4, !tbaa !16
  %195 = call ptr @MatNd_getRowPtr(ptr noundef %193, i32 noundef %194)
  store ptr %195, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store double 0.000000e+00, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !16
  br label %196

196:                                              ; preds = %226, %188
  %197 = load i32, ptr %20, align 4, !tbaa !16
  %198 = load i32, ptr %10, align 4, !tbaa !16
  %199 = icmp ult i32 %197, %198
  br i1 %199, label %201, label %200

200:                                              ; preds = %196
  store i32 15, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %229

201:                                              ; preds = %196
  %202 = load ptr, ptr %18, align 8, !tbaa !5
  %203 = load i32, ptr %20, align 4, !tbaa !16
  %204 = zext i32 %203 to i64
  %205 = getelementptr inbounds double, ptr %202, i64 %204
  %206 = load double, ptr %205, align 8, !tbaa !9
  %207 = load ptr, ptr %17, align 8, !tbaa !5
  %208 = load i32, ptr %20, align 4, !tbaa !16
  %209 = zext i32 %208 to i64
  %210 = getelementptr inbounds double, ptr %207, i64 %209
  %211 = load double, ptr %210, align 8, !tbaa !9
  %212 = fsub double %206, %211
  %213 = load ptr, ptr %18, align 8, !tbaa !5
  %214 = load i32, ptr %20, align 4, !tbaa !16
  %215 = zext i32 %214 to i64
  %216 = getelementptr inbounds double, ptr %213, i64 %215
  %217 = load double, ptr %216, align 8, !tbaa !9
  %218 = load ptr, ptr %17, align 8, !tbaa !5
  %219 = load i32, ptr %20, align 4, !tbaa !16
  %220 = zext i32 %219 to i64
  %221 = getelementptr inbounds double, ptr %218, i64 %220
  %222 = load double, ptr %221, align 8, !tbaa !9
  %223 = fsub double %217, %222
  %224 = load double, ptr %19, align 8, !tbaa !9
  %225 = call double @llvm.fmuladd.f64(double %212, double %223, double %224)
  store double %225, ptr %19, align 8, !tbaa !9
  br label %226

226:                                              ; preds = %201
  %227 = load i32, ptr %20, align 4, !tbaa !16
  %228 = add i32 %227, 1
  store i32 %228, ptr %20, align 4, !tbaa !16
  br label %196, !llvm.loop !20

229:                                              ; preds = %200
  %230 = load ptr, ptr %14, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct._MatNd, ptr %230, i32 0, i32 0
  %232 = load ptr, ptr %231, align 8, !tbaa !17
  %233 = load i32, ptr %16, align 4, !tbaa !16
  %234 = sub i32 %233, 1
  %235 = zext i32 %234 to i64
  %236 = getelementptr inbounds double, ptr %232, i64 %235
  %237 = load double, ptr %236, align 8, !tbaa !9
  %238 = load double, ptr %19, align 8, !tbaa !9
  %239 = call double @sqrt(double noundef %238) #7
  %240 = fadd double %237, %239
  %241 = load ptr, ptr %14, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct._MatNd, ptr %241, i32 0, i32 0
  %243 = load ptr, ptr %242, align 8, !tbaa !17
  %244 = load i32, ptr %16, align 4, !tbaa !16
  %245 = zext i32 %244 to i64
  %246 = getelementptr inbounds double, ptr %243, i64 %245
  store double %240, ptr %246, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %247

247:                                              ; preds = %229
  %248 = load i32, ptr %16, align 4, !tbaa !16
  %249 = add i32 %248, 1
  store i32 %249, ptr %16, align 4, !tbaa !16
  br label %183, !llvm.loop !22

250:                                              ; preds = %187
  %251 = load ptr, ptr %14, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct._MatNd, ptr %251, i32 0, i32 0
  %253 = load ptr, ptr %252, align 8, !tbaa !17
  %254 = load i32, ptr %11, align 4, !tbaa !16
  %255 = sub i32 %254, 1
  %256 = zext i32 %255 to i64
  %257 = getelementptr inbounds double, ptr %253, i64 %256
  %258 = load double, ptr %257, align 8, !tbaa !9
  %259 = fcmp ogt double %258, 0.000000e+00
  br i1 %259, label %260, label %271

260:                                              ; preds = %250
  %261 = load ptr, ptr %14, align 8, !tbaa !5
  %262 = load ptr, ptr %14, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct._MatNd, ptr %262, i32 0, i32 0
  %264 = load ptr, ptr %263, align 8, !tbaa !17
  %265 = load i32, ptr %11, align 4, !tbaa !16
  %266 = sub i32 %265, 1
  %267 = zext i32 %266 to i64
  %268 = getelementptr inbounds double, ptr %264, i64 %267
  %269 = load double, ptr %268, align 8, !tbaa !9
  %270 = fdiv double 1.000000e+00, %269
  call void @MatNd_constMulSelf(ptr noundef %261, double noundef %270)
  br label %271

271:                                              ; preds = %260, %250
  br label %272

272:                                              ; preds = %271, %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 1, ptr %21, align 4, !tbaa !16
  br label %273

273:                                              ; preds = %348, %272
  %274 = load i32, ptr %21, align 4, !tbaa !16
  %275 = load i32, ptr %11, align 4, !tbaa !16
  %276 = icmp ult i32 %274, %275
  br i1 %276, label %278, label %277

277:                                              ; preds = %273
  store i32 18, ptr %13, align 4
  br label %351

278:                                              ; preds = %273
  br label %279

279:                                              ; preds = %278
  %280 = load ptr, ptr %14, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct._MatNd, ptr %280, i32 0, i32 0
  %282 = load ptr, ptr %281, align 8, !tbaa !17
  %283 = load i32, ptr %21, align 4, !tbaa !16
  %284 = zext i32 %283 to i64
  %285 = getelementptr inbounds double, ptr %282, i64 %284
  %286 = load double, ptr %285, align 8, !tbaa !9
  %287 = load ptr, ptr %14, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct._MatNd, ptr %287, i32 0, i32 0
  %289 = load ptr, ptr %288, align 8, !tbaa !17
  %290 = load i32, ptr %21, align 4, !tbaa !16
  %291 = sub i32 %290, 1
  %292 = zext i32 %291 to i64
  %293 = getelementptr inbounds double, ptr %289, i64 %292
  %294 = load double, ptr %293, align 8, !tbaa !9
  %295 = fcmp oge double %286, %294
  br i1 %295, label %321, label %296

296:                                              ; preds = %279
  %297 = load ptr, ptr @stderr, align 8, !tbaa !5
  %298 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %297, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_interpolateArcLength, i32 noundef 5018, ptr noundef @.str.266) #7
  %299 = load ptr, ptr @stderr, align 8, !tbaa !5
  %300 = load i32, ptr %21, align 4, !tbaa !16
  %301 = load ptr, ptr %14, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct._MatNd, ptr %301, i32 0, i32 0
  %303 = load ptr, ptr %302, align 8, !tbaa !17
  %304 = load i32, ptr %21, align 4, !tbaa !16
  %305 = zext i32 %304 to i64
  %306 = getelementptr inbounds double, ptr %303, i64 %305
  %307 = load double, ptr %306, align 8, !tbaa !9
  %308 = load i32, ptr %21, align 4, !tbaa !16
  %309 = sub i32 %308, 1
  %310 = load ptr, ptr %14, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct._MatNd, ptr %310, i32 0, i32 0
  %312 = load ptr, ptr %311, align 8, !tbaa !17
  %313 = load i32, ptr %21, align 4, !tbaa !16
  %314 = sub i32 %313, 1
  %315 = zext i32 %314 to i64
  %316 = getelementptr inbounds double, ptr %312, i64 %315
  %317 = load double, ptr %316, align 8, !tbaa !9
  %318 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %299, ptr noundef @.str.267, i32 noundef %300, double noundef %307, i32 noundef %309, double noundef %317) #7
  %319 = load ptr, ptr @stderr, align 8, !tbaa !5
  %320 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %319, ptr noundef @.str.4) #7
  call void @print_trace()
  call void @exit(i32 noundef 1) #8
  unreachable

321:                                              ; preds = %279
  br label %322

322:                                              ; preds = %321
  br label %323

323:                                              ; preds = %322
  %324 = load ptr, ptr %14, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct._MatNd, ptr %324, i32 0, i32 0
  %326 = load ptr, ptr %325, align 8, !tbaa !17
  %327 = load i32, ptr %21, align 4, !tbaa !16
  %328 = sub i32 %327, 1
  %329 = zext i32 %328 to i64
  %330 = getelementptr inbounds double, ptr %326, i64 %329
  %331 = load double, ptr %330, align 8, !tbaa !9
  %332 = load double, ptr %9, align 8, !tbaa !9
  %333 = fcmp ole double %331, %332
  br i1 %333, label %334, label %347

334:                                              ; preds = %323
  %335 = load ptr, ptr %14, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct._MatNd, ptr %335, i32 0, i32 0
  %337 = load ptr, ptr %336, align 8, !tbaa !17
  %338 = load i32, ptr %21, align 4, !tbaa !16
  %339 = zext i32 %338 to i64
  %340 = getelementptr inbounds double, ptr %337, i64 %339
  %341 = load double, ptr %340, align 8, !tbaa !9
  %342 = load double, ptr %9, align 8, !tbaa !9
  %343 = fcmp ogt double %341, %342
  br i1 %343, label %344, label %347

344:                                              ; preds = %334
  %345 = load i32, ptr %21, align 4, !tbaa !16
  %346 = sub i32 %345, 1
  store i32 %346, ptr %12, align 4, !tbaa !16
  store i32 18, ptr %13, align 4
  br label %351

347:                                              ; preds = %334, %323
  br label %348

348:                                              ; preds = %347
  %349 = load i32, ptr %21, align 4, !tbaa !16
  %350 = add i32 %349, 1
  store i32 %350, ptr %21, align 4, !tbaa !16
  br label %273, !llvm.loop !23

351:                                              ; preds = %344, %277
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %352

352:                                              ; preds = %351
  %353 = load i32, ptr %12, align 4, !tbaa !16
  %354 = load i32, ptr %11, align 4, !tbaa !16
  %355 = sub i32 %354, 1
  %356 = icmp eq i32 %353, %355
  br i1 %356, label %357, label %371

357:                                              ; preds = %352
  %358 = load ptr, ptr %6, align 8, !tbaa !5
  %359 = getelementptr inbounds %struct._MatNd, ptr %358, i32 0, i32 0
  %360 = load ptr, ptr %359, align 8, !tbaa !17
  %361 = load ptr, ptr %8, align 8, !tbaa !5
  %362 = load i32, ptr %11, align 4, !tbaa !16
  %363 = sub i32 %362, 1
  %364 = call ptr @MatNd_getRowPtr(ptr noundef %361, i32 noundef %363)
  %365 = load i32, ptr %10, align 4, !tbaa !16
  call void @VecNd_copy(ptr noundef %360, ptr noundef %364, i32 noundef %365)
  %366 = load ptr, ptr %7, align 8, !tbaa !5
  %367 = icmp eq ptr %366, null
  br i1 %367, label %368, label %370

368:                                              ; preds = %357
  %369 = load ptr, ptr %14, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %369)
  br label %370

370:                                              ; preds = %368, %357
  store double 1.000000e+00, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %441

371:                                              ; preds = %352
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %372 = load ptr, ptr %8, align 8, !tbaa !5
  %373 = load i32, ptr %12, align 4, !tbaa !16
  %374 = call ptr @MatNd_getRowPtr(ptr noundef %372, i32 noundef %373)
  store ptr %374, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %375 = load ptr, ptr %8, align 8, !tbaa !5
  %376 = load i32, ptr %12, align 4, !tbaa !16
  %377 = add i32 %376, 1
  %378 = call ptr @MatNd_getRowPtr(ptr noundef %375, i32 noundef %377)
  store ptr %378, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %379 = load ptr, ptr %14, align 8, !tbaa !5
  %380 = getelementptr inbounds %struct._MatNd, ptr %379, i32 0, i32 0
  %381 = load ptr, ptr %380, align 8, !tbaa !17
  %382 = load i32, ptr %12, align 4, !tbaa !16
  %383 = zext i32 %382 to i64
  %384 = getelementptr inbounds double, ptr %381, i64 %383
  %385 = load double, ptr %384, align 8, !tbaa !9
  store double %385, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %386 = load ptr, ptr %14, align 8, !tbaa !5
  %387 = getelementptr inbounds %struct._MatNd, ptr %386, i32 0, i32 0
  %388 = load ptr, ptr %387, align 8, !tbaa !17
  %389 = load i32, ptr %12, align 4, !tbaa !16
  %390 = add i32 %389, 1
  %391 = zext i32 %390 to i64
  %392 = getelementptr inbounds double, ptr %388, i64 %391
  %393 = load double, ptr %392, align 8, !tbaa !9
  store double %393, ptr %25, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %394 = load i32, ptr %12, align 4, !tbaa !16
  %395 = uitofp i32 %394 to double
  store double %395, ptr %26, align 8, !tbaa !9
  %396 = load ptr, ptr %6, align 8, !tbaa !5
  %397 = getelementptr inbounds %struct._MatNd, ptr %396, i32 0, i32 0
  %398 = load ptr, ptr %397, align 8, !tbaa !17
  %399 = load ptr, ptr %22, align 8, !tbaa !5
  %400 = load i32, ptr %10, align 4, !tbaa !16
  call void @VecNd_copy(ptr noundef %398, ptr noundef %399, i32 noundef %400)
  %401 = load double, ptr %25, align 8, !tbaa !9
  %402 = load double, ptr %24, align 8, !tbaa !9
  %403 = fsub double %401, %402
  %404 = fcmp ogt double %403, 0.000000e+00
  br i1 %404, label %405, label %431

405:                                              ; preds = %371
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %406 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !5
  %407 = load i32, ptr %10, align 4, !tbaa !16
  %408 = zext i32 %407 to i64
  %409 = call ptr %406(i64 noundef %408, i64 noundef 8)
  store ptr %409, ptr %27, align 8, !tbaa !5
  %410 = load ptr, ptr %27, align 8, !tbaa !5
  %411 = load ptr, ptr %23, align 8, !tbaa !5
  %412 = load ptr, ptr %22, align 8, !tbaa !5
  %413 = load i32, ptr %10, align 4, !tbaa !16
  call void @VecNd_sub(ptr noundef %410, ptr noundef %411, ptr noundef %412, i32 noundef %413)
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %414 = load double, ptr %9, align 8, !tbaa !9
  %415 = load double, ptr %24, align 8, !tbaa !9
  %416 = fsub double %414, %415
  %417 = load double, ptr %25, align 8, !tbaa !9
  %418 = load double, ptr %24, align 8, !tbaa !9
  %419 = fsub double %417, %418
  %420 = fdiv double %416, %419
  store double %420, ptr %28, align 8, !tbaa !9
  %421 = load ptr, ptr %6, align 8, !tbaa !5
  %422 = getelementptr inbounds %struct._MatNd, ptr %421, i32 0, i32 0
  %423 = load ptr, ptr %422, align 8, !tbaa !17
  %424 = load ptr, ptr %27, align 8, !tbaa !5
  %425 = load double, ptr %28, align 8, !tbaa !9
  %426 = load i32, ptr %10, align 4, !tbaa !16
  call void @VecNd_constMulAndAddSelf(ptr noundef %423, ptr noundef %424, double noundef %425, i32 noundef %426)
  %427 = load double, ptr %28, align 8, !tbaa !9
  %428 = load double, ptr %26, align 8, !tbaa !9
  %429 = fadd double %428, %427
  store double %429, ptr %26, align 8, !tbaa !9
  %430 = load ptr, ptr %27, align 8, !tbaa !5
  call void @free(ptr noundef %430) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %431

431:                                              ; preds = %405, %371
  %432 = load ptr, ptr %7, align 8, !tbaa !5
  %433 = icmp eq ptr %432, null
  br i1 %433, label %434, label %436

434:                                              ; preds = %431
  %435 = load ptr, ptr %14, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %435)
  br label %436

436:                                              ; preds = %434, %431
  %437 = load double, ptr %26, align 8, !tbaa !9
  %438 = load i32, ptr %11, align 4, !tbaa !16
  %439 = uitofp i32 %438 to double
  %440 = fdiv double %437, %439
  store double %440, ptr %5, align 8
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %441

441:                                              ; preds = %436, %370
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %442

442:                                              ; preds = %441, %126, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %443 = load double, ptr %5, align 8
  ret double %443
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 12}
!12 = !{!"_MatNd", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !13, i64 8}
!16 = !{!13, !13, i64 0}
!17 = !{!12, !6, i64 0}
!18 = !{!12, !13, i64 16}
!19 = !{!12, !14, i64 20}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@Rcs_calloc = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [43 x i8], align 1
@__func__.MatNd_interpolateArcLength = external hidden unnamed_addr constant [27 x i8], align 1
@.str.259 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.260 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.261 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.262 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.263 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.264 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.265 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.266 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.267 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

declare void @print_trace() local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @MatNd_create(i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @MatNd_destroy(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare dso_local ptr @MatNd_getRowPtr(ptr noundef, i32 noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
declare dso_local void @MatNd_constMulSelf(ptr noundef, double noundef) local_unnamed_addr #4

declare void @VecNd_copy(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @VecNd_constMulAndAddSelf(ptr noundef, ptr noundef, double noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local double @MatNd_interpolateArcLength(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, double noundef %3) local_unnamed_addr #4 {
  %5 = getelementptr inbounds i8, ptr %2, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %10

7:                                                ; preds = %4
  %8 = load ptr, ptr @stderr, align 8, !tbaa !12
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_interpolateArcLength, i32 noundef 4959, ptr noundef nonnull @.str.259) #9
  tail call void @print_trace() #10
  tail call void @abort() #11
  unreachable

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load i32, ptr %11, align 8, !tbaa !13
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %17, label %14

14:                                               ; preds = %10
  %15 = load ptr, ptr @stderr, align 8, !tbaa !12
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_interpolateArcLength, i32 noundef 4960, ptr noundef nonnull @.str.260) #9
  tail call void @print_trace() #10
  tail call void @abort() #11
  unreachable

17:                                               ; preds = %10
  %18 = getelementptr inbounds i8, ptr %0, i64 12
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = icmp eq i32 %19, %6
  br i1 %20, label %24, label %21

21:                                               ; preds = %17
  %22 = load ptr, ptr @stderr, align 8, !tbaa !12
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_interpolateArcLength, i32 noundef 4961, ptr noundef nonnull @.str.261) #9
  tail call void @print_trace() #10
  tail call void @abort() #11
  unreachable

24:                                               ; preds = %17
  %.not150 = icmp eq ptr %1, null
  br i1 %.not150, label %._crit_edge187, label %25

._crit_edge187:                                   ; preds = %24
  %.phi.trans.insert = getelementptr inbounds i8, ptr %2, i64 8
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !13
  br label %52

25:                                               ; preds = %24
  %26 = getelementptr inbounds i8, ptr %1, i64 8
  %27 = load i32, ptr %26, align 8, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %2, i64 8
  %29 = load i32, ptr %28, align 8, !tbaa !13
  %30 = icmp eq i32 %27, %29
  br i1 %30, label %40, label %31

31:                                               ; preds = %25
  %32 = load ptr, ptr @stderr, align 8, !tbaa !12
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_interpolateArcLength, i32 noundef 4965, ptr noundef nonnull @.str.262) #9
  %34 = load ptr, ptr @stderr, align 8, !tbaa !12
  %35 = load i32, ptr %26, align 8, !tbaa !13
  %36 = load i32, ptr %28, align 8, !tbaa !13
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.263, i32 noundef %35, i32 noundef %36) #9
  %38 = load ptr, ptr @stderr, align 8, !tbaa !12
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.4) #9
  tail call void @print_trace() #10
  tail call void @exit(i32 noundef 1) #11
  unreachable

40:                                               ; preds = %25
  %41 = getelementptr inbounds i8, ptr %1, i64 12
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %52, label %44

44:                                               ; preds = %40
  %45 = load ptr, ptr @stderr, align 8, !tbaa !12
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_interpolateArcLength, i32 noundef 4966, ptr noundef nonnull @.str.264) #9
  %47 = load ptr, ptr @stderr, align 8, !tbaa !12
  %48 = load i32, ptr %41, align 4, !tbaa !5
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.265, i32 noundef %48) #9
  %50 = load ptr, ptr @stderr, align 8, !tbaa !12
  %51 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.4) #9
  tail call void @print_trace() #10
  tail call void @exit(i32 noundef 1) #11
  unreachable

52:                                               ; preds = %._crit_edge187, %40
  %53 = phi i32 [ %.pre, %._crit_edge187 ], [ %27, %40 ]
  %54 = add i32 %53, -1
  %55 = fcmp ugt double %3, 0.000000e+00
  br i1 %55, label %59, label %56

56:                                               ; preds = %52
  %57 = load ptr, ptr %0, align 8, !tbaa !14
  %58 = tail call ptr @MatNd_getRowPtr(ptr noundef nonnull %2, i32 noundef 0)
  tail call void @VecNd_copy(ptr noundef %57, ptr noundef %58, i32 noundef %6) #10
  br label %190

59:                                               ; preds = %52
  %60 = fcmp ult double %3, 1.000000e+00
  br i1 %60, label %64, label %61

61:                                               ; preds = %59
  %62 = load ptr, ptr %0, align 8, !tbaa !14
  %63 = tail call ptr @MatNd_getRowPtr(ptr noundef nonnull %2, i32 noundef %54)
  tail call void @VecNd_copy(ptr noundef %62, ptr noundef %63, i32 noundef %6) #10
  br label %190

64:                                               ; preds = %59
  br i1 %.not150, label %65, label %130

65:                                               ; preds = %64
  %66 = icmp ugt i32 %53, 1296
  br i1 %66, label %.thread190, label %68

.thread190:                                       ; preds = %65
  %67 = tail call ptr @MatNd_create(i32 noundef %53, i32 noundef 1)
  br label %.lr.ph.preheader

68:                                               ; preds = %65
  %69 = tail call i32 @llvm.umax.i32(i32 %53, i32 1)
  %70 = shl nuw nsw i32 %69, 3
  %71 = zext nneg i32 %70 to i64
  %72 = add nuw nsw i64 %71, 24
  %73 = alloca i8, i64 %72, align 16
  %74 = getelementptr inbounds i8, ptr %73, i64 24
  store ptr %74, ptr %73, align 16, !tbaa !14
  %75 = getelementptr inbounds i8, ptr %73, i64 8
  store i32 %53, ptr %75, align 8, !tbaa !13
  %76 = getelementptr inbounds i8, ptr %73, i64 12
  store i32 1, ptr %76, align 4, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %73, i64 16
  store i32 %69, ptr %77, align 16, !tbaa !15
  %78 = getelementptr inbounds i8, ptr %73, i64 20
  store i8 1, ptr %78, align 4, !tbaa !16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %74, i8 0, i64 %71, i1 false)
  %79 = icmp ugt i32 %53, 1
  br i1 %79, label %.lr.ph.preheader, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %68
  %.pre188 = load ptr, ptr %73, align 16, !tbaa !14
  br label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.thread190, %68
  %.0133193 = phi ptr [ %67, %.thread190 ], [ %73, %68 ]
  %wide.trip.count180 = zext i32 %53 to i64
  %wide.trip.count = zext i32 %6 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %80 = icmp ult i32 %6, 4
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph

._crit_edge:                                      ; preds = %.epilog-lcssa, %.._crit_edge_crit_edge
  %.0133192 = phi ptr [ %73, %.._crit_edge_crit_edge ], [ %.0133193, %.epilog-lcssa ]
  %81 = phi ptr [ %.pre188, %.._crit_edge_crit_edge ], [ %102, %.epilog-lcssa ]
  %82 = zext i32 %54 to i64
  %83 = getelementptr inbounds double, ptr %81, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !17
  %85 = fcmp ogt double %84, 0.000000e+00
  br i1 %85, label %128, label %130

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.epilog-lcssa
  %indvars.iv177 = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next178, %.epilog-lcssa ]
  %86 = add nsw i64 %indvars.iv177, -1
  %87 = trunc nuw i64 %86 to i32
  %88 = call ptr @MatNd_getRowPtr(ptr noundef %2, i32 noundef %87)
  %89 = trunc nuw i64 %indvars.iv177 to i32
  %90 = call ptr @MatNd_getRowPtr(ptr noundef %2, i32 noundef %89)
  br i1 %80, label %.unr-lcssa, label %.lr.ph.new

.unr-lcssa:                                       ; preds = %.lr.ph.new, %.lr.ph
  %.lcssa.ph = phi double [ poison, %.lr.ph ], [ %127, %.lr.ph.new ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.3, %.lr.ph.new ]
  %.0136160.unr = phi double [ 0.000000e+00, %.lr.ph ], [ %127, %.lr.ph.new ]
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %.unr-lcssa ]
  %.0136160.epil = phi double [ %96, %.epil.preheader ], [ %.0136160.unr, %.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.unr-lcssa ]
  %91 = getelementptr inbounds double, ptr %90, i64 %indvars.iv.epil
  %92 = load double, ptr %91, align 8, !tbaa !17
  %93 = getelementptr inbounds double, ptr %88, i64 %indvars.iv.epil
  %94 = load double, ptr %93, align 8, !tbaa !17
  %95 = fsub double %92, %94
  %96 = call double @llvm.fmuladd.f64(double %95, double %95, double %.0136160.epil)
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %.epil.preheader, !llvm.loop !19

.epilog-lcssa:                                    ; preds = %.epil.preheader, %.unr-lcssa
  %.lcssa = phi double [ %.lcssa.ph, %.unr-lcssa ], [ %96, %.epil.preheader ]
  %97 = load ptr, ptr %.0133193, align 8, !tbaa !14
  %98 = getelementptr inbounds double, ptr %97, i64 %86
  %99 = load double, ptr %98, align 8, !tbaa !17
  %100 = call double @sqrt(double noundef %.lcssa) #10
  %101 = fadd double %99, %100
  %102 = load ptr, ptr %.0133193, align 8, !tbaa !14
  %103 = getelementptr inbounds double, ptr %102, i64 %indvars.iv177
  store double %101, ptr %103, align 8, !tbaa !17
  %indvars.iv.next178 = add nuw nsw i64 %indvars.iv177, 1
  %exitcond181.not = icmp eq i64 %indvars.iv.next178, %wide.trip.count180
  br i1 %exitcond181.not, label %._crit_edge, label %.lr.ph, !llvm.loop !21

.lr.ph.new:                                       ; preds = %.lr.ph, %.lr.ph.new
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.lr.ph.new ], [ 0, %.lr.ph ]
  %.0136160 = phi double [ %127, %.lr.ph.new ], [ 0.000000e+00, %.lr.ph ]
  %niter = phi i64 [ %niter.next.3, %.lr.ph.new ], [ 0, %.lr.ph ]
  %104 = getelementptr inbounds double, ptr %90, i64 %indvars.iv
  %105 = load double, ptr %104, align 8, !tbaa !17
  %106 = getelementptr inbounds double, ptr %88, i64 %indvars.iv
  %107 = load double, ptr %106, align 8, !tbaa !17
  %108 = fsub double %105, %107
  %109 = call double @llvm.fmuladd.f64(double %108, double %108, double %.0136160)
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %110 = getelementptr inbounds double, ptr %90, i64 %indvars.iv.next
  %111 = load double, ptr %110, align 8, !tbaa !17
  %112 = getelementptr inbounds double, ptr %88, i64 %indvars.iv.next
  %113 = load double, ptr %112, align 8, !tbaa !17
  %114 = fsub double %111, %113
  %115 = call double @llvm.fmuladd.f64(double %114, double %114, double %109)
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %116 = getelementptr inbounds double, ptr %90, i64 %indvars.iv.next.1
  %117 = load double, ptr %116, align 8, !tbaa !17
  %118 = getelementptr inbounds double, ptr %88, i64 %indvars.iv.next.1
  %119 = load double, ptr %118, align 8, !tbaa !17
  %120 = fsub double %117, %119
  %121 = call double @llvm.fmuladd.f64(double %120, double %120, double %115)
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %122 = getelementptr inbounds double, ptr %90, i64 %indvars.iv.next.2
  %123 = load double, ptr %122, align 8, !tbaa !17
  %124 = getelementptr inbounds double, ptr %88, i64 %indvars.iv.next.2
  %125 = load double, ptr %124, align 8, !tbaa !17
  %126 = fsub double %123, %125
  %127 = call double @llvm.fmuladd.f64(double %126, double %126, double %121)
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.unr-lcssa, label %.lr.ph.new, !llvm.loop !23

128:                                              ; preds = %._crit_edge
  %129 = fdiv double 1.000000e+00, %84
  call void @MatNd_constMulSelf(ptr noundef nonnull %.0133192, double noundef %129)
  br label %130

130:                                              ; preds = %._crit_edge, %128, %64
  %.1134 = phi ptr [ %.0133192, %128 ], [ %.0133192, %._crit_edge ], [ %1, %64 ]
  %131 = icmp ugt i32 %53, 1
  br i1 %131, label %.lr.ph164, label %.thread

.lr.ph164:                                        ; preds = %130
  %132 = load ptr, ptr %.1134, align 8, !tbaa !14
  %wide.trip.count185 = zext i32 %53 to i64
  %.pre189 = load double, ptr %132, align 8, !tbaa !17
  br label %133

133:                                              ; preds = %.lr.ph164, %156
  %134 = phi double [ %.pre189, %.lr.ph164 ], [ %136, %156 ]
  %indvars.iv182 = phi i64 [ 1, %.lr.ph164 ], [ %indvars.iv.next183, %156 ]
  %135 = getelementptr inbounds double, ptr %132, i64 %indvars.iv182
  %136 = load double, ptr %135, align 8, !tbaa !17
  %137 = fcmp ult double %136, %134
  br i1 %137, label %138, label %153

138:                                              ; preds = %133
  %139 = add nsw i64 %indvars.iv182, -1
  %140 = trunc nuw i64 %indvars.iv182 to i32
  %141 = trunc nuw i64 %139 to i32
  %142 = load ptr, ptr @stderr, align 8, !tbaa !12
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_interpolateArcLength, i32 noundef 5018, ptr noundef nonnull @.str.266) #9
  %144 = load ptr, ptr @stderr, align 8, !tbaa !12
  %145 = load ptr, ptr %.1134, align 8, !tbaa !14
  %146 = getelementptr inbounds double, ptr %145, i64 %indvars.iv182
  %147 = load double, ptr %146, align 8, !tbaa !17
  %148 = getelementptr inbounds double, ptr %145, i64 %139
  %149 = load double, ptr %148, align 8, !tbaa !17
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %144, ptr noundef nonnull @.str.267, i32 noundef %140, double noundef %147, i32 noundef %141, double noundef %149) #9
  %151 = load ptr, ptr @stderr, align 8, !tbaa !12
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %151, ptr noundef nonnull @.str.4) #9
  call void @print_trace() #10
  call void @exit(i32 noundef 1) #11
  unreachable

153:                                              ; preds = %133
  %154 = fcmp ole double %134, %3
  %155 = fcmp ogt double %136, %3
  %or.cond = and i1 %155, %154
  br i1 %or.cond, label %160, label %156

156:                                              ; preds = %153
  %indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
  %exitcond186.not = icmp eq i64 %indvars.iv.next183, %wide.trip.count185
  br i1 %exitcond186.not, label %.thread, label %133, !llvm.loop !24

.thread:                                          ; preds = %156, %130
  %157 = load ptr, ptr %0, align 8, !tbaa !14
  %158 = call ptr @MatNd_getRowPtr(ptr noundef %2, i32 noundef %54)
  call void @VecNd_copy(ptr noundef %157, ptr noundef %158, i32 noundef %6) #10
  br i1 %.not150, label %159, label %190

159:                                              ; preds = %.thread
  call void @MatNd_destroy(ptr noundef nonnull %.1134)
  br label %190

160:                                              ; preds = %153
  %161 = add nsw i64 %indvars.iv182, -1
  %162 = trunc nuw i64 %indvars.iv182 to i32
  %163 = trunc nuw i64 %161 to i32
  %164 = call ptr @MatNd_getRowPtr(ptr noundef %2, i32 noundef %163)
  %165 = call ptr @MatNd_getRowPtr(ptr noundef %2, i32 noundef %162)
  %166 = load ptr, ptr %.1134, align 8, !tbaa !14
  %167 = and i64 %161, 4294967295
  %168 = getelementptr inbounds double, ptr %166, i64 %167
  %169 = load double, ptr %168, align 8, !tbaa !17
  %170 = and i64 %indvars.iv182, 4294967295
  %171 = getelementptr inbounds double, ptr %166, i64 %170
  %172 = load double, ptr %171, align 8, !tbaa !17
  %173 = uitofp i32 %163 to double
  %174 = load ptr, ptr %0, align 8, !tbaa !14
  call void @VecNd_copy(ptr noundef %174, ptr noundef %164, i32 noundef %6) #10
  %175 = fsub double %172, %169
  %176 = fcmp ogt double %175, 0.000000e+00
  br i1 %176, label %177, label %185

177:                                              ; preds = %160
  %178 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !12
  %179 = zext i32 %6 to i64
  %180 = call ptr %178(i64 noundef %179, i64 noundef 8) #10
  call void @VecNd_sub(ptr noundef %180, ptr noundef %165, ptr noundef %164, i32 noundef %6) #10
  %181 = fsub double %3, %169
  %182 = fdiv double %181, %175
  %183 = load ptr, ptr %0, align 8, !tbaa !14
  call void @VecNd_constMulAndAddSelf(ptr noundef %183, ptr noundef %180, double noundef %182, i32 noundef %6) #10
  %184 = fadd double %182, %173
  call void @free(ptr noundef %180) #10
  br label %185

185:                                              ; preds = %177, %160
  %.0132 = phi double [ %184, %177 ], [ %173, %160 ]
  br i1 %.not150, label %186, label %187

186:                                              ; preds = %185
  call void @MatNd_destroy(ptr noundef nonnull %.1134)
  br label %187

187:                                              ; preds = %186, %185
  %188 = uitofp i32 %53 to double
  %189 = fdiv double %.0132, %188
  br label %190

190:                                              ; preds = %187, %159, %.thread, %61, %56
  %.1 = phi double [ 0.000000e+00, %56 ], [ 1.000000e+00, %61 ], [ %189, %187 ], [ 1.000000e+00, %159 ], [ 1.000000e+00, %.thread ]
  ret double %.1
}

declare void @VecNd_sub(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #8

attributes #0 = { nofree 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 = { "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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { cold nounwind }
attributes #10 = { nounwind }
attributes #11 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 12}
!6 = !{!"_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/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !10, i64 16}
!16 = !{!6, !11, i64 20}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !8, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}


; Effective O3 passes: BDCEPass,ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass