; LLVM IR from romerojosh/zefr :: src/funcs.ll (Z17getRotationMatrixRK4Quat)

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

%class.mdvector = type <{ i32, [4 x i8], i64, i64, %"struct.std::array", %"struct.std::array", %"class.std::vector.6", ptr, i8, [7 x i8] }>
%"struct.std::array" = type { [6 x i32] }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.point = type { double, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::initializer_list" = type { ptr, i64 }
%"class.std::allocator.3" = type { i8 }

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

; Function Attrs: nounwind
declare double @sin(double noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare double @cos(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEEC2ESt16initializer_listIjERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8mdvectorIdEC2ESt6vectorIjSaIjEEdb(ptr noundef nonnull align 8 dereferenceable(105), ptr noundef, double noundef, i1 noundef zeroext) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8mdvectorIdED2Ev(ptr noundef nonnull align 8 dereferenceable(105)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5pointC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN5point4normEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17getRotationMatrixRK4Quat(ptr dead_on_unwind noalias writable sret(%class.mdvector) align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.point, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca i1, align 1
  %11 = alloca %"class.std::vector", align 8
  %12 = alloca %"class.std::initializer_list", align 8
  %13 = alloca [2 x i32], align 4
  %14 = alloca %"class.std::allocator.3", align 1
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef 1)
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %26, i32 noundef 2)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %28, i32 noundef 3)
  call void @_ZN5pointC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef %25, double noundef %27, double noundef %29)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %30 = call noundef double @_ZN5point4normEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  store double %30, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %31 = getelementptr inbounds %struct.point, ptr %5, i32 0, i32 0
  %32 = load double, ptr %31, align 8, !tbaa !11
  store double %32, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %33 = getelementptr inbounds %struct.point, ptr %5, i32 0, i32 1
  %34 = load double, ptr %33, align 8, !tbaa !13
  store double %34, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %35 = getelementptr inbounds %struct.point, ptr %5, i32 0, i32 2
  %36 = load double, ptr %35, align 8, !tbaa !14
  store double %36, ptr %9, align 8, !tbaa !9
  %37 = load double, ptr %6, align 8, !tbaa !9
  %38 = fcmp ogt double %37, 1.000000e-08
  br i1 %38, label %39, label %49

39:                                               ; preds = %2
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = load double, ptr %7, align 8, !tbaa !9
  %42 = fdiv double %41, %40
  store double %42, ptr %7, align 8, !tbaa !9
  %43 = load double, ptr %6, align 8, !tbaa !9
  %44 = load double, ptr %8, align 8, !tbaa !9
  %45 = fdiv double %44, %43
  store double %45, ptr %8, align 8, !tbaa !9
  %46 = load double, ptr %6, align 8, !tbaa !9
  %47 = load double, ptr %9, align 8, !tbaa !9
  %48 = fdiv double %47, %46
  store double %48, ptr %9, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %39, %2
  store i1 false, ptr %10, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i32 3, ptr %13, align 4, !tbaa !15
  %50 = getelementptr inbounds i32, ptr %13, i64 1
  store i32 3, ptr %50, align 4, !tbaa !15
  %51 = getelementptr inbounds %"class.std::initializer_list", ptr %12, i32 0, i32 0
  store ptr %13, ptr %51, align 8, !tbaa !17
  %52 = getelementptr inbounds %"class.std::initializer_list", ptr %12, i32 0, i32 1
  store i64 2, ptr %52, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  call void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #5
  %53 = getelementptr inbounds { ptr, i64 }, ptr %12, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8
  %55 = getelementptr inbounds { ptr, i64 }, ptr %12, i32 0, i32 1
  %56 = load i64, ptr %55, align 8
  invoke void @_ZNSt6vectorIjSaIjEEC2ESt16initializer_listIjERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr %54, i64 %56, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %57 unwind label %153

57:                                               ; preds = %49
  invoke void @_ZN8mdvectorIdEC2ESt6vectorIjSaIjEEdb(ptr noundef nonnull align 8 dereferenceable(105) %0, ptr noundef %11, double noundef 0.000000e+00, i1 noundef zeroext false)
          to label %58 unwind label %157

58:                                               ; preds = %57
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = invoke noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %59, i32 noundef 0)
          to label %61 unwind label %162

61:                                               ; preds = %58
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = invoke noundef double @_ZNK4Quat4normEv(ptr noundef nonnull align 8 dereferenceable(32) %62)
          to label %64 unwind label %162

64:                                               ; preds = %61
  %65 = fdiv double %60, %63
  %66 = call double @acos(double noundef %65) #5
  %67 = fmul double 2.000000e+00, %66
  store double %67, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %68 = load double, ptr %17, align 8, !tbaa !9
  %69 = call double @sin(double noundef %68) #5
  store double %69, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %70 = load double, ptr %17, align 8, !tbaa !9
  %71 = call double @cos(double noundef %70) #5
  store double %71, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %72 = load double, ptr %19, align 8, !tbaa !9
  %73 = fsub double 1.000000e+00, %72
  store double %73, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %74 = load double, ptr %7, align 8, !tbaa !9
  %75 = load double, ptr %8, align 8, !tbaa !9
  %76 = fmul double %74, %75
  %77 = load double, ptr %20, align 8, !tbaa !9
  %78 = fmul double %76, %77
  store double %78, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %79 = load double, ptr %7, align 8, !tbaa !9
  %80 = load double, ptr %9, align 8, !tbaa !9
  %81 = fmul double %79, %80
  %82 = load double, ptr %20, align 8, !tbaa !9
  %83 = fmul double %81, %82
  store double %83, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %84 = load double, ptr %8, align 8, !tbaa !9
  %85 = load double, ptr %9, align 8, !tbaa !9
  %86 = fmul double %84, %85
  %87 = load double, ptr %20, align 8, !tbaa !9
  %88 = fmul double %86, %87
  store double %88, ptr %23, align 8, !tbaa !9
  %89 = load double, ptr %19, align 8, !tbaa !9
  %90 = load double, ptr %7, align 8, !tbaa !9
  %91 = load double, ptr %7, align 8, !tbaa !9
  %92 = fmul double %90, %91
  %93 = load double, ptr %20, align 8, !tbaa !9
  %94 = call double @llvm.fmuladd.f64(double %92, double %93, double %89)
  %95 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 0, i32 noundef 0)
          to label %96 unwind label %166

96:                                               ; preds = %64
  store double %94, ptr %95, align 8, !tbaa !9
  %97 = load double, ptr %21, align 8, !tbaa !9
  %98 = load double, ptr %9, align 8, !tbaa !9
  %99 = load double, ptr %18, align 8, !tbaa !9
  %100 = fneg double %98
  %101 = call double @llvm.fmuladd.f64(double %100, double %99, double %97)
  %102 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 0, i32 noundef 1)
          to label %103 unwind label %166

103:                                              ; preds = %96
  store double %101, ptr %102, align 8, !tbaa !9
  %104 = load double, ptr %22, align 8, !tbaa !9
  %105 = load double, ptr %8, align 8, !tbaa !9
  %106 = load double, ptr %18, align 8, !tbaa !9
  %107 = call double @llvm.fmuladd.f64(double %105, double %106, double %104)
  %108 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 0, i32 noundef 2)
          to label %109 unwind label %166

109:                                              ; preds = %103
  store double %107, ptr %108, align 8, !tbaa !9
  %110 = load double, ptr %21, align 8, !tbaa !9
  %111 = load double, ptr %9, align 8, !tbaa !9
  %112 = load double, ptr %18, align 8, !tbaa !9
  %113 = call double @llvm.fmuladd.f64(double %111, double %112, double %110)
  %114 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 1, i32 noundef 0)
          to label %115 unwind label %166

115:                                              ; preds = %109
  store double %113, ptr %114, align 8, !tbaa !9
  %116 = load double, ptr %19, align 8, !tbaa !9
  %117 = load double, ptr %8, align 8, !tbaa !9
  %118 = load double, ptr %8, align 8, !tbaa !9
  %119 = fmul double %117, %118
  %120 = load double, ptr %20, align 8, !tbaa !9
  %121 = call double @llvm.fmuladd.f64(double %119, double %120, double %116)
  %122 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 1, i32 noundef 1)
          to label %123 unwind label %166

123:                                              ; preds = %115
  store double %121, ptr %122, align 8, !tbaa !9
  %124 = load double, ptr %23, align 8, !tbaa !9
  %125 = load double, ptr %7, align 8, !tbaa !9
  %126 = load double, ptr %18, align 8, !tbaa !9
  %127 = fneg double %125
  %128 = call double @llvm.fmuladd.f64(double %127, double %126, double %124)
  %129 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 1, i32 noundef 2)
          to label %130 unwind label %166

130:                                              ; preds = %123
  store double %128, ptr %129, align 8, !tbaa !9
  %131 = load double, ptr %22, align 8, !tbaa !9
  %132 = load double, ptr %8, align 8, !tbaa !9
  %133 = load double, ptr %18, align 8, !tbaa !9
  %134 = fneg double %132
  %135 = call double @llvm.fmuladd.f64(double %134, double %133, double %131)
  %136 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 2, i32 noundef 0)
          to label %137 unwind label %166

137:                                              ; preds = %130
  store double %135, ptr %136, align 8, !tbaa !9
  %138 = load double, ptr %23, align 8, !tbaa !9
  %139 = load double, ptr %7, align 8, !tbaa !9
  %140 = load double, ptr %18, align 8, !tbaa !9
  %141 = call double @llvm.fmuladd.f64(double %139, double %140, double %138)
  %142 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 2, i32 noundef 1)
          to label %143 unwind label %166

143:                                              ; preds = %137
  store double %141, ptr %142, align 8, !tbaa !9
  %144 = load double, ptr %19, align 8, !tbaa !9
  %145 = load double, ptr %9, align 8, !tbaa !9
  %146 = load double, ptr %9, align 8, !tbaa !9
  %147 = fmul double %145, %146
  %148 = load double, ptr %20, align 8, !tbaa !9
  %149 = call double @llvm.fmuladd.f64(double %147, double %148, double %144)
  %150 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 2, i32 noundef 2)
          to label %151 unwind label %166

151:                                              ; preds = %143
  store double %149, ptr %150, align 8, !tbaa !9
  store i1 true, ptr %10, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %152 = load i1, ptr %10, align 1
  br i1 %152, label %172, label %171

153:                                              ; preds = %49
  %154 = landingpad { ptr, i32 }
          cleanup
  %155 = extractvalue { ptr, i32 } %154, 0
  store ptr %155, ptr %15, align 8
  %156 = extractvalue { ptr, i32 } %154, 1
  store i32 %156, ptr %16, align 4
  br label %161

157:                                              ; preds = %57
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %15, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %16, align 4
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  br label %161

161:                                              ; preds = %157, %153
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %173

162:                                              ; preds = %61, %58
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %15, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %16, align 4
  br label %170

166:                                              ; preds = %143, %137, %130, %123, %115, %109, %103, %96, %64
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %15, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %170

170:                                              ; preds = %166, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @_ZN8mdvectorIdED2Ev(ptr noundef nonnull align 8 dereferenceable(105) %0) #5
  br label %173

171:                                              ; preds = %151
  call void @_ZN8mdvectorIdED2Ev(ptr noundef nonnull align 8 dereferenceable(105) %0) #5
  br label %172

172:                                              ; preds = %171, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #5
  ret void

173:                                              ; preds = %170, %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #5
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr %15, align 8
  %176 = load i32, ptr %16, align 4
  %177 = insertvalue { ptr, i32 } poison, ptr %175, 0
  %178 = insertvalue { ptr, i32 } %177, i32 %176, 1
  resume { ptr, i32 } %178
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #3 align 2

; Function Attrs: nounwind
declare double @acos(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4Quat4normEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress 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 = { mustprogress 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS5point", !10, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt16initializer_listIjE", !6, i64 0, !19, i64 8}
!19 = !{!"long", !7, i64 0}
!20 = !{!18, !19, i64 8}


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

%class.mdvector = type <{ i32, [4 x i8], i64, i64, %"struct.std::array", %"struct.std::array", %"class.std::vector.6", ptr, i8, [7 x i8] }>
%"struct.std::array" = type { [6 x i32] }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.point = type { double, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.3" = type { i8 }

; 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 nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEEC2ESt16initializer_listIjERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8mdvectorIdEC2ESt6vectorIjSaIjEEdb(ptr noundef nonnull align 8 dereferenceable(105), ptr noundef, double noundef, i1 noundef zeroext) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5pointC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN5point4normEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17getRotationMatrixRK4Quat(ptr dead_on_unwind noalias writable sret(%class.mdvector) align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.point, align 16
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca [2 x i32], align 4
  %6 = alloca %"class.std::allocator.3", align 1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  %7 = tail call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 1)
  %8 = tail call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 2)
  %9 = tail call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 3)
  call void @_ZN5pointC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %3, double noundef %7, double noundef %8, double noundef %9)
  %10 = call noundef double @_ZN5point4normEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %11 = load <2 x double>, ptr %3, align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %3, i64 16
  %13 = load double, ptr %12, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store i32 3, ptr %5, align 4, !tbaa !11
  %14 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 3, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  call void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  invoke void @_ZNSt6vectorIjSaIjEEC2ESt16initializer_listIjERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr nonnull %5, i64 2, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %15 unwind label %66

15:                                               ; preds = %2
  invoke void @_ZN8mdvectorIdEC2ESt6vectorIjSaIjEEdb(ptr noundef nonnull align 8 dereferenceable(105) %0, ptr noundef nonnull %4, double noundef 0.000000e+00, i1 noundef zeroext false)
          to label %16 unwind label %68

16:                                               ; preds = %15
  %17 = fcmp ogt double %10, 1.000000e-08
  %18 = insertelement <2 x double> poison, double %10, i64 0
  %19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
  %20 = fdiv <2 x double> %11, %19
  %21 = insertelement <2 x i1> poison, i1 %17, i64 0
  %22 = shufflevector <2 x i1> %21, <2 x i1> poison, <2 x i32> zeroinitializer
  %23 = select <2 x i1> %22, <2 x double> %20, <2 x double> %11
  %24 = fdiv double %13, %10
  %.057 = select i1 %17, double %24, double %13
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %25 = call noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 0)
  %26 = call noundef double @_ZNK4Quat4normEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %27 = fdiv double %25, %26
  %28 = call double @acos(double noundef %27) #5
  %29 = fmul double %28, 2.000000e+00
  %30 = call double @sin(double noundef %29) #5
  %31 = call double @cos(double noundef %29) #5
  %32 = fsub double 1.000000e+00, %31
  %33 = extractelement <2 x double> %23, i64 0
  %34 = extractelement <2 x double> %23, i64 1
  %35 = fmul double %33, %34
  %36 = fmul double %35, %32
  %37 = fmul double %33, %.057
  %38 = fmul double %37, %32
  %39 = fmul double %34, %.057
  %40 = fmul double %39, %32
  %41 = fmul <2 x double> %23, %23
  %42 = extractelement <2 x double> %41, i64 0
  %43 = call double @llvm.fmuladd.f64(double %42, double %32, double %31)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 0, i32 noundef 0)
  store double %43, ptr %44, align 8, !tbaa !5
  %45 = fneg double %.057
  %46 = call double @llvm.fmuladd.f64(double %45, double %30, double %36)
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 0, i32 noundef 1)
  store double %46, ptr %47, align 8, !tbaa !5
  %48 = call double @llvm.fmuladd.f64(double %34, double %30, double %38)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 0, i32 noundef 2)
  store double %48, ptr %49, align 8, !tbaa !5
  %50 = call double @llvm.fmuladd.f64(double %.057, double %30, double %36)
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 1, i32 noundef 0)
  store double %50, ptr %51, align 8, !tbaa !5
  %52 = fmul double %34, %34
  %53 = call double @llvm.fmuladd.f64(double %52, double %32, double %31)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 1, i32 noundef 1)
  store double %53, ptr %54, align 8, !tbaa !5
  %55 = fneg double %33
  %56 = call double @llvm.fmuladd.f64(double %55, double %30, double %40)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 1, i32 noundef 2)
  store double %56, ptr %57, align 8, !tbaa !5
  %58 = fneg double %34
  %59 = call double @llvm.fmuladd.f64(double %58, double %30, double %38)
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 2, i32 noundef 0)
  store double %59, ptr %60, align 8, !tbaa !5
  %61 = call double @llvm.fmuladd.f64(double %33, double %30, double %40)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 2, i32 noundef 1)
  store double %61, ptr %62, align 8, !tbaa !5
  %63 = fmul double %.057, %.057
  %64 = call double @llvm.fmuladd.f64(double %63, double %32, double %31)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8mdvectorIdEclEjj(ptr noundef nonnull align 8 dereferenceable(105) %0, i32 noundef 2, i32 noundef 2)
  store double %64, ptr %65, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  ret void

66:                                               ; preds = %2
  %67 = landingpad { ptr, i32 }
          cleanup
  br label %70

68:                                               ; preds = %15
  %69 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  br label %70

70:                                               ; preds = %68, %66
  %.pn = phi { ptr, i32 } [ %69, %68 ], [ %67, %66 ]
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @acos(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4Quat4normEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "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 speculatable willreturn memory(none) }
attributes #3 = { mustprogress 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 = { mustprogress 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"_ZTS5point", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass