; 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.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [69 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_cpfsk(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, i32 noundef %4, i32 noundef %5, float noundef %6, i32 noundef %7) #4 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca float, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !9
  store i32 %2, ptr %12, align 4, !tbaa !9
  store float %3, ptr %13, align 4, !tbaa !11
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !9
  store float %6, ptr %16, align 4, !tbaa !11
  store i32 %7, ptr %17, align 4, !tbaa !9
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %8
  %26 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 245, ptr noundef @.str.21)
  store ptr %26, ptr %9, align 8
  br label %109

27:                                               ; preds = %8
  %28 = load i32, ptr %14, align 4, !tbaa !9
  %29 = icmp ult i32 %28, 2
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  %31 = load i32, ptr %14, align 4, !tbaa !9
  %32 = icmp ugt i32 %31, 80
  br i1 %32, label %33, label %35

33:                                               ; preds = %30, %27
  %34 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 247, ptr noundef @.str.22)
  store ptr %34, ptr %9, align 8
  br label %109

35:                                               ; preds = %30
  %36 = load i32, ptr %15, align 4, !tbaa !9
  %37 = icmp ult i32 %36, 1
  br i1 %37, label %41, label %38

38:                                               ; preds = %35
  %39 = load i32, ptr %15, align 4, !tbaa !9
  %40 = icmp ugt i32 %39, 100
  br i1 %40, label %41, label %43

41:                                               ; preds = %38, %35
  %42 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 249, ptr noundef @.str.23)
  store ptr %42, ptr %9, align 8
  br label %109

43:                                               ; preds = %38
  %44 = load float, ptr %16, align 4, !tbaa !11
  %45 = fcmp olt float %44, 0.000000e+00
  br i1 %45, label %49, label %46

46:                                               ; preds = %43
  %47 = load float, ptr %16, align 4, !tbaa !11
  %48 = fcmp ogt float %47, 1.000000e+00
  br i1 %48, label %49, label %51

49:                                               ; preds = %46, %43
  %50 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 251, ptr noundef @.str.24)
  store ptr %50, ptr %9, align 8
  br label %109

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %52 = load i32, ptr %14, align 4, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = load i32, ptr %15, align 4, !tbaa !9
  %55 = mul i32 2, %54
  %56 = add i32 %53, %55
  %57 = mul i32 %52, %56
  store i32 %57, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %58 = load i32, ptr %18, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = mul i64 %59, 8
  %61 = call noalias ptr @malloc(i64 noundef %60) #6
  store ptr %61, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = load float, ptr %13, align 4, !tbaa !11
  %64 = load i32, ptr %14, align 4, !tbaa !9
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = load float, ptr %16, align 4, !tbaa !11
  %67 = load i32, ptr %17, align 4, !tbaa !9
  %68 = call ptr @cpfskmod_create(i32 noundef %62, float noundef %63, i32 noundef %64, i32 noundef %65, float noundef %66, i32 noundef %67)
  store ptr %68, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %98, %51
  %70 = load i32, ptr %21, align 4, !tbaa !9
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = load i32, ptr %15, align 4, !tbaa !9
  %73 = mul i32 2, %72
  %74 = add i32 %71, %73
  %75 = icmp ult i32 %70, %74
  br i1 %75, label %76, label %101

76:                                               ; preds = %69
  %77 = load ptr, ptr %20, align 8, !tbaa !5
  %78 = load i32, ptr %21, align 4, !tbaa !9
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = icmp ult i32 %78, %79
  br i1 %80, label %81, label %88

81:                                               ; preds = %76
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = load i32, ptr %21, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds i8, ptr %82, i64 %84
  %86 = load i8, ptr %85, align 1, !tbaa !13
  %87 = zext i8 %86 to i32
  br label %89

88:                                               ; preds = %76
  br label %89

89:                                               ; preds = %88, %81
  %90 = phi i32 [ %87, %81 ], [ 0, %88 ]
  %91 = load ptr, ptr %19, align 8, !tbaa !5
  %92 = load i32, ptr %14, align 4, !tbaa !9
  %93 = load i32, ptr %21, align 4, !tbaa !9
  %94 = mul i32 %92, %93
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds { float, float }, ptr %91, i64 %95
  %97 = call i32 @cpfskmod_modulate(ptr noundef %77, i32 noundef %90, ptr noundef %96)
  br label %98

98:                                               ; preds = %89
  %99 = load i32, ptr %21, align 4, !tbaa !9
  %100 = add i32 %99, 1
  store i32 %100, ptr %21, align 4, !tbaa !9
  br label %69, !llvm.loop !14

101:                                              ; preds = %69
  %102 = load ptr, ptr %20, align 8, !tbaa !5
  %103 = call i32 @cpfskmod_destroy(ptr noundef %102)
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %104 = load ptr, ptr %19, align 8, !tbaa !5
  %105 = load i32, ptr %18, align 4, !tbaa !9
  %106 = call ptr @qdetector_cccf_create(ptr noundef %104, i32 noundef %105)
  store ptr %106, ptr %22, align 8, !tbaa !5
  %107 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %107) #5
  %108 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %108, ptr %9, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %109

109:                                              ; preds = %101, %49, %41, %33, %25
  %110 = load ptr, ptr %9, align 8
  ret ptr %110
}

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

declare i32 @cpfskmod_modulate(ptr noundef, i32 noundef, ptr noundef) #0

declare i32 @cpfskmod_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 }
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 = !{!"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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [69 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_cpfsk(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, float noundef %3, i32 noundef %4, i32 noundef %5, float noundef %6, i32 noundef %7) local_unnamed_addr #3 {
  %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.11, i32 noundef 245, ptr noundef nonnull @.str.21) #4
  br label %48

12:                                               ; preds = %8
  %13 = add i32 %4, -81
  %or.cond = icmp ult i32 %13, -79
  br i1 %or.cond, label %14, label %16

14:                                               ; preds = %12
  %15 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 247, ptr noundef nonnull @.str.22) #4
  br label %48

16:                                               ; preds = %12
  %17 = add i32 %5, -101
  %or.cond3 = icmp ult i32 %17, -100
  br i1 %or.cond3, label %18, label %20

18:                                               ; preds = %16
  %19 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 249, ptr noundef nonnull @.str.23) #4
  br label %48

20:                                               ; preds = %16
  %21 = fcmp olt float %6, 0.000000e+00
  %22 = fcmp ogt float %6, 1.000000e+00
  %or.cond5 = or i1 %21, %22
  br i1 %or.cond5, label %23, label %25

23:                                               ; preds = %20
  %24 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 251, ptr noundef nonnull @.str.24) #4
  br label %48

25:                                               ; preds = %20
  %26 = shl nuw nsw i32 %5, 1
  %27 = add i32 %26, %1
  %28 = mul i32 %27, %4
  %29 = zext i32 %28 to i64
  %30 = shl nuw nsw i64 %29, 3
  %31 = tail call noalias ptr @malloc(i64 noundef %30) #5
  %32 = tail call ptr @cpfskmod_create(i32 noundef %2, float noundef %3, i32 noundef %4, i32 noundef %5, float noundef %6, i32 noundef %7) #4
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

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

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

35:                                               ; preds = %.lr.ph
  %36 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %37 = load i8, ptr %36, align 1, !tbaa !5
  %38 = zext i8 %37 to i32
  br label %39

39:                                               ; preds = %.lr.ph, %35
  %40 = phi i32 [ %38, %35 ], [ 0, %.lr.ph ]
  %41 = trunc nuw i64 %indvars.iv to i32
  %42 = mul i32 %41, %4
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds { float, float }, ptr %31, i64 %43
  %45 = tail call i32 @cpfskmod_modulate(ptr noundef %32, i32 noundef %40, ptr noundef %44) #4
  %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 !8

._crit_edge:                                      ; preds = %39, %25
  %46 = tail call i32 @cpfskmod_destroy(ptr noundef %32) #4
  %47 = tail call ptr @qdetector_cccf_create(ptr noundef %31, i32 noundef %28)
  tail call void @free(ptr noundef %31) #4
  br label %48

48:                                               ; preds = %._crit_edge, %23, %18, %14, %10
  %.0 = phi ptr [ %11, %10 ], [ %15, %14 ], [ %19, %18 ], [ %24, %23 ], [ %47, %._crit_edge ]
  ret ptr %.0
}

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

declare i32 @cpfskmod_modulate(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare i32 @cpfskmod_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 }
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, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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