; LLVM IR from chriskiefer/libcccrt :: benchmarks/maximilian.ll (ZN10maxiFilter8bandpassEddd)

; 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"

%class.maxiFilter = type { double, double, double, [10 x double], [10 x double], double, double, double, double, double, double, double }

@_ZN12maxiSettings10sampleRateE = external dso_local global i64, align 8

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

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN10maxiFilter8bandpassEddd(ptr noundef nonnull align 8 dereferenceable(240) %0, double noundef %1, double noundef %2, double noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !9
  %9 = load ptr, ptr %5, align 8
  %10 = load double, ptr %7, align 8, !tbaa !9
  %11 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 10
  store double %10, ptr %11, align 8, !tbaa !11
  %12 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 10
  %13 = load double, ptr %12, align 8, !tbaa !11
  %14 = load i64, ptr @_ZN12maxiSettings10sampleRateE, align 8, !tbaa !13
  %15 = uitofp i64 %14 to double
  %16 = fmul double %15, 5.000000e-01
  %17 = fcmp ogt double %13, %16
  br i1 %17, label %18, label %23

18:                                               ; preds = %4
  %19 = load i64, ptr @_ZN12maxiSettings10sampleRateE, align 8, !tbaa !13
  %20 = uitofp i64 %19 to double
  %21 = fmul double %20, 5.000000e-01
  %22 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 10
  store double %21, ptr %22, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %18, %4
  %24 = load double, ptr %8, align 8, !tbaa !9
  %25 = fcmp oge double %24, 1.000000e+00
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  store double 0x3FEFFFFDE7210BE9, ptr %8, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %26, %23
  %28 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 10
  %29 = load double, ptr %28, align 8, !tbaa !11
  %30 = fmul double 0x401921FB54442D18, %29
  %31 = load i64, ptr @_ZN12maxiSettings10sampleRateE, align 8, !tbaa !13
  %32 = uitofp i64 %31 to double
  %33 = fdiv double %30, %32
  %34 = call double @cos(double noundef %33) #4
  %35 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 8
  store double %34, ptr %35, align 8, !tbaa !15
  %36 = load double, ptr %8, align 8, !tbaa !9
  %37 = fsub double 1.000000e+00, %36
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = load double, ptr %8, align 8, !tbaa !9
  %40 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 8
  %41 = load double, ptr %40, align 8, !tbaa !15
  %42 = call double @pow(double noundef %41, double noundef 2.000000e+00) #4
  %43 = call double @llvm.fmuladd.f64(double -4.000000e+00, double %42, double %39)
  %44 = fadd double %43, 2.000000e+00
  %45 = call double @llvm.fmuladd.f64(double %38, double %44, double 1.000000e+00)
  %46 = call double @sqrt(double noundef %45) #4
  %47 = fmul double %37, %46
  %48 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 3
  %49 = getelementptr inbounds [10 x double], ptr %48, i64 0, i64 0
  store double %47, ptr %49, align 8, !tbaa !9
  %50 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 8
  %51 = load double, ptr %50, align 8, !tbaa !15
  %52 = fmul double 2.000000e+00, %51
  %53 = load double, ptr %8, align 8, !tbaa !9
  %54 = fmul double %52, %53
  %55 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 3
  %56 = getelementptr inbounds [10 x double], ptr %55, i64 0, i64 1
  store double %54, ptr %56, align 8, !tbaa !9
  %57 = load double, ptr %8, align 8, !tbaa !9
  %58 = fmul double %57, -1.000000e+00
  %59 = call noundef double @_ZSt3powIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef %58, i32 noundef 2)
  %60 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 3
  %61 = getelementptr inbounds [10 x double], ptr %60, i64 0, i64 2
  store double %59, ptr %61, align 8, !tbaa !9
  %62 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 3
  %63 = getelementptr inbounds [10 x double], ptr %62, i64 0, i64 0
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = load double, ptr %6, align 8, !tbaa !9
  %66 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 3
  %67 = getelementptr inbounds [10 x double], ptr %66, i64 0, i64 1
  %68 = load double, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 4
  %70 = getelementptr inbounds [10 x double], ptr %69, i64 0, i64 1
  %71 = load double, ptr %70, align 8, !tbaa !9
  %72 = fmul double %68, %71
  %73 = call double @llvm.fmuladd.f64(double %64, double %65, double %72)
  %74 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 3
  %75 = getelementptr inbounds [10 x double], ptr %74, i64 0, i64 2
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 4
  %78 = getelementptr inbounds [10 x double], ptr %77, i64 0, i64 2
  %79 = load double, ptr %78, align 8, !tbaa !9
  %80 = call double @llvm.fmuladd.f64(double %76, double %79, double %73)
  %81 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 2
  store double %80, ptr %81, align 8, !tbaa !16
  %82 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 4
  %83 = getelementptr inbounds [10 x double], ptr %82, i64 0, i64 1
  %84 = load double, ptr %83, align 8, !tbaa !9
  %85 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 4
  %86 = getelementptr inbounds [10 x double], ptr %85, i64 0, i64 2
  store double %84, ptr %86, align 8, !tbaa !9
  %87 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 2
  %88 = load double, ptr %87, align 8, !tbaa !16
  %89 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 4
  %90 = getelementptr inbounds [10 x double], ptr %89, i64 0, i64 1
  store double %88, ptr %90, align 8, !tbaa !9
  %91 = getelementptr inbounds %class.maxiFilter, ptr %9, i32 0, i32 2
  %92 = load double, ptr %91, align 8, !tbaa !16
  ret double %92
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { mustprogress 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 = { 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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 224}
!12 = !{!"_ZTS10maxiFilter", !10, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 104, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !10, i64 208}
!16 = !{!12, !10, 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"

@_ZN12maxiSettings10sampleRateE = external dso_local local_unnamed_addr global i64, align 8

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

; 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 @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN10maxiFilter8bandpassEddd(ptr nocapture noundef nonnull align 8 dereferenceable(240) %0, double noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #2 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 224
  store double %2, ptr %5, align 8, !tbaa !5
  %6 = load i64, ptr @_ZN12maxiSettings10sampleRateE, align 8, !tbaa !10
  %7 = uitofp i64 %6 to double
  %8 = fmul double %7, 5.000000e-01
  %9 = fcmp olt double %8, %2
  br i1 %9, label %10, label %11

10:                                               ; preds = %4
  store double %8, ptr %5, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %10, %4
  %12 = phi double [ %8, %10 ], [ %2, %4 ]
  %13 = fcmp ult double %3, 1.000000e+00
  %.0 = select i1 %13, double %3, double 0x3FEFFFFDE7210BE9
  %14 = fmul double %12, 0x401921FB54442D18
  %15 = fdiv double %14, %7
  %16 = tail call double @cos(double noundef %15) #4
  %17 = getelementptr inbounds i8, ptr %0, i64 208
  store double %16, ptr %17, align 8, !tbaa !12
  %18 = fsub double 1.000000e+00, %.0
  %square = fmul double %16, %16
  %19 = tail call double @llvm.fmuladd.f64(double %square, double -4.000000e+00, double %.0)
  %20 = fadd double %19, 2.000000e+00
  %21 = tail call double @llvm.fmuladd.f64(double %.0, double %20, double 1.000000e+00)
  %22 = tail call double @sqrt(double noundef %21) #4
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load double, ptr %17, align 8, !tbaa !12
  %25 = fmul double %24, 2.000000e+00
  %26 = getelementptr inbounds i8, ptr %0, i64 32
  %27 = insertelement <2 x double> poison, double %18, i64 0
  %28 = insertelement <2 x double> %27, double %25, i64 1
  %29 = insertelement <2 x double> poison, double %22, i64 0
  %30 = insertelement <2 x double> %29, double %.0, i64 1
  %31 = fmul <2 x double> %28, %30
  store <2 x double> %31, ptr %23, align 8, !tbaa !13
  %32 = fneg double %.0
  %33 = tail call noundef double @_ZSt3powIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef %32, i32 noundef 2)
  %34 = getelementptr inbounds i8, ptr %0, i64 40
  store double %33, ptr %34, align 8, !tbaa !13
  %35 = load double, ptr %23, align 8, !tbaa !13
  %36 = load double, ptr %26, align 8, !tbaa !13
  %37 = getelementptr inbounds i8, ptr %0, i64 112
  %38 = load double, ptr %37, align 8, !tbaa !13
  %39 = fmul double %36, %38
  %40 = tail call double @llvm.fmuladd.f64(double %35, double %1, double %39)
  %41 = getelementptr inbounds i8, ptr %0, i64 120
  %42 = load double, ptr %41, align 8, !tbaa !13
  %43 = tail call double @llvm.fmuladd.f64(double %33, double %42, double %40)
  %44 = getelementptr inbounds i8, ptr %0, i64 16
  store double %43, ptr %44, align 8, !tbaa !14
  store double %38, ptr %41, align 8, !tbaa !13
  store double %43, ptr %37, align 8, !tbaa !13
  ret double %43
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #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 = { 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 224}
!6 = !{!"_ZTS10maxiFilter", !7, i64 0, !7, i64 8, !7, i64 16, !8, i64 24, !8, i64 104, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !7, i64 208}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 16}


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