; LLVM IR from aap/librw :: src/base.ll (ZN2rw4multERKNS_4QuatES2_)

; 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.rw::Quat" = type { float, float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local { <2 x float>, <2 x float> } @_ZN2rw4multERKNS_4QuatES2_(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(16) %1) #0 {
  %3 = alloca %"struct.rw::Quat", align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %"struct.rw::Quat", ptr %6, i32 0, i32 3
  %8 = load float, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.rw::Quat", ptr %9, i32 0, i32 3
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.rw::Quat", ptr %12, i32 0, i32 0
  %14 = load float, ptr %13, align 4, !tbaa !12
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.rw::Quat", ptr %15, i32 0, i32 0
  %17 = load float, ptr %16, align 4, !tbaa !12
  %18 = fmul float %14, %17
  %19 = fneg float %18
  %20 = call float @llvm.fmuladd.f32(float %8, float %11, float %19)
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.rw::Quat", ptr %21, i32 0, i32 1
  %23 = load float, ptr %22, align 4, !tbaa !13
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.rw::Quat", ptr %24, i32 0, i32 1
  %26 = load float, ptr %25, align 4, !tbaa !13
  %27 = fneg float %23
  %28 = call float @llvm.fmuladd.f32(float %27, float %26, float %20)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.rw::Quat", ptr %29, i32 0, i32 2
  %31 = load float, ptr %30, align 4, !tbaa !14
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.rw::Quat", ptr %32, i32 0, i32 2
  %34 = load float, ptr %33, align 4, !tbaa !14
  %35 = fneg float %31
  %36 = call float @llvm.fmuladd.f32(float %35, float %34, float %28)
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.rw::Quat", ptr %37, i32 0, i32 3
  %39 = load float, ptr %38, align 4, !tbaa !9
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.rw::Quat", ptr %40, i32 0, i32 0
  %42 = load float, ptr %41, align 4, !tbaa !12
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.rw::Quat", ptr %43, i32 0, i32 0
  %45 = load float, ptr %44, align 4, !tbaa !12
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.rw::Quat", ptr %46, i32 0, i32 3
  %48 = load float, ptr %47, align 4, !tbaa !9
  %49 = fmul float %45, %48
  %50 = call float @llvm.fmuladd.f32(float %39, float %42, float %49)
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.rw::Quat", ptr %51, i32 0, i32 1
  %53 = load float, ptr %52, align 4, !tbaa !13
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.rw::Quat", ptr %54, i32 0, i32 2
  %56 = load float, ptr %55, align 4, !tbaa !14
  %57 = call float @llvm.fmuladd.f32(float %53, float %56, float %50)
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.rw::Quat", ptr %58, i32 0, i32 2
  %60 = load float, ptr %59, align 4, !tbaa !14
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.rw::Quat", ptr %61, i32 0, i32 1
  %63 = load float, ptr %62, align 4, !tbaa !13
  %64 = fneg float %60
  %65 = call float @llvm.fmuladd.f32(float %64, float %63, float %57)
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.rw::Quat", ptr %66, i32 0, i32 3
  %68 = load float, ptr %67, align 4, !tbaa !9
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.rw::Quat", ptr %69, i32 0, i32 1
  %71 = load float, ptr %70, align 4, !tbaa !13
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.rw::Quat", ptr %72, i32 0, i32 1
  %74 = load float, ptr %73, align 4, !tbaa !13
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.rw::Quat", ptr %75, i32 0, i32 3
  %77 = load float, ptr %76, align 4, !tbaa !9
  %78 = fmul float %74, %77
  %79 = call float @llvm.fmuladd.f32(float %68, float %71, float %78)
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.rw::Quat", ptr %80, i32 0, i32 2
  %82 = load float, ptr %81, align 4, !tbaa !14
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.rw::Quat", ptr %83, i32 0, i32 0
  %85 = load float, ptr %84, align 4, !tbaa !12
  %86 = call float @llvm.fmuladd.f32(float %82, float %85, float %79)
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.rw::Quat", ptr %87, i32 0, i32 0
  %89 = load float, ptr %88, align 4, !tbaa !12
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.rw::Quat", ptr %90, i32 0, i32 2
  %92 = load float, ptr %91, align 4, !tbaa !14
  %93 = fneg float %89
  %94 = call float @llvm.fmuladd.f32(float %93, float %92, float %86)
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %"struct.rw::Quat", ptr %95, i32 0, i32 3
  %97 = load float, ptr %96, align 4, !tbaa !9
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.rw::Quat", ptr %98, i32 0, i32 2
  %100 = load float, ptr %99, align 4, !tbaa !14
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.rw::Quat", ptr %101, i32 0, i32 2
  %103 = load float, ptr %102, align 4, !tbaa !14
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %"struct.rw::Quat", ptr %104, i32 0, i32 3
  %106 = load float, ptr %105, align 4, !tbaa !9
  %107 = fmul float %103, %106
  %108 = call float @llvm.fmuladd.f32(float %97, float %100, float %107)
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.rw::Quat", ptr %109, i32 0, i32 0
  %111 = load float, ptr %110, align 4, !tbaa !12
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %"struct.rw::Quat", ptr %112, i32 0, i32 1
  %114 = load float, ptr %113, align 4, !tbaa !13
  %115 = call float @llvm.fmuladd.f32(float %111, float %114, float %108)
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %"struct.rw::Quat", ptr %116, i32 0, i32 1
  %118 = load float, ptr %117, align 4, !tbaa !13
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.rw::Quat", ptr %119, i32 0, i32 0
  %121 = load float, ptr %120, align 4, !tbaa !12
  %122 = fneg float %118
  %123 = call float @llvm.fmuladd.f32(float %122, float %121, float %115)
  %124 = call { <2 x float>, <2 x float> } @_ZN2rw8makeQuatEffff(float noundef %36, float noundef %65, float noundef %94, float noundef %123)
  %125 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %3, i32 0, i32 0
  %126 = extractvalue { <2 x float>, <2 x float> } %124, 0
  store <2 x float> %126, ptr %125, align 4
  %127 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %3, i32 0, i32 1
  %128 = extractvalue { <2 x float>, <2 x float> } %124, 1
  store <2 x float> %128, ptr %127, align 4
  %129 = load { <2 x float>, <2 x float> }, ptr %3, align 4
  ret { <2 x float>, <2 x float> } %129
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZN2rw8makeQuatEffff(float noundef, float noundef, float noundef, float noundef) #1

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

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

!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, !11, i64 12}
!10 = !{!"_ZTSN2rw4QuatE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, 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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local { <2 x float>, <2 x float> } @_ZN2rw4multERKNS_4QuatES2_(ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 12
  %4 = load float, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = load float, ptr %0, align 4, !tbaa !10
  %8 = load float, ptr %1, align 4, !tbaa !10
  %9 = fneg float %7
  %10 = fmul float %8, %9
  %11 = tail call float @llvm.fmuladd.f32(float %4, float %6, float %10)
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  %13 = load float, ptr %12, align 4, !tbaa !11
  %14 = getelementptr inbounds i8, ptr %1, i64 4
  %15 = load float, ptr %14, align 4, !tbaa !11
  %16 = fneg float %13
  %17 = tail call float @llvm.fmuladd.f32(float %16, float %15, float %11)
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load float, ptr %18, align 4, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = load float, ptr %20, align 4, !tbaa !12
  %22 = fneg float %19
  %23 = tail call float @llvm.fmuladd.f32(float %22, float %21, float %17)
  %24 = fmul float %6, %7
  %25 = tail call float @llvm.fmuladd.f32(float %4, float %8, float %24)
  %26 = tail call float @llvm.fmuladd.f32(float %13, float %21, float %25)
  %27 = tail call float @llvm.fmuladd.f32(float %22, float %15, float %26)
  %28 = fmul float %6, %13
  %29 = tail call float @llvm.fmuladd.f32(float %4, float %15, float %28)
  %30 = tail call float @llvm.fmuladd.f32(float %19, float %8, float %29)
  %31 = tail call float @llvm.fmuladd.f32(float %9, float %21, float %30)
  %32 = fmul float %6, %19
  %33 = tail call float @llvm.fmuladd.f32(float %4, float %21, float %32)
  %34 = tail call float @llvm.fmuladd.f32(float %7, float %15, float %33)
  %35 = tail call float @llvm.fmuladd.f32(float %16, float %8, float %34)
  %36 = tail call { <2 x float>, <2 x float> } @_ZN2rw8makeQuatEffff(float noundef %23, float noundef %27, float noundef %31, float noundef %35)
  ret { <2 x float>, <2 x float> } %36
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZN2rw8makeQuatEffff(float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

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

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

!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, !7, i64 12}
!6 = !{!"_ZTSN2rw4QuatE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass