; 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 }
%struct.HTr = type { [3 x double], [3 x [3 x double]] }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@x_target_qprop = external hidden global [3 x double], align 16
@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
@__func__.test_dqprop_ts3 = external hidden unnamed_addr constant [16 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 @Vec3d_sub(ptr noundef, ptr noundef, ptr 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 @Vec3d_constMul(ptr noundef, ptr noundef, double noundef) #3

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 void @MatNd_reshape(ptr noundef, i32 noundef, i32 noundef) #3

declare void @MatNd_constMul(ptr noundef, ptr noundef, double noundef) #3

declare ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef) #3

declare ptr @Vec3d_zeroVec(...) #3

declare void @MatNd_setZero(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @test_dqprop_ts3(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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca double, 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 ptr, align 8
  %20 = alloca double, align 8
  %21 = alloca %struct._MatNd, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = 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) #4
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  call void @Rcs_setIKState(ptr noundef %31, ptr noundef %32)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._RcsGraph, ptr %33, i32 0, i32 3
  %35 = load i32, ptr %34, align 4, !tbaa !11
  store i32 %35, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._RcsGraph, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  store ptr %38, ptr %11, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %51, %3
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %54

43:                                               ; preds = %39
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._RcsBody, ptr %44, i32 0, i32 18
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %50

48:                                               ; preds = %43
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %49, ptr %10, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %48, %43
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = call ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef %52)
  store ptr %53, ptr %11, align 8, !tbaa !5
  br label %39, !llvm.loop !18

54:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store double 1.000000e-03, ptr %13, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store double 1.000000e-03, ptr %14, align 8, !tbaa !20
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %63

57:                                               ; preds = %54
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._RcsBody, ptr %58, i32 0, i32 10
  %60 = load ptr, ptr %59, align 8, !tbaa !21
  %61 = getelementptr inbounds %struct.HTr, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds [3 x double], ptr %61, i64 0, i64 0
  br label %65

63:                                               ; preds = %54
  %64 = call ptr (...) @Vec3d_zeroVec()
  br label %65

65:                                               ; preds = %63, %57
  %66 = phi ptr [ %62, %57 ], [ %64, %63 ]
  call void @Vec3d_constMul(ptr noundef @x_target_qprop, ptr noundef %66, double noundef 0x3FEFF7CED916872B)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %67 = call ptr @MatNd_create(i32 noundef 3, i32 noundef 1)
  store ptr %67, ptr %15, align 8, !tbaa !5
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._MatNd, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !22
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %79

73:                                               ; preds = %65
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._RcsBody, ptr %74, i32 0, i32 10
  %76 = load ptr, ptr %75, align 8, !tbaa !21
  %77 = getelementptr inbounds %struct.HTr, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds [3 x double], ptr %77, i64 0, i64 0
  br label %81

79:                                               ; preds = %65
  %80 = call ptr (...) @Vec3d_zeroVec()
  br label %81

81:                                               ; preds = %79, %73
  %82 = phi ptr [ %78, %73 ], [ %80, %79 ]
  call void @Vec3d_sub(ptr noundef %70, ptr noundef %82, ptr noundef @x_target_qprop)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = call ptr @MatNd_create(i32 noundef %83, i32 noundef %84)
  store ptr %85, ptr %16, align 8, !tbaa !5
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = load ptr, ptr %16, align 8, !tbaa !5
  call void @RcsGraph_bodyPointJacobian(ptr noundef %86, ptr noundef %87, ptr noundef %88, ptr noundef null, ptr noundef %89)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = call ptr @MatNd_create(i32 noundef %90, i32 noundef %91)
  store ptr %92, ptr %18, align 8, !tbaa !5
  %93 = load ptr, ptr %18, align 8, !tbaa !5
  %94 = load ptr, ptr %16, align 8, !tbaa !5
  call void @MatNd_transpose(ptr noundef %93, ptr noundef %94)
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %100

97:                                               ; preds = %81
  %98 = load ptr, ptr %18, align 8, !tbaa !5
  %99 = load ptr, ptr %17, align 8, !tbaa !5
  call void @MatNd_preMulDiagSelf(ptr noundef %98, ptr noundef %99)
  br label %100

100:                                              ; preds = %97, %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = call ptr @MatNd_create(i32 noundef %101, i32 noundef %102)
  store ptr %103, ptr %19, align 8, !tbaa !5
  %104 = load ptr, ptr %19, align 8, !tbaa !5
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %104, ptr noundef %105, ptr noundef %106)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %107 = load ptr, ptr %19, align 8, !tbaa !5
  %108 = load ptr, ptr %19, align 8, !tbaa !5
  %109 = call double @MatNd_choleskyInverse(ptr noundef %107, ptr noundef %108)
  store double %109, ptr %20, align 8, !tbaa !20
  %110 = load double, ptr %20, align 8, !tbaa !20
  %111 = fcmp olt double %110, 1.000000e-03
  br i1 %111, label %112, label %158

112:                                              ; preds = %100
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %115 = icmp ne ptr %114, null
  br i1 %115, label %116, label %128

116:                                              ; preds = %113
  %117 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %118 = load double, ptr %20, align 8, !tbaa !20
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %125

121:                                              ; preds = %116
  %122 = load ptr, ptr %10, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._RcsBody, ptr %122, i32 0, i32 6
  %124 = load ptr, ptr %123, align 8, !tbaa !24
  br label %126

125:                                              ; preds = %116
  br label %126

126:                                              ; preds = %125, %121
  %127 = phi ptr [ %124, %121 ], [ @.str.5, %125 ]
  call void (i32, ptr, ptr, i32, ptr, ...) %117(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__.test_dqprop_ts3, i32 noundef 822, ptr noundef @.str.4, double noundef %118, double noundef 1.000000e-03, ptr noundef %127)
  br label %128

128:                                              ; preds = %126, %113
  %129 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %130 = icmp sle i32 1, %129
  br i1 %130, label %131, label %148

131:                                              ; preds = %128
  %132 = load ptr, ptr @stderr, align 8, !tbaa !5
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %132, ptr noundef @.str.6, ptr noundef @.str.2, ptr noundef @__func__.test_dqprop_ts3, i32 noundef 822) #4
  %134 = load ptr, ptr @stderr, align 8, !tbaa !5
  %135 = load double, ptr %20, align 8, !tbaa !20
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = icmp ne ptr %136, null
  br i1 %137, label %138, label %142

138:                                              ; preds = %131
  %139 = load ptr, ptr %10, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct._RcsBody, ptr %139, i32 0, i32 6
  %141 = load ptr, ptr %140, align 8, !tbaa !24
  br label %143

142:                                              ; preds = %131
  br label %143

143:                                              ; preds = %142, %138
  %144 = phi ptr [ %141, %138 ], [ @.str.5, %142 ]
  %145 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef @.str.4, double noundef %135, double noundef 1.000000e-03, ptr noundef %144) #4
  %146 = load ptr, ptr @stderr, align 8, !tbaa !5
  %147 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.7) #4
  br label %148

148:                                              ; preds = %143, %128
  br label %149

149:                                              ; preds = %148
  br label %150

150:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #4
  %151 = load i32, ptr %9, align 4, !tbaa !9
  %152 = load i32, ptr %9, align 4, !tbaa !9
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  call void @MatNd_fromPtr(ptr dead_on_unwind writable sret(%struct._MatNd) align 8 %21, i32 noundef %151, i32 noundef %152, ptr noundef %153)
  call void @MatNd_setZero(ptr noundef %21)
  %154 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %154)
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %155)
  %156 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %156)
  %157 = load ptr, ptr %19, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %157)
  store i32 1, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #4
  br label %221

158:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %159 = load i32, ptr %9, align 4, !tbaa !9
  %160 = load i32, ptr %8, align 4, !tbaa !9
  %161 = call ptr @MatNd_create(i32 noundef %159, i32 noundef %160)
  store ptr %161, ptr %23, align 8, !tbaa !5
  %162 = load ptr, ptr %23, align 8, !tbaa !5
  %163 = load ptr, ptr %18, align 8, !tbaa !5
  %164 = load ptr, ptr %19, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %162, ptr noundef %163, ptr noundef %164)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %165 = load i32, ptr %8, align 4, !tbaa !9
  %166 = load i32, ptr %9, align 4, !tbaa !9
  %167 = mul nsw i32 %165, %166
  %168 = load i32, ptr %9, align 4, !tbaa !9
  %169 = call ptr @MatNd_create(i32 noundef %167, i32 noundef %168)
  store ptr %169, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %170 = load i32, ptr %9, align 4, !tbaa !9
  %171 = load i32, ptr %9, align 4, !tbaa !9
  %172 = mul nsw i32 %170, %171
  %173 = load i32, ptr %8, align 4, !tbaa !9
  %174 = call ptr @MatNd_create(i32 noundef %172, i32 noundef %173)
  store ptr %174, ptr %25, align 8, !tbaa !5
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = load ptr, ptr %12, align 8, !tbaa !5
  %178 = load ptr, ptr %24, align 8, !tbaa !5
  call void @RcsGraph_bodyPointHessian(ptr noundef %175, ptr noundef %176, ptr noundef %177, ptr noundef null, ptr noundef %178)
  %179 = load ptr, ptr %25, align 8, !tbaa !5
  %180 = load ptr, ptr %16, align 8, !tbaa !5
  %181 = load ptr, ptr %24, align 8, !tbaa !5
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  %183 = load ptr, ptr %19, align 8, !tbaa !5
  %184 = load ptr, ptr %23, align 8, !tbaa !5
  call void @MatNd_PinvHessian(ptr noundef %179, ptr noundef %180, ptr noundef %181, ptr noundef %182, ptr noundef %183, ptr noundef %184, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %185 = load i32, ptr %8, align 4, !tbaa !9
  %186 = load i32, ptr %9, align 4, !tbaa !9
  %187 = call ptr @MatNd_create(i32 noundef %185, i32 noundef %186)
  store ptr %187, ptr %26, align 8, !tbaa !5
  %188 = load ptr, ptr %26, align 8, !tbaa !5
  %189 = load ptr, ptr %16, align 8, !tbaa !5
  call void @MatNd_constMul(ptr noundef %188, ptr noundef %189, double noundef -1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  %190 = load i32, ptr %9, align 4, !tbaa !9
  %191 = load i32, ptr %9, align 4, !tbaa !9
  %192 = mul nsw i32 %190, %191
  %193 = call ptr @MatNd_create(i32 noundef %192, i32 noundef 1)
  store ptr %193, ptr %27, align 8, !tbaa !5
  %194 = load ptr, ptr %27, align 8, !tbaa !5
  %195 = load ptr, ptr %25, align 8, !tbaa !5
  %196 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %194, ptr noundef %195, ptr noundef %196)
  %197 = load ptr, ptr %27, align 8, !tbaa !5
  %198 = load i32, ptr %9, align 4, !tbaa !9
  %199 = load i32, ptr %9, align 4, !tbaa !9
  call void @MatNd_reshape(ptr noundef %197, i32 noundef %198, i32 noundef %199)
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  %200 = load i32, ptr %9, align 4, !tbaa !9
  %201 = load i32, ptr %9, align 4, !tbaa !9
  %202 = call ptr @MatNd_create(i32 noundef %200, i32 noundef %201)
  store ptr %202, ptr %28, align 8, !tbaa !5
  %203 = load ptr, ptr %28, align 8, !tbaa !5
  %204 = load ptr, ptr %23, align 8, !tbaa !5
  %205 = load ptr, ptr %26, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %203, ptr noundef %204, ptr noundef %205)
  call void @llvm.lifetime.start.p0(i64 24, ptr %29) #4
  %206 = load i32, ptr %9, align 4, !tbaa !9
  %207 = load i32, ptr %9, align 4, !tbaa !9
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  call void @MatNd_fromPtr(ptr dead_on_unwind writable sret(%struct._MatNd) align 8 %29, i32 noundef %206, i32 noundef %207, ptr noundef %208)
  call void @MatNd_setIdentity(ptr noundef %29)
  %209 = load ptr, ptr %27, align 8, !tbaa !5
  call void @MatNd_subSelf(ptr noundef %29, ptr noundef %209)
  %210 = load ptr, ptr %28, align 8, !tbaa !5
  call void @MatNd_subSelf(ptr noundef %29, ptr noundef %210)
  %211 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %211)
  %212 = load ptr, ptr %16, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %212)
  %213 = load ptr, ptr %18, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %213)
  %214 = load ptr, ptr %19, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %214)
  %215 = load ptr, ptr %23, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %215)
  %216 = load ptr, ptr %24, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %216)
  %217 = load ptr, ptr %25, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %217)
  %218 = load ptr, ptr %26, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %218)
  %219 = load ptr, ptr %27, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %219)
  %220 = load ptr, ptr %28, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %220)
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  store i32 0, ptr %22, align 4
  br label %221

221:                                              ; preds = %158, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %222 = load i32, ptr %22, align 4
  switch i32 %222, label %224 [
    i32 0, label %223
    i32 1, label %223
  ]

223:                                              ; preds = %221, %221
  ret void

224:                                              ; preds = %221
  unreachable
}

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

declare void @MatNd_setIdentity(ptr noundef) #3

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

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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 1852}
!12 = !{!"_RcsGraph", !6, i64 0, !7, i64 8, !10, i64 1848, !10, i64 1852, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888}
!13 = !{!12, !6, i64 0}
!14 = !{!15, !6, i64 168}
!15 = !{!"_RcsBody", !16, i64 0, !17, i64 8, !10, i64 12, !7, i64 16, !7, i64 40, !16, 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}
!16 = !{!"double", !7, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!16, !16, i64 0}
!21 = !{!15, !6, i64 104}
!22 = !{!23, !6, i64 0}
!23 = !{!"_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !17, i64 20}
!24 = !{!15, !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
@x_target_qprop = external hidden global [3 x double], align 16
@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
@__func__.test_dqprop_ts3 = external hidden unnamed_addr constant [16 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 @Vec3d_sub(ptr noundef, ptr noundef, ptr 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 @Vec3d_constMul(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #3

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 void @MatNd_reshape(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @MatNd_constMul(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #3

declare ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef) local_unnamed_addr #3

declare ptr @Vec3d_zeroVec(...) local_unnamed_addr #3

declare void @MatNd_setZero(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @test_dqprop_ts3(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct._MatNd, align 8
  %5 = alloca %struct._MatNd, align 8
  tail call void @Rcs_setIKState(ptr noundef %2, ptr noundef %1)
  %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
  %.not106 = icmp eq ptr %8, null
  br i1 %.not106, label %._crit_edge.thread, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %.not103 = icmp eq ptr %spec.select, null
  br i1 %.not103, label %._crit_edge.thread, label %12

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.0108 = phi ptr [ %spec.select, %.lr.ph ], [ null, %3 ]
  %.0100107 = phi ptr [ %11, %.lr.ph ], [ %8, %3 ]
  %9 = getelementptr inbounds i8, ptr %.0100107, i64 168
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %.not105 = icmp eq ptr %10, null
  %spec.select = select i1 %.not105, ptr %.0108, ptr %.0100107
  %11 = tail call ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef nonnull %.0100107) #4
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

12:                                               ; preds = %._crit_edge
  %13 = getelementptr inbounds i8, ptr %spec.select, i64 104
  %14 = load ptr, ptr %13, align 8, !tbaa !18
  br label %16

._crit_edge.thread:                               ; preds = %3, %._crit_edge
  %15 = tail call ptr (...) @Vec3d_zeroVec() #4
  br label %16

16:                                               ; preds = %._crit_edge.thread, %12
  %.not103113 = phi i1 [ false, %12 ], [ true, %._crit_edge.thread ]
  %.0.lcssa111 = phi ptr [ %spec.select, %12 ], [ null, %._crit_edge.thread ]
  %17 = phi ptr [ %14, %12 ], [ %15, %._crit_edge.thread ]
  tail call void @Vec3d_constMul(ptr noundef nonnull @x_target_qprop, ptr noundef %17, double noundef 0x3FEFF7CED916872B) #4
  %18 = tail call ptr @MatNd_create(i32 noundef 3, i32 noundef 1) #4
  %19 = load ptr, ptr %18, align 8, !tbaa !19
  br i1 %.not103113, label %23, label %20

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %.0.lcssa111, i64 104
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  br label %25

23:                                               ; preds = %16
  %24 = tail call ptr (...) @Vec3d_zeroVec() #4
  br label %25

25:                                               ; preds = %23, %20
  %26 = phi ptr [ %22, %20 ], [ %24, %23 ]
  tail call void @Vec3d_sub(ptr noundef %19, ptr noundef %26, ptr noundef nonnull @x_target_qprop) #4
  %27 = tail call ptr @MatNd_create(i32 noundef 3, i32 noundef %7) #4
  tail call void @RcsGraph_bodyPointJacobian(ptr noundef nonnull %2, ptr noundef %.0.lcssa111, ptr noundef null, ptr noundef null, ptr noundef %27) #4
  %28 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef 3) #4
  tail call void @MatNd_transpose(ptr noundef %28, ptr noundef %27) #4
  %29 = tail call ptr @MatNd_create(i32 noundef 3, i32 noundef 3) #4
  tail call void @MatNd_mul(ptr noundef %29, ptr noundef %27, ptr noundef %28) #4
  %30 = tail call double @MatNd_choleskyInverse(ptr noundef %29, ptr noundef %29) #4
  %31 = fcmp olt double %30, 1.000000e-03
  br i1 %31, label %32, label %56

32:                                               ; preds = %25
  %33 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !21
  %.not104 = icmp eq ptr %33, null
  br i1 %.not104, label %40, label %34

34:                                               ; preds = %32
  br i1 %.not103113, label %38, label %35

35:                                               ; preds = %34
  %36 = getelementptr inbounds i8, ptr %.0.lcssa111, i64 72
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  br label %38

38:                                               ; preds = %34, %35
  %39 = phi ptr [ %37, %35 ], [ @.str.5, %34 ]
  tail call void (i32, ptr, ptr, i32, ptr, ...) %33(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.test_dqprop_ts3, i32 noundef 822, ptr noundef nonnull @.str.4, double noundef %30, double noundef 1.000000e-03, ptr noundef %39) #4
  br label %40

40:                                               ; preds = %38, %32
  %41 = load i32, ptr @RcsLogLevel, align 4, !tbaa !23
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %43, label %55

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !21
  %45 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.test_dqprop_ts3, i32 noundef 822) #5
  %46 = load ptr, ptr @stderr, align 8, !tbaa !21
  br i1 %.not103113, label %50, label %47

47:                                               ; preds = %43
  %48 = getelementptr inbounds i8, ptr %.0.lcssa111, i64 72
  %49 = load ptr, ptr %48, align 8, !tbaa !22
  br label %50

50:                                               ; preds = %43, %47
  %51 = phi ptr [ %49, %47 ], [ @.str.5, %43 ]
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.4, double noundef %30, double noundef 1.000000e-03, ptr noundef %51) #5
  %53 = load ptr, ptr @stderr, align 8, !tbaa !21
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.7) #5
  br label %55

55:                                               ; preds = %50, %40
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  call void @MatNd_fromPtr(ptr dead_on_unwind nonnull writable sret(%struct._MatNd) align 8 %4, i32 noundef %7, i32 noundef %7, ptr noundef %0) #4
  call void @MatNd_setZero(ptr noundef nonnull %4) #4
  call void @MatNd_destroy(ptr noundef nonnull %18) #4
  call void @MatNd_destroy(ptr noundef %27) #4
  call void @MatNd_destroy(ptr noundef %28) #4
  call void @MatNd_destroy(ptr noundef %29) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  br label %65

56:                                               ; preds = %25
  %57 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef 3) #4
  tail call void @MatNd_mul(ptr noundef %57, ptr noundef %28, ptr noundef %29) #4
  %58 = mul nsw i32 %7, 3
  %59 = tail call ptr @MatNd_create(i32 noundef %58, i32 noundef %7) #4
  %60 = mul nsw i32 %7, %7
  %61 = tail call ptr @MatNd_create(i32 noundef %60, i32 noundef 3) #4
  tail call void @RcsGraph_bodyPointHessian(ptr noundef nonnull %2, ptr noundef %.0.lcssa111, ptr noundef null, ptr noundef null, ptr noundef %59) #4
  tail call void @MatNd_PinvHessian(ptr noundef %61, ptr noundef %27, ptr noundef %59, ptr noundef null, ptr noundef %29, ptr noundef %57, i1 noundef zeroext false) #4
  %62 = tail call ptr @MatNd_create(i32 noundef 3, i32 noundef %7) #4
  tail call void @MatNd_constMul(ptr noundef %62, ptr noundef %27, double noundef -1.000000e+00) #4
  %63 = tail call ptr @MatNd_create(i32 noundef %60, i32 noundef 1) #4
  tail call void @MatNd_mul(ptr noundef %63, ptr noundef %61, ptr noundef nonnull %18) #4
  tail call void @MatNd_reshape(ptr noundef %63, i32 noundef %7, i32 noundef %7) #4
  %64 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef %7) #4
  tail call void @MatNd_mul(ptr noundef %64, ptr noundef %57, ptr noundef %62) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  call void @MatNd_fromPtr(ptr dead_on_unwind nonnull writable sret(%struct._MatNd) align 8 %5, i32 noundef %7, i32 noundef %7, ptr noundef %0) #4
  call void @MatNd_setIdentity(ptr noundef nonnull %5) #4
  call void @MatNd_subSelf(ptr noundef nonnull %5, ptr noundef %63) #4
  call void @MatNd_subSelf(ptr noundef nonnull %5, ptr noundef %64) #4
  call void @MatNd_destroy(ptr noundef nonnull %18) #4
  call void @MatNd_destroy(ptr noundef %27) #4
  call void @MatNd_destroy(ptr noundef %28) #4
  call void @MatNd_destroy(ptr noundef %29) #4
  call void @MatNd_destroy(ptr noundef %57) #4
  call void @MatNd_destroy(ptr noundef %59) #4
  call void @MatNd_destroy(ptr noundef %61) #4
  call void @MatNd_destroy(ptr noundef %62) #4
  call void @MatNd_destroy(ptr noundef %63) #4
  call void @MatNd_destroy(ptr noundef %64) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  br label %65

65:                                               ; preds = %56, %55
  ret void
}

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

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

declare void @MatNd_setIdentity(ptr noundef) local_unnamed_addr #3

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

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 = { nounwind }
attributes #5 = { 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 = !{!13, !7, i64 104}
!19 = !{!20, !7, i64 0}
!20 = !{!"_MatNd", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 20}
!21 = !{!7, !7, i64 0}
!22 = !{!13, !7, i64 72}
!23 = !{!10, !10, i64 0}


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