; LLVM IR from BigdogManLuo/DSPLibrary :: DSPTools/dq_32_Transformation (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.dq = type { double, double }
%struct.Phase2 = type { double, double }

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nounwind uwtable
define dso_local { double, double } @parkTransformation(double %0, double %1, float noundef %2) #2 {
  %4 = alloca %struct.dq, align 8
  %5 = alloca %struct.Phase2, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 0
  store double %0, ptr %9, align 8
  %10 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 1
  store double %1, ptr %10, align 8
  store float %2, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %11 = load float, ptr %6, align 4, !tbaa !5
  %12 = fpext float %11 to double
  %13 = call double @cos(double noundef %12) #4
  %14 = getelementptr inbounds %struct.Phase2, ptr %5, i32 0, i32 0
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = load float, ptr %6, align 4, !tbaa !5
  %17 = fpext float %16 to double
  %18 = call double @sin(double noundef %17) #4
  %19 = getelementptr inbounds %struct.Phase2, ptr %5, i32 0, i32 1
  %20 = load double, ptr %19, align 8, !tbaa !12
  %21 = fmul double %18, %20
  %22 = call double @llvm.fmuladd.f64(double %13, double %15, double %21)
  %23 = fptrunc double %22 to float
  store float %23, ptr %7, align 4, !tbaa !5
  %24 = load float, ptr %6, align 4, !tbaa !5
  %25 = fpext float %24 to double
  %26 = call double @sin(double noundef %25) #4
  %27 = fneg double %26
  %28 = getelementptr inbounds %struct.Phase2, ptr %5, i32 0, i32 0
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = load float, ptr %6, align 4, !tbaa !5
  %31 = fpext float %30 to double
  %32 = call double @cos(double noundef %31) #4
  %33 = getelementptr inbounds %struct.Phase2, ptr %5, i32 0, i32 1
  %34 = load double, ptr %33, align 8, !tbaa !12
  %35 = fmul double %32, %34
  %36 = call double @llvm.fmuladd.f64(double %27, double %29, double %35)
  %37 = fptrunc double %36 to float
  store float %37, ptr %8, align 4, !tbaa !5
  %38 = load float, ptr %7, align 4, !tbaa !5
  %39 = fpext float %38 to double
  %40 = getelementptr inbounds %struct.dq, ptr %4, i32 0, i32 0
  store double %39, ptr %40, align 8, !tbaa !13
  %41 = load float, ptr %8, align 4, !tbaa !5
  %42 = fpext float %41 to double
  %43 = getelementptr inbounds %struct.dq, ptr %4, i32 0, i32 1
  store double %42, ptr %43, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %44 = load { double, double }, ptr %4, align 8
  ret { double, double } %44
}

; Function Attrs: nounwind
declare double @cos(double noundef) #3

; Function Attrs: nounwind
declare double @sin(double noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Phase2", !11, i64 0, !11, i64 8}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!14, !11, i64 0}
!14 = !{!"dq", !11, i64 0, !11, i64 8}
!15 = !{!14, !11, 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"

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local { double, double } @parkTransformation(double %0, double %1, float noundef %2) local_unnamed_addr #0 {
  %4 = fpext float %2 to double
  %5 = tail call double @cos(double noundef %4) #3
  %6 = tail call double @sin(double noundef %4) #3
  %7 = tail call double @sin(double noundef %4) #3
  %8 = fneg double %7
  %9 = tail call double @cos(double noundef %4) #3
  %10 = insertelement <2 x double> poison, double %6, i64 0
  %11 = insertelement <2 x double> %10, double %9, i64 1
  %12 = insertelement <2 x double> poison, double %1, i64 0
  %13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
  %14 = fmul <2 x double> %11, %13
  %15 = insertelement <2 x double> poison, double %5, i64 0
  %16 = insertelement <2 x double> %15, double %8, i64 1
  %17 = insertelement <2 x double> poison, double %0, i64 0
  %18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
  %19 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %18, <2 x double> %14)
  %20 = fptrunc <2 x double> %19 to <2 x float>
  %21 = fpext <2 x float> %20 to <2 x double>
  %22 = extractelement <2 x double> %21, i64 0
  %.fca.0.insert = insertvalue { double, double } poison, double %22, 0
  %23 = extractelement <2 x double> %21, i64 1
  %.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %23, 1
  ret { double, double } %.fca.1.insert
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #2

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


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass