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

; 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__._ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj = external hidden unnamed_addr constant [15 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [33 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

declare i32 @__gxx_personality_v0(...)

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

declare zeroext i1 @Math_isBitSet(i32 noundef, i32 noundef) #2

; 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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3Rcs16ViaPointSequence4initEPK6_MatNd(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, i32 noundef %2, double noundef %3, double noundef %4, i32 noundef %5) #3 align 2 personality ptr @__gxx_personality_v0 {
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca %"class.Rcs::ViaPointSequence", align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  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 i32 %5, ptr %13, align 4, !tbaa !9
  %24 = load ptr, ptr %8, align 8
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = load i32, ptr %13, align 4, !tbaa !9
  call void @MatNd_reshapeAndSetZero(ptr noundef %25, i32 noundef %26, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %27 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %24, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %struct._MatNd, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !25
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %24, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = getelementptr inbounds %struct._MatNd, ptr %33, i32 0, i32 2
  %35 = load i32, ptr %34, align 4, !tbaa !27
  %36 = mul i32 %31, %35
  %37 = add i32 %36, 4
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds double, ptr %30, i64 %38
  %40 = load double, ptr %39, align 8, !tbaa !11
  %41 = call i64 @lround(double noundef %40) #5
  %42 = trunc i64 %41 to i32
  store i32 %42, ptr %14, align 4, !tbaa !9
  %43 = load i32, ptr %14, align 4, !tbaa !9
  %44 = call zeroext i1 @Math_isBitSet(i32 noundef %43, i32 noundef 0)
  br i1 %44, label %66, label %45

45:                                               ; preds = %6
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %46
  %50 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %51 = load i32, ptr %10, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %50(i32 noundef 4, ptr noundef @.str.2, ptr noundef @__func__._ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj, i32 noundef 1929, ptr noundef @.str.82, i32 noundef %51)
  br label %52

52:                                               ; preds = %49, %46
  %53 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %54 = icmp sle i32 4, %53
  br i1 %54, label %55, label %63

55:                                               ; preds = %52
  %56 = load ptr, ptr @stderr, align 8, !tbaa !5
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj, i32 noundef 1929) #5
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.82, i32 noundef %59) #5
  %61 = load ptr, ptr @stderr, align 8, !tbaa !5
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.4) #5
  br label %63

63:                                               ; preds = %55, %52
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %120

66:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store double 1.000000e-03, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 104, ptr %17) #5
  call void @_ZN3Rcs16ViaPointSequenceC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %17, ptr noundef nonnull align 8 dereferenceable(104) %24)
  %67 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %17, i32 0, i32 1
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = load i32, ptr %10, align 4, !tbaa !9
  invoke void @MatNd_addToEle(ptr noundef %68, i32 noundef %69, i32 noundef 1, double noundef 1.000000e-03)
          to label %70 unwind label %80

70:                                               ; preds = %66
  %71 = getelementptr inbounds %"class.Rcs::ViaPointSequence", ptr %17, i32 0, i32 1
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  %73 = invoke noundef zeroext i1 @_ZN3Rcs16ViaPointSequence4initEPK6_MatNd(ptr noundef nonnull align 8 dereferenceable(104) %17, ptr noundef %72)
          to label %74 unwind label %80

74:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %106, %74
  %76 = load i32, ptr %20, align 4, !tbaa !9
  %77 = load i32, ptr %13, align 4, !tbaa !9
  %78 = icmp ult i32 %76, %77
  br i1 %78, label %84, label %79

79:                                               ; preds = %75
  store i32 4, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %118

80:                                               ; preds = %70, %66
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %18, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %19, align 4
  br label %119

84:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %85 = load double, ptr %11, align 8, !tbaa !11
  %86 = load i32, ptr %20, align 4, !tbaa !9
  %87 = uitofp i32 %86 to double
  %88 = load double, ptr %12, align 8, !tbaa !11
  %89 = call double @llvm.fmuladd.f64(double %87, double %88, double %85)
  store double %89, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %90 = load double, ptr %21, align 8, !tbaa !11
  %91 = invoke noundef double @_ZNK3Rcs16ViaPointSequence20computeTrajectoryPosEd(ptr noundef nonnull align 8 dereferenceable(104) %24, double noundef %90)
          to label %92 unwind label %109

92:                                               ; preds = %84
  store double %91, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %93 = load double, ptr %21, align 8, !tbaa !11
  %94 = invoke noundef double @_ZNK3Rcs16ViaPointSequence20computeTrajectoryPosEd(ptr noundef nonnull align 8 dereferenceable(104) %17, double noundef %93)
          to label %95 unwind label %113

95:                                               ; preds = %92
  store double %94, ptr %23, align 8, !tbaa !11
  %96 = load double, ptr %23, align 8, !tbaa !11
  %97 = load double, ptr %22, align 8, !tbaa !11
  %98 = fsub double %96, %97
  %99 = fdiv double %98, 1.000000e-03
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._MatNd, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !25
  %103 = load i32, ptr %20, align 4, !tbaa !9
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds double, ptr %102, i64 %104
  store double %99, ptr %105, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %106

106:                                              ; preds = %95
  %107 = load i32, ptr %20, align 4, !tbaa !9
  %108 = add i32 %107, 1
  store i32 %108, ptr %20, align 4, !tbaa !9
  br label %75, !llvm.loop !28

109:                                              ; preds = %84
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %18, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %19, align 4
  br label %117

113:                                              ; preds = %92
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %18, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %117

117:                                              ; preds = %113, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %119

118:                                              ; preds = %79
  store i1 true, ptr %7, align 1
  store i32 1, ptr %15, align 4
  call void @_ZN3Rcs16ViaPointSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(104) %17) #5
  call void @llvm.lifetime.end.p0(i64 104, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %120

119:                                              ; preds = %117, %80
  call void @_ZN3Rcs16ViaPointSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(104) %17) #5
  call void @llvm.lifetime.end.p0(i64 104, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %122

120:                                              ; preds = %118, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %121 = load i1, ptr %7, align 1
  ret i1 %121

122:                                              ; preds = %119
  %123 = load ptr, ptr %18, align 8
  %124 = load i32, ptr %19, align 4
  %125 = insertvalue { ptr, i32 } poison, ptr %123, 0
  %126 = insertvalue { ptr, i32 } %125, i32 %124, 1
  resume { ptr, i32 } %126
}

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

declare void @MatNd_addToEle(ptr noundef, i32 noundef, i32 noundef, double noundef) #2

declare void @_ZN3Rcs16ViaPointSequenceD1Ev(ptr)

declare void @_ZN3Rcs16ViaPointSequenceC1ERKS0_(ptr, ptr)

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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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 = !{!26, !6, i64 0}
!26 = !{!"_ZTS6_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 20}
!27 = !{!26, !10, i64 12}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.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 }

@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__._ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj = external hidden unnamed_addr constant [15 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [33 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

declare zeroext i1 @Math_isBitSet(i32 noundef, i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3Rcs16ViaPointSequence4initEPK6_MatNd(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, i32 noundef %2, double noundef %3, double noundef %4, i32 noundef %5) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.Rcs::ViaPointSequence", align 8
  tail call void @MatNd_reshapeAndSetZero(ptr noundef %1, i32 noundef %5, i32 noundef 1)
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %9, align 8, !tbaa !20
  %11 = getelementptr inbounds i8, ptr %9, i64 12
  %12 = load i32, ptr %11, align 4, !tbaa !23
  %13 = mul i32 %12, %2
  %14 = add i32 %13, 4
  %15 = zext i32 %14 to i64
  %16 = getelementptr inbounds double, ptr %10, i64 %15
  %17 = load double, ptr %16, align 8, !tbaa !24
  %18 = tail call i64 @lround(double noundef %17) #6
  %19 = trunc i64 %18 to i32
  %20 = tail call zeroext i1 @Math_isBitSet(i32 noundef %19, i32 noundef 0)
  br i1 %20, label %34, label %21

21:                                               ; preds = %6
  %22 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !26
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %24, label %23

23:                                               ; preds = %21
  tail call void (i32, ptr, ptr, i32, ptr, ...) %22(i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj, i32 noundef 1929, ptr noundef nonnull @.str.82, i32 noundef %2)
  br label %24

24:                                               ; preds = %23, %21
  %25 = load i32, ptr @RcsLogLevel, align 4, !tbaa !27
  %26 = icmp sgt i32 %25, 3
  br i1 %26, label %27, label %58

27:                                               ; preds = %24
  %28 = load ptr, ptr @stderr, align 8, !tbaa !26
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZNK3Rcs16ViaPointSequence14gradientDxDviaEP6_MatNdjddj, i32 noundef 1929) #7
  %30 = load ptr, ptr @stderr, align 8, !tbaa !26
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.82, i32 noundef %2) #7
  %32 = load ptr, ptr @stderr, align 8, !tbaa !26
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.4) #7
  br label %58

34:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %7) #6
  call void @_ZN3Rcs16ViaPointSequenceC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %7, ptr noundef nonnull align 8 dereferenceable(104) %0)
  %35 = getelementptr inbounds i8, ptr %7, i64 8
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  invoke void @MatNd_addToEle(ptr noundef %36, i32 noundef %2, i32 noundef 1, double noundef 1.000000e-03)
          to label %37 unwind label %40

37:                                               ; preds = %34
  %38 = load ptr, ptr %35, align 8, !tbaa !5
  %39 = invoke noundef zeroext i1 @_ZN3Rcs16ViaPointSequence4initEPK6_MatNd(ptr noundef nonnull align 8 dereferenceable(104) %7, ptr noundef %38)
          to label %.preheader unwind label %40

.preheader:                                       ; preds = %37
  %.not30 = icmp eq i32 %5, 0
  br i1 %.not30, label %._crit_edge, label %.lr.ph.preheader

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

._crit_edge:                                      ; preds = %48, %.preheader
  call void @_ZN3Rcs16ViaPointSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(104) %7) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %7) #6
  br label %58

40:                                               ; preds = %37, %34
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %57

.lr.ph:                                           ; preds = %.lr.ph.preheader, %48
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %48 ]
  %42 = trunc nuw i64 %indvars.iv to i32
  %43 = uitofp i32 %42 to double
  %44 = call double @llvm.fmuladd.f64(double %43, double %4, double %3)
  %45 = invoke noundef double @_ZNK3Rcs16ViaPointSequence20computeTrajectoryPosEd(ptr noundef nonnull align 8 dereferenceable(104) %0, double noundef %44)
          to label %46 unwind label %53

46:                                               ; preds = %.lr.ph
  %47 = invoke noundef double @_ZNK3Rcs16ViaPointSequence20computeTrajectoryPosEd(ptr noundef nonnull align 8 dereferenceable(104) %7, double noundef %44)
          to label %48 unwind label %55

48:                                               ; preds = %46
  %49 = fsub double %47, %45
  %50 = fdiv double %49, 1.000000e-03
  %51 = load ptr, ptr %1, align 8, !tbaa !20
  %52 = getelementptr inbounds double, ptr %51, i64 %indvars.iv
  store double %50, ptr %52, align 8, !tbaa !24
  %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 !28

53:                                               ; preds = %.lr.ph
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %57

55:                                               ; preds = %46
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %57

57:                                               ; preds = %53, %55, %40
  %.pn.pn = phi { ptr, i32 } [ %41, %40 ], [ %56, %55 ], [ %54, %53 ]
  call void @_ZN3Rcs16ViaPointSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(104) %7) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %7) #6
  resume { ptr, i32 } %.pn.pn

58:                                               ; preds = %24, %27, %._crit_edge
  ret i1 %20
}

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

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

declare void @_ZN3Rcs16ViaPointSequenceD1Ev(ptr) local_unnamed_addr

declare void @_ZN3Rcs16ViaPointSequenceC1ERKS0_(ptr, ptr) local_unnamed_addr

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


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