; 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"

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

@.str.35 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [50 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 uwtable
declare dso_local ptr @qdetector_cccf_create_linear(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef) #3

; Function Attrs: nounwind uwtable
define dso_local ptr @qdsync_cccf_create_linear(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, float noundef %5, ptr noundef %6, ptr 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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = 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 i32 %3, ptr %13, align 4, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !9
  store float %5, ptr %15, align 4, !tbaa !11
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  %19 = load i32, ptr %11, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %23

21:                                               ; preds = %8
  %22 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.35, i32 noundef 92, ptr noundef @.str.36)
  store ptr %22, ptr %9, align 8
  br label %91

23:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %24 = call noalias ptr @malloc(i64 noundef 104) #6
  store ptr %24, ptr %18, align 8, !tbaa !5
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = load ptr, ptr %18, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %26, i32 0, i32 0
  store i32 %25, ptr %27, align 8, !tbaa !13
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = load ptr, ptr %18, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %29, i32 0, i32 1
  store i32 %28, ptr %30, align 4, !tbaa !15
  %31 = load i32, ptr %13, align 4, !tbaa !9
  %32 = load ptr, ptr %18, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %32, i32 0, i32 2
  store i32 %31, ptr %33, align 8, !tbaa !16
  %34 = load i32, ptr %14, align 4, !tbaa !9
  %35 = load ptr, ptr %18, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %35, i32 0, i32 3
  store i32 %34, ptr %36, align 4, !tbaa !17
  %37 = load float, ptr %15, align 4, !tbaa !11
  %38 = load ptr, ptr %18, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %38, i32 0, i32 4
  store float %37, ptr %39, align 8, !tbaa !18
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr %14, align 4, !tbaa !9
  %45 = load float, ptr %15, align 4, !tbaa !11
  %46 = call ptr @qdetector_cccf_create_linear(ptr noundef %40, i32 noundef %41, i32 noundef %42, i32 noundef %43, i32 noundef %44, float noundef %45)
  %47 = load ptr, ptr %18, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %47, i32 0, i32 7
  store ptr %46, ptr %48, align 8, !tbaa !19
  %49 = call ptr @nco_crcf_create(i32 noundef 0)
  %50 = load ptr, ptr %18, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %50, i32 0, i32 10
  store ptr %49, ptr %51, align 8, !tbaa !20
  %52 = load ptr, ptr %18, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %52, i32 0, i32 12
  store i32 256, ptr %53, align 8, !tbaa !21
  %54 = load ptr, ptr %18, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 4, !tbaa !15
  %57 = load ptr, ptr %18, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %57, i32 0, i32 12
  %59 = load i32, ptr %58, align 8, !tbaa !21
  %60 = load ptr, ptr %18, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 8, !tbaa !16
  %63 = load ptr, ptr %18, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 4, !tbaa !17
  %66 = load ptr, ptr %18, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %66, i32 0, i32 4
  %68 = load float, ptr %67, align 8, !tbaa !18
  %69 = call ptr @firpfb_crcf_create_rnyquist(i32 noundef %56, i32 noundef %59, i32 noundef %62, i32 noundef %65, float noundef %68)
  %70 = load ptr, ptr %18, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %70, i32 0, i32 11
  store ptr %69, ptr %71, align 8, !tbaa !22
  %72 = load ptr, ptr %18, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %72, i32 0, i32 15
  store i32 64, ptr %73, align 4, !tbaa !23
  %74 = load ptr, ptr %18, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %74, i32 0, i32 15
  %76 = load i32, ptr %75, align 4, !tbaa !23
  %77 = zext i32 %76 to i64
  %78 = mul i64 %77, 8
  %79 = call noalias ptr @malloc(i64 noundef %78) #6
  %80 = load ptr, ptr %18, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %80, i32 0, i32 16
  store ptr %79, ptr %81, align 8, !tbaa !24
  %82 = load ptr, ptr %18, align 8, !tbaa !5
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = call i32 @qdsync_cccf_set_callback(ptr noundef %82, ptr noundef %83)
  %85 = load ptr, ptr %18, align 8, !tbaa !5
  %86 = load ptr, ptr %17, align 8, !tbaa !5
  %87 = call i32 @qdsync_cccf_set_context(ptr noundef %85, ptr noundef %86)
  %88 = load ptr, ptr %18, align 8, !tbaa !5
  %89 = call i32 @qdsync_cccf_reset(ptr noundef %88)
  %90 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %90, ptr %9, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %91

91:                                               ; preds = %23, %21
  %92 = load ptr, ptr %9, align 8
  ret ptr %92
}

declare ptr @nco_crcf_create(i32 noundef) #0

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

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

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

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

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 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 #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 = !{!14, !10, i64 0}
!14 = !{!"qdsync_cccf_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !6, i64 56, !6, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !6, i64 88, !10, i64 96}
!15 = !{!14, !10, i64 4}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !10, i64 12}
!18 = !{!14, !12, i64 16}
!19 = !{!14, !6, i64 40}
!20 = !{!14, !6, i64 56}
!21 = !{!14, !10, i64 72}
!22 = !{!14, !6, i64 64}
!23 = !{!14, !10, i64 84}
!24 = !{!14, !6, i64 88}


; 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.35 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [50 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: nounwind uwtable
declare dso_local ptr @qdetector_cccf_create_linear(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @qdsync_cccf_create_linear(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, float noundef %5, ptr noundef %6, ptr 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.35, i32 noundef 92, ptr noundef nonnull @.str.36) #4
  br label %31

12:                                               ; preds = %8
  %13 = tail call noalias dereferenceable_or_null(104) ptr @malloc(i64 noundef 104) #5
  store i32 %1, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 %2, ptr %14, align 4, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %13, i64 8
  store i32 %3, ptr %15, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %13, i64 12
  store i32 %4, ptr %16, align 4, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %13, i64 16
  store float %5, ptr %17, align 8, !tbaa !15
  %18 = tail call ptr @qdetector_cccf_create_linear(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, float noundef %5)
  %19 = getelementptr inbounds i8, ptr %13, i64 40
  store ptr %18, ptr %19, align 8, !tbaa !16
  %20 = tail call ptr @nco_crcf_create(i32 noundef 0) #4
  %21 = getelementptr inbounds i8, ptr %13, i64 56
  store ptr %20, ptr %21, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %13, i64 72
  store i32 256, ptr %22, align 8, !tbaa !18
  %23 = tail call ptr @firpfb_crcf_create_rnyquist(i32 noundef %2, i32 noundef 256, i32 noundef %3, i32 noundef %4, float noundef %5) #4
  %24 = getelementptr inbounds i8, ptr %13, i64 64
  store ptr %23, ptr %24, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %13, i64 84
  store i32 64, ptr %25, align 4, !tbaa !20
  %26 = tail call noalias dereferenceable_or_null(512) ptr @malloc(i64 noundef 512) #5
  %27 = getelementptr inbounds i8, ptr %13, i64 88
  store ptr %26, ptr %27, align 8, !tbaa !21
  %28 = tail call i32 @qdsync_cccf_set_callback(ptr noundef nonnull %13, ptr noundef %6)
  %29 = tail call i32 @qdsync_cccf_set_context(ptr noundef nonnull %13, ptr noundef %7)
  %30 = tail call i32 @qdsync_cccf_reset(ptr noundef nonnull %13)
  br label %31

31:                                               ; preds = %12, %10
  %.0 = phi ptr [ %11, %10 ], [ %13, %12 ]
  ret ptr %.0
}

declare ptr @nco_crcf_create(i32 noundef) local_unnamed_addr #0

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

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

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

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

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 = { 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 #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, !7, i64 0}
!6 = !{!"qdsync_cccf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !7, i64 48, !7, i64 52, !11, i64 56, !11, i64 64, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !11, i64 88, !7, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = !{!6, !10, i64 16}
!16 = !{!6, !11, i64 40}
!17 = !{!6, !11, i64 56}
!18 = !{!6, !7, i64 72}
!19 = !{!6, !11, i64 64}
!20 = !{!6, !7, i64 84}
!21 = !{!6, !11, i64 88}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass