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

; 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 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [49 x i8], align 1

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #0

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

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

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

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

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

13:                                               ; preds = %2
  %14 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 139, ptr noundef @.str.9)
  store float 0.000000e+00, ptr %3, align 4
  br label %78

15:                                               ; preds = %2
  %16 = load float, ptr %5, align 4, !tbaa !9
  %17 = fcmp olt float %16, 0.000000e+00
  br i1 %17, label %21, label %18

18:                                               ; preds = %15
  %19 = load float, ptr %5, align 4, !tbaa !9
  %20 = fcmp ogt float %19, 1.000000e+00
  br i1 %20, label %21, label %23

21:                                               ; preds = %18, %15
  %22 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 142, ptr noundef @.str.10)
  store float 0.000000e+00, ptr %3, align 4
  br label %78

23:                                               ; preds = %18
  br label %24

24:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store float 0.000000e+00, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store float 0.000000e+00, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store float 0.000000e+00, ptr %8, align 4, !tbaa !9
  %25 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %25, label %48 [
    i32 1, label %26
    i32 2, label %27
    i32 3, label %28
    i32 4, label %29
    i32 5, label %30
    i32 6, label %31
    i32 7, label %32
    i32 8, label %33
    i32 9, label %34
    i32 10, label %35
    i32 11, label %36
    i32 12, label %37
    i32 13, label %38
    i32 14, label %39
    i32 15, label %40
    i32 16, label %41
    i32 17, label %42
    i32 18, label %43
    i32 19, label %44
    i32 20, label %45
    i32 21, label %46
    i32 22, label %47
  ]

26:                                               ; preds = %24
  store float 0x3FE83D6B00000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAF685A80000000, ptr %7, align 4, !tbaa !9
  store float 0xBFB6591260000000, ptr %8, align 4, !tbaa !9
  br label %56

27:                                               ; preds = %24
  store float 0x3FE9F7F5E0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FB30A5800000000, ptr %7, align 4, !tbaa !9
  store float 0xBF8D3A0D20000000, ptr %8, align 4, !tbaa !9
  br label %56

28:                                               ; preds = %24
  store float 0x3FEAF5B8E0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FB3ABE860000000, ptr %7, align 4, !tbaa !9
  store float 0xBF75FD95A0000000, ptr %8, align 4, !tbaa !9
  br label %56

29:                                               ; preds = %24
  store float 0x3FEB90A720000000, ptr %6, align 4, !tbaa !9
  store float 0x3FB249F980000000, ptr %7, align 4, !tbaa !9
  store float 0xBF76E1E400000000, ptr %8, align 4, !tbaa !9
  br label %56

30:                                               ; preds = %24
  store float 0x3FEBFC89C0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FB0D769C0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF7AA46E60000000, ptr %8, align 4, !tbaa !9
  br label %56

31:                                               ; preds = %24
  store float 0x3FEC4CE800000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAF19A920000000, ptr %7, align 4, !tbaa !9
  store float 0xBF7E29C420000000, ptr %8, align 4, !tbaa !9
  br label %56

32:                                               ; preds = %24
  store float 0x3FEC8CA020000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAD06C800000000, ptr %7, align 4, !tbaa !9
  store float 0xBF80344840000000, ptr %8, align 4, !tbaa !9
  br label %56

33:                                               ; preds = %24
  store float 0x3FECC28F00000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAB73AEA0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF80B28680000000, ptr %8, align 4, !tbaa !9
  br label %56

34:                                               ; preds = %24
  store float 0x3FECF27C60000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAA75BD00000000, ptr %7, align 4, !tbaa !9
  store float 0xBF808BAFA0000000, ptr %8, align 4, !tbaa !9
  br label %56

35:                                               ; preds = %24
  store float 0x3FED218A60000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAA44FB00000000, ptr %7, align 4, !tbaa !9
  store float 0xBF7E9063E0000000, ptr %8, align 4, !tbaa !9
  br label %56

36:                                               ; preds = %24
  store float 0x3FED4EDCC0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAA8619E0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF7B78EA20000000, ptr %8, align 4, !tbaa !9
  br label %56

37:                                               ; preds = %24
  store float 0x3FED7A9FC0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAB007A00000000, ptr %7, align 4, !tbaa !9
  store float 0xBF78194EC0000000, ptr %8, align 4, !tbaa !9
  br label %56

38:                                               ; preds = %24
  store float 0x3FEDA4EBC0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FABA6E3A0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF74D38180000000, ptr %8, align 4, !tbaa !9
  br label %56

39:                                               ; preds = %24
  store float 0x3FEDCCAE80000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAC3E2520000000, ptr %7, align 4, !tbaa !9
  store float 0xBF71E97C60000000, ptr %8, align 4, !tbaa !9
  br label %56

40:                                               ; preds = %24
  store float 0x3FEDF0D820000000, ptr %6, align 4, !tbaa !9
  store float 0x3FACA78640000000, ptr %7, align 4, !tbaa !9
  store float 0xBF6FCC2320000000, ptr %8, align 4, !tbaa !9
  br label %56

41:                                               ; preds = %24
  store float 0x3FEE129320000000, ptr %6, align 4, !tbaa !9
  store float 0x3FACFDA7E0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF6C87F600000000, ptr %8, align 4, !tbaa !9
  br label %56

42:                                               ; preds = %24
  store float 0x3FEE314AA0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAD2765A0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF6A1E2940000000, ptr %8, align 4, !tbaa !9
  br label %56

43:                                               ; preds = %24
  store float 0x3FEE4221C0000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAAC3E880000000, ptr %7, align 4, !tbaa !9
  store float 0xBF70696480000000, ptr %8, align 4, !tbaa !9
  br label %56

44:                                               ; preds = %24
  store float 0x3FEE668840000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAD170A60000000, ptr %7, align 4, !tbaa !9
  store float 0xBF68A0A040000000, ptr %8, align 4, !tbaa !9
  br label %56

45:                                               ; preds = %24
  store float 0x3FEE7D7A40000000, ptr %6, align 4, !tbaa !9
  store float 0x3FACDD5300000000, ptr %7, align 4, !tbaa !9
  store float 0xBF68F7E8E0000000, ptr %8, align 4, !tbaa !9
  br label %56

46:                                               ; preds = %24
  store float 0x3FEE925480000000, ptr %6, align 4, !tbaa !9
  store float 0x3FAC8C6AE0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF69A3D580000000, ptr %8, align 4, !tbaa !9
  br label %56

47:                                               ; preds = %24
  store float 0x3FEEA42F40000000, ptr %6, align 4, !tbaa !9
  store float 0x3FABC80BA0000000, ptr %7, align 4, !tbaa !9
  store float 0xBF6F9DDA80000000, ptr %8, align 4, !tbaa !9
  br label %56

48:                                               ; preds = %24
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = uitofp i32 %49 to float
  %51 = fadd float %50, 0x3F50624DE0000000
  %52 = call float @logf(float noundef %51) #5
  %53 = fpext float %52 to double
  %54 = call double @llvm.fmuladd.f64(double 5.687300e-02, double %53, double 0x3FE90121682F9442)
  %55 = fptrunc double %54 to float
  store float %55, ptr %6, align 4, !tbaa !9
  store float 0x3FABC7F780000000, ptr %7, align 4, !tbaa !9
  store float 0xBF6F9F01C0000000, ptr %8, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %48, %47, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %57 = load float, ptr %5, align 4, !tbaa !9
  %58 = call float @logf(float noundef %57) #5
  store float %58, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %59 = load float, ptr %6, align 4, !tbaa !9
  %60 = load float, ptr %7, align 4, !tbaa !9
  %61 = load float, ptr %9, align 4, !tbaa !9
  %62 = call float @llvm.fmuladd.f32(float %60, float %61, float %59)
  %63 = load float, ptr %8, align 4, !tbaa !9
  %64 = load float, ptr %9, align 4, !tbaa !9
  %65 = fmul float %63, %64
  %66 = load float, ptr %9, align 4, !tbaa !9
  %67 = call float @llvm.fmuladd.f32(float %65, float %66, float %62)
  store float %67, ptr %10, align 4, !tbaa !9
  %68 = load float, ptr %10, align 4, !tbaa !9
  %69 = fcmp olt float %68, 0.000000e+00
  br i1 %69, label %70, label %71

70:                                               ; preds = %56
  store float 0.000000e+00, ptr %10, align 4, !tbaa !9
  br label %76

71:                                               ; preds = %56
  %72 = load float, ptr %10, align 4, !tbaa !9
  %73 = fcmp ogt float %72, 1.000000e+00
  br i1 %73, label %74, label %75

74:                                               ; preds = %71
  store float 1.000000e+00, ptr %10, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %74, %71
  br label %76

76:                                               ; preds = %75, %70
  %77 = load float, ptr %10, align 4, !tbaa !9
  store float %77, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %78

78:                                               ; preds = %76, %21, %13
  %79 = load float, ptr %3, align 4
  ret float %79
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"float", !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 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [49 x i8], align 1
@switch.table.rkaiser_approximate_rho = private unnamed_addr constant [22 x float] [float 0x3FE83D6B00000000, float 0x3FE9F7F5E0000000, float 0x3FEAF5B8E0000000, float 0x3FEB90A720000000, float 0x3FEBFC89C0000000, float 0x3FEC4CE800000000, float 0x3FEC8CA020000000, float 0x3FECC28F00000000, float 0x3FECF27C60000000, float 0x3FED218A60000000, float 0x3FED4EDCC0000000, float 0x3FED7A9FC0000000, float 0x3FEDA4EBC0000000, float 0x3FEDCCAE80000000, float 0x3FEDF0D820000000, float 0x3FEE129320000000, float 0x3FEE314AA0000000, float 0x3FEE4221C0000000, float 0x3FEE668840000000, float 0x3FEE7D7A40000000, float 0x3FEE925480000000, float 0x3FEEA42F40000000], align 4
@switch.table.rkaiser_approximate_rho.1 = private unnamed_addr constant [22 x float] [float 0x3FAF685A80000000, float 0x3FB30A5800000000, float 0x3FB3ABE860000000, float 0x3FB249F980000000, float 0x3FB0D769C0000000, float 0x3FAF19A920000000, float 0x3FAD06C800000000, float 0x3FAB73AEA0000000, float 0x3FAA75BD00000000, float 0x3FAA44FB00000000, float 0x3FAA8619E0000000, float 0x3FAB007A00000000, float 0x3FABA6E3A0000000, float 0x3FAC3E2520000000, float 0x3FACA78640000000, float 0x3FACFDA7E0000000, float 0x3FAD2765A0000000, float 0x3FAAC3E880000000, float 0x3FAD170A60000000, float 0x3FACDD5300000000, float 0x3FAC8C6AE0000000, float 0x3FABC80BA0000000], align 4
@switch.table.rkaiser_approximate_rho.2 = private unnamed_addr constant [22 x float] [float 0xBFB6591260000000, float 0xBF8D3A0D20000000, float 0xBF75FD95A0000000, float 0xBF76E1E400000000, float 0xBF7AA46E60000000, float 0xBF7E29C420000000, float 0xBF80344840000000, float 0xBF80B28680000000, float 0xBF808BAFA0000000, float 0xBF7E9063E0000000, float 0xBF7B78EA20000000, float 0xBF78194EC0000000, float 0xBF74D38180000000, float 0xBF71E97C60000000, float 0xBF6FCC2320000000, float 0xBF6C87F600000000, float 0xBF6A1E2940000000, float 0xBF70696480000000, float 0xBF68A0A040000000, float 0xBF68F7E8E0000000, float 0xBF69A3D580000000, float 0xBF6F9DDA80000000], align 4

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

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

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

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

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

4:                                                ; preds = %2
  %5 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 139, ptr noundef nonnull @.str.9) #4
  br label %32

6:                                                ; preds = %2
  %7 = fcmp olt float %1, 0.000000e+00
  %8 = fcmp ogt float %1, 1.000000e+00
  %or.cond = or i1 %7, %8
  br i1 %or.cond, label %9, label %11

9:                                                ; preds = %6
  %10 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 142, ptr noundef nonnull @.str.10) #4
  br label %32

11:                                               ; preds = %6
  %12 = icmp ult i32 %0, 23
  br i1 %12, label %switch.lookup, label %13

13:                                               ; preds = %11
  %14 = uitofp i32 %0 to float
  %15 = fadd float %14, 0x3F50624DE0000000
  %16 = tail call float @logf(float noundef %15) #4
  %17 = fpext float %16 to double
  %18 = tail call double @llvm.fmuladd.f64(double %17, double 5.687300e-02, double 0x3FE90121682F9442)
  %19 = fptrunc double %18 to float
  br label %23

switch.lookup:                                    ; preds = %11
  %switch.tableidx = add nsw i32 %0, -1
  %20 = sext i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [22 x float], ptr @switch.table.rkaiser_approximate_rho, i64 0, i64 %20
  %switch.load = load float, ptr %switch.gep, align 4
  %21 = sext i32 %switch.tableidx to i64
  %switch.gep23 = getelementptr inbounds [22 x float], ptr @switch.table.rkaiser_approximate_rho.1, i64 0, i64 %21
  %switch.load24 = load float, ptr %switch.gep23, align 4
  %22 = sext i32 %switch.tableidx to i64
  %switch.gep25 = getelementptr inbounds [22 x float], ptr @switch.table.rkaiser_approximate_rho.2, i64 0, i64 %22
  %switch.load26 = load float, ptr %switch.gep25, align 4
  br label %23

23:                                               ; preds = %switch.lookup, %13
  %.019 = phi float [ %19, %13 ], [ %switch.load, %switch.lookup ]
  %.018 = phi float [ 0x3FABC7F780000000, %13 ], [ %switch.load24, %switch.lookup ]
  %.017 = phi float [ 0xBF6F9F01C0000000, %13 ], [ %switch.load26, %switch.lookup ]
  %24 = tail call float @logf(float noundef %1) #4
  %25 = tail call float @llvm.fmuladd.f32(float %.018, float %24, float %.019)
  %26 = fmul float %.017, %24
  %27 = tail call float @llvm.fmuladd.f32(float %26, float %24, float %25)
  %28 = fcmp olt float %27, 0.000000e+00
  br i1 %28, label %32, label %29

29:                                               ; preds = %23
  %30 = fcmp ogt float %27, 1.000000e+00
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31, %29, %23, %9, %4
  %.016 = phi float [ 0.000000e+00, %4 ], [ 0.000000e+00, %9 ], [ 1.000000e+00, %31 ], [ %27, %29 ], [ 0.000000e+00, %23 ]
  ret float %.016
}

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 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass