; LLVM IR from jgaeddert/liquid-dsp :: src/channel/src (channel_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"

%struct.tvmpch_cccf_s = type { ptr, i32, ptr, float, float, float }

@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [52 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; 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, ...) #2

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

12:                                               ; preds = %3
  %13 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.13, i32 noundef 55, ptr noundef @.str.14, ptr noundef @.str.2)
  store ptr %13, ptr %4, align 8
  br label %98

14:                                               ; preds = %3
  %15 = load float, ptr %6, align 4, !tbaa !9
  %16 = fcmp olt float %15, 0.000000e+00
  br i1 %16, label %17, label %19

17:                                               ; preds = %14
  %18 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.13, i32 noundef 57, ptr noundef @.str.15, ptr noundef @.str.2)
  store ptr %18, ptr %4, align 8
  br label %98

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

22:                                               ; preds = %19
  %23 = load float, ptr %7, align 4, !tbaa !9
  %24 = fcmp ogt float %23, 1.000000e+00
  br i1 %24, label %25, label %27

25:                                               ; preds = %22, %19
  %26 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.13, i32 noundef 59, ptr noundef @.str.16, ptr noundef @.str.2)
  store ptr %26, ptr %4, align 8
  br label %98

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %28 = call noalias ptr @malloc(i64 noundef 40) #6
  store ptr %28, ptr %8, align 8, !tbaa !11
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = load ptr, ptr %8, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %30, i32 0, i32 1
  store i32 %29, ptr %31, align 8, !tbaa !13
  %32 = load ptr, ptr %8, align 8, !tbaa !11
  %33 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !13
  %35 = zext i32 %34 to i64
  %36 = mul i64 %35, 8
  %37 = call noalias ptr @malloc(i64 noundef %36) #6
  %38 = load ptr, ptr %8, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %38, i32 0, i32 0
  store ptr %37, ptr %39, align 8, !tbaa !15
  %40 = load float, ptr %7, align 4, !tbaa !9
  %41 = load ptr, ptr %8, align 8, !tbaa !11
  %42 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %41, i32 0, i32 5
  store float %40, ptr %42, align 8, !tbaa !16
  %43 = load float, ptr %6, align 4, !tbaa !9
  %44 = fmul float 2.000000e+00, %43
  %45 = load ptr, ptr %8, align 8, !tbaa !11
  %46 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %45, i32 0, i32 5
  %47 = load float, ptr %46, align 8, !tbaa !16
  %48 = call float @sqrtf(float noundef %47) #5
  %49 = fdiv float %44, %48
  %50 = load ptr, ptr %8, align 8, !tbaa !11
  %51 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %50, i32 0, i32 3
  store float %49, ptr %51, align 8, !tbaa !17
  %52 = load ptr, ptr %8, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %52, i32 0, i32 5
  %54 = load float, ptr %53, align 8, !tbaa !16
  %55 = fsub float 1.000000e+00, %54
  %56 = load ptr, ptr %8, align 8, !tbaa !11
  %57 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %56, i32 0, i32 4
  store float %55, ptr %57, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %58 = load ptr, ptr %8, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !15
  %61 = load ptr, ptr %8, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !13
  %64 = sub i32 %63, 1
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds { float, float }, ptr %60, i64 %65
  %67 = getelementptr inbounds { float, float }, ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds { float, float }, ptr %66, i32 0, i32 1
  store float 1.000000e+00, ptr %67, align 4
  store float 0.000000e+00, ptr %68, align 4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %85, %27
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !11
  %72 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %71, i32 0, i32 1
  %73 = load i32, ptr %72, align 8, !tbaa !13
  %74 = sub i32 %73, 1
  %75 = icmp ult i32 %70, %74
  br i1 %75, label %76, label %88

76:                                               ; preds = %69
  %77 = load ptr, ptr %8, align 8, !tbaa !11
  %78 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !15
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds { float, float }, ptr %79, i64 %81
  %83 = getelementptr inbounds { float, float }, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds { float, float }, ptr %82, i32 0, i32 1
  store float 0.000000e+00, ptr %83, align 4
  store float 0.000000e+00, ptr %84, align 4
  br label %85

85:                                               ; preds = %76
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = add i32 %86, 1
  store i32 %87, ptr %9, align 4, !tbaa !5
  br label %69, !llvm.loop !19

88:                                               ; preds = %69
  %89 = load ptr, ptr %8, align 8, !tbaa !11
  %90 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !13
  %92 = call ptr @windowcf_create(i32 noundef %91)
  %93 = load ptr, ptr %8, align 8, !tbaa !11
  %94 = getelementptr inbounds %struct.tvmpch_cccf_s, ptr %93, i32 0, i32 2
  store ptr %92, ptr %94, align 8, !tbaa !21
  %95 = load ptr, ptr %8, align 8, !tbaa !11
  %96 = call i32 @tvmpch_cccf_reset(ptr noundef %95)
  %97 = load ptr, ptr %8, align 8, !tbaa !11
  store ptr %97, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %98

98:                                               ; preds = %88, %25, %17, %12
  %99 = load ptr, ptr %4, align 8
  ret ptr %99
}

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

declare ptr @windowcf_create(i32 noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 = { "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 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 }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"tvmpch_cccf_s", !12, i64 0, !6, i64 8, !12, i64 16, !10, i64 24, !10, i64 28, !10, i64 32}
!15 = !{!14, !12, i64 0}
!16 = !{!14, !10, i64 32}
!17 = !{!14, !10, i64 24}
!18 = !{!14, !10, i64 28}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!14, !12, i64 16}


; 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.13 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [52 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

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

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

5:                                                ; preds = %3
  %6 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.13, i32 noundef 55, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.2) #4
  br label %41

7:                                                ; preds = %3
  %8 = fcmp olt float %1, 0.000000e+00
  br i1 %8, label %9, label %11

9:                                                ; preds = %7
  %10 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.13, i32 noundef 57, ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.2) #4
  br label %41

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

14:                                               ; preds = %11
  %15 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.13, i32 noundef 59, ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.2) #4
  br label %41

16:                                               ; preds = %11
  %17 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #5
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  store i32 %0, ptr %18, align 8, !tbaa !5
  %19 = zext i32 %0 to i64
  %20 = shl nuw nsw i64 %19, 3
  %21 = tail call noalias ptr @malloc(i64 noundef %20) #5
  store ptr %21, ptr %17, align 8, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %17, i64 32
  store float %2, ptr %22, align 8, !tbaa !13
  %23 = fmul float %1, 2.000000e+00
  %24 = tail call float @sqrtf(float noundef %2) #4
  %25 = fdiv float %23, %24
  %26 = getelementptr inbounds i8, ptr %17, i64 24
  store float %25, ptr %26, align 8, !tbaa !14
  %27 = fsub float 1.000000e+00, %2
  %28 = getelementptr inbounds i8, ptr %17, i64 28
  store float %27, ptr %28, align 4, !tbaa !15
  %29 = add i32 %0, -1
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds { float, float }, ptr %21, i64 %30
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %31, align 4
  %.not = icmp eq i32 %0, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %16
  %min.iters.check = icmp ult i32 %0, 5
  br i1 %min.iters.check, label %.lr.ph.preheader34, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %30, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %32 = or disjoint i64 %index, 2
  %33 = getelementptr inbounds { float, float }, ptr %21, i64 %index
  %34 = getelementptr inbounds { float, float }, ptr %21, i64 %32
  store <4 x float> zeroinitializer, ptr %33, align 4
  store <4 x float> zeroinitializer, ptr %34, align 4
  %index.next = add nuw i64 %index, 4
  %35 = icmp eq i64 %index.next, %n.vec
  br i1 %35, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %30
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader34

.lr.ph.preheader34:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader34, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader34 ]
  %36 = getelementptr inbounds { float, float }, ptr %21, i64 %indvars.iv
  store <2 x float> zeroinitializer, ptr %36, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = icmp ult i64 %indvars.iv.next, %30
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %16
  %38 = tail call ptr @windowcf_create(i32 noundef %0) #4
  %39 = getelementptr inbounds i8, ptr %17, i64 16
  store ptr %38, ptr %39, align 8, !tbaa !21
  %40 = tail call i32 @tvmpch_cccf_reset(ptr noundef nonnull %17)
  br label %41

41:                                               ; preds = %._crit_edge, %14, %9, %5
  %.027 = phi ptr [ %6, %5 ], [ %10, %9 ], [ %15, %14 ], [ %17, %._crit_edge ]
  ret ptr %.027
}

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

declare ptr @windowcf_create(i32 noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { 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 }
attributes #5 = { nounwind allocsize(0) }

!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, !10, i64 8}
!6 = !{!"tvmpch_cccf_s", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !11, i64 28, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !11, i64 32}
!14 = !{!6, !11, i64 24}
!15 = !{!6, !11, i64 28}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !17, !19, !18}
!21 = !{!6, !7, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass