; LLVM IR from BigdogManLuo/DSPLibrary :: DSPTools/PR_Controller (pr)

; 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.ButterQueue = type { [3 x float], i32, float, float }

; Function Attrs: nounwind uwtable
define dso_local double @PRCalc(ptr noundef %0, float noundef %1, ptr noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, ptr noundef %8) #0 {
  %10 = alloca ptr, align 8
  %11 = alloca float, align 4
  %12 = alloca ptr, align 8
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca ptr, align 8
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store float %1, ptr %11, align 4, !tbaa !9
  store ptr %2, ptr %12, align 8, !tbaa !5
  store float %3, ptr %13, align 4, !tbaa !9
  store float %4, ptr %14, align 4, !tbaa !9
  store float %5, ptr %15, align 4, !tbaa !9
  store float %6, ptr %16, align 4, !tbaa !9
  store float %7, ptr %17, align 4, !tbaa !9
  store ptr %8, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store float 0.000000e+00, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  store float 0.000000e+00, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store float 0.000000e+00, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store float 0.000000e+00, ptr %22, align 4, !tbaa !9
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = load float, ptr %11, align 4, !tbaa !9
  %25 = load float, ptr %17, align 4, !tbaa !9
  %26 = load ptr, ptr %18, align 8, !tbaa !5
  %27 = load float, ptr %26, align 4, !tbaa !9
  %28 = fneg float %25
  %29 = call float @llvm.fmuladd.f32(float %28, float %27, float %24)
  call void @InButterQueue(ptr noundef %23, float noundef %29)
  %30 = load float, ptr %14, align 4, !tbaa !9
  %31 = load float, ptr %11, align 4, !tbaa !9
  %32 = fmul float %30, %31
  store float %32, ptr %21, align 4, !tbaa !9
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = getelementptr inbounds double, ptr %33, i64 3
  %35 = load double, ptr %34, align 8, !tbaa !11
  %36 = fdiv double 1.000000e+00, %35
  %37 = fptrunc double %36 to float
  store float %37, ptr %22, align 4, !tbaa !9
  %38 = load float, ptr %22, align 4, !tbaa !9
  %39 = fpext float %38 to double
  %40 = load float, ptr %15, align 4, !tbaa !9
  %41 = fpext float %40 to double
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds double, ptr %42, i64 0
  %44 = load double, ptr %43, align 8, !tbaa !11
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ButterQueue, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ButterQueue, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [3 x float], ptr %46, i64 0, i64 %50
  %52 = load float, ptr %51, align 4, !tbaa !9
  %53 = fpext float %52 to double
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds double, ptr %54, i64 1
  %56 = load double, ptr %55, align 8, !tbaa !11
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ButterQueue, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ButterQueue, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !13
  %62 = add nsw i32 %61, 2
  %63 = srem i32 %62, 3
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [3 x float], ptr %58, i64 0, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !9
  %67 = fpext float %66 to double
  %68 = fmul double %56, %67
  %69 = call double @llvm.fmuladd.f64(double %44, double %53, double %68)
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds double, ptr %70, i64 2
  %72 = load double, ptr %71, align 8, !tbaa !11
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.ButterQueue, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.ButterQueue, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !13
  %78 = add nsw i32 %77, 1
  %79 = srem i32 %78, 3
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [3 x float], ptr %74, i64 0, i64 %80
  %82 = load float, ptr %81, align 4, !tbaa !9
  %83 = fpext float %82 to double
  %84 = call double @llvm.fmuladd.f64(double %72, double %83, double %69)
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = getelementptr inbounds double, ptr %85, i64 4
  %87 = load double, ptr %86, align 8, !tbaa !11
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ButterQueue, ptr %88, i32 0, i32 2
  %90 = load float, ptr %89, align 4, !tbaa !16
  %91 = fpext float %90 to double
  %92 = fmul double %87, %91
  %93 = fneg double %92
  %94 = call double @llvm.fmuladd.f64(double %41, double %84, double %93)
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = getelementptr inbounds double, ptr %95, i64 5
  %97 = load double, ptr %96, align 8, !tbaa !11
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.ButterQueue, ptr %98, i32 0, i32 3
  %100 = load float, ptr %99, align 4, !tbaa !17
  %101 = fpext float %100 to double
  %102 = fneg double %97
  %103 = call double @llvm.fmuladd.f64(double %102, double %101, double %94)
  %104 = fmul double %39, %103
  %105 = fptrunc double %104 to float
  store float %105, ptr %19, align 4, !tbaa !9
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.ButterQueue, ptr %106, i32 0, i32 2
  %108 = load float, ptr %107, align 4, !tbaa !16
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.ButterQueue, ptr %109, i32 0, i32 3
  store float %108, ptr %110, align 4, !tbaa !17
  %111 = load float, ptr %19, align 4, !tbaa !9
  %112 = load ptr, ptr %10, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.ButterQueue, ptr %112, i32 0, i32 2
  store float %111, ptr %113, align 4, !tbaa !16
  %114 = load float, ptr %19, align 4, !tbaa !9
  %115 = load float, ptr %21, align 4, !tbaa !9
  %116 = fadd float %114, %115
  store float %116, ptr %20, align 4, !tbaa !9
  %117 = load float, ptr %13, align 4, !tbaa !9
  %118 = load float, ptr %20, align 4, !tbaa !9
  %119 = fmul float %117, %118
  %120 = fpext float %119 to double
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  ret double %120
}

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

declare void @InButterQueue(ptr noundef, float noundef) #2

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !15, i64 12}
!14 = !{!"", !7, i64 0, !15, i64 12, !10, i64 16, !10, i64 20}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !10, i64 20}


; 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: nounwind uwtable
define dso_local double @PRCalc(ptr noundef %0, float noundef %1, ptr nocapture noundef readonly %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, ptr nocapture noundef readonly %8) local_unnamed_addr #0 {
  %10 = load float, ptr %8, align 4, !tbaa !5
  %11 = fneg float %7
  %12 = tail call float @llvm.fmuladd.f32(float %11, float %10, float %1)
  tail call void @InButterQueue(ptr noundef %0, float noundef %12) #3
  %13 = fmul float %1, %4
  %14 = getelementptr inbounds i8, ptr %2, i64 24
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = fdiv double 1.000000e+00, %15
  %17 = fptrunc double %16 to float
  %18 = fpext float %17 to double
  %19 = fpext float %5 to double
  %20 = load double, ptr %2, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %0, i64 12
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [3 x float], ptr %0, i64 0, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = fpext float %25 to double
  %27 = getelementptr inbounds i8, ptr %2, i64 8
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = add nsw i32 %22, 2
  %30 = srem i32 %29, 3
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [3 x float], ptr %0, i64 0, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = fpext float %33 to double
  %35 = fmul double %28, %34
  %36 = tail call double @llvm.fmuladd.f64(double %20, double %26, double %35)
  %37 = getelementptr inbounds i8, ptr %2, i64 16
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = add nsw i32 %22, 1
  %40 = srem i32 %39, 3
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [3 x float], ptr %0, i64 0, i64 %41
  %43 = load float, ptr %42, align 4, !tbaa !5
  %44 = fpext float %43 to double
  %45 = tail call double @llvm.fmuladd.f64(double %38, double %44, double %36)
  %46 = getelementptr inbounds i8, ptr %2, i64 32
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %0, i64 16
  %49 = load float, ptr %48, align 4, !tbaa !14
  %50 = fpext float %49 to double
  %51 = fneg double %47
  %52 = fmul double %51, %50
  %53 = tail call double @llvm.fmuladd.f64(double %19, double %45, double %52)
  %54 = getelementptr inbounds i8, ptr %2, i64 40
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %0, i64 20
  %57 = load float, ptr %56, align 4, !tbaa !15
  %58 = fpext float %57 to double
  %59 = fneg double %55
  %60 = tail call double @llvm.fmuladd.f64(double %59, double %58, double %53)
  %61 = fmul double %60, %18
  %62 = fptrunc double %61 to float
  store float %49, ptr %56, align 4, !tbaa !15
  store float %62, ptr %48, align 4, !tbaa !14
  %63 = fadd float %13, %62
  %64 = fmul float %63, %3
  %65 = fpext float %64 to double
  ret double %65
}

declare void @InButterQueue(ptr noundef, 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

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

attributes #0 = { 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 #1 = { "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 = { 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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 12}
!12 = !{!"", !7, i64 0, !13, i64 12, !6, i64 16, !6, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 16}
!15 = !{!12, !6, i64 20}


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