; LLVM IR from chrxh/alien :: source/Base/Math.ll (ZN4Math18calcRotationMatrixEf)

; 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.std::array" = type { [2 x %"struct.std::array.0"] }
%"struct.std::array.0" = type { [2 x float] }

; Function Attrs: nounwind
declare float @sinf(float noundef) #0

; Function Attrs: nounwind
declare float @cosf(float noundef) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local { <2 x float>, <2 x float> } @_ZN4Math18calcRotationMatrixEf(float noundef %0) #1 align 2 {
  %2 = alloca %"struct.std::array", align 4
  %3 = alloca float, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  %4 = load float, ptr %3, align 4, !tbaa !5
  %5 = fmul float %4, 0x3F91DF46A0000000
  %6 = call float @cosf(float noundef %5) #2
  %7 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 0) #2
  %8 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %7, i64 noundef 0) #2
  store float %6, ptr %8, align 4, !tbaa !5
  %9 = load float, ptr %3, align 4, !tbaa !5
  %10 = fmul float %9, 0x3F91DF46A0000000
  %11 = call float @sinf(float noundef %10) #2
  %12 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 1) #2
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %12, i64 noundef 0) #2
  store float %11, ptr %13, align 4, !tbaa !5
  %14 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 1) #2
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %14, i64 noundef 0) #2
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = fneg float %16
  %18 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 0) #2
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %18, i64 noundef 1) #2
  store float %17, ptr %19, align 4, !tbaa !5
  %20 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 0) #2
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %20, i64 noundef 0) #2
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 1) #2
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %23, i64 noundef 1) #2
  store float %22, ptr %24, align 4, !tbaa !5
  %25 = getelementptr inbounds %"struct.std::array", ptr %2, i32 0, i32 0
  %26 = load { <2 x float>, <2 x float> }, ptr %25, align 4
  ret { <2 x float>, <2 x float> } %26
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8), i64 noundef) #1 align 2

attributes #0 = { 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 #1 = { 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 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

%"struct.std::array" = type { [2 x %"struct.std::array.0"] }
%"struct.std::array.0" = type { [2 x float] }

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sinf(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @cosf(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local { <2 x float>, <2 x float> } @_ZN4Math18calcRotationMatrixEf(float noundef %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"struct.std::array", align 8
  %3 = fmul float %0, 0x3F91DF46A0000000
  %4 = tail call float @cosf(float noundef %3) #2
  %5 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 0) #2
  %6 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %5, i64 noundef 0) #2
  store float %4, ptr %6, align 4, !tbaa !5
  %7 = call float @sinf(float noundef %3) #2
  %8 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 1) #2
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %8, i64 noundef 0) #2
  store float %7, ptr %9, align 4, !tbaa !5
  %10 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 1) #2
  %11 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %10, i64 noundef 0) #2
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fneg float %12
  %14 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 0) #2
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %14, i64 noundef 1) #2
  store float %13, ptr %15, align 4, !tbaa !5
  %16 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 0) #2
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %16, i64 noundef 0) #2
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5arrayIS_IfLm2EELm2EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %2, i64 noundef 1) #2
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %19, i64 noundef 1) #2
  store float %18, ptr %20, align 4, !tbaa !5
  %.fca.0.load = load <2 x float>, ptr %2, align 8
  %.fca.0.insert = insertvalue { <2 x float>, <2 x float> } poison, <2 x float> %.fca.0.load, 0
  %.fca.1.gep = getelementptr inbounds i8, ptr %2, i64 8
  %.fca.1.load = load <2 x float>, ptr %.fca.1.gep, align 8
  %.fca.1.insert = insertvalue { <2 x float>, <2 x float> } %.fca.0.insert, <2 x float> %.fca.1.load, 1
  ret { <2 x float>, <2 x float> } %.fca.1.insert
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIfLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8), i64 noundef) local_unnamed_addr #1 align 2

attributes #0 = { 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 #1 = { 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 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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