; LLVM IR from jgaeddert/liquid-dsp :: src/math/src (windows)

; 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.23 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [60 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 i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

15:                                               ; preds = %3
  %16 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str.23, i32 noundef 218, ptr noundef @.str.32)
  store float 0.000000e+00, ptr %4, align 4
  br label %50

17:                                               ; preds = %3
  %18 = load float, ptr %7, align 4, !tbaa !9
  %19 = fcmp olt float %18, 0.000000e+00
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str.23, i32 noundef 221, ptr noundef @.str.33)
  store float 0.000000e+00, ptr %4, align 4
  br label %50

22:                                               ; preds = %17
  br label %23

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = uitofp i32 %24 to float
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = sub i32 %26, 1
  %28 = uitofp i32 %27 to float
  %29 = fdiv float %28, 2.000000e+00
  %30 = fsub float %25, %29
  store float %30, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %31 = load float, ptr %8, align 4, !tbaa !9
  %32 = fmul float 2.000000e+00, %31
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sub i32 %33, 1
  %35 = uitofp i32 %34 to float
  %36 = fdiv float %32, %35
  store float %36, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %37 = load float, ptr %7, align 4, !tbaa !9
  %38 = load float, ptr %9, align 4, !tbaa !9
  %39 = load float, ptr %9, align 4, !tbaa !9
  %40 = fneg float %38
  %41 = call float @llvm.fmuladd.f32(float %40, float %39, float 1.000000e+00)
  %42 = call float @sqrtf(float noundef %41) #5
  %43 = fmul float %37, %42
  %44 = call float @liquid_besseli0f(float noundef %43)
  store float %44, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %45 = load float, ptr %7, align 4, !tbaa !9
  %46 = call float @liquid_besseli0f(float noundef %45)
  store float %46, ptr %11, align 4, !tbaa !9
  %47 = load float, ptr %10, align 4, !tbaa !9
  %48 = load float, ptr %11, align 4, !tbaa !9
  %49 = fdiv float %47, %48
  store float %49, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  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
  br label %50

50:                                               ; preds = %23, %20, %15
  %51 = load float, ptr %4, align 4
  ret float %51
}

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #3

declare float @liquid_besseli0f(float noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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"="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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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.23 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [60 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local float @liquid_kaiser(i32 noundef %0, i32 noundef %1, float noundef %2) local_unnamed_addr #1 {
  %.not = icmp ult i32 %0, %1
  br i1 %.not, label %6, label %4

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

6:                                                ; preds = %3
  %7 = fcmp olt float %2, 0.000000e+00
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  %9 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str.23, i32 noundef 221, ptr noundef nonnull @.str.33) #4
  br label %25

10:                                               ; preds = %6
  %11 = uitofp i32 %0 to float
  %12 = add i32 %1, -1
  %13 = uitofp i32 %12 to float
  %14 = fmul float %13, 5.000000e-01
  %15 = fsub float %11, %14
  %16 = fmul float %15, 2.000000e+00
  %17 = fdiv float %16, %13
  %18 = fneg float %17
  %19 = tail call float @llvm.fmuladd.f32(float %18, float %17, float 1.000000e+00)
  %20 = tail call float @sqrtf(float noundef %19) #4
  %21 = fmul float %20, %2
  %22 = tail call float @liquid_besseli0f(float noundef %21) #4
  %23 = tail call float @liquid_besseli0f(float noundef %2) #4
  %24 = fdiv float %22, %23
  br label %25

25:                                               ; preds = %10, %8, %4
  %.0 = phi float [ 0.000000e+00, %4 ], [ 0.000000e+00, %8 ], [ %24, %10 ]
  ret float %.0
}

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

declare float @liquid_besseli0f(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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 = { 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 #2 = { 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 #3 = { mustprogress 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)"}


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