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

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

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

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

25:                                               ; preds = %4
  %26 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str.9, i32 noundef 228, ptr noundef @.str.5, ptr noundef @.str.2)
  store i32 %26, ptr %5, align 4
  br label %110

27:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.presync_cccf_s, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = call i32 @windowf_read(ptr noundef %30, ptr noundef %10)
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.presync_cccf_s, ptr %32, i32 0, i32 3
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = call i32 @windowf_read(ptr noundef %34, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.presync_cccf_s, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds ptr, ptr %38, i64 %40
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = call i32 @dotprod_rrrf_execute(ptr noundef %42, ptr noundef %43, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.presync_cccf_s, ptr %45, i32 0, i32 6
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds ptr, ptr %47, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = call i32 @dotprod_rrrf_execute(ptr noundef %51, ptr noundef %52, ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.presync_cccf_s, ptr %54, i32 0, i32 5
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds ptr, ptr %56, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = call i32 @dotprod_rrrf_execute(ptr noundef %60, ptr noundef %61, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.presync_cccf_s, ptr %63, i32 0, i32 6
  %65 = load ptr, ptr %64, align 8, !tbaa !17
  %66 = load i32, ptr %7, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds ptr, ptr %65, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = call i32 @dotprod_rrrf_execute(ptr noundef %69, ptr noundef %70, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %72 = load float, ptr %12, align 4, !tbaa !18
  %73 = load float, ptr %13, align 4, !tbaa !18
  %74 = fsub float %72, %73
  store float %74, ptr %16, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %75 = load float, ptr %14, align 4, !tbaa !18
  %76 = load float, ptr %15, align 4, !tbaa !18
  %77 = fadd float %75, %76
  store float %77, ptr %17, align 4, !tbaa !18
  %78 = load float, ptr %16, align 4, !tbaa !18
  %79 = load float, ptr %17, align 4, !tbaa !18
  %80 = fmul float %79, 0.000000e+00
  %81 = fmul float %79, 1.000000e+00
  %82 = fadd float %78, %80
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.presync_cccf_s, ptr %83, i32 0, i32 8
  %85 = load float, ptr %84, align 8, !tbaa !19
  %86 = fmul float %82, %85
  %87 = fmul float %81, %85
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds { float, float }, ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds { float, float }, ptr %88, i32 0, i32 1
  store float %86, ptr %89, align 4
  store float %87, ptr %90, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %91 = load float, ptr %12, align 4, !tbaa !18
  %92 = load float, ptr %13, align 4, !tbaa !18
  %93 = fadd float %91, %92
  store float %93, ptr %18, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %94 = load float, ptr %14, align 4, !tbaa !18
  %95 = load float, ptr %15, align 4, !tbaa !18
  %96 = fsub float %94, %95
  store float %96, ptr %19, align 4, !tbaa !18
  %97 = load float, ptr %18, align 4, !tbaa !18
  %98 = load float, ptr %19, align 4, !tbaa !18
  %99 = fmul float %98, 0.000000e+00
  %100 = fmul float %98, 1.000000e+00
  %101 = fadd float %97, %99
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.presync_cccf_s, ptr %102, i32 0, i32 8
  %104 = load float, ptr %103, align 8, !tbaa !19
  %105 = fmul float %101, %104
  %106 = fmul float %100, %104
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = getelementptr inbounds { float, float }, ptr %107, i32 0, i32 0
  %109 = getelementptr inbounds { float, float }, ptr %107, i32 0, i32 1
  store float %105, ptr %108, align 4
  store float %106, ptr %109, align 4
  store i32 0, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  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 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %110

110:                                              ; preds = %27, %25
  %111 = load i32, ptr %5, align 4
  ret i32 %111
}

declare i32 @windowf_read(ptr noundef, ptr noundef) #1

declare i32 @dotprod_rrrf_execute(ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!"presync_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 8}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !6, i64 32}
!17 = !{!12, !6, i64 40}
!18 = !{!13, !13, i64 0}
!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.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [86 x i8], align 1

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

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

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

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

13:                                               ; preds = %4
  %14 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str.9, i32 noundef 228, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2) #3
  br label %70

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

70:                                               ; preds = %15, %13
  %.0 = phi i32 [ %14, %13 ], [ 0, %15 ]
  ret i32 %.0
}

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

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

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


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