; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_cccf)

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

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [75 x i8], align 1
@__const.iirfilt_cccf_create_dc_blocker.bf = external hidden unnamed_addr constant [2 x 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @iirfilt_cccf_create(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @iirfilt_cccf_set_scale(ptr noundef, <2 x float> noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @iirfilt_cccf_create_dc_blocker(float noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  %4 = alloca [2 x float], align 4
  %5 = alloca [2 x float], align 4
  %6 = alloca [2 x { float, float }], align 16
  %7 = alloca [2 x { float, float }], align 16
  %8 = alloca ptr, align 8
  %9 = alloca { float, float }, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  %10 = load float, ptr %3, align 4, !tbaa !5
  %11 = fcmp ole float %10, 0.000000e+00
  br i1 %11, label %12, label %14

12:                                               ; preds = %1
  %13 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.81, i32 noundef 386, ptr noundef @.str.86, ptr noundef @.str.3)
  store ptr %13, ptr %2, align 8
  br label %50

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 @__const.iirfilt_cccf_create_dc_blocker.bf, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store float 1.000000e+00, ptr %5, align 4, !tbaa !5
  %15 = getelementptr inbounds float, ptr %5, i64 1
  %16 = load float, ptr %3, align 4, !tbaa !5
  %17 = fadd float -1.000000e+00, %16
  store float %17, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  %18 = getelementptr inbounds [2 x float], ptr %4, i64 0, i64 0
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %21 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  store float %19, ptr %20, align 8
  store float 0.000000e+00, ptr %21, align 4
  %22 = getelementptr inbounds { float, float }, ptr %6, i64 1
  %23 = getelementptr inbounds [2 x float], ptr %4, i64 0, i64 1
  %24 = load float, ptr %23, align 4, !tbaa !5
  %25 = getelementptr inbounds { float, float }, ptr %22, i32 0, i32 0
  %26 = getelementptr inbounds { float, float }, ptr %22, i32 0, i32 1
  store float %24, ptr %25, align 8
  store float 0.000000e+00, ptr %26, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  %27 = getelementptr inbounds [2 x float], ptr %5, i64 0, i64 0
  %28 = load float, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %30 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %28, ptr %29, align 8
  store float 0.000000e+00, ptr %30, align 4
  %31 = getelementptr inbounds { float, float }, ptr %7, i64 1
  %32 = getelementptr inbounds [2 x float], ptr %5, i64 0, i64 1
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds { float, float }, ptr %31, i32 0, i32 0
  %35 = getelementptr inbounds { float, float }, ptr %31, i32 0, i32 1
  store float %33, ptr %34, align 8
  store float 0.000000e+00, ptr %35, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %36 = getelementptr inbounds [2 x { float, float }], ptr %6, i64 0, i64 0
  %37 = getelementptr inbounds [2 x { float, float }], ptr %7, i64 0, i64 0
  %38 = call ptr @iirfilt_cccf_create(ptr noundef %36, i32 noundef 2, ptr noundef %37, i32 noundef 2)
  store ptr %38, ptr %8, align 8, !tbaa !9
  %39 = load ptr, ptr %8, align 8, !tbaa !9
  %40 = load float, ptr %3, align 4, !tbaa !5
  %41 = fsub float 1.000000e+00, %40
  %42 = fpext float %41 to double
  %43 = call double @sqrt(double noundef %42) #5
  %44 = fptrunc double %43 to float
  %45 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %46 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %44, ptr %45, align 4
  store float 0.000000e+00, ptr %46, align 4
  %47 = load <2 x float>, ptr %9, align 4
  %48 = call i32 @iirfilt_cccf_set_scale(ptr noundef %39, <2 x float> noundef %47)
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %49, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %50

50:                                               ; preds = %14, %12
  %51 = load ptr, ptr %2, align 8
  ret ptr %51
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind uwtable "min-legal-vector-width"="64" "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 nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = !{!"any pointer", !7, i64 0}


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

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [75 x i8], align 1
@__const.iirfilt_cccf_create_dc_blocker.bf = external hidden unnamed_addr constant [2 x float], align 4

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

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

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @iirfilt_cccf_create(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @iirfilt_cccf_set_scale(ptr noundef, <2 x float> noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @iirfilt_cccf_create_dc_blocker(float noundef %0) local_unnamed_addr #2 {
  %2 = alloca [2 x { float, float }], align 16
  %3 = alloca [2 x { float, float }], align 16
  %4 = fcmp ugt float %0, 0.000000e+00
  br i1 %4, label %7, label %5

5:                                                ; preds = %1
  %6 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.81, i32 noundef 386, ptr noundef nonnull @.str.86, ptr noundef nonnull @.str.3) #3
  br label %17

7:                                                ; preds = %1
  %.sroa.04.0.copyload = load float, ptr @__const.iirfilt_cccf_create_dc_blocker.bf, align 4
  %.sroa.45.0.copyload = load float, ptr getelementptr inbounds (i8, ptr @__const.iirfilt_cccf_create_dc_blocker.bf, i64 4), align 4
  %8 = fadd float %0, -1.000000e+00
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %9 = getelementptr inbounds i8, ptr %2, i64 4
  store float %.sroa.04.0.copyload, ptr %2, align 16
  store float 0.000000e+00, ptr %9, align 4
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = getelementptr inbounds i8, ptr %2, i64 12
  store float %.sroa.45.0.copyload, ptr %10, align 8
  store float 0.000000e+00, ptr %11, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %3, align 16
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  %13 = getelementptr inbounds i8, ptr %3, i64 12
  store float %8, ptr %12, align 8
  store float 0.000000e+00, ptr %13, align 4
  %14 = call ptr @iirfilt_cccf_create(ptr noundef nonnull %2, i32 noundef 2, ptr noundef nonnull %3, i32 noundef 2)
  %15 = fsub float 1.000000e+00, %0
  %sqrtf = call float @sqrtf(float noundef %15) #4
  %.sroa.0.4.vec.insert = insertelement <2 x float> <float poison, float 0.000000e+00>, float %sqrtf, i64 0
  %16 = call i32 @iirfilt_cccf_set_scale(ptr noundef %14, <2 x float> noundef %.sroa.0.4.vec.insert)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  br label %17

17:                                               ; preds = %7, %5
  %.0 = phi ptr [ %6, %5 ], [ %14, %7 ]
  ret ptr %.0
}

declare float @sqrtf(float) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind uwtable "min-legal-vector-width"="64" "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 }
attributes #4 = { 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" }

!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,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass