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

19:                                               ; preds = %5
  %20 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 198, ptr noundef @.str.17)
  store ptr %20, ptr %6, align 8
  br label %100

21:                                               ; preds = %5
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = icmp ult i32 %22, 2
  br i1 %23, label %27, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = icmp ugt i32 %25, 80
  br i1 %26, label %27, label %29

27:                                               ; preds = %24, %21
  %28 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 200, ptr noundef @.str.18)
  store ptr %28, ptr %6, align 8
  br label %100

29:                                               ; preds = %24
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = icmp ult i32 %30, 1
  br i1 %31, label %35, label %32

32:                                               ; preds = %29
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = icmp ugt i32 %33, 100
  br i1 %34, label %35, label %37

35:                                               ; preds = %32, %29
  %36 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 202, ptr noundef @.str.19)
  store ptr %36, ptr %6, align 8
  br label %100

37:                                               ; preds = %32
  %38 = load float, ptr %11, align 4, !tbaa !11
  %39 = fcmp olt float %38, 0.000000e+00
  br i1 %39, label %43, label %40

40:                                               ; preds = %37
  %41 = load float, ptr %11, align 4, !tbaa !11
  %42 = fcmp ogt float %41, 1.000000e+00
  br i1 %42, label %43, label %45

43:                                               ; preds = %40, %37
  %44 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.11, i32 noundef 204, ptr noundef @.str.20)
  store ptr %44, ptr %6, align 8
  br label %100

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = load i32, ptr %8, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = mul i32 2, %48
  %50 = add i32 %47, %49
  %51 = mul i32 %46, %50
  store i32 %51, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = mul i64 %53, 8
  %55 = call noalias ptr @malloc(i64 noundef %54) #6
  store ptr %55, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = load float, ptr %11, align 4, !tbaa !11
  %59 = call ptr @gmskmod_create(i32 noundef %56, i32 noundef %57, float noundef %58)
  store ptr %59, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %89, %45
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = mul i32 2, %63
  %65 = add i32 %62, %64
  %66 = icmp ult i32 %61, %65
  br i1 %66, label %67, label %92

67:                                               ; preds = %60
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  %69 = load i32, ptr %15, align 4, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = icmp ult i32 %69, %70
  br i1 %71, label %72, label %79

72:                                               ; preds = %67
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load i32, ptr %15, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds i8, ptr %73, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !13
  %78 = zext i8 %77 to i32
  br label %80

79:                                               ; preds = %67
  br label %80

80:                                               ; preds = %79, %72
  %81 = phi i32 [ %78, %72 ], [ 0, %79 ]
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = load i32, ptr %15, align 4, !tbaa !9
  %85 = mul i32 %83, %84
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds { float, float }, ptr %82, i64 %86
  %88 = call i32 @gmskmod_modulate(ptr noundef %68, i32 noundef %81, ptr noundef %87)
  br label %89

89:                                               ; preds = %80
  %90 = load i32, ptr %15, align 4, !tbaa !9
  %91 = add i32 %90, 1
  store i32 %91, ptr %15, align 4, !tbaa !9
  br label %60, !llvm.loop !14

92:                                               ; preds = %60
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = call i32 @gmskmod_destroy(ptr noundef %93)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = load i32, ptr %12, align 4, !tbaa !9
  %97 = call ptr @qdetector_cccf_create(ptr noundef %95, i32 noundef %96)
  store ptr %97, ptr %16, align 8, !tbaa !5
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %98) #5
  %99 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %99, ptr %6, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %100

100:                                              ; preds = %92, %43, %35, %27, %19
  %101 = load ptr, ptr %6, align 8
  ret ptr %101
}

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

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

declare i32 @gmskmod_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.17 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [68 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_gmsk(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4) local_unnamed_addr #3 {
  %6 = icmp eq i32 %1, 0
  br i1 %6, label %7, label %9

7:                                                ; preds = %5
  %8 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 198, ptr noundef nonnull @.str.17) #4
  br label %45

9:                                                ; preds = %5
  %10 = add i32 %2, -81
  %or.cond = icmp ult i32 %10, -79
  br i1 %or.cond, label %11, label %13

11:                                               ; preds = %9
  %12 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 200, ptr noundef nonnull @.str.18) #4
  br label %45

13:                                               ; preds = %9
  %14 = add i32 %3, -101
  %or.cond3 = icmp ult i32 %14, -100
  br i1 %or.cond3, label %15, label %17

15:                                               ; preds = %13
  %16 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 202, ptr noundef nonnull @.str.19) #4
  br label %45

17:                                               ; preds = %13
  %18 = fcmp olt float %4, 0.000000e+00
  %19 = fcmp ogt float %4, 1.000000e+00
  %or.cond5 = or i1 %18, %19
  br i1 %or.cond5, label %20, label %22

20:                                               ; preds = %17
  %21 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.11, i32 noundef 204, ptr noundef nonnull @.str.20) #4
  br label %45

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

.lr.ph.preheader:                                 ; preds = %22
  %30 = zext i32 %1 to i64
  %wide.trip.count = zext i32 %24 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 ]
  %31 = icmp ult i64 %indvars.iv, %30
  br i1 %31, label %32, label %36

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

36:                                               ; preds = %.lr.ph, %32
  %37 = phi i32 [ %35, %32 ], [ 0, %.lr.ph ]
  %38 = trunc nuw i64 %indvars.iv to i32
  %39 = mul i32 %38, %2
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds { float, float }, ptr %28, i64 %40
  %42 = tail call i32 @gmskmod_modulate(ptr noundef %29, i32 noundef %37, ptr noundef %41) #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 = %36, %22
  %43 = tail call i32 @gmskmod_destroy(ptr noundef %29) #4
  %44 = tail call ptr @qdetector_cccf_create(ptr noundef %28, i32 noundef %25)
  tail call void @free(ptr noundef %28) #4
  br label %45

45:                                               ; preds = %._crit_edge, %20, %15, %11, %7
  %.0 = phi ptr [ %8, %7 ], [ %12, %11 ], [ %16, %15 ], [ %21, %20 ], [ %44, %._crit_edge ]
  ret ptr %.0
}

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

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

declare i32 @gmskmod_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