; 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.bpresync_cccf_s = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, float }

@.str = external hidden unnamed_addr constant [87 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1

; 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
define dso_local i32 @bpresync_cccf_correlatex(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = icmp uge i32 %18, %21
  br i1 %22, label %23, label %25

23:                                               ; preds = %4
  %24 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 229, ptr noundef @.str.5, ptr noundef @.str.2)
  store i32 %24, ptr %5, align 4
  br label %132

25:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %26, i32 0, i32 5
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds ptr, ptr %28, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = call i32 @bsequence_correlate(ptr noundef %32, ptr noundef %35)
  %37 = mul nsw i32 2, %36
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 8, !tbaa !16
  %41 = sub nsw i32 %37, %40
  store i32 %41, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !17
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds ptr, ptr %44, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %49, i32 0, i32 3
  %51 = load ptr, ptr %50, align 8, !tbaa !18
  %52 = call i32 @bsequence_correlate(ptr noundef %48, ptr noundef %51)
  %53 = mul nsw i32 2, %52
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 8, !tbaa !16
  %57 = sub nsw i32 %53, %56
  store i32 %57, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %58, i32 0, i32 5
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = call i32 @bsequence_correlate(ptr noundef %64, ptr noundef %67)
  %69 = mul nsw i32 2, %68
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !16
  %73 = sub nsw i32 %69, %72
  store i32 %73, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %74, i32 0, i32 6
  %76 = load ptr, ptr %75, align 8, !tbaa !17
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds ptr, ptr %76, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %81, i32 0, i32 2
  %83 = load ptr, ptr %82, align 8, !tbaa !15
  %84 = call i32 @bsequence_correlate(ptr noundef %80, ptr noundef %83)
  %85 = mul nsw i32 2, %84
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %86, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !16
  %89 = sub nsw i32 %85, %88
  store i32 %89, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = sub nsw i32 %90, %91
  store i32 %92, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %93 = load i32, ptr %12, align 4, !tbaa !9
  %94 = load i32, ptr %13, align 4, !tbaa !9
  %95 = add nsw i32 %93, %94
  store i32 %95, ptr %15, align 4, !tbaa !9
  %96 = load i32, ptr %14, align 4, !tbaa !9
  %97 = sitofp i32 %96 to float
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = sitofp i32 %98 to float
  %100 = fmul float %99, 0.000000e+00
  %101 = fmul float %99, 1.000000e+00
  %102 = fadd float %97, %100
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %103, i32 0, i32 8
  %105 = load float, ptr %104, align 8, !tbaa !19
  %106 = fmul float %102, %105
  %107 = fmul float %101, %105
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds { float, float }, ptr %108, i32 0, i32 0
  %110 = getelementptr inbounds { float, float }, ptr %108, i32 0, i32 1
  store float %106, ptr %109, align 4
  store float %107, ptr %110, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %111 = load i32, ptr %10, align 4, !tbaa !9
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = add nsw i32 %111, %112
  store i32 %113, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %114 = load i32, ptr %12, align 4, !tbaa !9
  %115 = load i32, ptr %13, align 4, !tbaa !9
  %116 = sub nsw i32 %114, %115
  store i32 %116, ptr %17, align 4, !tbaa !9
  %117 = load i32, ptr %16, align 4, !tbaa !9
  %118 = sitofp i32 %117 to float
  %119 = load i32, ptr %17, align 4, !tbaa !9
  %120 = sitofp i32 %119 to float
  %121 = fmul float %120, 0.000000e+00
  %122 = fmul float %120, 1.000000e+00
  %123 = fadd float %118, %121
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.bpresync_cccf_s, ptr %124, i32 0, i32 8
  %126 = load float, ptr %125, align 8, !tbaa !19
  %127 = fmul float %123, %126
  %128 = fmul float %122, %126
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = getelementptr inbounds { float, float }, ptr %129, i32 0, i32 0
  %131 = getelementptr inbounds { float, float }, ptr %129, i32 0, i32 1
  store float %127, ptr %130, align 4
  store float %128, ptr %131, align 4
  store i32 0, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %132

132:                                              ; preds = %25, %23
  %133 = load i32, ptr %5, align 4
  ret i32 %133
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #2

declare i32 @bsequence_correlate(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !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, !10, i64 4}
!12 = !{!"bpresync_cccf_s", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 32}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !10, i64 0}
!17 = !{!12, !6, i64 40}
!18 = !{!12, !6, i64 16}
!19 = !{!12, !13, i64 56}


; 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 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @bpresync_cccf_correlatex(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp ugt i32 %6, %1
  br i1 %.not, label %9, label %7

7:                                                ; preds = %4
  %8 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 229, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2) #3
  br label %72

9:                                                ; preds = %4
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = zext i32 %1 to i64
  %13 = getelementptr inbounds ptr, ptr %11, i64 %12
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = tail call i32 @bsequence_correlate(ptr noundef %14, ptr noundef %16) #3
  %18 = shl nsw i32 %17, 1
  %19 = load i32, ptr %0, align 8, !tbaa !15
  %20 = sub nsw i32 %18, %19
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds ptr, ptr %22, i64 %12
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = tail call i32 @bsequence_correlate(ptr noundef %24, ptr noundef %26) #3
  %28 = shl nsw i32 %27, 1
  %29 = load i32, ptr %0, align 8, !tbaa !15
  %30 = sub nsw i32 %28, %29
  %31 = load ptr, ptr %10, align 8, !tbaa !12
  %32 = getelementptr inbounds ptr, ptr %31, i64 %12
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = load ptr, ptr %25, align 8, !tbaa !17
  %35 = tail call i32 @bsequence_correlate(ptr noundef %33, ptr noundef %34) #3
  %36 = shl nsw i32 %35, 1
  %37 = load i32, ptr %0, align 8, !tbaa !15
  %38 = sub nsw i32 %36, %37
  %39 = load ptr, ptr %21, align 8, !tbaa !16
  %40 = getelementptr inbounds ptr, ptr %39, i64 %12
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  %42 = load ptr, ptr %15, align 8, !tbaa !14
  %43 = tail call i32 @bsequence_correlate(ptr noundef %41, ptr noundef %42) #3
  %44 = shl nsw i32 %43, 1
  %45 = load i32, ptr %0, align 8, !tbaa !15
  %46 = sub nsw i32 %44, %45
  %47 = sub nsw i32 %20, %30
  %48 = add nsw i32 %46, %38
  %49 = sitofp i32 %47 to float
  %50 = sitofp i32 %48 to float
  %51 = tail call float @llvm.copysign.f32(float 0.000000e+00, float %50)
  %52 = fadd float %51, %49
  %53 = getelementptr inbounds i8, ptr %0, i64 56
  %54 = load float, ptr %53, align 8, !tbaa !18
  %55 = insertelement <2 x float> poison, float %54, i64 0
  %56 = shufflevector <2 x float> %55, <2 x float> poison, <2 x i32> zeroinitializer
  %57 = insertelement <2 x float> poison, float %52, i64 0
  %58 = insertelement <2 x float> %57, float %50, i64 1
  %59 = fmul <2 x float> %56, %58
  store <2 x float> %59, ptr %2, align 4
  %60 = add nsw i32 %30, %20
  %61 = sub nsw i32 %38, %46
  %62 = sitofp i32 %60 to float
  %63 = sitofp i32 %61 to float
  %64 = tail call float @llvm.copysign.f32(float 0.000000e+00, float %63)
  %65 = fadd float %64, %62
  %66 = load float, ptr %53, align 8, !tbaa !18
  %67 = insertelement <2 x float> poison, float %66, i64 0
  %68 = shufflevector <2 x float> %67, <2 x float> poison, <2 x i32> zeroinitializer
  %69 = insertelement <2 x float> poison, float %65, i64 0
  %70 = insertelement <2 x float> %69, float %63, i64 1
  %71 = fmul <2 x float> %68, %70
  store <2 x float> %71, ptr %3, align 4
  br label %72

72:                                               ; preds = %9, %7
  %.0 = phi i32 [ %8, %7 ], [ 0, %9 ]
  ret i32 %.0
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

declare i32 @bsequence_correlate(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.copysign.f32(float, float) #2

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 4}
!6 = !{!"bpresync_cccf_s", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !11, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 32}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !10, i64 40}
!17 = !{!6, !10, i64 16}
!18 = !{!6, !11, i64 56}


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