; 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.Phase3 = type { double, 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 void @invClarkTransformation(ptr dead_on_unwind noalias writable sret(%struct.Phase3) align 8 %0, double %1, double %2) #2 {
  %4 = alloca %struct.Phase2, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = getelementptr inbounds { double, double }, ptr %4, i32 0, i32 0
  store double %1, ptr %8, align 8
  %9 = getelementptr inbounds { double, double }, ptr %4, i32 0, i32 1
  store double %2, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %10 = getelementptr inbounds %struct.Phase2, ptr %4, i32 0, i32 0
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fptrunc double %11 to float
  store float %12, ptr %5, align 4, !tbaa !10
  %13 = getelementptr inbounds %struct.Phase2, ptr %4, i32 0, i32 0
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.Phase2, ptr %4, i32 0, i32 1
  %16 = load double, ptr %15, align 8, !tbaa !12
  %17 = fmul double 8.660000e-01, %16
  %18 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %14, double %17)
  %19 = fptrunc double %18 to float
  store float %19, ptr %6, align 4, !tbaa !10
  %20 = getelementptr inbounds %struct.Phase2, ptr %4, i32 0, i32 0
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Phase2, ptr %4, i32 0, i32 1
  %23 = load double, ptr %22, align 8, !tbaa !12
  %24 = fmul double 8.660000e-01, %23
  %25 = fneg double %24
  %26 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %21, double %25)
  %27 = fptrunc double %26 to float
  store float %27, ptr %7, align 4, !tbaa !10
  %28 = load float, ptr %5, align 4, !tbaa !10
  %29 = fpext float %28 to double
  %30 = getelementptr inbounds %struct.Phase3, ptr %0, i32 0, i32 0
  store double %29, ptr %30, align 8, !tbaa !13
  %31 = load float, ptr %6, align 4, !tbaa !10
  %32 = fpext float %31 to double
  %33 = getelementptr inbounds %struct.Phase3, ptr %0, i32 0, i32 1
  store double %32, ptr %33, align 8, !tbaa !15
  %34 = load float, ptr %7, align 4, !tbaa !10
  %35 = fpext float %34 to double
  %36 = getelementptr inbounds %struct.Phase3, ptr %0, i32 0, i32 2
  store double %35, ptr %36, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

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 }

!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, !7, i64 0}
!6 = !{!"Phase2", !7, i64 0, !7, i64 8}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !7, i64 8}
!13 = !{!14, !7, i64 0}
!14 = !{!"Phase3", !7, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!14, !7, i64 8}
!16 = !{!14, !7, i64 16}


; 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.Phase3 = type { double, double, double }

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @invClarkTransformation(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.Phase3) align 8 %0, double %1, double %2) local_unnamed_addr #1 {
  %4 = fmul double %2, 8.660000e-01
  %5 = tail call double @llvm.fmuladd.f64(double %1, double -5.000000e-01, double %4)
  %6 = fneg double %4
  %7 = tail call double @llvm.fmuladd.f64(double %1, double -5.000000e-01, double %6)
  %8 = fptrunc double %7 to float
  %9 = insertelement <2 x double> poison, double %1, i64 0
  %10 = insertelement <2 x double> %9, double %5, i64 1
  %11 = fptrunc <2 x double> %10 to <2 x float>
  %12 = fpext <2 x float> %11 to <2 x double>
  store <2 x double> %12, ptr %0, align 8, !tbaa !5
  %13 = fpext float %8 to double
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store double %13, ptr %14, align 8, !tbaa !9
  ret void
}

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

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"Phase3", !6, i64 0, !6, i64 8, !6, i64 16}


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