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

; 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.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.155 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.164 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.165 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.167 = external hidden unnamed_addr constant [80 x i8], align 1

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

declare i32 @liquid_firdes_kaiser(i32 noundef, float noundef, float noundef, float noundef, ptr noundef) #0

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

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

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

19:                                               ; preds = %4
  %20 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.155, i32 noundef 220, ptr noundef @.str.164, ptr noundef @.str.2)
  store ptr %20, ptr %5, align 8
  br label %87

21:                                               ; preds = %4
  %22 = load i32, ptr %7, align 4, !tbaa !5
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %21
  %25 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.155, i32 noundef 222, ptr noundef @.str.165, ptr noundef @.str.2)
  store ptr %25, ptr %5, align 8
  br label %87

26:                                               ; preds = %21
  %27 = load float, ptr %8, align 4, !tbaa !9
  %28 = fcmp olt float %27, 0.000000e+00
  br i1 %28, label %32, label %29

29:                                               ; preds = %26
  %30 = load float, ptr %8, align 4, !tbaa !9
  %31 = fcmp ogt float %30, 1.000000e+00
  br i1 %31, label %32, label %34

32:                                               ; preds = %29, %26
  %33 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.155, i32 noundef 224, ptr noundef @.str.166, ptr noundef @.str.2)
  store ptr %33, ptr %5, align 8
  br label %87

34:                                               ; preds = %29
  %35 = load i32, ptr %9, align 4, !tbaa !5
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %39

37:                                               ; preds = %34
  %38 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.155, i32 noundef 226, ptr noundef @.str.167, ptr noundef @.str.2)
  store ptr %38, ptr %5, align 8
  br label %87

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %40 = load i32, ptr %9, align 4, !tbaa !5
  %41 = mul i32 2, %40
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = mul i32 %41, %42
  %44 = load i32, ptr %7, align 4, !tbaa !5
  %45 = mul i32 %43, %44
  %46 = add i32 %45, 1
  store i32 %46, ptr %10, align 4, !tbaa !5
  %47 = load i32, ptr %10, align 4, !tbaa !5
  %48 = zext i32 %47 to i64
  %49 = call ptr @llvm.stacksave.p0()
  store ptr %49, ptr %11, align 8
  %50 = alloca float, i64 %48, align 16
  store i64 %48, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store float 7.500000e-01, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store float 4.000000e+01, ptr %14, align 4, !tbaa !9
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = load float, ptr %13, align 4, !tbaa !9
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = mul i32 %53, %54
  %56 = uitofp i32 %55 to float
  %57 = fdiv float %52, %56
  %58 = load float, ptr %14, align 4, !tbaa !9
  %59 = call i32 @liquid_firdes_kaiser(i32 noundef %51, float noundef %57, float noundef %58, float noundef 0.000000e+00, ptr noundef %50)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = zext i32 %60 to i64
  %62 = alloca float, i64 %61, align 16
  store i64 %61, ptr %16, align 8
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %78, %39
  %64 = load i32, ptr %15, align 4, !tbaa !5
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = icmp ult i32 %64, %65
  br i1 %66, label %67, label %81

67:                                               ; preds = %63
  %68 = load i32, ptr %15, align 4, !tbaa !5
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds float, ptr %50, i64 %69
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = fmul float %71, 2.000000e+00
  %73 = load float, ptr %13, align 4, !tbaa !9
  %74 = fmul float %72, %73
  %75 = load i32, ptr %15, align 4, !tbaa !5
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds float, ptr %62, i64 %76
  store float %74, ptr %77, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %67
  %79 = load i32, ptr %15, align 4, !tbaa !5
  %80 = add i32 %79, 1
  store i32 %80, ptr %15, align 4, !tbaa !5
  br label %63, !llvm.loop !11

81:                                               ; preds = %63
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = call ptr @symsync_crcf_create(i32 noundef %82, i32 noundef %83, ptr noundef %62, i32 noundef %84)
  store ptr %85, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %86 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %86)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %87

87:                                               ; preds = %81, %37, %32, %24, %19
  %88 = load ptr, ptr %5, align 8
  ret ptr %88
}

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 = { 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 }

!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}
!11 = distinct !{!11, !12}
!12 = !{!"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.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.155 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.164 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.165 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.167 = external hidden unnamed_addr constant [80 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

declare i32 @liquid_firdes_kaiser(i32 noundef, float noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @symsync_crcf_create_kaiser(i32 noundef %0, i32 noundef %1, float noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = icmp ult i32 %0, 2
  br i1 %5, label %6, label %8

6:                                                ; preds = %4
  %7 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.155, i32 noundef 220, ptr noundef nonnull @.str.164, ptr noundef nonnull @.str.2) #3
  br label %50

8:                                                ; preds = %4
  %9 = icmp eq i32 %1, 0
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.155, i32 noundef 222, ptr noundef nonnull @.str.165, ptr noundef nonnull @.str.2) #3
  br label %50

12:                                               ; preds = %8
  %13 = fcmp olt float %2, 0.000000e+00
  %14 = fcmp ogt float %2, 1.000000e+00
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %17

15:                                               ; preds = %12
  %16 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.155, i32 noundef 224, ptr noundef nonnull @.str.166, ptr noundef nonnull @.str.2) #3
  br label %50

17:                                               ; preds = %12
  %18 = icmp eq i32 %3, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %17
  %20 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.155, i32 noundef 226, ptr noundef nonnull @.str.167, ptr noundef nonnull @.str.2) #3
  br label %50

21:                                               ; preds = %17
  %22 = shl i32 %0, 1
  %23 = mul i32 %22, %1
  %24 = mul i32 %23, %3
  %25 = or disjoint i32 %24, 1
  %26 = zext i32 %25 to i64
  %27 = tail call ptr @llvm.stacksave.p0()
  %28 = alloca float, i64 %26, align 16
  %29 = mul i32 %3, %0
  %30 = uitofp i32 %29 to float
  %31 = fdiv float 7.500000e-01, %30
  %32 = call i32 @liquid_firdes_kaiser(i32 noundef %25, float noundef %31, float noundef 4.000000e+01, float noundef 0.000000e+00, ptr noundef nonnull %28) #3
  %33 = alloca float, i64 %26, align 16
  %34 = or disjoint i32 %24, 1
  %wide.trip.count = zext i32 %34 to i64
  %min.iters.check = icmp ult i32 %24, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %21
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %35 = getelementptr inbounds float, ptr %28, i64 %index
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %wide.load = load <4 x float>, ptr %35, align 16, !tbaa !5
  %wide.load33 = load <4 x float>, ptr %36, align 16, !tbaa !5
  %37 = fmul <4 x float> %wide.load, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
  %38 = fmul <4 x float> %wide.load33, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
  %39 = fmul <4 x float> %37, <float 7.500000e-01, float 7.500000e-01, float 7.500000e-01, float 7.500000e-01>
  %40 = fmul <4 x float> %38, <float 7.500000e-01, float 7.500000e-01, float 7.500000e-01, float 7.500000e-01>
  %41 = getelementptr inbounds float, ptr %33, i64 %index
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  store <4 x float> %39, ptr %41, align 16, !tbaa !5
  store <4 x float> %40, ptr %42, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %43 = icmp eq i64 %index.next, %n.vec
  br i1 %43, label %scalar.ph.preheader, label %vector.body, !llvm.loop !9

scalar.ph.preheader:                              ; preds = %vector.body, %21
  %indvars.iv.ph = phi i64 [ 0, %21 ], [ %n.vec, %vector.body ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %44 = getelementptr inbounds float, ptr %28, i64 %indvars.iv
  %45 = load float, ptr %44, align 4, !tbaa !5
  %46 = fmul float %45, 2.000000e+00
  %47 = fmul float %46, 7.500000e-01
  %48 = getelementptr inbounds float, ptr %33, i64 %indvars.iv
  store float %47, ptr %48, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond, label %.loopexit, label %scalar.ph, !llvm.loop !13

.loopexit:                                        ; preds = %scalar.ph
  %49 = call ptr @symsync_crcf_create(i32 noundef %0, i32 noundef %3, ptr noundef nonnull %33, i32 noundef %25)
  call void @llvm.stackrestore.p0(ptr %27)
  br label %50

50:                                               ; preds = %.loopexit, %19, %15, %10, %6
  %.0 = phi ptr [ %7, %6 ], [ %11, %10 ], [ %16, %15 ], [ %20, %19 ], [ %49, %.loopexit ]
  ret ptr %.0
}

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 = { 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 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass