; 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.42 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [67 x i8], align 1

; 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firinterp_cccf_create_window(i32 noundef %0, i32 noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = icmp ult i32 %9, 1
  br i1 %10, label %11, label %13

11:                                               ; preds = %2
  %12 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.42, i32 noundef 172, ptr noundef @.str.53, ptr noundef @.str.3)
  store ptr %12, ptr %3, align 8
  br label %64

13:                                               ; preds = %2
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = icmp ult i32 %14, 1
  br i1 %15, label %16, label %18

16:                                               ; preds = %13
  %17 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.42, i32 noundef 174, ptr noundef @.str.53, ptr noundef @.str.3)
  store ptr %17, ptr %3, align 8
  br label %64

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = mul i32 2, %19
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = mul i32 %20, %21
  %23 = zext i32 %22 to i64
  %24 = call ptr @llvm.stacksave.p0()
  store ptr %24, ptr %7, align 8
  %25 = alloca { float, float }, i64 %23, align 16
  store i64 %23, ptr %8, align 8
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %53, %18
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = mul i32 2, %28
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = mul i32 %29, %30
  %32 = icmp ult i32 %27, %31
  br i1 %32, label %33, label %56

33:                                               ; preds = %26
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = uitofp i32 %34 to float
  %36 = fpext float %35 to double
  %37 = fmul double 0x400921FB54442D18, %36
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = mul i32 2, %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = mul i32 %39, %40
  %42 = uitofp i32 %41 to float
  %43 = fpext float %42 to double
  %44 = fdiv double %37, %43
  %45 = fptrunc double %44 to float
  %46 = call float @sinf(float noundef %45) #5
  %47 = call float @powf(float noundef %46, float noundef 2.000000e+00) #5
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds { float, float }, ptr %25, i64 %49
  %51 = getelementptr inbounds { float, float }, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds { float, float }, ptr %50, i32 0, i32 1
  store float %47, ptr %51, align 8
  store float 0.000000e+00, ptr %52, align 4
  br label %53

53:                                               ; preds = %33
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = add i32 %54, 1
  store i32 %55, ptr %6, align 4, !tbaa !5
  br label %26, !llvm.loop !9

56:                                               ; preds = %26
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = mul i32 2, %58
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = mul i32 %59, %60
  %62 = call ptr @firinterp_cccf_create(i32 noundef %57, ptr noundef %25, i32 noundef %61)
  store ptr %62, ptr %3, align 8
  %63 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %63)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %64

64:                                               ; preds = %56, %16, %11
  %65 = load ptr, ptr %3, align 8
  ret ptr %65
}

; Function Attrs: nounwind
declare float @powf(float noundef, float noundef) #4

; Function Attrs: nounwind
declare float @sinf(float 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 = { nocallback nofree nosync nounwind willreturn }
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 "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; 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.42 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [67 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @firinterp_cccf_create_window(i32 noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = icmp eq i32 %0, 0
  br i1 %3, label %4, label %6

4:                                                ; preds = %2
  %5 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.42, i32 noundef 172, ptr noundef nonnull @.str.53, ptr noundef nonnull @.str.3) #4
  br label %38

6:                                                ; preds = %2
  %7 = icmp eq i32 %1, 0
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  %9 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.42, i32 noundef 174, ptr noundef nonnull @.str.53, ptr noundef nonnull @.str.3) #4
  br label %38

10:                                               ; preds = %6
  %11 = shl i32 %1, 1
  %12 = mul i32 %11, %0
  %13 = zext i32 %12 to i64
  %14 = tail call ptr @llvm.stacksave.p0()
  %15 = alloca { float, float }, i64 %13, align 16
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %16 = uitofp i32 %12 to float
  %17 = fpext float %16 to double
  br label %18

18:                                               ; preds = %18, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.1, %18 ]
  %19 = trunc nuw i64 %indvars.iv to i32
  %20 = uitofp i32 %19 to float
  %21 = fpext float %20 to double
  %22 = fmul double %21, 0x400921FB54442D18
  %23 = fdiv double %22, %17
  %24 = fptrunc double %23 to float
  %25 = tail call float @sinf(float noundef %24) #4
  %square = fmul float %25, %25
  %26 = getelementptr inbounds { float, float }, ptr %15, i64 %indvars.iv
  %27 = getelementptr inbounds i8, ptr %26, i64 4
  store float %square, ptr %26, align 16
  store float 0.000000e+00, ptr %27, align 4
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %28 = trunc nuw i64 %indvars.iv.next to i32
  %29 = uitofp i32 %28 to float
  %30 = fpext float %29 to double
  %31 = fmul double %30, 0x400921FB54442D18
  %32 = fdiv double %31, %17
  %33 = fptrunc double %32 to float
  %34 = tail call float @sinf(float noundef %33) #4
  %square.1 = fmul float %34, %34
  %35 = getelementptr inbounds { float, float }, ptr %15, i64 %indvars.iv.next
  %36 = getelementptr inbounds i8, ptr %35, i64 4
  store float %square.1, ptr %35, align 8
  store float 0.000000e+00, ptr %36, align 4
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %13
  br i1 %exitcond.not.1, label %._crit_edge, label %18, !llvm.loop !5

._crit_edge:                                      ; preds = %18, %10
  %37 = call ptr @firinterp_cccf_create(i32 noundef %0, ptr noundef nonnull %15, i32 noundef %12)
  call void @llvm.stackrestore.p0(ptr %14)
  br label %38

38:                                               ; preds = %._crit_edge, %8, %4
  %.0 = phi ptr [ %5, %4 ], [ %9, %8 ], [ %37, %._crit_edge ]
  ret ptr %.0
}

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

attributes #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass