; LLVM IR from Razakhel/RaZ :: src/RaZ/Render/Camera.ll (ZN3Raz6Camera17computeViewMatrixERKNS_9TransformE)

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

; 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: mustprogress uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN3Raz6Camera17computeViewMatrixERKNS_9TransformE(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.Raz::Matrix", align 4
  %6 = alloca %"class.Raz::Matrix", align 4
  %7 = alloca %"class.Raz::Quaternion", align 4
  %8 = alloca %"class.Raz::Matrix", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3Raz9Transform11getRotationEv(ptr noundef nonnull align 8 dereferenceable(56) %10)
  %12 = call { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfE7inverseEv(ptr noundef nonnull align 4 dereferenceable(16) %11) #5
  %13 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 0
  %14 = extractvalue { <2 x float>, <2 x float> } %12, 0
  store <2 x float> %14, ptr %13, align 4
  %15 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 1
  %16 = extractvalue { <2 x float>, <2 x float> } %12, 1
  store <2 x float> %16, ptr %15, align 4
  call void @_ZNK3Raz10QuaternionIfE13computeMatrixEv(ptr dead_on_unwind writable sret(%"class.Raz::Matrix") align 4 %6, ptr noundef nonnull align 4 dereferenceable(16) %7) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %8) #5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK3Raz9Transform24computeTranslationMatrixEb(ptr dead_on_unwind writable sret(%"class.Raz::Matrix") align 4 %8, ptr noundef nonnull align 8 dereferenceable(56) %17, i1 noundef zeroext true)
  call void @_ZN3RazmlIfLm4ELm4ELm4ELm4EEENS_6MatrixIT_XT1_EXT2_EEERKNS1_IS2_XT0_EXT1_EEERKNS1_IS2_XT2_EXT3_EEE(ptr dead_on_unwind writable sret(%"class.Raz::Matrix") align 4 %5, ptr noundef nonnull align 4 dereferenceable(64) %6, ptr noundef nonnull align 4 dereferenceable(64) %8) #5
  %18 = getelementptr inbounds %"class.Raz::Camera", ptr %9, i32 0, i32 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 4 %5, i64 64, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 64, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %5) #5
  %19 = getelementptr inbounds %"class.Raz::Camera", ptr %9, i32 0, i32 10
  ret ptr %19
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3RazmlIfLm4ELm4ELm4ELm4EEENS_6MatrixIT_XT1_EXT2_EEERKNS1_IS2_XT0_EXT1_EEERKNS1_IS2_XT2_EXT3_EEE(ptr dead_on_unwind noalias writable sret(%"class.Raz::Matrix") align 4, ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(64)) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3Raz10QuaternionIfE13computeMatrixEv(ptr dead_on_unwind noalias writable sret(%"class.Raz::Matrix") align 4, ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

declare void @_ZNK3Raz9Transform24computeTranslationMatrixEb(ptr dead_on_unwind writable sret(%"class.Raz::Matrix") align 4, ptr noundef nonnull align 8 dereferenceable(56), i1 noundef zeroext) #4

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{i64 0, i64 64, !10}
!10 = !{!7, !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::Matrix" = type { %"struct.std::array.0" }
%"struct.std::array.0" = type { [16 x float] }
%"class.Raz::Quaternion" = type { float, %"class.Raz::Vector" }
%"class.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }

; Function Attrs: mustprogress 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: mustprogress uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN3Raz6Camera17computeViewMatrixERKNS_9TransformE(ptr noundef nonnull writeonly align 8 dereferenceable(312) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.Raz::Matrix", align 4
  %4 = alloca %"class.Raz::Matrix", align 4
  %5 = alloca %"class.Raz::Quaternion", align 8
  %6 = alloca %"class.Raz::Matrix", align 4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %7 = tail call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3Raz9Transform11getRotationEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %8 = tail call { <2 x float>, <2 x float> } @_ZNK3Raz10QuaternionIfE7inverseEv(ptr noundef nonnull align 4 dereferenceable(16) %7) #5
  %9 = extractvalue { <2 x float>, <2 x float> } %8, 0
  store <2 x float> %9, ptr %5, align 8
  %10 = getelementptr inbounds i8, ptr %5, i64 8
  %11 = extractvalue { <2 x float>, <2 x float> } %8, 1
  store <2 x float> %11, ptr %10, align 8
  call void @_ZNK3Raz10QuaternionIfE13computeMatrixEv(ptr dead_on_unwind nonnull writable sret(%"class.Raz::Matrix") align 4 %4, ptr noundef nonnull align 4 dereferenceable(16) %5) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %6) #5
  call void @_ZNK3Raz9Transform24computeTranslationMatrixEb(ptr dead_on_unwind nonnull writable sret(%"class.Raz::Matrix") align 4 %6, ptr noundef nonnull align 8 dereferenceable(56) %1, i1 noundef zeroext true)
  call void @_ZN3RazmlIfLm4ELm4ELm4ELm4EEENS_6MatrixIT_XT1_EXT2_EEERKNS1_IS2_XT0_EXT1_EEERKNS1_IS2_XT2_EXT3_EEE(ptr dead_on_unwind nonnull writable sret(%"class.Raz::Matrix") align 4 %3, ptr noundef nonnull align 4 dereferenceable(64) %4, ptr noundef nonnull align 4 dereferenceable(64) %6) #5
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %12, ptr noundef nonnull align 4 dereferenceable(64) %3, i64 64, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %3) #5
  ret ptr %12
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3RazmlIfLm4ELm4ELm4ELm4EEENS_6MatrixIT_XT1_EXT2_EEERKNS1_IS2_XT0_EXT1_EEERKNS1_IS2_XT2_EXT3_EEE(ptr dead_on_unwind noalias writable sret(%"class.Raz::Matrix") align 4, ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(64)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3Raz9Transform11getRotationEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3Raz10QuaternionIfE13computeMatrixEv(ptr dead_on_unwind noalias writable sret(%"class.Raz::Matrix") align 4, ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3 align 2

declare void @_ZNK3Raz9Transform24computeTranslationMatrixEb(ptr dead_on_unwind writable sret(%"class.Raz::Matrix") align 4, ptr noundef nonnull align 8 dereferenceable(56), i1 noundef zeroext) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{i64 0, i64 64, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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