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

@.str.11 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [70 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; 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 void @free(ptr noundef) #3

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

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

22:                                               ; preds = %6
  %23 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 157, ptr noundef @.str.13)
  store ptr %23, ptr %7, align 8
  br label %110

24:                                               ; preds = %6
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = icmp ult i32 %25, 2
  br i1 %26, label %30, label %27

27:                                               ; preds = %24
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = icmp ugt i32 %28, 80
  br i1 %29, label %30, label %32

30:                                               ; preds = %27, %24
  %31 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 159, ptr noundef @.str.14)
  store ptr %31, ptr %7, align 8
  br label %110

32:                                               ; preds = %27
  %33 = load i32, ptr %12, align 4, !tbaa !9
  %34 = icmp ult i32 %33, 1
  br i1 %34, label %38, label %35

35:                                               ; preds = %32
  %36 = load i32, ptr %12, align 4, !tbaa !9
  %37 = icmp ugt i32 %36, 100
  br i1 %37, label %38, label %40

38:                                               ; preds = %35, %32
  %39 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 161, ptr noundef @.str.15)
  store ptr %39, ptr %7, align 8
  br label %110

40:                                               ; preds = %35
  %41 = load float, ptr %13, align 4, !tbaa !11
  %42 = fcmp olt float %41, 0.000000e+00
  br i1 %42, label %46, label %43

43:                                               ; preds = %40
  %44 = load float, ptr %13, align 4, !tbaa !11
  %45 = fcmp ogt float %44, 1.000000e+00
  br i1 %45, label %46, label %48

46:                                               ; preds = %43, %40
  %47 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 163, ptr noundef @.str.16)
  store ptr %47, ptr %7, align 8
  br label %110

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %49 = load i32, ptr %11, align 4, !tbaa !9
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = mul i32 2, %51
  %53 = add i32 %50, %52
  %54 = mul i32 %49, %53
  store i32 %54, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %55 = load i32, ptr %14, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = mul i64 %56, 8
  %58 = call noalias ptr @malloc(i64 noundef %57) #7
  store ptr %58, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = load float, ptr %13, align 4, !tbaa !11
  %63 = call ptr @firinterp_crcf_create_prototype(i32 noundef %59, i32 noundef %60, i32 noundef %61, float noundef %62, float noundef 0.000000e+00)
  store ptr %63, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %99, %48
  %65 = load i32, ptr %17, align 4, !tbaa !9
  %66 = load i32, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %12, align 4, !tbaa !9
  %68 = mul i32 2, %67
  %69 = add i32 %66, %68
  %70 = icmp ult i32 %65, %69
  br i1 %70, label %71, label %102

71:                                               ; preds = %64
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = load i32, ptr %17, align 4, !tbaa !9
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = icmp ult i32 %73, %74
  br i1 %75, label %76, label %85

76:                                               ; preds = %71
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load i32, ptr %17, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  %80 = getelementptr inbounds { float, float }, ptr %77, i64 %79
  %81 = getelementptr inbounds { float, float }, ptr %80, i32 0, i32 0
  %82 = load float, ptr %81, align 4
  %83 = getelementptr inbounds { float, float }, ptr %80, i32 0, i32 1
  %84 = load float, ptr %83, align 4
  br label %86

85:                                               ; preds = %71
  br label %86

86:                                               ; preds = %85, %76
  %87 = phi float [ %82, %76 ], [ 0.000000e+00, %85 ]
  %88 = phi float [ %84, %76 ], [ 0.000000e+00, %85 ]
  %89 = load ptr, ptr %15, align 8, !tbaa !5
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = load i32, ptr %17, align 4, !tbaa !9
  %92 = mul i32 %90, %91
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds { float, float }, ptr %89, i64 %93
  %95 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 0
  %96 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 1
  store float %87, ptr %95, align 4
  store float %88, ptr %96, align 4
  %97 = load <2 x float>, ptr %18, align 4
  %98 = call i32 @firinterp_crcf_execute(ptr noundef %72, <2 x float> noundef %97, ptr noundef %94)
  br label %99

99:                                               ; preds = %86
  %100 = load i32, ptr %17, align 4, !tbaa !9
  %101 = add i32 %100, 1
  store i32 %101, ptr %17, align 4, !tbaa !9
  br label %64, !llvm.loop !13

102:                                              ; preds = %64
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = call i32 @firinterp_crcf_destroy(ptr noundef %103)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = load i32, ptr %14, align 4, !tbaa !9
  %107 = call ptr @qdetector_cccf_create(ptr noundef %105, i32 noundef %106)
  store ptr %107, ptr %19, align 8, !tbaa !5
  %108 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %108) #6
  %109 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %109, ptr %7, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %110

110:                                              ; preds = %102, %46, %38, %30, %22
  %111 = load ptr, ptr %7, align 8
  ret ptr %111
}

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

declare i32 @firinterp_crcf_execute(ptr noundef, <2 x float> noundef, ptr noundef) #0

declare i32 @firinterp_crcf_destroy(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 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 uwtable "min-legal-vector-width"="64" "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 #6 = { nounwind }
attributes #7 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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.11 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [70 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

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

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

8:                                                ; preds = %6
  %9 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 157, ptr noundef nonnull @.str.13) #5
  br label %45

10:                                               ; preds = %6
  %11 = add i32 %3, -81
  %or.cond = icmp ult i32 %11, -79
  br i1 %or.cond, label %12, label %14

12:                                               ; preds = %10
  %13 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 159, ptr noundef nonnull @.str.14) #5
  br label %45

14:                                               ; preds = %10
  %15 = add i32 %4, -101
  %or.cond3 = icmp ult i32 %15, -100
  br i1 %or.cond3, label %16, label %18

16:                                               ; preds = %14
  %17 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 161, ptr noundef nonnull @.str.15) #5
  br label %45

18:                                               ; preds = %14
  %19 = fcmp olt float %5, 0.000000e+00
  %20 = fcmp ogt float %5, 1.000000e+00
  %or.cond5 = or i1 %19, %20
  br i1 %or.cond5, label %21, label %23

21:                                               ; preds = %18
  %22 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 163, ptr noundef nonnull @.str.16) #5
  br label %45

23:                                               ; preds = %18
  %24 = shl nuw nsw i32 %4, 1
  %25 = add i32 %24, %1
  %26 = mul i32 %25, %3
  %27 = zext i32 %26 to i64
  %28 = shl nuw nsw i64 %27, 3
  %29 = tail call noalias ptr @malloc(i64 noundef %28) #6
  %30 = tail call ptr @firinterp_crcf_create_prototype(i32 noundef %2, i32 noundef %3, i32 noundef %4, float noundef %5, float noundef 0.000000e+00) #5
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %23
  %31 = zext i32 %1 to i64
  %wide.trip.count = zext i32 %25 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %36
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %36 ]
  %32 = icmp ult i64 %indvars.iv, %31
  br i1 %32, label %33, label %36

33:                                               ; preds = %.lr.ph
  %34 = getelementptr inbounds { float, float }, ptr %0, i64 %indvars.iv
  %35 = load <2 x float>, ptr %34, align 4
  br label %36

36:                                               ; preds = %.lr.ph, %33
  %37 = phi <2 x float> [ %35, %33 ], [ zeroinitializer, %.lr.ph ]
  %38 = trunc nuw i64 %indvars.iv to i32
  %39 = mul i32 %38, %3
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds { float, float }, ptr %29, i64 %40
  %42 = tail call i32 @firinterp_crcf_execute(ptr noundef %30, <2 x float> noundef %37, ptr noundef %41) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %36, %23
  %43 = tail call i32 @firinterp_crcf_destroy(ptr noundef %30) #5
  %44 = tail call ptr @qdetector_cccf_create(ptr noundef %29, i32 noundef %26)
  tail call void @free(ptr noundef %29) #5
  br label %45

45:                                               ; preds = %._crit_edge, %21, %16, %12, %8
  %.0 = phi ptr [ %9, %8 ], [ %13, %12 ], [ %17, %16 ], [ %22, %21 ], [ %44, %._crit_edge ]
  ret ptr %.0
}

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

declare i32 @firinterp_crcf_execute(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #0

declare i32 @firinterp_crcf_destroy(ptr noundef) local_unnamed_addr #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 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 #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #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 uwtable "min-legal-vector-width"="64" "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass