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

; 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 }
%struct._RcsGraph = type { ptr, [10 x %struct._RcsBody], i32, i32, ptr, ptr, ptr, ptr, ptr }
%struct._RcsBody = type { double, i8, i32, [3 x double], [3 x double], double, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@RcsLogLevel = external global i32, align 4
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GRADIENTTESTS_BODYPT1 = external dso_local global [3 x double], align 16
@__func__.test_hessianPinv = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 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 i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local void @Rcs_setIKState(ptr noundef, ptr noundef) #2

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

declare void @MatNd_fromPtr(ptr dead_on_unwind writable sret(%struct._MatNd) align 8, i32 noundef, i32 noundef, ptr noundef) #3

declare void @RcsGraph_bodyPointJacobian(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @MatNd_mul(ptr noundef, ptr noundef, ptr noundef) #3

declare void @MatNd_destroy(ptr noundef) #3

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

declare void @RcsGraph_bodyPointHessian(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @MatNd_PinvHessian(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) #3

declare ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef) #3

declare void @MatNd_transpose(ptr noundef, ptr noundef) #3

declare void @MatNd_preMulDiagSelf(ptr noundef, ptr noundef) #3

declare double @MatNd_choleskyInverse(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @test_hessianPinv(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca double, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca %struct._MatNd, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %24, ptr %7, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void @Rcs_setIKState(ptr noundef %25, ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %27 = call double (...) @Timer_getTime()
  store double %27, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 3, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._RcsGraph, ptr %28, i32 0, i32 3
  %30 = load i32, ptr %29, align 4, !tbaa !13
  store i32 %30, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._RcsGraph, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  store ptr %33, ptr %12, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %46, %3
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %49

38:                                               ; preds = %34
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._RcsBody, ptr %39, i32 0, i32 18
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %45

43:                                               ; preds = %38
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %44, ptr %11, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %43, %38
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = call ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef %47)
  store ptr %48, ptr %12, align 8, !tbaa !5
  br label %34, !llvm.loop !19

49:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr @RCS_GRADIENTTESTS_BODYPT1, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store double 1.000000e-03, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %50 = load i32, ptr %9, align 4, !tbaa !11
  %51 = load i32, ptr %10, align 4, !tbaa !11
  %52 = call ptr @MatNd_create(i32 noundef %50, i32 noundef %51)
  store ptr %52, ptr %15, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = load ptr, ptr %13, align 8, !tbaa !5
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  call void @RcsGraph_bodyPointJacobian(ptr noundef %53, ptr noundef %54, ptr noundef %55, ptr noundef null, ptr noundef %56)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %57 = load i32, ptr %10, align 4, !tbaa !11
  %58 = load i32, ptr %9, align 4, !tbaa !11
  %59 = call ptr @MatNd_create(i32 noundef %57, i32 noundef %58)
  store ptr %59, ptr %17, align 8, !tbaa !5
  %60 = load ptr, ptr %17, align 8, !tbaa !5
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_transpose(ptr noundef %60, ptr noundef %61)
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %67

64:                                               ; preds = %49
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  call void @MatNd_preMulDiagSelf(ptr noundef %65, ptr noundef %66)
  br label %67

67:                                               ; preds = %64, %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %68 = load i32, ptr %9, align 4, !tbaa !11
  %69 = load i32, ptr %9, align 4, !tbaa !11
  %70 = call ptr @MatNd_create(i32 noundef %68, i32 noundef %69)
  store ptr %70, ptr %18, align 8, !tbaa !5
  %71 = load ptr, ptr %18, align 8, !tbaa !5
  %72 = load ptr, ptr %15, align 8, !tbaa !5
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %71, ptr noundef %72, ptr noundef %73)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %74 = load ptr, ptr %18, align 8, !tbaa !5
  %75 = load ptr, ptr %18, align 8, !tbaa !5
  %76 = call double @MatNd_choleskyInverse(ptr noundef %74, ptr noundef %75)
  store double %76, ptr %19, align 8, !tbaa !9
  %77 = load double, ptr %19, align 8, !tbaa !9
  %78 = fcmp olt double %77, 1.000000e-03
  br i1 %78, label %79, label %129

79:                                               ; preds = %67
  br label %80

80:                                               ; preds = %79
  %81 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %82 = icmp ne ptr %81, null
  br i1 %82, label %83, label %95

83:                                               ; preds = %80
  %84 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %85 = load double, ptr %19, align 8, !tbaa !9
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %92

88:                                               ; preds = %83
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._RcsBody, ptr %89, i32 0, i32 6
  %91 = load ptr, ptr %90, align 8, !tbaa !21
  br label %93

92:                                               ; preds = %83
  br label %93

93:                                               ; preds = %92, %88
  %94 = phi ptr [ %91, %88 ], [ @.str.5, %92 ]
  call void (i32, ptr, ptr, i32, ptr, ...) %84(i32 noundef 4, ptr noundef @.str.2, ptr noundef @__func__.test_hessianPinv, i32 noundef 1019, ptr noundef @.str.4, double noundef %85, double noundef 1.000000e-03, ptr noundef %94)
  br label %95

95:                                               ; preds = %93, %80
  %96 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %97 = icmp sle i32 4, %96
  br i1 %97, label %98, label %115

98:                                               ; preds = %95
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef @.str.6, ptr noundef @.str.2, ptr noundef @__func__.test_hessianPinv, i32 noundef 1019) #5
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = load double, ptr %19, align 8, !tbaa !9
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %109

105:                                              ; preds = %98
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._RcsBody, ptr %106, i32 0, i32 6
  %108 = load ptr, ptr %107, align 8, !tbaa !21
  br label %110

109:                                              ; preds = %98
  br label %110

110:                                              ; preds = %109, %105
  %111 = phi ptr [ %108, %105 ], [ @.str.5, %109 ]
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef @.str.4, double noundef %102, double noundef 1.000000e-03, ptr noundef %111) #5
  %113 = load ptr, ptr @stderr, align 8, !tbaa !5
  %114 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %113, ptr noundef @.str.7) #5
  br label %115

115:                                              ; preds = %110, %95
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !11
  %120 = load i32, ptr %10, align 4, !tbaa !11
  %121 = mul nsw i32 %119, %120
  %122 = load i32, ptr %10, align 4, !tbaa !11
  %123 = mul nsw i32 %121, %122
  %124 = sext i32 %123 to i64
  %125 = mul i64 %124, 8
  call void @llvm.memset.p0.i64(ptr align 8 %118, i8 0, i64 %125, i1 false)
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %126)
  %127 = load ptr, ptr %17, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %127)
  %128 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %128)
  store i32 1, ptr %20, align 4
  br label %185

129:                                              ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %130 = load i32, ptr %10, align 4, !tbaa !11
  %131 = load i32, ptr %9, align 4, !tbaa !11
  %132 = call ptr @MatNd_create(i32 noundef %130, i32 noundef %131)
  store ptr %132, ptr %21, align 8, !tbaa !5
  %133 = load ptr, ptr %21, align 8, !tbaa !5
  %134 = load ptr, ptr %17, align 8, !tbaa !5
  %135 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %133, ptr noundef %134, ptr noundef %135)
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %136 = load i32, ptr %9, align 4, !tbaa !11
  %137 = load i32, ptr %10, align 4, !tbaa !11
  %138 = mul nsw i32 %136, %137
  %139 = load i32, ptr %10, align 4, !tbaa !11
  %140 = call ptr @MatNd_create(i32 noundef %138, i32 noundef %139)
  store ptr %140, ptr %22, align 8, !tbaa !5
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = load ptr, ptr %13, align 8, !tbaa !5
  %144 = load ptr, ptr %22, align 8, !tbaa !5
  call void @RcsGraph_bodyPointHessian(ptr noundef %141, ptr noundef %142, ptr noundef %143, ptr noundef null, ptr noundef %144)
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #5
  %145 = load i32, ptr %10, align 4, !tbaa !11
  %146 = load i32, ptr %10, align 4, !tbaa !11
  %147 = mul nsw i32 %145, %146
  %148 = load i32, ptr %9, align 4, !tbaa !11
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  call void @MatNd_fromPtr(ptr dead_on_unwind writable sret(%struct._MatNd) align 8 %23, i32 noundef %147, i32 noundef %148, ptr noundef %149)
  %150 = load ptr, ptr %15, align 8, !tbaa !5
  %151 = load ptr, ptr %22, align 8, !tbaa !5
  %152 = load ptr, ptr %16, align 8, !tbaa !5
  %153 = load ptr, ptr %18, align 8, !tbaa !5
  %154 = load ptr, ptr %21, align 8, !tbaa !5
  call void @MatNd_PinvHessian(ptr noundef %23, ptr noundef %150, ptr noundef %151, ptr noundef %152, ptr noundef %153, ptr noundef %154, i1 noundef zeroext false)
  %155 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %155)
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %156)
  %157 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %157)
  %158 = load ptr, ptr %21, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %158)
  %159 = load ptr, ptr %22, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %159)
  %160 = call double (...) @Timer_getTime()
  %161 = load double, ptr %8, align 8, !tbaa !9
  %162 = fsub double %160, %161
  store double %162, ptr %8, align 8, !tbaa !9
  br label %163

163:                                              ; preds = %129
  %164 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %165 = icmp ne ptr %164, null
  br i1 %165, label %166, label %170

166:                                              ; preds = %163
  %167 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %168 = load double, ptr %8, align 8, !tbaa !9
  %169 = fmul double 1.000000e+03, %168
  call void (i32, ptr, ptr, i32, ptr, ...) %167(i32 noundef 5, ptr noundef @.str.2, ptr noundef @__func__.test_hessianPinv, i32 noundef 1046, ptr noundef @.str.8, double noundef %169)
  br label %170

170:                                              ; preds = %166, %163
  %171 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %172 = icmp sle i32 5, %171
  br i1 %172, label %173, label %182

173:                                              ; preds = %170
  %174 = load ptr, ptr @stderr, align 8, !tbaa !5
  %175 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef @.str.6, ptr noundef @.str.2, ptr noundef @__func__.test_hessianPinv, i32 noundef 1046) #5
  %176 = load ptr, ptr @stderr, align 8, !tbaa !5
  %177 = load double, ptr %8, align 8, !tbaa !9
  %178 = fmul double 1.000000e+03, %177
  %179 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %176, ptr noundef @.str.8, double noundef %178) #5
  %180 = load ptr, ptr @stderr, align 8, !tbaa !5
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %180, ptr noundef @.str.7) #5
  br label %182

182:                                              ; preds = %173, %170
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  call void @llvm.lifetime.end.p0(i64 24, 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
  store i32 0, ptr %20, align 4
  br label %185

185:                                              ; preds = %184, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %186 = load i32, ptr %20, align 4
  switch i32 %186, label %188 [
    i32 0, label %187
    i32 1, label %187
  ]

187:                                              ; preds = %185, %185
  ret void

188:                                              ; preds = %185
  unreachable
}

declare double @Timer_getTime(...) #3

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

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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 nounwind willreturn memory(argmem: write) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 1852}
!14 = !{!"_RcsGraph", !6, i64 0, !7, i64 8, !12, i64 1848, !12, i64 1852, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888}
!15 = !{!14, !6, i64 0}
!16 = !{!17, !6, i64 168}
!17 = !{!"_RcsBody", !10, i64 0, !18, i64 8, !12, i64 12, !7, i64 16, !7, i64 40, !10, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!18 = !{!"_Bool", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!17, !6, i64 72}


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

%struct._MatNd = type { ptr, i32, i32, i32, i8 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GRADIENTTESTS_BODYPT1 = external dso_local global [3 x double], align 16
@__func__.test_hessianPinv = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Rcs_setIKState(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare void @MatNd_fromPtr(ptr dead_on_unwind writable sret(%struct._MatNd) align 8, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @RcsGraph_bodyPointJacobian(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @MatNd_mul(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @MatNd_destroy(ptr noundef) 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

declare void @RcsGraph_bodyPointHessian(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @MatNd_PinvHessian(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

declare ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef) local_unnamed_addr #3

declare void @MatNd_transpose(ptr noundef, ptr noundef) local_unnamed_addr #3

declare double @MatNd_choleskyInverse(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @test_hessianPinv(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct._MatNd, align 8
  tail call void @Rcs_setIKState(ptr noundef %2, ptr noundef %1)
  %5 = tail call double (...) @Timer_getTime() #5
  %6 = getelementptr inbounds i8, ptr %2, i64 1852
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = load ptr, ptr %2, align 8, !tbaa !11
  %.not80 = icmp eq ptr %8, null
  br i1 %.not80, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %3
  %.0.lcssa = phi ptr [ null, %3 ], [ %spec.select, %.lr.ph ]
  %9 = tail call ptr @MatNd_create(i32 noundef 3, i32 noundef %7) #5
  tail call void @RcsGraph_bodyPointJacobian(ptr noundef nonnull %2, ptr noundef %.0.lcssa, ptr noundef nonnull @RCS_GRADIENTTESTS_BODYPT1, ptr noundef null, ptr noundef %9) #5
  %10 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef 3) #5
  tail call void @MatNd_transpose(ptr noundef %10, ptr noundef %9) #5
  %11 = tail call ptr @MatNd_create(i32 noundef 3, i32 noundef 3) #5
  tail call void @MatNd_mul(ptr noundef %11, ptr noundef %9, ptr noundef %10) #5
  %12 = tail call double @MatNd_choleskyInverse(ptr noundef %11, ptr noundef %11) #5
  %13 = fcmp olt double %12, 1.000000e-03
  br i1 %13, label %17, label %45

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.082 = phi ptr [ %spec.select, %.lr.ph ], [ null, %3 ]
  %.07181 = phi ptr [ %16, %.lr.ph ], [ %8, %3 ]
  %14 = getelementptr inbounds i8, ptr %.07181, i64 168
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %.not79 = icmp eq ptr %15, null
  %spec.select = select i1 %.not79, ptr %.082, ptr %.07181
  %16 = tail call ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef nonnull %.07181) #5
  %.not = icmp eq ptr %16, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

17:                                               ; preds = %._crit_edge
  %18 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !18
  %.not76 = icmp eq ptr %18, null
  br i1 %.not76, label %25, label %19

19:                                               ; preds = %17
  %.not77 = icmp eq ptr %.0.lcssa, null
  br i1 %.not77, label %23, label %20

20:                                               ; preds = %19
  %21 = getelementptr inbounds i8, ptr %.0.lcssa, i64 72
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  br label %23

23:                                               ; preds = %19, %20
  %24 = phi ptr [ %22, %20 ], [ @.str.5, %19 ]
  tail call void (i32, ptr, ptr, i32, ptr, ...) %18(i32 noundef 4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.test_hessianPinv, i32 noundef 1019, ptr noundef nonnull @.str.4, double noundef %12, double noundef 1.000000e-03, ptr noundef %24) #5
  br label %25

25:                                               ; preds = %23, %17
  %26 = load i32, ptr @RcsLogLevel, align 4, !tbaa !20
  %27 = icmp sgt i32 %26, 3
  br i1 %27, label %28, label %40

28:                                               ; preds = %25
  %29 = load ptr, ptr @stderr, align 8, !tbaa !18
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.test_hessianPinv, i32 noundef 1019) #6
  %31 = load ptr, ptr @stderr, align 8, !tbaa !18
  %.not78 = icmp eq ptr %.0.lcssa, null
  br i1 %.not78, label %35, label %32

32:                                               ; preds = %28
  %33 = getelementptr inbounds i8, ptr %.0.lcssa, i64 72
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  br label %35

35:                                               ; preds = %28, %32
  %36 = phi ptr [ %34, %32 ], [ @.str.5, %28 ]
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.4, double noundef %12, double noundef 1.000000e-03, ptr noundef %36) #6
  %38 = load ptr, ptr @stderr, align 8, !tbaa !18
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.7) #6
  br label %40

40:                                               ; preds = %35, %25
  %41 = mul nsw i32 %7, 3
  %42 = mul nsw i32 %41, %7
  %43 = sext i32 %42 to i64
  %44 = shl nsw i64 %43, 3
  tail call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 %44, i1 false)
  tail call void @MatNd_destroy(ptr noundef %9) #5
  tail call void @MatNd_destroy(ptr noundef %10) #5
  tail call void @MatNd_destroy(ptr noundef %11) #5
  br label %67

45:                                               ; preds = %._crit_edge
  %46 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef 3) #5
  tail call void @MatNd_mul(ptr noundef %46, ptr noundef %10, ptr noundef %11) #5
  %47 = mul nsw i32 %7, 3
  %48 = tail call ptr @MatNd_create(i32 noundef %47, i32 noundef %7) #5
  tail call void @RcsGraph_bodyPointHessian(ptr noundef nonnull %2, ptr noundef %.0.lcssa, ptr noundef nonnull @RCS_GRADIENTTESTS_BODYPT1, ptr noundef null, ptr noundef %48) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  %49 = mul nsw i32 %7, %7
  call void @MatNd_fromPtr(ptr dead_on_unwind nonnull writable sret(%struct._MatNd) align 8 %4, i32 noundef %49, i32 noundef 3, ptr noundef %0) #5
  call void @MatNd_PinvHessian(ptr noundef nonnull %4, ptr noundef %9, ptr noundef %48, ptr noundef null, ptr noundef %11, ptr noundef %46, i1 noundef zeroext false) #5
  call void @MatNd_destroy(ptr noundef %9) #5
  call void @MatNd_destroy(ptr noundef %10) #5
  call void @MatNd_destroy(ptr noundef %11) #5
  call void @MatNd_destroy(ptr noundef %46) #5
  call void @MatNd_destroy(ptr noundef %48) #5
  %50 = call double (...) @Timer_getTime() #5
  %51 = fsub double %50, %5
  %52 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !18
  %.not75 = icmp eq ptr %52, null
  br i1 %.not75, label %55, label %53

53:                                               ; preds = %45
  %54 = fmul double %51, 1.000000e+03
  call void (i32, ptr, ptr, i32, ptr, ...) %52(i32 noundef 5, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.test_hessianPinv, i32 noundef 1046, ptr noundef nonnull @.str.8, double noundef %54) #5
  br label %55

55:                                               ; preds = %53, %45
  %56 = load i32, ptr @RcsLogLevel, align 4, !tbaa !20
  %57 = icmp sgt i32 %56, 4
  br i1 %57, label %58, label %66

58:                                               ; preds = %55
  %59 = load ptr, ptr @stderr, align 8, !tbaa !18
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.test_hessianPinv, i32 noundef 1046) #6
  %61 = load ptr, ptr @stderr, align 8, !tbaa !18
  %62 = fmul double %51, 1.000000e+03
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.8, double noundef %62) #6
  %64 = load ptr, ptr @stderr, align 8, !tbaa !18
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef nonnull @.str.7) #6
  br label %66

66:                                               ; preds = %58, %55
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %67

67:                                               ; preds = %66, %40
  ret void
}

declare double @Timer_getTime(...) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { 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, !10, i64 1852}
!6 = !{!"_RcsGraph", !7, i64 0, !8, i64 8, !10, i64 1848, !10, i64 1852, !7, i64 1856, !7, i64 1864, !7, i64 1872, !7, i64 1880, !7, i64 1888}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !7, i64 168}
!13 = !{!"_RcsBody", !14, i64 0, !15, i64 8, !10, i64 12, !8, i64 16, !8, i64 40, !14, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176}
!14 = !{!"double", !8, i64 0}
!15 = !{!"_Bool", !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!7, !7, i64 0}
!19 = !{!13, !7, i64 72}
!20 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass