; LLVM IR from goldest-star/seawave-animation :: src/vcl/math/transformation/special_transform (special_transform)

; 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.vcl::mat" = type { float, float, float, float, float, float, float, float, float }
%"struct.vcl::buffer_stack" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vcl29rotation_from_axis_angle_mat3ERKNS_12buffer_stackIfLm3EEEf(ptr dead_on_unwind noalias writable sret(%"struct.vcl::mat") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %1, float noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca %"struct.vcl::buffer_stack", align 4
  %7 = alloca { <2 x float>, float }, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  store ptr %1, ptr %4, align 8, !tbaa !5
  store float %2, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #6
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call { <2 x float>, float } @_ZN3vcl9normalizeILm3EEENS_12buffer_stackIfXT_EEERKS2_(ptr noundef nonnull align 4 dereferenceable(12) %13)
  store { <2 x float>, float } %14, ptr %7, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 8 %7, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %15 = getelementptr inbounds %"struct.vcl::buffer_stack", ptr %6, i32 0, i32 0
  %16 = load float, ptr %15, align 4, !tbaa !11
  store float %16, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %17 = getelementptr inbounds %"struct.vcl::buffer_stack", ptr %6, i32 0, i32 1
  %18 = load float, ptr %17, align 4, !tbaa !13
  store float %18, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %19 = getelementptr inbounds %"struct.vcl::buffer_stack", ptr %6, i32 0, i32 2
  %20 = load float, ptr %19, align 4, !tbaa !14
  store float %20, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %21 = load float, ptr %5, align 4, !tbaa !9
  %22 = call noundef float @_ZSt3cosf(float noundef %21)
  store float %22, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %23 = load float, ptr %5, align 4, !tbaa !9
  %24 = call noundef float @_ZSt3sinf(float noundef %23)
  store float %24, ptr %12, align 4, !tbaa !9
  %25 = load float, ptr %11, align 4, !tbaa !9
  %26 = load float, ptr %8, align 4, !tbaa !9
  %27 = load float, ptr %8, align 4, !tbaa !9
  %28 = fmul float %26, %27
  %29 = load float, ptr %11, align 4, !tbaa !9
  %30 = fsub float 1.000000e+00, %29
  %31 = call float @llvm.fmuladd.f32(float %28, float %30, float %25)
  %32 = load float, ptr %8, align 4, !tbaa !9
  %33 = load float, ptr %9, align 4, !tbaa !9
  %34 = fmul float %32, %33
  %35 = load float, ptr %11, align 4, !tbaa !9
  %36 = fsub float 1.000000e+00, %35
  %37 = load float, ptr %10, align 4, !tbaa !9
  %38 = load float, ptr %12, align 4, !tbaa !9
  %39 = fmul float %37, %38
  %40 = fneg float %39
  %41 = call float @llvm.fmuladd.f32(float %34, float %36, float %40)
  %42 = load float, ptr %8, align 4, !tbaa !9
  %43 = load float, ptr %10, align 4, !tbaa !9
  %44 = fmul float %42, %43
  %45 = load float, ptr %11, align 4, !tbaa !9
  %46 = fsub float 1.000000e+00, %45
  %47 = load float, ptr %9, align 4, !tbaa !9
  %48 = load float, ptr %12, align 4, !tbaa !9
  %49 = fmul float %47, %48
  %50 = call float @llvm.fmuladd.f32(float %44, float %46, float %49)
  %51 = load float, ptr %9, align 4, !tbaa !9
  %52 = load float, ptr %8, align 4, !tbaa !9
  %53 = fmul float %51, %52
  %54 = load float, ptr %11, align 4, !tbaa !9
  %55 = fsub float 1.000000e+00, %54
  %56 = load float, ptr %10, align 4, !tbaa !9
  %57 = load float, ptr %12, align 4, !tbaa !9
  %58 = fmul float %56, %57
  %59 = call float @llvm.fmuladd.f32(float %53, float %55, float %58)
  %60 = load float, ptr %11, align 4, !tbaa !9
  %61 = load float, ptr %9, align 4, !tbaa !9
  %62 = load float, ptr %9, align 4, !tbaa !9
  %63 = fmul float %61, %62
  %64 = load float, ptr %11, align 4, !tbaa !9
  %65 = fsub float 1.000000e+00, %64
  %66 = call float @llvm.fmuladd.f32(float %63, float %65, float %60)
  %67 = load float, ptr %9, align 4, !tbaa !9
  %68 = load float, ptr %10, align 4, !tbaa !9
  %69 = fmul float %67, %68
  %70 = load float, ptr %11, align 4, !tbaa !9
  %71 = fsub float 1.000000e+00, %70
  %72 = load float, ptr %8, align 4, !tbaa !9
  %73 = load float, ptr %12, align 4, !tbaa !9
  %74 = fmul float %72, %73
  %75 = fneg float %74
  %76 = call float @llvm.fmuladd.f32(float %69, float %71, float %75)
  %77 = load float, ptr %10, align 4, !tbaa !9
  %78 = load float, ptr %8, align 4, !tbaa !9
  %79 = fmul float %77, %78
  %80 = load float, ptr %11, align 4, !tbaa !9
  %81 = fsub float 1.000000e+00, %80
  %82 = load float, ptr %9, align 4, !tbaa !9
  %83 = load float, ptr %12, align 4, !tbaa !9
  %84 = fmul float %82, %83
  %85 = fneg float %84
  %86 = call float @llvm.fmuladd.f32(float %79, float %81, float %85)
  %87 = load float, ptr %10, align 4, !tbaa !9
  %88 = load float, ptr %9, align 4, !tbaa !9
  %89 = fmul float %87, %88
  %90 = load float, ptr %11, align 4, !tbaa !9
  %91 = fsub float 1.000000e+00, %90
  %92 = load float, ptr %8, align 4, !tbaa !9
  %93 = load float, ptr %12, align 4, !tbaa !9
  %94 = fmul float %92, %93
  %95 = call float @llvm.fmuladd.f32(float %89, float %91, float %94)
  %96 = load float, ptr %11, align 4, !tbaa !9
  %97 = load float, ptr %10, align 4, !tbaa !9
  %98 = load float, ptr %10, align 4, !tbaa !9
  %99 = fmul float %97, %98
  %100 = load float, ptr %11, align 4, !tbaa !9
  %101 = fsub float 1.000000e+00, %100
  %102 = call float @llvm.fmuladd.f32(float %99, float %101, float %96)
  call void @_ZN3vcl3matILm3ELm3EEC1Efffffffff(ptr noundef nonnull align 4 dereferenceable(36) %0, float noundef %31, float noundef %41, float noundef %50, float noundef %59, float noundef %66, float noundef %76, float noundef %86, float noundef %95, float noundef %102)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #6
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZN3vcl9normalizeILm3EEENS_12buffer_stackIfXT_EEERKS2_(ptr noundef nonnull align 4 dereferenceable(12)) #0

; 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) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) #3

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

declare void @_ZN3vcl3matILm3ELm3EEC1Efffffffff(ptr noundef nonnull align 4 dereferenceable(36), float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) unnamed_addr #5

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { "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 #6 = { 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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN3vcl12buffer_stackIfLm3EEE", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!12, !10, i64 4}
!14 = !{!12, !10, 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"

%"struct.vcl::mat" = type { float, float, float, float, float, float, float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vcl29rotation_from_axis_angle_mat3ERKNS_12buffer_stackIfLm3EEEf(ptr dead_on_unwind noalias writable sret(%"struct.vcl::mat") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %1, float noundef %2) local_unnamed_addr #0 {
  %4 = tail call { <2 x float>, float } @_ZN3vcl9normalizeILm3EEENS_12buffer_stackIfXT_EEERKS2_(ptr noundef nonnull align 4 dereferenceable(12) %1)
  %.fca.0.extract = extractvalue { <2 x float>, float } %4, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %4, 1
  %.sroa.042.0.vec.extract = extractelement <2 x float> %.fca.0.extract, i64 0
  %.sroa.042.4.vec.extract = extractelement <2 x float> %.fca.0.extract, i64 1
  %5 = tail call noundef float @_ZSt3cosf(float noundef %2)
  %6 = tail call noundef float @_ZSt3sinf(float noundef %2)
  %7 = fmul <2 x float> %.fca.0.extract, %.fca.0.extract
  %8 = extractelement <2 x float> %7, i64 0
  %9 = fsub float 1.000000e+00, %5
  %10 = tail call float @llvm.fmuladd.f32(float %8, float %9, float %5)
  %11 = fmul float %.sroa.042.0.vec.extract, %.sroa.042.4.vec.extract
  %12 = fmul float %.fca.1.extract, %6
  %13 = fneg float %12
  %14 = tail call float @llvm.fmuladd.f32(float %11, float %9, float %13)
  %15 = fmul float %.fca.1.extract, %.sroa.042.0.vec.extract
  %16 = fmul float %.sroa.042.4.vec.extract, %6
  %17 = tail call float @llvm.fmuladd.f32(float %15, float %9, float %16)
  %18 = tail call float @llvm.fmuladd.f32(float %11, float %9, float %12)
  %19 = fmul float %.sroa.042.4.vec.extract, %.sroa.042.4.vec.extract
  %20 = tail call float @llvm.fmuladd.f32(float %19, float %9, float %5)
  %21 = fmul float %.fca.1.extract, %.sroa.042.4.vec.extract
  %22 = fmul float %.sroa.042.0.vec.extract, %6
  %23 = fneg float %22
  %24 = tail call float @llvm.fmuladd.f32(float %21, float %9, float %23)
  %25 = fneg float %16
  %26 = tail call float @llvm.fmuladd.f32(float %15, float %9, float %25)
  %27 = tail call float @llvm.fmuladd.f32(float %21, float %9, float %22)
  %28 = fmul float %.fca.1.extract, %.fca.1.extract
  %29 = tail call float @llvm.fmuladd.f32(float %28, float %9, float %5)
  tail call void @_ZN3vcl3matILm3ELm3EEC1Efffffffff(ptr noundef nonnull align 4 dereferenceable(36) %0, float noundef %10, float noundef %14, float noundef %17, float noundef %18, float noundef %20, float noundef %24, float noundef %26, float noundef %27, float noundef %29)
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(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

declare void @_ZN3vcl3matILm3ELm3EEC1Efffffffff(ptr noundef nonnull align 4 dereferenceable(36), float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) unnamed_addr #3

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


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