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

@Ts = external dso_local global float, align 4

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local { double, double } @invParkTransformation(double %0, double %1, i32 noundef %2, float noundef %3) #3 {
  %5 = alloca %struct.Phase2, align 8
  %6 = alloca %struct.dq, align 8
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 0
  store double %0, ptr %11, align 8
  %12 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 1
  store double %1, ptr %12, align 8
  store i32 %2, ptr %7, align 4, !tbaa !5
  store float %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %13 = load float, ptr %8, align 4, !tbaa !9
  %14 = load i32, ptr %7, align 4, !tbaa !5
  %15 = sitofp i32 %14 to float
  %16 = fmul float %13, %15
  %17 = load float, ptr @Ts, align 4, !tbaa !9
  %18 = fmul float %16, %17
  %19 = call float @cosf(float noundef %18) #4
  %20 = fpext float %19 to double
  %21 = getelementptr inbounds %struct.dq, ptr %6, i32 0, i32 0
  %22 = load double, ptr %21, align 8, !tbaa !11
  %23 = load float, ptr %8, align 4, !tbaa !9
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = sitofp i32 %24 to float
  %26 = fmul float %23, %25
  %27 = load float, ptr @Ts, align 4, !tbaa !9
  %28 = fmul float %26, %27
  %29 = call float @sinf(float noundef %28) #4
  %30 = fpext float %29 to double
  %31 = getelementptr inbounds %struct.dq, ptr %6, i32 0, i32 1
  %32 = load double, ptr %31, align 8, !tbaa !14
  %33 = fmul double %30, %32
  %34 = fneg double %33
  %35 = call double @llvm.fmuladd.f64(double %20, double %22, double %34)
  %36 = fptrunc double %35 to float
  store float %36, ptr %9, align 4, !tbaa !9
  %37 = load float, ptr %8, align 4, !tbaa !9
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sitofp i32 %38 to float
  %40 = fmul float %37, %39
  %41 = load float, ptr @Ts, align 4, !tbaa !9
  %42 = fmul float %40, %41
  %43 = call float @sinf(float noundef %42) #4
  %44 = fpext float %43 to double
  %45 = getelementptr inbounds %struct.dq, ptr %6, i32 0, i32 0
  %46 = load double, ptr %45, align 8, !tbaa !11
  %47 = load float, ptr %8, align 4, !tbaa !9
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = sitofp i32 %48 to float
  %50 = fmul float %47, %49
  %51 = load float, ptr @Ts, align 4, !tbaa !9
  %52 = fmul float %50, %51
  %53 = call float @cosf(float noundef %52) #4
  %54 = fpext float %53 to double
  %55 = getelementptr inbounds %struct.dq, ptr %6, i32 0, i32 1
  %56 = load double, ptr %55, align 8, !tbaa !14
  %57 = fmul double %54, %56
  %58 = call double @llvm.fmuladd.f64(double %44, double %46, double %57)
  %59 = fptrunc double %58 to float
  store float %59, ptr %10, align 4, !tbaa !9
  %60 = load float, ptr %9, align 4, !tbaa !9
  %61 = fpext float %60 to double
  %62 = getelementptr inbounds %struct.Phase2, ptr %5, i32 0, i32 0
  store double %61, ptr %62, align 8, !tbaa !15
  %63 = load float, ptr %10, align 4, !tbaa !9
  %64 = fpext float %63 to double
  %65 = getelementptr inbounds %struct.Phase2, ptr %5, i32 0, i32 1
  store double %64, ptr %65, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %66 = load { double, double }, ptr %5, align 8
  ret { double, double } %66
}

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

@Ts = external dso_local local_unnamed_addr global float, align 4

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local { double, double } @invParkTransformation(double %0, double %1, i32 noundef %2, float noundef %3) local_unnamed_addr #1 {
  %5 = sitofp i32 %2 to float
  %6 = fmul float %5, %3
  %7 = load float, ptr @Ts, align 4, !tbaa !5
  %8 = fmul float %6, %7
  %9 = tail call float @cosf(float noundef %8) #3
  %10 = load float, ptr @Ts, align 4, !tbaa !5
  %11 = fmul float %6, %10
  %12 = tail call float @sinf(float noundef %11) #3
  %13 = fpext float %12 to double
  %14 = fneg double %13
  %15 = load float, ptr @Ts, align 4, !tbaa !5
  %16 = fmul float %6, %15
  %17 = tail call float @sinf(float noundef %16) #3
  %18 = load float, ptr @Ts, align 4, !tbaa !5
  %19 = fmul float %6, %18
  %20 = tail call float @cosf(float noundef %19) #3
  %21 = fpext float %20 to double
  %22 = insertelement <2 x float> poison, float %9, i64 0
  %23 = insertelement <2 x float> %22, float %17, i64 1
  %24 = fpext <2 x float> %23 to <2 x double>
  %25 = insertelement <2 x double> poison, double %14, i64 0
  %26 = insertelement <2 x double> %25, double %21, i64 1
  %27 = insertelement <2 x double> poison, double %1, i64 0
  %28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
  %29 = fmul <2 x double> %26, %28
  %30 = insertelement <2 x double> poison, double %0, i64 0
  %31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
  %32 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %31, <2 x double> %29)
  %33 = fptrunc <2 x double> %32 to <2 x float>
  %34 = fpext <2 x float> %33 to <2 x double>
  %35 = extractelement <2 x double> %34, i64 0
  %.fca.0.insert = insertvalue { double, double } poison, double %35, 0
  %36 = extractelement <2 x double> %34, i64 1
  %.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %36, 1
  ret { double, double } %.fca.1.insert
}

; 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) "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(readwrite, argmem: write, inaccessiblemem: 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 #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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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