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

; 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.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 }
%struct._MatNd = type { ptr, i32, i32, i32, i8 }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@RcsLogLevel = external global i32, align 4
@.str.42 = external hidden unnamed_addr constant [16 x i8], align 1
@__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd = external hidden unnamed_addr constant [17 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [32 x i8], align 1

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

; Function Attrs: nounwind
declare i64 @lround(double noundef) #1

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

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

declare void @MatNd_destroy(ptr noundef) #2

declare void @MatNd_setZero(ptr noundef) #2

declare ptr @MatNd_create(i32 noundef, i32 noundef) #2

declare void @MatNd_reshape(ptr noundef, i32 noundef, i32 noundef) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj(ptr noundef, i32 noundef, i32 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, i32 noundef %2, double noundef %3, double noundef %4, double noundef %5) #5 align 2 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store double %3, ptr %11, align 8, !tbaa !11
  store double %4, ptr %12, align 8, !tbaa !11
  store double %5, ptr %13, align 8, !tbaa !11
  %20 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %21 = load double, ptr %12, align 8, !tbaa !11
  %22 = load double, ptr %11, align 8, !tbaa !11
  %23 = fsub double %21, %22
  %24 = load double, ptr %13, align 8, !tbaa !11
  %25 = fdiv double %23, %24
  %26 = call i64 @lround(double noundef %25) #6
  %27 = add nsw i64 %26, 1
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %14, align 4, !tbaa !9
  %29 = load i32, ptr %14, align 4, !tbaa !9
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %31, label %56

31:                                               ; preds = %6
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %40

35:                                               ; preds = %32
  %36 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %37 = load i32, ptr %14, align 4, !tbaa !9
  %38 = load double, ptr %11, align 8, !tbaa !11
  %39 = load double, ptr %12, align 8, !tbaa !11
  call void (i32, ptr, ptr, i32, ptr, ...) %36(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2058, ptr noundef @.str.87, i32 noundef %37, double noundef %38, double noundef %39)
  br label %40

40:                                               ; preds = %35, %32
  %41 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %42 = icmp sle i32 1, %41
  br i1 %42, label %43, label %53

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2058) #6
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = load double, ptr %11, align 8, !tbaa !11
  %49 = load double, ptr %12, align 8, !tbaa !11
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.87, i32 noundef %47, double noundef %48, double noundef %49) #6
  %51 = load ptr, ptr @stderr, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str.4) #6
  br label %53

53:                                               ; preds = %43, %40
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %137

56:                                               ; preds = %6
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load i32, ptr %14, align 4, !tbaa !9
  call void @MatNd_reshape(ptr noundef %57, i32 noundef %58, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %59 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !13
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = call noundef i32 @_ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj(ptr noundef %60, i32 noundef %61, i32 noundef 0)
  store i32 %62, ptr %16, align 4, !tbaa !9
  %63 = load i32, ptr %16, align 4, !tbaa !9
  %64 = icmp slt i32 %63, 0
  br i1 %64, label %65, label %87

65:                                               ; preds = %56
  br label %66

66:                                               ; preds = %65
  %67 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %72

69:                                               ; preds = %66
  %70 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %71 = load i32, ptr %10, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %70(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2070, ptr noundef @.str.88, i32 noundef %71)
  br label %72

72:                                               ; preds = %69, %66
  %73 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %74 = icmp sle i32 1, %73
  br i1 %74, label %75, label %83

75:                                               ; preds = %72
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2070) #6
  %78 = load ptr, ptr @stderr, align 8, !tbaa !5
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str.88, i32 noundef %79) #6
  %81 = load ptr, ptr @stderr, align 8, !tbaa !5
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef @.str.4) #6
  br label %83

83:                                               ; preds = %75, %72
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  call void @MatNd_setZero(ptr noundef %86)
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %136

87:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %88 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 3
  %89 = load ptr, ptr %88, align 8, !tbaa !25
  %90 = getelementptr inbounds %struct._MatNd, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !26
  %92 = call ptr @MatNd_create(i32 noundef %91, i32 noundef 1)
  store ptr %92, ptr %17, align 8, !tbaa !5
  %93 = load ptr, ptr %17, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 3
  %95 = load ptr, ptr %94, align 8, !tbaa !25
  %96 = load i32, ptr %16, align 4, !tbaa !9
  call void @MatNd_copyColumn(ptr noundef %93, i32 noundef 0, ptr noundef %95, i32 noundef %96)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %97 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 9
  %98 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %97) #6
  %99 = trunc i64 %98 to i32
  %100 = call ptr @MatNd_create(i32 noundef %99, i32 noundef 1)
  store ptr %100, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %130, %87
  %102 = load i32, ptr %19, align 4, !tbaa !9
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 6, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %133

106:                                              ; preds = %101
  %107 = load ptr, ptr %18, align 8, !tbaa !5
  %108 = load double, ptr %11, align 8, !tbaa !11
  %109 = load i32, ptr %19, align 4, !tbaa !9
  %110 = sitofp i32 %109 to double
  %111 = load double, ptr %13, align 8, !tbaa !11
  %112 = call double @llvm.fmuladd.f64(double %110, double %111, double %108)
  call void @_ZNK3Rcs16ViaPointSequence10computeRHSEP6_MatNdd(ptr noundef nonnull align 8 dereferenceable(104) %20, ptr noundef %107, double noundef %112)
  %113 = load ptr, ptr %18, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._MatNd, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !28
  %116 = load ptr, ptr %17, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._MatNd, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !28
  %119 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %20, i32 0, i32 3
  %120 = load ptr, ptr %119, align 8, !tbaa !25
  %121 = getelementptr inbounds %struct._MatNd, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 8, !tbaa !26
  %123 = call double @VecNd_innerProduct(ptr noundef %115, ptr noundef %118, i32 noundef %122)
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._MatNd, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !28
  %127 = load i32, ptr %19, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds double, ptr %126, i64 %128
  store double %123, ptr %129, align 8, !tbaa !11
  br label %130

130:                                              ; preds = %106
  %131 = load i32, ptr %19, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %19, align 4, !tbaa !9
  br label %101, !llvm.loop !29

133:                                              ; preds = %105
  %134 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %134)
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %135)
  store i1 true, ptr %7, align 1
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %136

136:                                              ; preds = %133, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %137

137:                                              ; preds = %136, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %138 = load i1, ptr %7, align 1
  ret i1 %138
}

declare void @MatNd_copyColumn(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Rcs16ViaPointSequence10computeRHSEP6_MatNdd(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef, double noundef) #5 align 2

declare double @VecNd_innerProduct(ptr noundef, ptr noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 speculatable willreturn memory(none) }
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 = { 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 = { 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, !6, i64 8}
!14 = !{!"_ZTSN3Rcs16ViaPointSequenceE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !16, i64 52, !17, i64 56, !21, i64 80}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN3Rcs16ViaPointSequence12ViaPointTypeE", !7, i64 0}
!17 = !{!"_ZTSSt6vectorIiSaIiEE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSSt6vectorIdSaIdEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!14, !6, i64 24}
!26 = !{!27, !10, i64 8}
!27 = !{!"_ZTS6_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 20}
!28 = !{!27, !6, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.42 = external hidden unnamed_addr constant [16 x i8], align 1
@__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd = external hidden unnamed_addr constant [17 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind
declare i64 @lround(double noundef) local_unnamed_addr #0

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

declare void @MatNd_destroy(ptr noundef) local_unnamed_addr #2

declare void @MatNd_setZero(ptr noundef) local_unnamed_addr #2

declare ptr @MatNd_create(i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @MatNd_reshape(ptr noundef, i32 noundef, 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, i32 noundef %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #5 align 2 {
  %7 = fsub double %4, %3
  %8 = fdiv double %7, %5
  %9 = tail call i64 @lround(double noundef %8) #6
  %10 = trunc i64 %9 to i32
  %11 = add i32 %10, 1
  %12 = icmp slt i32 %11, 0
  br i1 %12, label %13, label %26

13:                                               ; preds = %6
  %14 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not39 = icmp eq ptr %14, null
  br i1 %.not39, label %16, label %15

15:                                               ; preds = %13
  tail call void (i32, ptr, ptr, i32, ptr, ...) %14(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2058, ptr noundef nonnull @.str.87, i32 noundef %11, double noundef %3, double noundef %4)
  br label %16

16:                                               ; preds = %15, %13
  %17 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %19, label %67

19:                                               ; preds = %16
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2058) #7
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.87, i32 noundef %11, double noundef %3, double noundef %4) #7
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.4) #7
  br label %67

26:                                               ; preds = %6
  tail call void @MatNd_reshape(ptr noundef %1, i32 noundef %11, i32 noundef 1)
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = tail call noundef i32 @_ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj(ptr noundef %28, i32 noundef %2, i32 noundef 0)
  %30 = icmp sgt i32 %29, -1
  br i1 %30, label %45, label %31

31:                                               ; preds = %26
  %32 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not = icmp eq ptr %32, null
  br i1 %.not, label %34, label %33

33:                                               ; preds = %31
  tail call void (i32, ptr, ptr, i32, ptr, ...) %32(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2070, ptr noundef nonnull @.str.88, i32 noundef %2)
  br label %34

34:                                               ; preds = %33, %31
  %35 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZNK3Rcs16ViaPointSequence16gradientDxDvia_aEP6_MatNdjddd, i32 noundef 2070) #7
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.88, i32 noundef %2) #7
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.4) #7
  br label %44

44:                                               ; preds = %37, %34
  tail call void @MatNd_setZero(ptr noundef %1)
  br label %67

45:                                               ; preds = %26
  %46 = getelementptr inbounds i8, ptr %0, i64 24
  %47 = load ptr, ptr %46, align 8, !tbaa !23
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load i32, ptr %48, align 8, !tbaa !24
  %50 = tail call ptr @MatNd_create(i32 noundef %49, i32 noundef 1)
  %51 = load ptr, ptr %46, align 8, !tbaa !23
  tail call void @MatNd_copyColumn(ptr noundef %50, i32 noundef 0, ptr noundef %51, i32 noundef %29)
  %52 = getelementptr inbounds i8, ptr %0, i64 80
  %53 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #6
  %54 = trunc i64 %53 to i32
  %55 = tail call ptr @MatNd_create(i32 noundef %54, i32 noundef 1)
  %.not41 = icmp eq i32 %11, 0
  br i1 %.not41, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %45
  %wide.trip.count = zext nneg i32 %11 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %45
  tail call void @MatNd_destroy(ptr noundef %55)
  tail call void @MatNd_destroy(ptr noundef %50)
  br label %67

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %56 = trunc nuw nsw i64 %indvars.iv to i32
  %57 = uitofp nneg i32 %56 to double
  %58 = tail call double @llvm.fmuladd.f64(double %57, double %5, double %3)
  tail call void @_ZNK3Rcs16ViaPointSequence10computeRHSEP6_MatNdd(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %55, double noundef %58)
  %59 = load ptr, ptr %55, align 8, !tbaa !26
  %60 = load ptr, ptr %50, align 8, !tbaa !26
  %61 = load ptr, ptr %46, align 8, !tbaa !23
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  %63 = load i32, ptr %62, align 8, !tbaa !24
  %64 = tail call double @VecNd_innerProduct(ptr noundef %59, ptr noundef %60, i32 noundef %63)
  %65 = load ptr, ptr %1, align 8, !tbaa !26
  %66 = getelementptr inbounds double, ptr %65, i64 %indvars.iv
  store double %64, ptr %66, align 8, !tbaa !27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !29

67:                                               ; preds = %44, %._crit_edge, %16, %19
  %.1 = phi i1 [ false, %19 ], [ false, %16 ], [ true, %._crit_edge ], [ false, %44 ]
  ret i1 %.1
}

declare void @MatNd_copyColumn(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Rcs16ViaPointSequence10computeRHSEP6_MatNdd(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef, double noundef) local_unnamed_addr #5 align 2

declare double @VecNd_innerProduct(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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 = { 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 #2 = { "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 = { 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 = { 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 = { nounwind }
attributes #7 = { cold 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, !6, i64 8}
!12 = !{!"_ZTSN3Rcs16ViaPointSequenceE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48, !14, i64 52, !15, i64 56, !19, i64 80}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN3Rcs16ViaPointSequence12ViaPointTypeE", !7, i64 0}
!15 = !{!"_ZTSSt6vectorIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt6vectorIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!12, !6, i64 24}
!24 = !{!25, !10, i64 8}
!25 = !{!"_ZTS6_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 20}
!26 = !{!25, !6, i64 0}
!27 = !{!28, !28, i64 0}
!28 = !{!"double", !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass