; LLVM IR from Razakhel/RaZ :: src/RaZ/Math/Transform.ll (ZN3Raz9Transform6rotateENS_7RadiansIfEES2_S2_)

; 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.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }
%"struct.Raz::Radians" = type { float }
%"class.Raz::Quaternion" = type { float, %"class.Raz::Vector" }
%"class.Raz::Transform" = type <{ %"class.Raz::Component", %"class.Raz::Vector", %"class.Raz::Quaternion", %"class.Raz::Vector", i8, [7 x i8] }>
%"class.Raz::Component" = type { ptr }

@_ZN3Raz4AxisL1XE = external hidden constant %"class.Raz::Vector", align 4
@_ZN3Raz4AxisL1YE = external hidden constant %"class.Raz::Vector", align 4
@_ZN3Raz4AxisL1ZE = external hidden constant %"class.Raz::Vector", align 4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16), float, ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3Raz10QuaternionIfEmLERKS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfEmlERKS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3Raz9Transform6rotateENS_7RadiansIfEES2_S2_(ptr noundef nonnull align 8 dereferenceable(56) %0, float %1, float %2, float %3) #2 align 2 {
  %5 = alloca %"struct.Raz::Radians", align 4
  %6 = alloca %"struct.Raz::Radians", align 4
  %7 = alloca %"struct.Raz::Radians", align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"class.Raz::Quaternion", align 4
  %10 = alloca %"struct.Raz::Radians", align 4
  %11 = alloca %"class.Raz::Quaternion", align 4
  %12 = alloca %"struct.Raz::Radians", align 4
  %13 = alloca %"class.Raz::Quaternion", align 4
  %14 = alloca %"struct.Raz::Radians", align 4
  %15 = alloca %"class.Raz::Quaternion", align 4
  %16 = alloca %"class.Raz::Quaternion", align 4
  %17 = getelementptr inbounds %"struct.Raz::Radians", ptr %5, i32 0, i32 0
  store float %1, ptr %17, align 4
  %18 = getelementptr inbounds %"struct.Raz::Radians", ptr %6, i32 0, i32 0
  store float %2, ptr %18, align 4
  %19 = getelementptr inbounds %"struct.Raz::Radians", ptr %7, i32 0, i32 0
  store float %3, ptr %19, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %5, i64 4, i1 false), !tbaa.struct !9
  %21 = getelementptr inbounds %"struct.Raz::Radians", ptr %10, i32 0, i32 0
  %22 = load float, ptr %21, align 4
  call void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %9, float %22, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz4AxisL1XE) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %6, i64 4, i1 false), !tbaa.struct !9
  %23 = getelementptr inbounds %"struct.Raz::Radians", ptr %12, i32 0, i32 0
  %24 = load float, ptr %23, align 4
  call void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %11, float %24, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz4AxisL1YE) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %7, i64 4, i1 false), !tbaa.struct !9
  %25 = getelementptr inbounds %"struct.Raz::Radians", ptr %14, i32 0, i32 0
  %26 = load float, ptr %25, align 4
  call void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %13, float %26, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz4AxisL1ZE) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #4
  %27 = call { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfEmlERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(16) %9) #4
  %28 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 0
  %29 = extractvalue { <2 x float>, <2 x float> } %27, 0
  store <2 x float> %29, ptr %28, align 4
  %30 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 1
  %31 = extractvalue { <2 x float>, <2 x float> } %27, 1
  store <2 x float> %31, ptr %30, align 4
  %32 = call { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfEmlERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(16) %11) #4
  %33 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 0
  %34 = extractvalue { <2 x float>, <2 x float> } %32, 0
  store <2 x float> %34, ptr %33, align 4
  %35 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 1
  %36 = extractvalue { <2 x float>, <2 x float> } %32, 1
  store <2 x float> %36, ptr %35, align 4
  %37 = getelementptr inbounds %"class.Raz::Transform", ptr %20, i32 0, i32 2
  %38 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3Raz10QuaternionIfEmLERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(16) %15) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #4
  %39 = getelementptr inbounds %"class.Raz::Transform", ptr %20, i32 0, i32 4
  store i8 1, ptr %39, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 = !{i64 0, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !18, i64 48}
!13 = !{!"_ZTSN3Raz9TransformE", !14, i64 0, !15, i64 8, !17, i64 20, !15, i64 36, !18, i64 48}
!14 = !{!"_ZTSN3Raz9ComponentE"}
!15 = !{!"_ZTSN3Raz6VectorIfLm3EEE", !16, i64 0}
!16 = !{!"_ZTSSt5arrayIfLm3EE", !7, i64 0}
!17 = !{!"_ZTSN3Raz10QuaternionIfEE", !11, i64 0, !15, i64 4}
!18 = !{!"bool", !7, 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.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }
%"class.Raz::Quaternion" = type { float, %"class.Raz::Vector" }

@_ZN3Raz4AxisL1XE = external hidden constant %"class.Raz::Vector", align 4
@_ZN3Raz4AxisL1YE = external hidden constant %"class.Raz::Vector", align 4
@_ZN3Raz4AxisL1ZE = external hidden constant %"class.Raz::Vector", align 4

; 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 nounwind uwtable
declare dso_local void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16), float, ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3Raz10QuaternionIfEmLERKS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfEmlERKS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3Raz9Transform6rotateENS_7RadiansIfEES2_S2_(ptr noundef nonnull align 8 dereferenceable(56) %0, float %1, float %2, float %3) local_unnamed_addr #1 align 2 {
  %5 = alloca %"class.Raz::Quaternion", align 4
  %6 = alloca %"class.Raz::Quaternion", align 4
  %7 = alloca %"class.Raz::Quaternion", align 4
  %8 = alloca %"class.Raz::Quaternion", align 8
  %9 = alloca %"class.Raz::Quaternion", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  call void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %5, float %1, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz4AxisL1XE) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  call void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %6, float %2, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz4AxisL1YE) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #3
  call void @_ZN3Raz10QuaternionIfEC2ENS_7RadiansIfEERKNS_6VectorIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %7, float %3, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz4AxisL1ZE) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #3
  %10 = call { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfEmlERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(16) %5) #3
  %11 = extractvalue { <2 x float>, <2 x float> } %10, 0
  store <2 x float> %11, ptr %9, align 8
  %12 = getelementptr inbounds i8, ptr %9, i64 8
  %13 = extractvalue { <2 x float>, <2 x float> } %10, 1
  store <2 x float> %13, ptr %12, align 8
  %14 = call { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfEmlERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(16) %6) #3
  %15 = extractvalue { <2 x float>, <2 x float> } %14, 0
  store <2 x float> %15, ptr %8, align 8
  %16 = getelementptr inbounds i8, ptr %8, i64 8
  %17 = extractvalue { <2 x float>, <2 x float> } %14, 1
  store <2 x float> %17, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr %0, i64 20
  %19 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3Raz10QuaternionIfEmLERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(16) %8) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #3
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  store i8 1, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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, !14, i64 48}
!6 = !{!"_ZTSN3Raz9TransformE", !7, i64 0, !8, i64 8, !12, i64 20, !8, i64 36, !14, i64 48}
!7 = !{!"_ZTSN3Raz9ComponentE"}
!8 = !{!"_ZTSN3Raz6VectorIfLm3EEE", !9, i64 0}
!9 = !{!"_ZTSSt5arrayIfLm3EE", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN3Raz10QuaternionIfEE", !13, i64 0, !8, i64 4}
!13 = !{!"float", !10, i64 0}
!14 = !{!"bool", !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass