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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @qdetector_cccf_execute(ptr noundef, <2 x float> noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_tau(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_gamma(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_dphi(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_phi(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @qdsync_cccf_execute_detect(ptr noundef %0, <2 x float> noundef %1) #1 {
  %3 = alloca { float, float }, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca { float, float }, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store <2 x float> %1, ptr %3, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %13, i32 0, i32 7
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %17 = load float, ptr %16, align 4
  %18 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %19 = load float, ptr %18, align 4
  %20 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %21 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  store float %17, ptr %20, align 4
  store float %19, ptr %21, align 4
  %22 = load <2 x float>, ptr %6, align 4
  %23 = call ptr @qdetector_cccf_execute(ptr noundef %15, <2 x float> noundef %22)
  store ptr %23, ptr %5, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %105

26:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %27, i32 0, i32 7
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = call float @qdetector_cccf_get_tau(ptr noundef %29)
  store float %30, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %31, i32 0, i32 7
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call float @qdetector_cccf_get_gamma(ptr noundef %33)
  store float %34, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %35, i32 0, i32 7
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = call float @qdetector_cccf_get_dphi(ptr noundef %37)
  store float %38, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %39, i32 0, i32 7
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = call float @qdetector_cccf_get_phi(ptr noundef %41)
  store float %42, ptr %10, align 4, !tbaa !13
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %43, i32 0, i32 2
  %45 = load i32, ptr %44, align 8, !tbaa !14
  %46 = sub i32 %45, 2
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %47, i32 0, i32 13
  store i32 %46, ptr %48, align 4, !tbaa !15
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %49, i32 0, i32 14
  store i32 0, ptr %50, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %51 = load float, ptr %7, align 4, !tbaa !13
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %52, i32 0, i32 12
  %54 = load i32, ptr %53, align 8, !tbaa !17
  %55 = uitofp i32 %54 to float
  %56 = fmul float %51, %55
  %57 = fptosi float %56 to i32
  store i32 %57, ptr %11, align 4, !tbaa !18
  %58 = load i32, ptr %11, align 4, !tbaa !18
  %59 = icmp slt i32 %58, 0
  br i1 %59, label %60, label %70

60:                                               ; preds = %26
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %61, i32 0, i32 13
  %63 = load i32, ptr %62, align 4, !tbaa !15
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %62, align 4, !tbaa !15
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %65, i32 0, i32 12
  %67 = load i32, ptr %66, align 8, !tbaa !17
  %68 = load i32, ptr %11, align 4, !tbaa !18
  %69 = add i32 %68, %67
  store i32 %69, ptr %11, align 4, !tbaa !18
  br label %70

70:                                               ; preds = %60, %26
  %71 = load i32, ptr %11, align 4, !tbaa !18
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %72, i32 0, i32 14
  store i32 %71, ptr %73, align 8, !tbaa !16
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %74, i32 0, i32 11
  %76 = load ptr, ptr %75, align 8, !tbaa !19
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %77, i32 0, i32 2
  %79 = load i32, ptr %78, align 8, !tbaa !14
  %80 = uitofp i32 %79 to float
  %81 = load float, ptr %8, align 4, !tbaa !13
  %82 = fmul float %80, %81
  %83 = fdiv float 1.000000e+00, %82
  %84 = call i32 @firpfb_crcf_set_scale(ptr noundef %76, float noundef %83)
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %85, i32 0, i32 10
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = load float, ptr %9, align 4, !tbaa !13
  %89 = call i32 @nco_crcf_set_frequency(ptr noundef %87, float noundef %88)
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %90, i32 0, i32 10
  %92 = load ptr, ptr %91, align 8, !tbaa !20
  %93 = load float, ptr %10, align 4, !tbaa !13
  %94 = call i32 @nco_crcf_set_phase(ptr noundef %92, float noundef %93)
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %95, i32 0, i32 8
  store i32 1, ptr %96, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.qdsync_cccf_s, ptr %97, i32 0, i32 7
  %99 = load ptr, ptr %98, align 8, !tbaa !9
  %100 = call i32 @qdetector_cccf_get_buf_len(ptr noundef %99)
  store i32 %100, ptr %12, align 4, !tbaa !18
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = load i32, ptr %12, align 4, !tbaa !18
  %104 = call i32 @qdsync_cccf_execute(ptr noundef %101, ptr noundef %102, i32 noundef %103)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %105

105:                                              ; preds = %70, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret i32 0
}

declare i32 @firpfb_crcf_set_scale(ptr noundef, float noundef) #3

declare i32 @nco_crcf_set_frequency(ptr noundef, float noundef) #3

declare i32 @nco_crcf_set_phase(ptr noundef, float noundef) #3

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

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


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

; Function Attrs: nounwind uwtable
declare dso_local ptr @qdetector_cccf_execute(ptr noundef, <2 x float> noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_tau(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_gamma(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_dphi(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local float @qdetector_cccf_get_phi(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @qdsync_cccf_execute_detect(ptr noundef %0, <2 x float> noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call ptr @qdetector_cccf_execute(ptr noundef %4, <2 x float> noundef %1)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %45, label %6

6:                                                ; preds = %2
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = tail call float @qdetector_cccf_get_tau(ptr noundef %7)
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = tail call float @qdetector_cccf_get_gamma(ptr noundef %9)
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = tail call float @qdetector_cccf_get_dphi(ptr noundef %11)
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = tail call float @qdetector_cccf_get_phi(ptr noundef %13)
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !12
  %17 = add i32 %16, -2
  %18 = getelementptr inbounds i8, ptr %0, i64 76
  store i32 %17, ptr %18, align 4, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 80
  %20 = getelementptr inbounds i8, ptr %0, i64 72
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = uitofp i32 %21 to float
  %23 = fmul float %8, %22
  %24 = fptosi float %23 to i32
  %25 = icmp slt i32 %24, 0
  br i1 %25, label %26, label %29

26:                                               ; preds = %6
  %27 = add i32 %16, -1
  store i32 %27, ptr %18, align 4, !tbaa !13
  %28 = add i32 %21, %24
  br label %29

29:                                               ; preds = %26, %6
  %.0 = phi i32 [ %28, %26 ], [ %24, %6 ]
  store i32 %.0, ptr %19, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %0, i64 64
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = uitofp i32 %16 to float
  %33 = fmul float %10, %32
  %34 = fdiv float 1.000000e+00, %33
  %35 = tail call i32 @firpfb_crcf_set_scale(ptr noundef %31, float noundef %34) #3
  %36 = getelementptr inbounds i8, ptr %0, i64 56
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = tail call i32 @nco_crcf_set_frequency(ptr noundef %37, float noundef %12) #3
  %39 = load ptr, ptr %36, align 8, !tbaa !17
  %40 = tail call i32 @nco_crcf_set_phase(ptr noundef %39, float noundef %14) #3
  %41 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 1, ptr %41, align 8, !tbaa !18
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = tail call i32 @qdetector_cccf_get_buf_len(ptr noundef %42)
  %44 = tail call i32 @qdsync_cccf_execute(ptr noundef nonnull %0, ptr noundef nonnull %5, i32 noundef %43)
  br label %45

45:                                               ; preds = %29, %2
  ret i32 0
}

declare i32 @firpfb_crcf_set_scale(ptr noundef, float noundef) local_unnamed_addr #2

declare i32 @nco_crcf_set_frequency(ptr noundef, float noundef) local_unnamed_addr #2

declare i32 @nco_crcf_set_phase(ptr noundef, float noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #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 }

!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, !11, i64 40}
!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 8}
!13 = !{!6, !7, i64 76}
!14 = !{!6, !7, i64 72}
!15 = !{!6, !7, i64 80}
!16 = !{!6, !11, i64 64}
!17 = !{!6, !11, i64 56}
!18 = !{!6, !7, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass