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

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

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

11:                                               ; preds = %3
  %12 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str.23, i32 noundef 357, ptr noundef @.str.42)
  store float 0.000000e+00, ptr %4, align 4
  br label %53

13:                                               ; preds = %3
  %14 = load i32, ptr %7, align 4, !tbaa !5
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = udiv i32 %15, 2
  %17 = icmp ugt i32 %14, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %13
  %19 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str.23, i32 noundef 360, ptr noundef @.str.43)
  store float 0.000000e+00, ptr %4, align 4
  br label %53

20:                                               ; preds = %13
  br label %21

21:                                               ; preds = %20
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = sub i32 %23, %24
  %26 = sub i32 %25, 1
  %27 = icmp ugt i32 %22, %26
  br i1 %27, label %28, label %33

28:                                               ; preds = %21
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sub i32 %29, %30
  %32 = sub i32 %31, 1
  store i32 %32, ptr %5, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %28, %21
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = icmp ult i32 %34, %35
  br i1 %36, label %37, label %50

37:                                               ; preds = %33
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = uitofp i32 %38 to float
  %40 = fadd float %39, 5.000000e-01
  %41 = fpext float %40 to double
  %42 = fmul double 0x400921FB54442D18, %41
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = uitofp i32 %43 to float
  %45 = fpext float %44 to double
  %46 = fdiv double %42, %45
  %47 = fptrunc double %46 to float
  %48 = call float @cosf(float noundef %47) #4
  %49 = call float @llvm.fmuladd.f32(float -5.000000e-01, float %48, float 5.000000e-01)
  br label %51

50:                                               ; preds = %33
  br label %51

51:                                               ; preds = %50, %37
  %52 = phi float [ %49, %37 ], [ 1.000000e+00, %50 ]
  store float %52, ptr %4, align 4
  br label %53

53:                                               ; preds = %51, %18, %11
  %54 = load float, ptr %4, align 4
  ret float %54
}

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

; Function Attrs: nounwind
declare float @cosf(float noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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"}


; 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.42 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [73 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_rcostaper_window(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp ugt i32 %0, %1
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str.23, i32 noundef 357, ptr noundef nonnull @.str.42) #4
  br label %30

7:                                                ; preds = %3
  %8 = lshr i32 %1, 1
  %9 = icmp ult i32 %8, %2
  br i1 %9, label %10, label %12

10:                                               ; preds = %7
  %11 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str.23, i32 noundef 360, ptr noundef nonnull @.str.43) #4
  br label %30

12:                                               ; preds = %7
  %13 = xor i32 %2, -1
  %14 = add i32 %13, %1
  %15 = icmp ult i32 %14, %0
  %16 = xor i32 %0, -1
  %17 = add i32 %16, %1
  %.013 = select i1 %15, i32 %17, i32 %0
  %18 = icmp ult i32 %.013, %2
  br i1 %18, label %19, label %30

19:                                               ; preds = %12
  %20 = uitofp nneg i32 %.013 to float
  %21 = fadd float %20, 5.000000e-01
  %22 = fpext float %21 to double
  %23 = fmul double %22, 0x400921FB54442D18
  %24 = uitofp nneg i32 %2 to float
  %25 = fpext float %24 to double
  %26 = fdiv double %23, %25
  %27 = fptrunc double %26 to float
  %28 = tail call float @cosf(float noundef %27) #4
  %29 = tail call float @llvm.fmuladd.f32(float %28, float -5.000000e-01, float 5.000000e-01)
  br label %30

30:                                               ; preds = %19, %12, %10, %5
  %.0 = phi float [ 0.000000e+00, %5 ], [ 0.000000e+00, %10 ], [ %29, %19 ], [ 1.000000e+00, %12 ]
  ret float %.0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @cosf(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 = { 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}


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