; 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._RcsJoint = type { ptr, double, double, double, double, double, double, double, i8, i32, i32, i32, i32, ptr, %struct.HTr, double, double, double, double, i32, 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 void @MatNd_reshapeAndSetZero(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @RcsGraph_bodyPointHessian(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %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 i8, align 1
  %16 = alloca ptr, align 8
  %17 = alloca [3 x double], align 16
  %18 = alloca i8, align 1
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca [3 x double], align 16
  %22 = alloca [3 x double], align 16
  %23 = 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) #3
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._RcsGraph, ptr %24, i32 0, i32 3
  %26 = load i32, ptr %25, align 4, !tbaa !9
  store i32 %26, ptr %11, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %27 = load i32, ptr %11, align 4, !tbaa !12
  %28 = load i32, ptr %11, align 4, !tbaa !12
  %29 = mul nsw i32 %27, %28
  store i32 %29, ptr %12, align 4, !tbaa !12
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = load i32, ptr %11, align 4, !tbaa !12
  %32 = mul nsw i32 3, %31
  %33 = load i32, ptr %11, align 4, !tbaa !12
  call void @MatNd_reshapeAndSetZero(ptr noundef %30, i32 noundef %32, i32 noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call ptr @RcsBody_lastJointBeforeBody(ptr noundef %34)
  store ptr %35, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %5
  store i32 1, ptr %14, align 4
  br label %195

39:                                               ; preds = %5
  br label %40

40:                                               ; preds = %190, %48, %39
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %194

43:                                               ; preds = %40
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._RcsJoint, ptr %44, i32 0, i32 8
  %46 = load i8, ptr %45, align 8, !tbaa !13, !range !18, !noundef !19
  %47 = trunc i8 %46 to i1
  br i1 %47, label %48, label %52

48:                                               ; preds = %43
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._RcsJoint, ptr %49, i32 0, i32 22
  %51 = load ptr, ptr %50, align 8, !tbaa !20
  store ptr %51, ptr %13, align 8, !tbaa !5
  br label %40, !llvm.loop !21

52:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #3
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = call zeroext i1 @RcsJoint_isRotation(ptr noundef %53)
  %55 = zext i1 %54 to i8
  store i8 %55, ptr %15, align 1, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %56, ptr %16, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %189, %187, %67, %52
  %58 = load ptr, ptr %16, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %190

60:                                               ; preds = %57
  %61 = load ptr, ptr %16, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._RcsJoint, ptr %61, i32 0, i32 8
  %63 = load i8, ptr %62, align 8, !tbaa !13, !range !18, !noundef !19
  %64 = trunc i8 %63 to i1
  %65 = zext i1 %64 to i32
  %66 = icmp eq i32 %65, 1
  br i1 %66, label %67, label %71

67:                                               ; preds = %60
  %68 = load ptr, ptr %16, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._RcsJoint, ptr %68, i32 0, i32 22
  %70 = load ptr, ptr %69, align 8, !tbaa !20
  store ptr %70, ptr %16, align 8, !tbaa !5
  br label %57, !llvm.loop !24

71:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #3
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = call zeroext i1 @RcsJoint_isRotation(ptr noundef %72)
  %74 = zext i1 %73 to i8
  store i8 %74, ptr %18, align 1, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %75 = load ptr, ptr %13, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._RcsJoint, ptr %75, i32 0, i32 14
  %77 = getelementptr inbounds %struct.HTr, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._RcsJoint, ptr %78, i32 0, i32 10
  %80 = load i32, ptr %79, align 8, !tbaa !25
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [3 x [3 x double]], ptr %77, i64 0, i64 %81
  %83 = getelementptr inbounds [3 x double], ptr %82, i64 0, i64 0
  store ptr %83, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._RcsJoint, ptr %84, i32 0, i32 14
  %86 = getelementptr inbounds %struct.HTr, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._RcsJoint, ptr %87, i32 0, i32 10
  %89 = load i32, ptr %88, align 8, !tbaa !25
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [3 x [3 x double]], ptr %86, i64 0, i64 %90
  %92 = getelementptr inbounds [3 x double], ptr %91, i64 0, i64 0
  store ptr %92, ptr %20, align 8, !tbaa !5
  %93 = load i8, ptr %15, align 1, !tbaa !23, !range !18, !noundef !19
  %94 = trunc i8 %93 to i1
  br i1 %94, label %95, label %109

95:                                               ; preds = %71
  %96 = load i8, ptr %18, align 1, !tbaa !23, !range !18, !noundef !19
  %97 = trunc i8 %96 to i1
  br i1 %97, label %98, label %109

98:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #3
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds [3 x double], ptr %21, i64 0, i64 0
  call void @RcsGraph_computeJointToBodyPt(ptr noundef %99, ptr noundef %100, ptr noundef %101, ptr noundef %102)
  %103 = getelementptr inbounds [3 x double], ptr %22, i64 0, i64 0
  %104 = load ptr, ptr %19, align 8, !tbaa !5
  %105 = getelementptr inbounds [3 x double], ptr %21, i64 0, i64 0
  call void @Vec3d_crossProduct(ptr noundef %103, ptr noundef %104, ptr noundef %105)
  %106 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %107 = load ptr, ptr %20, align 8, !tbaa !5
  %108 = getelementptr inbounds [3 x double], ptr %22, i64 0, i64 0
  call void @Vec3d_crossProduct(ptr noundef %106, ptr noundef %107, ptr noundef %108)
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #3
  br label %124

109:                                              ; preds = %95, %71
  %110 = load i8, ptr %15, align 1, !tbaa !23, !range !18, !noundef !19
  %111 = trunc i8 %110 to i1
  br i1 %111, label %119, label %112

112:                                              ; preds = %109
  %113 = load i8, ptr %18, align 1, !tbaa !23, !range !18, !noundef !19
  %114 = trunc i8 %113 to i1
  br i1 %114, label %115, label %119

115:                                              ; preds = %112
  %116 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %117 = load ptr, ptr %20, align 8, !tbaa !5
  %118 = load ptr, ptr %19, align 8, !tbaa !5
  call void @Vec3d_crossProduct(ptr noundef %116, ptr noundef %117, ptr noundef %118)
  br label %123

119:                                              ; preds = %112, %109
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct._RcsJoint, ptr %120, i32 0, i32 22
  %122 = load ptr, ptr %121, align 8, !tbaa !20
  store ptr %122, ptr %16, align 8, !tbaa !5
  store i32 4, ptr %14, align 4
  br label %187, !llvm.loop !24

123:                                              ; preds = %115
  br label %124

124:                                              ; preds = %123, %98
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = icmp ne ptr %125, null
  br i1 %126, label %127, label %130

127:                                              ; preds = %124
  %128 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  call void @Vec3d_rotateSelf(ptr noundef %128, ptr noundef %129)
  br label %130

130:                                              ; preds = %127, %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  store i32 0, ptr %23, align 4, !tbaa !12
  br label %131

131:                                              ; preds = %180, %130
  %132 = load i32, ptr %23, align 4, !tbaa !12
  %133 = icmp slt i32 %132, 3
  br i1 %133, label %135, label %134

134:                                              ; preds = %131
  store i32 6, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  br label %183

135:                                              ; preds = %131
  %136 = load i32, ptr %23, align 4, !tbaa !12
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 %137
  %139 = load double, ptr %138, align 8, !tbaa !26
  %140 = load ptr, ptr %10, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._MatNd, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !27
  %143 = load i32, ptr %23, align 4, !tbaa !12
  %144 = load i32, ptr %12, align 4, !tbaa !12
  %145 = mul nsw i32 %143, %144
  %146 = load ptr, ptr %13, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._RcsJoint, ptr %146, i32 0, i32 12
  %148 = load i32, ptr %147, align 8, !tbaa !29
  %149 = load i32, ptr %11, align 4, !tbaa !12
  %150 = mul nsw i32 %148, %149
  %151 = add nsw i32 %145, %150
  %152 = load ptr, ptr %16, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct._RcsJoint, ptr %152, i32 0, i32 12
  %154 = load i32, ptr %153, align 8, !tbaa !29
  %155 = add nsw i32 %151, %154
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds double, ptr %142, i64 %156
  store double %139, ptr %157, align 8, !tbaa !26
  %158 = load i32, ptr %23, align 4, !tbaa !12
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 %159
  %161 = load double, ptr %160, align 8, !tbaa !26
  %162 = load ptr, ptr %10, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct._MatNd, ptr %162, i32 0, i32 0
  %164 = load ptr, ptr %163, align 8, !tbaa !27
  %165 = load i32, ptr %23, align 4, !tbaa !12
  %166 = load i32, ptr %12, align 4, !tbaa !12
  %167 = mul nsw i32 %165, %166
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._RcsJoint, ptr %168, i32 0, i32 12
  %170 = load i32, ptr %169, align 8, !tbaa !29
  %171 = load i32, ptr %11, align 4, !tbaa !12
  %172 = mul nsw i32 %170, %171
  %173 = add nsw i32 %167, %172
  %174 = load ptr, ptr %13, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct._RcsJoint, ptr %174, i32 0, i32 12
  %176 = load i32, ptr %175, align 8, !tbaa !29
  %177 = add nsw i32 %173, %176
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds double, ptr %164, i64 %178
  store double %161, ptr %179, align 8, !tbaa !26
  br label %180

180:                                              ; preds = %135
  %181 = load i32, ptr %23, align 4, !tbaa !12
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %23, align 4, !tbaa !12
  br label %131, !llvm.loop !30

183:                                              ; preds = %134
  %184 = load ptr, ptr %16, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct._RcsJoint, ptr %184, i32 0, i32 22
  %186 = load ptr, ptr %185, align 8, !tbaa !20
  store ptr %186, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %187

187:                                              ; preds = %183, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #3
  %188 = load i32, ptr %14, align 4
  switch i32 %188, label %198 [
    i32 0, label %189
    i32 4, label %57
  ]

189:                                              ; preds = %187
  br label %57, !llvm.loop !24

190:                                              ; preds = %57
  %191 = load ptr, ptr %13, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct._RcsJoint, ptr %191, i32 0, i32 22
  %193 = load ptr, ptr %192, align 8, !tbaa !20
  store ptr %193, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #3
  br label %40, !llvm.loop !21

194:                                              ; preds = %40
  store i32 0, ptr %14, align 4
  br label %195

195:                                              ; preds = %194, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  %196 = load i32, ptr %14, align 4
  switch i32 %196, label %198 [
    i32 0, label %197
    i32 1, label %197
  ]

197:                                              ; preds = %195, %195
  ret void

198:                                              ; preds = %195, %187
  unreachable
}

declare ptr @RcsBody_lastJointBeforeBody(ptr noundef) #1

declare zeroext i1 @RcsJoint_isRotation(ptr noundef) #1

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

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

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

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 = { 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 = { 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, !16, i64 64}
!14 = !{!"_RcsJoint", !6, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !16, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !6, i64 88, !17, i64 96, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !11, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!"", !7, i64 0, !7, i64 24}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!14, !6, i64 248}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!16, !16, i64 0}
!24 = distinct !{!24, !22}
!25 = !{!14, !11, i64 72}
!26 = !{!15, !15, i64 0}
!27 = !{!28, !6, i64 0}
!28 = !{!"_MatNd", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !16, i64 20}
!29 = !{!14, !11, i64 80}
!30 = distinct !{!30, !22}


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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @RcsGraph_bodyPointHessian(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca [3 x double], align 16
  %7 = alloca [3 x double], align 16
  %8 = alloca [3 x double], align 16
  %9 = getelementptr inbounds i8, ptr %0, i64 1852
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = mul nsw i32 %10, %10
  %12 = mul nsw i32 %10, 3
  tail call void @MatNd_reshapeAndSetZero(ptr noundef %4, i32 noundef %12, i32 noundef %10) #3
  %13 = tail call ptr @RcsBody_lastJointBeforeBody(ptr noundef %1) #3
  %14 = icmp eq ptr %13, null
  br i1 %14, label %.loopexit62, label %.preheader

.preheader:                                       ; preds = %5
  %.not57 = icmp eq ptr %3, null
  %15 = zext nneg i32 %11 to i64
  %16 = getelementptr inbounds i8, ptr %6, i64 8
  %17 = getelementptr inbounds i8, ptr %6, i64 16
  %18 = shl nuw nsw i64 %15, 1
  %19 = trunc nuw nsw i64 %18 to i32
  br label %20

20:                                               ; preds = %.preheader, %.backedge63
  %.05266 = phi ptr [ %13, %.preheader ], [ %.052.be, %.backedge63 ]
  %21 = getelementptr inbounds i8, ptr %.05266, i64 64
  %22 = load i8, ptr %21, align 8, !tbaa !11, !range !16, !noundef !17
  %23 = trunc nuw i8 %22 to i1
  br i1 %23, label %.backedge63, label %24

.backedge63:                                      ; preds = %.backedge, %20
  %.052.be.in = getelementptr inbounds i8, ptr %.05266, i64 248
  %.052.be = load ptr, ptr %.052.be.in, align 8, !tbaa !18
  %.not = icmp eq ptr %.052.be, null
  br i1 %.not, label %.loopexit62, label %20, !llvm.loop !19

24:                                               ; preds = %20
  %25 = call zeroext i1 @RcsJoint_isRotation(ptr noundef nonnull %.05266) #3
  %26 = getelementptr inbounds i8, ptr %.05266, i64 120
  %27 = getelementptr inbounds i8, ptr %.05266, i64 72
  %28 = getelementptr inbounds i8, ptr %.05266, i64 80
  br label %29

29:                                               ; preds = %24, %.backedge
  %.05365 = phi ptr [ %.05266, %24 ], [ %.053.be, %.backedge ]
  %30 = getelementptr inbounds i8, ptr %.05365, i64 64
  %31 = load i8, ptr %30, align 8, !tbaa !11, !range !16, !noundef !17
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %33, label %36

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %.05365, i64 248
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  br label %.backedge

.backedge:                                        ; preds = %33, %.loopexit
  %.053.be = phi ptr [ %35, %33 ], [ %.1, %.loopexit ]
  %.not56 = icmp eq ptr %.053.be, null
  br i1 %.not56, label %.backedge63, label %29, !llvm.loop !21

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #3
  %37 = call zeroext i1 @RcsJoint_isRotation(ptr noundef nonnull %.05365) #3
  %38 = load i32, ptr %27, align 8, !tbaa !22
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [3 x [3 x double]], ptr %26, i64 0, i64 %39
  %41 = getelementptr inbounds i8, ptr %.05365, i64 120
  %42 = getelementptr inbounds i8, ptr %.05365, i64 72
  %43 = load i32, ptr %42, align 8, !tbaa !22
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [3 x [3 x double]], ptr %41, i64 0, i64 %44
  %46 = select i1 %25, i1 %37, i1 false
  br i1 %46, label %47, label %48

47:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #3
  call void @RcsGraph_computeJointToBodyPt(ptr noundef nonnull %.05266, ptr noundef %1, ptr noundef %2, ptr noundef nonnull %7)
  call void @Vec3d_crossProduct(ptr noundef nonnull %8, ptr noundef nonnull %40, ptr noundef nonnull %7) #3
  call void @Vec3d_crossProduct(ptr noundef nonnull %6, ptr noundef nonnull %45, ptr noundef nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #3
  br label %50

48:                                               ; preds = %36
  %.not59 = xor i1 %37, true
  %brmerge61 = select i1 %25, i1 true, i1 %.not59
  br i1 %brmerge61, label %.loopexit, label %49, !llvm.loop !21

49:                                               ; preds = %48
  call void @Vec3d_crossProduct(ptr noundef nonnull %6, ptr noundef nonnull %45, ptr noundef nonnull %40) #3
  br label %50

50:                                               ; preds = %49, %47
  br i1 %.not57, label %.loopexit.loopexit, label %51

51:                                               ; preds = %50
  call void @Vec3d_rotateSelf(ptr noundef nonnull %6, ptr noundef nonnull %3) #3
  br label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %51, %50
  %52 = load ptr, ptr %4, align 8, !tbaa !23
  %53 = load i32, ptr %28, align 8, !tbaa !25
  %54 = mul nsw i32 %53, %10
  %55 = getelementptr inbounds i8, ptr %.05365, i64 80
  %56 = load i32, ptr %55, align 8, !tbaa !25
  %57 = mul nsw i32 %56, %10
  %58 = sext i32 %54 to i64
  %59 = sext i32 %56 to i64
  %60 = load double, ptr %6, align 16, !tbaa !26
  %61 = getelementptr double, ptr %52, i64 %58
  %62 = getelementptr double, ptr %61, i64 %59
  store double %60, ptr %62, align 8, !tbaa !26
  %63 = add i32 %53, %57
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds double, ptr %52, i64 %64
  store double %60, ptr %65, align 8, !tbaa !26
  %66 = load double, ptr %16, align 8, !tbaa !26
  %67 = getelementptr double, ptr %52, i64 %58
  %68 = getelementptr double, ptr %67, i64 %15
  %69 = getelementptr double, ptr %68, i64 %59
  store double %66, ptr %69, align 8, !tbaa !26
  %70 = add i32 %53, %11
  %71 = add i32 %70, %57
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds double, ptr %52, i64 %72
  store double %66, ptr %73, align 8, !tbaa !26
  %74 = load double, ptr %17, align 16, !tbaa !26
  %75 = getelementptr double, ptr %52, i64 %18
  %76 = getelementptr double, ptr %75, i64 %58
  %77 = getelementptr double, ptr %76, i64 %59
  store double %74, ptr %77, align 8, !tbaa !26
  %78 = add i32 %53, %19
  %79 = add i32 %78, %57
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %52, i64 %80
  store double %74, ptr %81, align 8, !tbaa !26
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %48
  %.1.in = getelementptr inbounds i8, ptr %.05365, i64 248
  %.1 = load ptr, ptr %.1.in, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #3
  br label %.backedge

.loopexit62:                                      ; preds = %.backedge63, %5
  ret void
}

declare ptr @RcsBody_lastJointBeforeBody(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @RcsJoint_isRotation(ptr noundef) local_unnamed_addr #1

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

declare void @Vec3d_crossProduct(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @Vec3d_rotateSelf(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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 = { 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, !14, i64 64}
!12 = !{!"_RcsJoint", !7, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !14, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !7, i64 88, !15, i64 96, !13, i64 192, !13, i64 200, !13, i64 208, !13, i64 216, !10, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264}
!13 = !{!"double", !8, i64 0}
!14 = !{!"_Bool", !8, i64 0}
!15 = !{!"", !8, i64 0, !8, i64 24}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!12, !7, i64 248}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{!12, !10, i64 72}
!23 = !{!24, !7, i64 0}
!24 = !{!"_MatNd", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 20}
!25 = !{!12, !10, i64 80}
!26 = !{!13, !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass