; LLVM IR from thuhcsi/Crystal.TTVS :: Xface/XFace/src/XMath/Quaternion.ll (ZNK5XMath10QuaternionmlERKS0_)

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

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

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

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

declare void @_ZN5XMath10QuaternionC1Effff(ptr, float, float, float, float)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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++ TBAA"}
!9 = !{!10, !11, i64 12}
!10 = !{!"_ZTSN5XMath10QuaternionE", !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}
!15 = !{!11, !11, i64 0}


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

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

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

declare void @_ZN5XMath10QuaternionC1Effff(ptr, float, float, float, float) local_unnamed_addr

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

!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 = !{!"_ZTSN5XMath10QuaternionE", !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