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

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

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

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

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

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

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

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

declare void @MatNd_destroy(ptr noundef) #1

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

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

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

declare void @MatNd_addSelf(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @RcsGraph_dAdq(ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) #3

declare void @MatNd_transposeSelf(ptr noundef) #1

declare zeroext i1 @RcsBody_isArticulated(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @RcsGraph_3dOmegaHessian(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._RcsGraph, ptr %21, i32 0, i32 3
  %23 = load i32, ptr %22, align 4, !tbaa !9
  store i32 %23, ptr %11, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %24 = load i32, ptr %11, align 4, !tbaa !12
  %25 = mul nsw i32 %24, 3
  store i32 %25, ptr %12, align 4, !tbaa !12
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %38

28:                                               ; preds = %5
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %38

31:                                               ; preds = %28
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = load i32, ptr %11, align 4, !tbaa !12
  %34 = load i32, ptr %12, align 4, !tbaa !12
  call void @MatNd_reshape(ptr noundef %32, i32 noundef %33, i32 noundef %34)
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  call void @RcsGraph_rotationHessian(ptr noundef %35, ptr noundef %36, ptr noundef null, ptr noundef %37)
  br label %307

38:                                               ; preds = %28, %5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %62

41:                                               ; preds = %38
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = icmp eq ptr %42, %43
  br i1 %44, label %45, label %62

45:                                               ; preds = %41
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = call zeroext i1 @RcsBody_isArticulated(ptr noundef %46)
  %48 = zext i1 %47 to i32
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %62

50:                                               ; preds = %45
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = load i32, ptr %11, align 4, !tbaa !12
  %53 = load i32, ptr %12, align 4, !tbaa !12
  call void @MatNd_reshape(ptr noundef %51, i32 noundef %52, i32 noundef %53)
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._RcsBody, ptr %56, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = getelementptr inbounds %struct.HTr, ptr %58, i32 0, i32 1
  %60 = getelementptr inbounds [3 x [3 x double]], ptr %59, i64 0, i64 0
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  call void @RcsGraph_rotationHessian(ptr noundef %54, ptr noundef %55, ptr noundef %60, ptr noundef %61)
  br label %306

62:                                               ; preds = %45, %41, %38
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = load i32, ptr %12, align 4, !tbaa !12
  %65 = load i32, ptr %11, align 4, !tbaa !12
  call void @MatNd_reshape(ptr noundef %63, i32 noundef %64, i32 noundef %65)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store ptr null, ptr %13, align 8, !tbaa !5
  %66 = load i32, ptr %12, align 4, !tbaa !12
  %67 = load i32, ptr %11, align 4, !tbaa !12
  %68 = mul nsw i32 %66, %67
  %69 = icmp sgt i32 %68, 1296
  br i1 %69, label %70, label %74

70:                                               ; preds = %62
  %71 = load i32, ptr %12, align 4, !tbaa !12
  %72 = load i32, ptr %11, align 4, !tbaa !12
  %73 = call ptr @MatNd_create(i32 noundef %71, i32 noundef %72)
  store ptr %73, ptr %13, align 8, !tbaa !5
  br label %112

74:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %75 = load i32, ptr %12, align 4, !tbaa !12
  %76 = load i32, ptr %11, align 4, !tbaa !12
  %77 = mul nsw i32 %75, %76
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %74
  br label %84

80:                                               ; preds = %74
  %81 = load i32, ptr %12, align 4, !tbaa !12
  %82 = load i32, ptr %11, align 4, !tbaa !12
  %83 = mul nsw i32 %81, %82
  br label %84

84:                                               ; preds = %80, %79
  %85 = phi i32 [ 1, %79 ], [ %83, %80 ]
  store i32 %85, ptr %14, align 4, !tbaa !12
  %86 = load i32, ptr %14, align 4, !tbaa !12
  %87 = zext i32 %86 to i64
  %88 = mul i64 %87, 8
  %89 = add i64 24, %88
  %90 = alloca i8, i64 %89, align 16
  store ptr %90, ptr %13, align 8, !tbaa !5
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._MatNd, ptr %91, i64 1
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._MatNd, ptr %93, i32 0, i32 0
  store ptr %92, ptr %94, align 8, !tbaa !17
  %95 = load i32, ptr %12, align 4, !tbaa !12
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._MatNd, ptr %96, i32 0, i32 1
  store i32 %95, ptr %97, align 8, !tbaa !19
  %98 = load i32, ptr %11, align 4, !tbaa !12
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._MatNd, ptr %99, i32 0, i32 2
  store i32 %98, ptr %100, align 4, !tbaa !20
  %101 = load i32, ptr %14, align 4, !tbaa !12
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._MatNd, ptr %102, i32 0, i32 3
  store i32 %101, ptr %103, align 8, !tbaa !21
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._MatNd, ptr %104, i32 0, i32 4
  store i8 1, ptr %105, align 4, !tbaa !22
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._MatNd, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !17
  %109 = load i32, ptr %14, align 4, !tbaa !12
  %110 = zext i32 %109 to i64
  %111 = mul i64 %110, 8
  call void @llvm.memset.p0.i64(ptr align 8 %108, i8 0, i64 %111, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %112

112:                                              ; preds = %84, %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store ptr null, ptr %15, align 8, !tbaa !5
  %113 = load i32, ptr %11, align 4, !tbaa !12
  %114 = mul nsw i32 3, %113
  %115 = icmp sgt i32 %114, 1296
  br i1 %115, label %116, label %119

116:                                              ; preds = %112
  %117 = load i32, ptr %11, align 4, !tbaa !12
  %118 = call ptr @MatNd_create(i32 noundef 3, i32 noundef %117)
  store ptr %118, ptr %15, align 8, !tbaa !5
  br label %154

119:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %120 = load i32, ptr %11, align 4, !tbaa !12
  %121 = mul nsw i32 3, %120
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %124

123:                                              ; preds = %119
  br label %127

124:                                              ; preds = %119
  %125 = load i32, ptr %11, align 4, !tbaa !12
  %126 = mul nsw i32 3, %125
  br label %127

127:                                              ; preds = %124, %123
  %128 = phi i32 [ 1, %123 ], [ %126, %124 ]
  store i32 %128, ptr %16, align 4, !tbaa !12
  %129 = load i32, ptr %16, align 4, !tbaa !12
  %130 = zext i32 %129 to i64
  %131 = mul i64 %130, 8
  %132 = add i64 24, %131
  %133 = alloca i8, i64 %132, align 16
  store ptr %133, ptr %15, align 8, !tbaa !5
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._MatNd, ptr %134, i64 1
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._MatNd, ptr %136, i32 0, i32 0
  store ptr %135, ptr %137, align 8, !tbaa !17
  %138 = load ptr, ptr %15, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._MatNd, ptr %138, i32 0, i32 1
  store i32 3, ptr %139, align 8, !tbaa !19
  %140 = load i32, ptr %11, align 4, !tbaa !12
  %141 = load ptr, ptr %15, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._MatNd, ptr %141, i32 0, i32 2
  store i32 %140, ptr %142, align 4, !tbaa !20
  %143 = load i32, ptr %16, align 4, !tbaa !12
  %144 = load ptr, ptr %15, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._MatNd, ptr %144, i32 0, i32 3
  store i32 %143, ptr %145, align 8, !tbaa !21
  %146 = load ptr, ptr %15, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._MatNd, ptr %146, i32 0, i32 4
  store i8 1, ptr %147, align 4, !tbaa !22
  %148 = load ptr, ptr %15, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._MatNd, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !17
  %151 = load i32, ptr %16, align 4, !tbaa !12
  %152 = zext i32 %151 to i64
  %153 = mul i64 %152, 8
  call void @llvm.memset.p0.i64(ptr align 8 %150, i8 0, i64 %153, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %154

154:                                              ; preds = %127, %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  store ptr null, ptr %17, align 8, !tbaa !5
  %155 = load i32, ptr %12, align 4, !tbaa !12
  %156 = mul nsw i32 %155, 3
  %157 = icmp sgt i32 %156, 1296
  br i1 %157, label %158, label %161

158:                                              ; preds = %154
  %159 = load i32, ptr %12, align 4, !tbaa !12
  %160 = call ptr @MatNd_create(i32 noundef %159, i32 noundef 3)
  store ptr %160, ptr %17, align 8, !tbaa !5
  br label %196

161:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %162 = load i32, ptr %12, align 4, !tbaa !12
  %163 = mul nsw i32 %162, 3
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %166

165:                                              ; preds = %161
  br label %169

166:                                              ; preds = %161
  %167 = load i32, ptr %12, align 4, !tbaa !12
  %168 = mul nsw i32 %167, 3
  br label %169

169:                                              ; preds = %166, %165
  %170 = phi i32 [ 1, %165 ], [ %168, %166 ]
  store i32 %170, ptr %18, align 4, !tbaa !12
  %171 = load i32, ptr %18, align 4, !tbaa !12
  %172 = zext i32 %171 to i64
  %173 = mul i64 %172, 8
  %174 = add i64 24, %173
  %175 = alloca i8, i64 %174, align 16
  store ptr %175, ptr %17, align 8, !tbaa !5
  %176 = load ptr, ptr %17, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct._MatNd, ptr %176, i64 1
  %178 = load ptr, ptr %17, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct._MatNd, ptr %178, i32 0, i32 0
  store ptr %177, ptr %179, align 8, !tbaa !17
  %180 = load i32, ptr %12, align 4, !tbaa !12
  %181 = load ptr, ptr %17, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct._MatNd, ptr %181, i32 0, i32 1
  store i32 %180, ptr %182, align 8, !tbaa !19
  %183 = load ptr, ptr %17, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct._MatNd, ptr %183, i32 0, i32 2
  store i32 3, ptr %184, align 4, !tbaa !20
  %185 = load i32, ptr %18, align 4, !tbaa !12
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._MatNd, ptr %186, i32 0, i32 3
  store i32 %185, ptr %187, align 8, !tbaa !21
  %188 = load ptr, ptr %17, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct._MatNd, ptr %188, i32 0, i32 4
  store i8 1, ptr %189, align 4, !tbaa !22
  %190 = load ptr, ptr %17, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct._MatNd, ptr %190, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8, !tbaa !17
  %193 = load i32, ptr %18, align 4, !tbaa !12
  %194 = zext i32 %193 to i64
  %195 = mul i64 %194, 8
  call void @llvm.memset.p0.i64(ptr align 8 %192, i8 0, i64 %195, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %196

196:                                              ; preds = %169, %158
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = load ptr, ptr %9, align 8, !tbaa !5
  %199 = load ptr, ptr %17, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct._MatNd, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !17
  %202 = getelementptr inbounds double, ptr %201, i64 0
  call void @RcsGraph_dAdq(ptr noundef %197, ptr noundef %198, ptr noundef %202, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  store ptr null, ptr %19, align 8, !tbaa !5
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct._RcsGraph, ptr %203, i32 0, i32 3
  %205 = load i32, ptr %204, align 4, !tbaa !9
  %206 = mul i32 3, %205
  %207 = icmp ugt i32 %206, 1296
  br i1 %207, label %208, label %213

208:                                              ; preds = %196
  %209 = load ptr, ptr %6, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct._RcsGraph, ptr %209, i32 0, i32 3
  %211 = load i32, ptr %210, align 4, !tbaa !9
  %212 = call ptr @MatNd_create(i32 noundef 3, i32 noundef %211)
  store ptr %212, ptr %19, align 8, !tbaa !5
  br label %254

213:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %214 = load ptr, ptr %6, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct._RcsGraph, ptr %214, i32 0, i32 3
  %216 = load i32, ptr %215, align 4, !tbaa !9
  %217 = mul i32 3, %216
  %218 = icmp eq i32 %217, 0
  br i1 %218, label %219, label %220

219:                                              ; preds = %213
  br label %225

220:                                              ; preds = %213
  %221 = load ptr, ptr %6, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct._RcsGraph, ptr %221, i32 0, i32 3
  %223 = load i32, ptr %222, align 4, !tbaa !9
  %224 = mul i32 3, %223
  br label %225

225:                                              ; preds = %220, %219
  %226 = phi i32 [ 1, %219 ], [ %224, %220 ]
  store i32 %226, ptr %20, align 4, !tbaa !12
  %227 = load i32, ptr %20, align 4, !tbaa !12
  %228 = zext i32 %227 to i64
  %229 = mul i64 %228, 8
  %230 = add i64 24, %229
  %231 = alloca i8, i64 %230, align 16
  store ptr %231, ptr %19, align 8, !tbaa !5
  %232 = load ptr, ptr %19, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct._MatNd, ptr %232, i64 1
  %234 = load ptr, ptr %19, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct._MatNd, ptr %234, i32 0, i32 0
  store ptr %233, ptr %235, align 8, !tbaa !17
  %236 = load ptr, ptr %19, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct._MatNd, ptr %236, i32 0, i32 1
  store i32 3, ptr %237, align 8, !tbaa !19
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct._RcsGraph, ptr %238, i32 0, i32 3
  %240 = load i32, ptr %239, align 4, !tbaa !9
  %241 = load ptr, ptr %19, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct._MatNd, ptr %241, i32 0, i32 2
  store i32 %240, ptr %242, align 4, !tbaa !20
  %243 = load i32, ptr %20, align 4, !tbaa !12
  %244 = load ptr, ptr %19, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct._MatNd, ptr %244, i32 0, i32 3
  store i32 %243, ptr %245, align 8, !tbaa !21
  %246 = load ptr, ptr %19, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct._MatNd, ptr %246, i32 0, i32 4
  store i8 1, ptr %247, align 4, !tbaa !22
  %248 = load ptr, ptr %19, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct._MatNd, ptr %248, i32 0, i32 0
  %250 = load ptr, ptr %249, align 8, !tbaa !17
  %251 = load i32, ptr %20, align 4, !tbaa !12
  %252 = zext i32 %251 to i64
  %253 = mul i64 %252, 8
  call void @llvm.memset.p0.i64(ptr align 8 %250, i8 0, i64 %253, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %254

254:                                              ; preds = %225, %208
  %255 = load ptr, ptr %6, align 8, !tbaa !5
  %256 = load ptr, ptr %8, align 8, !tbaa !5
  %257 = load ptr, ptr %15, align 8, !tbaa !5
  call void @RcsGraph_rotationJacobian(ptr noundef %255, ptr noundef %256, ptr noundef null, ptr noundef %257)
  %258 = load ptr, ptr %6, align 8, !tbaa !5
  %259 = load ptr, ptr %7, align 8, !tbaa !5
  %260 = load ptr, ptr %19, align 8, !tbaa !5
  call void @RcsGraph_rotationJacobian(ptr noundef %258, ptr noundef %259, ptr noundef null, ptr noundef %260)
  %261 = load ptr, ptr %19, align 8, !tbaa !5
  %262 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_subSelf(ptr noundef %261, ptr noundef %262)
  %263 = load ptr, ptr %10, align 8, !tbaa !5
  %264 = load ptr, ptr %17, align 8, !tbaa !5
  %265 = load ptr, ptr %19, align 8, !tbaa !5
  call void @MatNd_mul(ptr noundef %263, ptr noundef %264, ptr noundef %265)
  %266 = load ptr, ptr %10, align 8, !tbaa !5
  %267 = load i32, ptr %11, align 4, !tbaa !12
  %268 = load i32, ptr %12, align 4, !tbaa !12
  call void @MatNd_reshape(ptr noundef %266, i32 noundef %267, i32 noundef %268)
  %269 = load ptr, ptr %10, align 8, !tbaa !5
  call void @MatNd_transposeSelf(ptr noundef %269)
  %270 = load ptr, ptr %6, align 8, !tbaa !5
  %271 = load ptr, ptr %7, align 8, !tbaa !5
  %272 = load ptr, ptr %9, align 8, !tbaa !5
  %273 = icmp ne ptr %272, null
  br i1 %273, label %274, label %280

274:                                              ; preds = %254
  %275 = load ptr, ptr %9, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct._RcsBody, ptr %275, i32 0, i32 10
  %277 = load ptr, ptr %276, align 8, !tbaa !13
  %278 = getelementptr inbounds %struct.HTr, ptr %277, i32 0, i32 1
  %279 = getelementptr inbounds [3 x [3 x double]], ptr %278, i64 0, i64 0
  br label %281

280:                                              ; preds = %254
  br label %281

281:                                              ; preds = %280, %274
  %282 = phi ptr [ %279, %274 ], [ null, %280 ]
  %283 = load ptr, ptr %13, align 8, !tbaa !5
  call void @RcsGraph_rotationHessian(ptr noundef %270, ptr noundef %271, ptr noundef %282, ptr noundef %283)
  %284 = load ptr, ptr %10, align 8, !tbaa !5
  %285 = load ptr, ptr %13, align 8, !tbaa !5
  call void @MatNd_addSelf(ptr noundef %284, ptr noundef %285)
  %286 = load ptr, ptr %6, align 8, !tbaa !5
  %287 = load ptr, ptr %8, align 8, !tbaa !5
  %288 = load ptr, ptr %9, align 8, !tbaa !5
  %289 = icmp ne ptr %288, null
  br i1 %289, label %290, label %296

290:                                              ; preds = %281
  %291 = load ptr, ptr %9, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct._RcsBody, ptr %291, i32 0, i32 10
  %293 = load ptr, ptr %292, align 8, !tbaa !13
  %294 = getelementptr inbounds %struct.HTr, ptr %293, i32 0, i32 1
  %295 = getelementptr inbounds [3 x [3 x double]], ptr %294, i64 0, i64 0
  br label %297

296:                                              ; preds = %281
  br label %297

297:                                              ; preds = %296, %290
  %298 = phi ptr [ %295, %290 ], [ null, %296 ]
  %299 = load ptr, ptr %13, align 8, !tbaa !5
  call void @RcsGraph_rotationHessian(ptr noundef %286, ptr noundef %287, ptr noundef %298, ptr noundef %299)
  %300 = load ptr, ptr %10, align 8, !tbaa !5
  %301 = load ptr, ptr %13, align 8, !tbaa !5
  call void @MatNd_subSelf(ptr noundef %300, ptr noundef %301)
  %302 = load ptr, ptr %17, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %302)
  %303 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %303)
  %304 = load ptr, ptr %19, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %304)
  %305 = load ptr, ptr %13, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %305)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %306

306:                                              ; preds = %297, %50
  br label %307

307:                                              ; preds = %306, %31
  %308 = load ptr, ptr %10, align 8, !tbaa !5
  %309 = load i32, ptr %12, align 4, !tbaa !12
  %310 = load i32, ptr %11, align 4, !tbaa !12
  call void @MatNd_reshape(ptr noundef %308, i32 noundef %309, i32 noundef %310)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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, !11, i64 1852}
!10 = !{!"_RcsGraph", !6, i64 0, !7, i64 8, !11, i64 1848, !11, i64 1852, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!14, !6, i64 104}
!14 = !{!"_RcsBody", !15, i64 0, !16, i64 8, !11, i64 12, !7, i64 16, !7, i64 40, !15, 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}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_MatNd", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !16, i64 20}
!19 = !{!18, !11, i64 8}
!20 = !{!18, !11, i64 12}
!21 = !{!18, !11, i64 16}
!22 = !{!18, !16, i64 20}


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

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

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

declare void @MatNd_reshape(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

declare void @MatNd_destroy(ptr noundef) local_unnamed_addr #0

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

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

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

declare void @MatNd_addSelf(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare void @MatNd_transposeSelf(ptr noundef) local_unnamed_addr #0

declare zeroext i1 @RcsBody_isArticulated(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @RcsGraph_3dOmegaHessian(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 1852
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = mul nsw i32 %7, 3
  %9 = icmp eq ptr %2, null
  %10 = icmp eq ptr %3, null
  %or.cond = and i1 %9, %10
  br i1 %or.cond, label %11, label %12

11:                                               ; preds = %5
  tail call void @MatNd_reshape(ptr noundef %4, i32 noundef %7, i32 noundef %8) #4
  tail call void @RcsGraph_rotationHessian(ptr noundef nonnull %0, ptr noundef %1, ptr noundef null, ptr noundef %4)
  br label %96

12:                                               ; preds = %5
  %.not = icmp ne ptr %2, null
  %13 = icmp eq ptr %3, %2
  %or.cond138 = and i1 %.not, %13
  br i1 %or.cond138, label %14, label %20

14:                                               ; preds = %12
  %15 = tail call zeroext i1 @RcsBody_isArticulated(ptr noundef nonnull %2) #4
  br i1 %15, label %20, label %16

16:                                               ; preds = %14
  tail call void @MatNd_reshape(ptr noundef %4, i32 noundef %7, i32 noundef %8) #4
  %17 = getelementptr inbounds i8, ptr %2, i64 104
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %18, i64 24
  tail call void @RcsGraph_rotationHessian(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %19, ptr noundef %4)
  br label %96

20:                                               ; preds = %14, %12
  tail call void @MatNd_reshape(ptr noundef %4, i32 noundef %8, i32 noundef %7) #4
  %21 = mul nsw i32 %8, %7
  %22 = icmp sgt i32 %21, 1296
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = tail call ptr @MatNd_create(i32 noundef %8, i32 noundef %7) #4
  br label %36

25:                                               ; preds = %20
  %26 = tail call i32 @llvm.umax.i32(i32 %21, i32 1)
  %27 = zext i32 %26 to i64
  %28 = shl nuw nsw i64 %27, 3
  %29 = add nuw nsw i64 %28, 24
  %30 = alloca i8, i64 %29, align 16
  %31 = getelementptr inbounds i8, ptr %30, i64 24
  store ptr %31, ptr %30, align 16, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %30, i64 8
  store i32 %8, ptr %32, align 8, !tbaa !17
  %33 = getelementptr inbounds i8, ptr %30, i64 12
  store i32 %7, ptr %33, align 4, !tbaa !18
  %34 = getelementptr inbounds i8, ptr %30, i64 16
  store i32 %26, ptr %34, align 16, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %30, i64 20
  store i8 1, ptr %35, align 4, !tbaa !20
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %31, i8 0, i64 %28, i1 false)
  br label %36

36:                                               ; preds = %25, %23
  %.0 = phi ptr [ %24, %23 ], [ %30, %25 ]
  %37 = icmp sgt i32 %7, 432
  br i1 %37, label %38, label %40

38:                                               ; preds = %36
  %39 = call ptr @MatNd_create(i32 noundef 3, i32 noundef %7) #4
  br label %52

40:                                               ; preds = %36
  %41 = icmp eq i32 %7, 0
  %42 = select i1 %41, i32 1, i32 %8
  %43 = zext i32 %42 to i64
  %44 = shl nuw nsw i64 %43, 3
  %45 = add nuw nsw i64 %44, 24
  %46 = alloca i8, i64 %45, align 16
  %47 = getelementptr inbounds i8, ptr %46, i64 24
  store ptr %47, ptr %46, align 16, !tbaa !15
  %48 = getelementptr inbounds i8, ptr %46, i64 8
  store i32 3, ptr %48, align 8, !tbaa !17
  %49 = getelementptr inbounds i8, ptr %46, i64 12
  store i32 %7, ptr %49, align 4, !tbaa !18
  %50 = getelementptr inbounds i8, ptr %46, i64 16
  store i32 %42, ptr %50, align 16, !tbaa !19
  %51 = getelementptr inbounds i8, ptr %46, i64 20
  store i8 1, ptr %51, align 4, !tbaa !20
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %47, i8 0, i64 %44, i1 false)
  br label %52

52:                                               ; preds = %40, %38
  %.0129 = phi ptr [ %39, %38 ], [ %46, %40 ]
  %53 = mul i32 %7, 9
  %54 = icmp sgt i32 %53, 1296
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = call ptr @MatNd_create(i32 noundef %8, i32 noundef 3) #4
  %.pre = load ptr, ptr %56, align 8, !tbaa !15
  br label %69

57:                                               ; preds = %52
  %58 = icmp eq i32 %7, 0
  %59 = select i1 %58, i32 1, i32 %53
  %60 = zext i32 %59 to i64
  %61 = shl nuw nsw i64 %60, 3
  %62 = add nuw nsw i64 %61, 24
  %63 = alloca i8, i64 %62, align 16
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  store ptr %64, ptr %63, align 16, !tbaa !15
  %65 = getelementptr inbounds i8, ptr %63, i64 8
  store i32 %8, ptr %65, align 8, !tbaa !17
  %66 = getelementptr inbounds i8, ptr %63, i64 12
  store i32 3, ptr %66, align 4, !tbaa !18
  %67 = getelementptr inbounds i8, ptr %63, i64 16
  store i32 %59, ptr %67, align 16, !tbaa !19
  %68 = getelementptr inbounds i8, ptr %63, i64 20
  store i8 1, ptr %68, align 4, !tbaa !20
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %64, i8 0, i64 %61, i1 false)
  br label %69

69:                                               ; preds = %57, %55
  %70 = phi ptr [ %.pre, %55 ], [ %64, %57 ]
  %.0130 = phi ptr [ %56, %55 ], [ %63, %57 ]
  call void @RcsGraph_dAdq(ptr noundef nonnull %0, ptr noundef %3, ptr noundef %70, i1 noundef zeroext true)
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = mul i32 %71, 3
  %73 = icmp ugt i32 %72, 1296
  br i1 %73, label %74, label %76

74:                                               ; preds = %69
  %75 = call ptr @MatNd_create(i32 noundef 3, i32 noundef %71) #4
  br label %87

76:                                               ; preds = %69
  %77 = icmp eq i32 %71, 0
  %spec.select = select i1 %77, i32 1, i32 %72
  %78 = shl nuw nsw i32 %spec.select, 3
  %79 = zext nneg i32 %78 to i64
  %80 = add nuw nsw i64 %79, 24
  %81 = alloca i8, i64 %80, align 16
  %82 = getelementptr inbounds i8, ptr %81, i64 24
  store ptr %82, ptr %81, align 16, !tbaa !15
  %83 = getelementptr inbounds i8, ptr %81, i64 8
  store i32 3, ptr %83, align 8, !tbaa !17
  %84 = getelementptr inbounds i8, ptr %81, i64 12
  store i32 %71, ptr %84, align 4, !tbaa !18
  %85 = getelementptr inbounds i8, ptr %81, i64 16
  store i32 %spec.select, ptr %85, align 16, !tbaa !19
  %86 = getelementptr inbounds i8, ptr %81, i64 20
  store i8 1, ptr %86, align 4, !tbaa !20
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %82, i8 0, i64 %79, i1 false)
  br label %87

87:                                               ; preds = %76, %74
  %.0128 = phi ptr [ %75, %74 ], [ %81, %76 ]
  call void @RcsGraph_rotationJacobian(ptr noundef nonnull %0, ptr noundef %2, ptr noundef null, ptr noundef %.0129)
  call void @RcsGraph_rotationJacobian(ptr noundef nonnull %0, ptr noundef %1, ptr noundef null, ptr noundef %.0128)
  call void @MatNd_subSelf(ptr noundef %.0128, ptr noundef %.0129) #4
  call void @MatNd_mul(ptr noundef %4, ptr noundef nonnull %.0130, ptr noundef %.0128) #4
  call void @MatNd_reshape(ptr noundef %4, i32 noundef %7, i32 noundef %8) #4
  call void @MatNd_transposeSelf(ptr noundef %4) #4
  br i1 %10, label %.critedge, label %88

88:                                               ; preds = %87
  %89 = getelementptr inbounds i8, ptr %3, i64 104
  %90 = load ptr, ptr %89, align 8, !tbaa !11
  %91 = getelementptr inbounds i8, ptr %90, i64 24
  call void @RcsGraph_rotationHessian(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %91, ptr noundef %.0)
  call void @MatNd_addSelf(ptr noundef %4, ptr noundef %.0) #4
  %92 = load ptr, ptr %89, align 8, !tbaa !11
  %93 = getelementptr inbounds i8, ptr %92, i64 24
  br label %94

.critedge:                                        ; preds = %87
  call void @RcsGraph_rotationHessian(ptr noundef nonnull %0, ptr noundef %1, ptr noundef null, ptr noundef %.0)
  call void @MatNd_addSelf(ptr noundef %4, ptr noundef %.0) #4
  br label %94

94:                                               ; preds = %.critedge, %88
  %95 = phi ptr [ %93, %88 ], [ null, %.critedge ]
  call void @RcsGraph_rotationHessian(ptr noundef nonnull %0, ptr noundef %2, ptr noundef %95, ptr noundef %.0)
  call void @MatNd_subSelf(ptr noundef %4, ptr noundef %.0) #4
  call void @MatNd_destroy(ptr noundef nonnull %.0130) #4
  call void @MatNd_destroy(ptr noundef %.0129) #4
  call void @MatNd_destroy(ptr noundef %.0128) #4
  call void @MatNd_destroy(ptr noundef %.0) #4
  br label %96

96:                                               ; preds = %16, %94, %11
  call void @MatNd_reshape(ptr noundef %4, i32 noundef %8, i32 noundef %7) #4
  ret void
}

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

attributes #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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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 = !{!12, !7, i64 104}
!12 = !{!"_RcsBody", !13, i64 0, !14, i64 8, !10, i64 12, !8, i64 16, !8, i64 40, !13, 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}
!13 = !{!"double", !8, i64 0}
!14 = !{!"_Bool", !8, i64 0}
!15 = !{!16, !7, i64 0}
!16 = !{!"_MatNd", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 20}
!17 = !{!16, !10, i64 8}
!18 = !{!16, !10, i64 12}
!19 = !{!16, !10, i64 16}
!20 = !{!16, !14, i64 20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass