; LLVM IR from robinrodricks/InspiritImage :: Inspirit.Assurf/clib/rpp (rpp)

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

declare void @vec3_assign(ptr noundef, double noundef, double noundef, double noundef) #1

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

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

declare void @mat33_clear(ptr noundef) #1

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

declare void @mat33_transpose(ptr noundef, ptr noundef byval(%struct.mat33_t) align 8) #1

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

declare void @mat33_eye(ptr noundef) #1

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

declare void @mat33_div(ptr noundef, double noundef) #1

declare double @vec3trans_mul_vec3(ptr noundef, ptr noundef) #1

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

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

declare double @vec3_sum(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @getRfor2ndPose_V_Exact(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef byval(%struct.mat33_t) align 8 %3, ptr noundef byval(%struct.vec3_t) align 8 %4, double noundef %5, i32 noundef %6, ptr noundef %7) #3 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %struct.mat33_t, align 8
  %16 = alloca %struct.mat33_t, align 8
  %17 = alloca %struct.mat33_t, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca %struct.vec3_t, align 8
  %21 = alloca %struct.vec3_t, align 8
  %22 = alloca %struct.mat33_t, align 8
  %23 = alloca %struct.mat33_t, align 8
  %24 = alloca [10 x double], align 16
  %25 = alloca [10 x %struct.vec3_t], align 16
  %26 = alloca i32, align 4
  %27 = alloca i64, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca %struct.mat33_t, align 8
  %31 = alloca %struct.mat33_t, align 8
  %32 = alloca %struct.vec3_t, align 8
  %33 = alloca %struct.vec3_t, align 8
  %34 = alloca double, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store double %5, ptr %12, align 8, !tbaa !9
  store i32 %6, ptr %13, align 4, !tbaa !11
  store ptr %7, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 72, ptr %15) #4
  call void @decomposeR(ptr noundef %15, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 72, ptr %16) #4
  call void @mat33_mult_mat2(ptr noundef %16, ptr noundef %3, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 72, ptr %17) #4
  call void @mat33_transpose(ptr noundef %17, ptr noundef byval(%struct.mat33_t) align 8 %15)
  %35 = load i32, ptr %13, align 4, !tbaa !11
  %36 = zext i32 %35 to i64
  %37 = call ptr @llvm.stacksave.p0()
  store ptr %37, ptr %18, align 8
  %38 = alloca %struct.vec3_t, i64 %36, align 16
  store i64 %36, ptr %19, align 8
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = load i32, ptr %13, align 4, !tbaa !11
  call void @vec3_array_mult_vec2(ptr noundef %38, ptr noundef %17, ptr noundef %39, i32 noundef %40)
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #4
  call void @rpyAng_X(ptr noundef %20, ptr noundef %16)
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %23) #4
  %41 = getelementptr inbounds %struct.vec3_t, ptr %20, i32 0, i32 0
  %42 = getelementptr inbounds [3 x double], ptr %41, i64 0, i64 1
  %43 = load double, ptr %42, align 8, !tbaa !9
  call void @vec3_assign(ptr noundef %21, double noundef 0.000000e+00, double noundef %43, double noundef 0.000000e+00)
  call void @rpyMat(ptr noundef %22, ptr noundef %21)
  %44 = getelementptr inbounds %struct.vec3_t, ptr %20, i32 0, i32 0
  %45 = getelementptr inbounds [3 x double], ptr %44, i64 0, i64 2
  %46 = load double, ptr %45, align 8, !tbaa !9
  call void @vec3_assign(ptr noundef %21, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef %46)
  call void @rpyMat(ptr noundef %23, ptr noundef %21)
  call void @llvm.lifetime.start.p0(i64 80, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 240, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  store i32 0, ptr %26, align 4, !tbaa !11
  %47 = getelementptr inbounds [10 x double], ptr %24, i64 0, i64 0
  %48 = getelementptr inbounds [10 x %struct.vec3_t], ptr %25, i64 0, i64 0
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = load i32, ptr %13, align 4, !tbaa !11
  call void @getRotationY_wrtT(ptr noundef %47, ptr noundef %48, ptr noundef %49, ptr noundef %38, ptr noundef %4, ptr noundef %12, ptr noundef %23, i32 noundef %50, ptr noundef %26)
  %51 = getelementptr inbounds [10 x double], ptr %24, i64 0, i64 0
  %52 = load i32, ptr %26, align 4, !tbaa !11
  call void @scalar_array_div(ptr noundef %51, double noundef 0x404CA5DC1A63C1F8, i32 noundef %52)
  %53 = load i32, ptr %13, align 4, !tbaa !11
  %54 = zext i32 %53 to i64
  %55 = alloca %struct.mat33_t, i64 %54, align 16
  store i64 %54, ptr %27, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  store i32 0, ptr %28, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %84, %8
  %57 = load i32, ptr %28, align 4, !tbaa !11
  %58 = load i32, ptr %13, align 4, !tbaa !11
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %60, label %87

60:                                               ; preds = %56
  %61 = load i32, ptr %28, align 4, !tbaa !11
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds %struct.mat33_t, ptr %55, i64 %62
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load i32, ptr %28, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds %struct.vec3_t, ptr %64, i64 %66
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load i32, ptr %28, align 4, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds %struct.vec3_t, ptr %68, i64 %70
  call void @vec3_mul_vec3trans(ptr noundef %63, ptr noundef %67, ptr noundef %71)
  %72 = load i32, ptr %28, align 4, !tbaa !11
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %struct.mat33_t, ptr %55, i64 %73
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load i32, ptr %28, align 4, !tbaa !11
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds %struct.vec3_t, ptr %75, i64 %77
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = load i32, ptr %28, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.vec3_t, ptr %79, i64 %81
  %83 = call double @vec3trans_mul_vec3(ptr noundef %78, ptr noundef %82)
  call void @mat33_div(ptr noundef %74, double noundef %83)
  br label %84

84:                                               ; preds = %60
  %85 = load i32, ptr %28, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %28, align 4, !tbaa !11
  br label %56, !llvm.loop !13

87:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 72, ptr %30) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %31) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %32) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %33) #4
  store i32 0, ptr %29, align 4, !tbaa !11
  br label %88

88:                                               ; preds = %145, %87
  %89 = load i32, ptr %29, align 4, !tbaa !11
  %90 = load i32, ptr %26, align 4, !tbaa !11
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %92, label %148

92:                                               ; preds = %88
  call void @mat33_clear(ptr noundef %22)
  %93 = load i32, ptr %29, align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [10 x double], ptr %24, i64 0, i64 %94
  %96 = load double, ptr %95, align 8, !tbaa !9
  call void @vec3_assign(ptr noundef %21, double noundef 0.000000e+00, double noundef %96, double noundef 0.000000e+00)
  call void @rpyMat(ptr noundef %22, ptr noundef %21)
  call void @mat33_mult_mat2(ptr noundef %30, ptr noundef %23, ptr noundef %22)
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load i32, ptr %29, align 4, !tbaa !11
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds %struct.pose_t, ptr %97, i64 %99
  %101 = getelementptr inbounds %struct.pose_t, ptr %100, i32 0, i32 0
  call void @mat33_mult_mat2(ptr noundef %101, ptr noundef %30, ptr noundef %17)
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = load i32, ptr %29, align 4, !tbaa !11
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.pose_t, ptr %102, i64 %104
  %106 = getelementptr inbounds %struct.pose_t, ptr %105, i32 0, i32 1
  %107 = load i32, ptr %29, align 4, !tbaa !11
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [10 x %struct.vec3_t], ptr %25, i64 0, i64 %108
  call void @vec3_copy(ptr noundef %106, ptr noundef %109)
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #4
  store double 0.000000e+00, ptr %34, align 8, !tbaa !9
  store i32 0, ptr %28, align 4, !tbaa !11
  br label %110

110:                                              ; preds = %135, %92
  %111 = load i32, ptr %28, align 4, !tbaa !11
  %112 = load i32, ptr %13, align 4, !tbaa !11
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %114, label %138

114:                                              ; preds = %110
  call void @mat33_eye(ptr noundef %31)
  %115 = load i32, ptr %28, align 4, !tbaa !11
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %struct.mat33_t, ptr %55, i64 %116
  call void @mat33_sub(ptr noundef %31, ptr noundef %117)
  %118 = load ptr, ptr %9, align 8, !tbaa !5
  %119 = load i32, ptr %29, align 4, !tbaa !11
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds %struct.pose_t, ptr %118, i64 %120
  %122 = getelementptr inbounds %struct.pose_t, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = load i32, ptr %28, align 4, !tbaa !11
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds %struct.vec3_t, ptr %123, i64 %125
  call void @vec3_mult_mat(ptr noundef %32, ptr noundef %122, ptr noundef %126)
  %127 = load ptr, ptr %9, align 8, !tbaa !5
  %128 = load i32, ptr %29, align 4, !tbaa !11
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds %struct.pose_t, ptr %127, i64 %129
  %131 = getelementptr inbounds %struct.pose_t, ptr %130, i32 0, i32 1
  call void @vec3_add_vec(ptr noundef %32, ptr noundef %131)
  call void @vec3_mult_mat(ptr noundef %33, ptr noundef %31, ptr noundef %32)
  call void @vec3_mult_vec(ptr noundef %33, ptr noundef %33)
  %132 = call double @vec3_sum(ptr noundef %33)
  %133 = load double, ptr %34, align 8, !tbaa !9
  %134 = fadd double %133, %132
  store double %134, ptr %34, align 8, !tbaa !9
  br label %135

135:                                              ; preds = %114
  %136 = load i32, ptr %28, align 4, !tbaa !11
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %28, align 4, !tbaa !11
  br label %110, !llvm.loop !15

138:                                              ; preds = %110
  %139 = load double, ptr %34, align 8, !tbaa !9
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load i32, ptr %29, align 4, !tbaa !11
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds %struct.pose_t, ptr %140, i64 %142
  %144 = getelementptr inbounds %struct.pose_t, ptr %143, i32 0, i32 2
  store double %139, ptr %144, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #4
  br label %145

145:                                              ; preds = %138
  %146 = load i32, ptr %29, align 4, !tbaa !11
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %29, align 4, !tbaa !11
  br label %88, !llvm.loop !19

148:                                              ; preds = %88
  %149 = load i32, ptr %26, align 4, !tbaa !11
  %150 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 %149, ptr %150, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 24, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 240, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #4
  %151 = load ptr, ptr %18, align 8
  call void @llvm.stackrestore.p0(ptr %151)
  call void @llvm.lifetime.end.p0(i64 72, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #4
  ret void
}

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

declare void @scalar_array_div(ptr noundef, double noundef, i32 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 = { nocallback nofree nosync nounwind willreturn }
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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !10, i64 96}
!17 = !{!"", !18, i64 0, !18, i64 72, !10, i64 96, !18, i64 104, !18, i64 176, !10, i64 200}
!18 = !{!"", !7, i64 0}
!19 = distinct !{!19, !14}


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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

declare void @vec3_assign(ptr noundef, double noundef, double noundef, double noundef) local_unnamed_addr #1

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

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

declare void @mat33_clear(ptr noundef) local_unnamed_addr #1

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

declare void @mat33_transpose(ptr noundef, ptr noundef byval(%struct.mat33_t) align 8) local_unnamed_addr #1

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

declare void @mat33_eye(ptr noundef) local_unnamed_addr #1

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

declare void @mat33_div(ptr noundef, double noundef) local_unnamed_addr #1

declare double @vec3trans_mul_vec3(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare double @vec3_sum(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @getRfor2ndPose_V_Exact(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef byval(%struct.mat33_t) align 8 %3, ptr noundef byval(%struct.vec3_t) align 8 %4, double noundef %5, i32 noundef %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #3 {
  %9 = alloca double, align 8
  %10 = alloca %struct.mat33_t, align 8
  %11 = alloca %struct.mat33_t, align 8
  %12 = alloca %struct.mat33_t, align 8
  %13 = alloca %struct.vec3_t, align 8
  %14 = alloca %struct.vec3_t, align 8
  %15 = alloca %struct.mat33_t, align 8
  %16 = alloca %struct.mat33_t, align 8
  %17 = alloca [10 x double], align 16
  %18 = alloca [10 x %struct.vec3_t], align 16
  %19 = alloca i32, align 4
  %20 = alloca %struct.mat33_t, align 8
  %21 = alloca %struct.mat33_t, align 8
  %22 = alloca %struct.vec3_t, align 8
  %23 = alloca %struct.vec3_t, align 8
  store double %5, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %10) #4
  call void @decomposeR(ptr noundef nonnull %10, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %11) #4
  call void @mat33_mult_mat2(ptr noundef nonnull %11, ptr noundef nonnull %3, ptr noundef nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %12) #4
  call void @mat33_transpose(ptr noundef nonnull %12, ptr noundef nonnull byval(%struct.mat33_t) align 8 %10) #4
  %24 = zext i32 %6 to i64
  %25 = call ptr @llvm.stacksave.p0()
  %26 = alloca %struct.vec3_t, i64 %24, align 16
  call void @vec3_array_mult_vec2(ptr noundef nonnull %26, ptr noundef nonnull %12, ptr noundef %2, i32 noundef %6) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #4
  call void @rpyAng_X(ptr noundef nonnull %13, ptr noundef nonnull %11)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %15) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %16) #4
  %27 = getelementptr inbounds i8, ptr %13, i64 8
  %28 = load double, ptr %27, align 8, !tbaa !5
  call void @vec3_assign(ptr noundef nonnull %14, double noundef 0.000000e+00, double noundef %28, double noundef 0.000000e+00) #4
  call void @rpyMat(ptr noundef nonnull %15, ptr noundef nonnull %14)
  %29 = getelementptr inbounds i8, ptr %13, i64 16
  %30 = load double, ptr %29, align 8, !tbaa !5
  call void @vec3_assign(ptr noundef nonnull %14, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef %30) #4
  call void @rpyMat(ptr noundef nonnull %16, ptr noundef nonnull %14)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %17) #4
  call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #4
  store i32 0, ptr %19, align 4, !tbaa !9
  call void @getRotationY_wrtT(ptr noundef nonnull %17, ptr noundef nonnull %18, ptr noundef %1, ptr noundef nonnull %26, ptr noundef nonnull %4, ptr noundef nonnull %9, ptr noundef nonnull %16, i32 noundef %6, ptr noundef nonnull %19)
  %31 = load i32, ptr %19, align 4, !tbaa !9
  call void @scalar_array_div(ptr noundef nonnull %17, double noundef 0x404CA5DC1A63C1F8, i32 noundef %31) #4
  %32 = alloca %struct.mat33_t, i64 %24, align 16
  %33 = icmp sgt i32 %6, 0
  br i1 %33, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %8, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %8 ]
  %34 = getelementptr inbounds %struct.mat33_t, ptr %32, i64 %indvars.iv
  %35 = getelementptr inbounds %struct.vec3_t, ptr %1, i64 %indvars.iv
  call void @vec3_mul_vec3trans(ptr noundef nonnull %34, ptr noundef %35, ptr noundef %35) #4
  %36 = call double @vec3trans_mul_vec3(ptr noundef %35, ptr noundef %35) #4
  call void @mat33_div(ptr noundef nonnull %34, double noundef %36) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %24
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %20) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %21) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %22) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %23) #4
  %37 = load i32, ptr %19, align 4, !tbaa !9
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph54, label %._crit_edge55

._crit_edge.thread:                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %20) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %21) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %22) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %23) #4
  %39 = load i32, ptr %19, align 4, !tbaa !9
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph54.split.preheader, label %._crit_edge55

.lr.ph54:                                         ; preds = %._crit_edge
  br i1 %33, label %.lr.ph50.us, label %.lr.ph54.split.preheader

.lr.ph54.split.preheader:                         ; preds = %._crit_edge.thread, %.lr.ph54
  br label %.lr.ph54.split

.lr.ph50.us:                                      ; preds = %.lr.ph54, %._crit_edge51.us
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %._crit_edge51.us ], [ 0, %.lr.ph54 ]
  call void @mat33_clear(ptr noundef nonnull %15) #4
  %41 = getelementptr inbounds [10 x double], ptr %17, i64 0, i64 %indvars.iv70
  %42 = load double, ptr %41, align 8, !tbaa !5
  call void @vec3_assign(ptr noundef nonnull %14, double noundef 0.000000e+00, double noundef %42, double noundef 0.000000e+00) #4
  call void @rpyMat(ptr noundef nonnull %15, ptr noundef nonnull %14)
  call void @mat33_mult_mat2(ptr noundef nonnull %20, ptr noundef nonnull %16, ptr noundef nonnull %15) #4
  %43 = getelementptr inbounds %struct.pose_t, ptr %0, i64 %indvars.iv70
  call void @mat33_mult_mat2(ptr noundef %43, ptr noundef nonnull %20, ptr noundef nonnull %12) #4
  %44 = getelementptr inbounds i8, ptr %43, i64 72
  %45 = getelementptr inbounds [10 x %struct.vec3_t], ptr %18, i64 0, i64 %indvars.iv70
  call void @vec3_copy(ptr noundef nonnull %44, ptr noundef nonnull %45) #4
  br label %46

46:                                               ; preds = %.lr.ph50.us, %46
  %indvars.iv65 = phi i64 [ 0, %.lr.ph50.us ], [ %indvars.iv.next66, %46 ]
  %.048.us = phi double [ 0.000000e+00, %.lr.ph50.us ], [ %50, %46 ]
  call void @mat33_eye(ptr noundef nonnull %21) #4
  %47 = getelementptr inbounds %struct.mat33_t, ptr %32, i64 %indvars.iv65
  call void @mat33_sub(ptr noundef nonnull %21, ptr noundef nonnull %47) #4
  %48 = getelementptr inbounds %struct.vec3_t, ptr %2, i64 %indvars.iv65
  call void @vec3_mult_mat(ptr noundef nonnull %22, ptr noundef %43, ptr noundef %48) #4
  call void @vec3_add_vec(ptr noundef nonnull %22, ptr noundef nonnull %44) #4
  call void @vec3_mult_mat(ptr noundef nonnull %23, ptr noundef nonnull %21, ptr noundef nonnull %22) #4
  call void @vec3_mult_vec(ptr noundef nonnull %23, ptr noundef nonnull %23) #4
  %49 = call double @vec3_sum(ptr noundef nonnull %23) #4
  %50 = fadd double %.048.us, %49
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond69.not = icmp eq i64 %indvars.iv.next66, %24
  br i1 %exitcond69.not, label %._crit_edge51.us, label %46, !llvm.loop !13

._crit_edge51.us:                                 ; preds = %46
  %51 = getelementptr inbounds i8, ptr %43, i64 96
  store double %50, ptr %51, align 8, !tbaa !14
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %52 = load i32, ptr %19, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next71, %53
  br i1 %54, label %.lr.ph50.us, label %._crit_edge55, !llvm.loop !17

.lr.ph54.split:                                   ; preds = %.lr.ph54.split.preheader, %.lr.ph54.split
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %.lr.ph54.split ], [ 0, %.lr.ph54.split.preheader ]
  call void @mat33_clear(ptr noundef nonnull %15) #4
  %55 = getelementptr inbounds [10 x double], ptr %17, i64 0, i64 %indvars.iv62
  %56 = load double, ptr %55, align 8, !tbaa !5
  call void @vec3_assign(ptr noundef nonnull %14, double noundef 0.000000e+00, double noundef %56, double noundef 0.000000e+00) #4
  call void @rpyMat(ptr noundef nonnull %15, ptr noundef nonnull %14)
  call void @mat33_mult_mat2(ptr noundef nonnull %20, ptr noundef nonnull %16, ptr noundef nonnull %15) #4
  %57 = getelementptr inbounds %struct.pose_t, ptr %0, i64 %indvars.iv62
  call void @mat33_mult_mat2(ptr noundef %57, ptr noundef nonnull %20, ptr noundef nonnull %12) #4
  %58 = getelementptr inbounds i8, ptr %57, i64 72
  %59 = getelementptr inbounds [10 x %struct.vec3_t], ptr %18, i64 0, i64 %indvars.iv62
  call void @vec3_copy(ptr noundef nonnull %58, ptr noundef nonnull %59) #4
  %60 = getelementptr inbounds i8, ptr %57, i64 96
  store double 0.000000e+00, ptr %60, align 8, !tbaa !14
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %61 = load i32, ptr %19, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next63, %62
  br i1 %63, label %.lr.ph54.split, label %._crit_edge55, !llvm.loop !17

._crit_edge55:                                    ; preds = %.lr.ph54.split, %._crit_edge51.us, %._crit_edge.thread, %._crit_edge
  %.lcssa = phi i32 [ %37, %._crit_edge ], [ %39, %._crit_edge.thread ], [ %52, %._crit_edge51.us ], [ %61, %.lr.ph54.split ]
  store i32 %.lcssa, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %23) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %22) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %21) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #4
  call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %18) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %17) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %15) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #4
  call void @llvm.stackrestore.p0(ptr %25)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %10) #4
  ret void
}

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

declare void @scalar_array_div(ptr noundef, double noundef, i32 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!"double", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !6, i64 96}
!15 = !{!"", !16, i64 0, !16, i64 72, !6, i64 96, !16, i64 104, !16, i64 176, !6, i64 200}
!16 = !{!"", !7, i64 0}
!17 = distinct !{!17, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass