; LLVM IR from jgaeddert/liquid-dsp :: src/modem/src (ampmodem)

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ampmodem_demod_dsb_pll_carrier(ptr noundef %0, <2 x float> noundef %1, ptr noundef %2) #1 {
  %4 = alloca { float, float }, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca { float, float }, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca { float, float }, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  %14 = alloca { float, float }, align 4
  %15 = alloca float, align 4
  %16 = alloca { float, float }, align 4
  %17 = alloca float, align 4
  store <2 x float> %1, ptr %4, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ampmodem_s, ptr %18, i32 0, i32 7
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %22 = load float, ptr %21, align 4
  %23 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %24 = load float, ptr %23, align 4
  %25 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %26 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %22, ptr %25, align 4
  store float %24, ptr %26, align 4
  %27 = load <2 x float>, ptr %9, align 4
  %28 = call i32 @firfilt_crcf_push(ptr noundef %20, <2 x float> noundef %27)
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ampmodem_s, ptr %29, i32 0, i32 7
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = call i32 @firfilt_crcf_execute(ptr noundef %31, ptr noundef %7)
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ampmodem_s, ptr %33, i32 0, i32 8
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %37 = load float, ptr %36, align 4
  %38 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %39 = load float, ptr %38, align 4
  %40 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %41 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %37, ptr %40, align 4
  store float %39, ptr %41, align 4
  %42 = load <2 x float>, ptr %10, align 4
  %43 = call i32 @wdelaycf_push(ptr noundef %35, <2 x float> noundef %42)
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ampmodem_s, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = call i32 @wdelaycf_read(ptr noundef %46, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ampmodem_s, ptr %48, i32 0, i32 4
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %52 = load float, ptr %51, align 4
  %53 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %54 = load float, ptr %53, align 4
  %55 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %56 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %52, ptr %55, align 4
  store float %54, ptr %56, align 4
  %57 = load <2 x float>, ptr %13, align 4
  %58 = call i32 @nco_crcf_mix_down(ptr noundef %50, <2 x float> noundef %57, ptr noundef %11)
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ampmodem_s, ptr %59, i32 0, i32 4
  %61 = load ptr, ptr %60, align 8, !tbaa !14
  %62 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %63 = load float, ptr %62, align 4
  %64 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %65 = load float, ptr %64, align 4
  %66 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %67 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  store float %63, ptr %66, align 4
  store float %65, ptr %67, align 4
  %68 = load <2 x float>, ptr %14, align 4
  %69 = call i32 @nco_crcf_mix_down(ptr noundef %61, <2 x float> noundef %68, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %70 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %71 = load float, ptr %70, align 4
  %72 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  %73 = load float, ptr %72, align 4
  %74 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %75 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float %71, ptr %74, align 4
  store float %73, ptr %75, align 4
  %76 = load <2 x float>, ptr %16, align 4
  %77 = call float @cargf(<2 x float> noundef %76) #4
  store float %77, ptr %15, align 4, !tbaa !15
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ampmodem_s, ptr %78, i32 0, i32 4
  %80 = load ptr, ptr %79, align 8, !tbaa !14
  %81 = load float, ptr %15, align 4, !tbaa !15
  %82 = call i32 @nco_crcf_pll_step(ptr noundef %80, float noundef %81)
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ampmodem_s, ptr %83, i32 0, i32 4
  %85 = load ptr, ptr %84, align 8, !tbaa !14
  %86 = call i32 @nco_crcf_step(ptr noundef %85)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %87 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %88 = load float, ptr %87, align 4
  %89 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  %90 = load float, ptr %89, align 4
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.ampmodem_s, ptr %91, i32 0, i32 0
  %93 = load float, ptr %92, align 8, !tbaa !16
  %94 = fdiv float %88, %93
  store float %94, ptr %17, align 4, !tbaa !15
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.ampmodem_s, ptr %95, i32 0, i32 5
  %97 = load ptr, ptr %96, align 8, !tbaa !17
  %98 = load float, ptr %17, align 4, !tbaa !15
  %99 = call i32 @firfilt_rrrf_push(ptr noundef %97, float noundef %98)
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ampmodem_s, ptr %100, i32 0, i32 5
  %102 = load ptr, ptr %101, align 8, !tbaa !17
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = call i32 @firfilt_rrrf_execute(ptr noundef %102, ptr noundef %103)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret i32 0
}

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

declare i32 @firfilt_rrrf_push(ptr noundef, float noundef) #2

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

declare i32 @firfilt_crcf_push(ptr noundef, <2 x float> noundef) #2

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

declare i32 @wdelaycf_push(ptr noundef, <2 x float> noundef) #2

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

declare i32 @nco_crcf_mix_down(ptr noundef, <2 x float> noundef, ptr noundef) #2

; Function Attrs: nounwind
declare float @cargf(<2 x float> noundef) #3

declare i32 @nco_crcf_pll_step(ptr noundef, float noundef) #2

declare i32 @nco_crcf_step(ptr noundef) #2

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 = { "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 }

!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 = !{!"ampmodem_s", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"float", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 48}
!14 = !{!10, !6, i64 16}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 0}
!17 = !{!10, !6, i64 24}


; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @ampmodem_demod_dsb_pll_carrier(ptr nocapture noundef readonly %0, <2 x float> noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca { float, float }, align 8
  %5 = alloca { float, float }, align 8
  %6 = alloca { float, float }, align 8
  %7 = alloca { float, float }, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call i32 @firfilt_crcf_push(ptr noundef %9, <2 x float> noundef %1) #4
  %11 = load ptr, ptr %8, align 8, !tbaa !5
  %12 = call i32 @firfilt_crcf_execute(ptr noundef %11, ptr noundef nonnull %4) #4
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = call i32 @wdelaycf_push(ptr noundef %14, <2 x float> noundef %1) #4
  %16 = load ptr, ptr %13, align 8, !tbaa !12
  %17 = call i32 @wdelaycf_read(ptr noundef %16, ptr noundef nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = load <2 x float>, ptr %4, align 8
  %21 = call i32 @nco_crcf_mix_down(ptr noundef %19, <2 x float> noundef %20, ptr noundef nonnull %6) #4
  %22 = load ptr, ptr %18, align 8, !tbaa !13
  %23 = load <2 x float>, ptr %5, align 8
  %24 = call i32 @nco_crcf_mix_down(ptr noundef %22, <2 x float> noundef %23, ptr noundef nonnull %7) #4
  %25 = load <2 x float>, ptr %6, align 8
  %26 = call float @cargf(<2 x float> noundef %25) #4
  %27 = load ptr, ptr %18, align 8, !tbaa !13
  %28 = call i32 @nco_crcf_pll_step(ptr noundef %27, float noundef %26) #4
  %29 = load ptr, ptr %18, align 8, !tbaa !13
  %30 = call i32 @nco_crcf_step(ptr noundef %29) #4
  %31 = load float, ptr %7, align 4
  %32 = load float, ptr %0, align 8, !tbaa !14
  %33 = fdiv float %31, %32
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = call i32 @firfilt_rrrf_push(ptr noundef %35, float noundef %33) #4
  %37 = load ptr, ptr %34, align 8, !tbaa !15
  %38 = call i32 @firfilt_rrrf_execute(ptr noundef %37, ptr noundef %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i32 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 @firfilt_rrrf_push(ptr noundef, float noundef) local_unnamed_addr #2

declare i32 @firfilt_rrrf_execute(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @firfilt_crcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #2

declare i32 @firfilt_crcf_execute(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @wdelaycf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #2

declare i32 @wdelaycf_read(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @nco_crcf_mix_down(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare float @cargf(<2 x float> noundef) local_unnamed_addr #3

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

declare i32 @nco_crcf_step(ptr noundef) local_unnamed_addr #2

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

!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 = !{!"ampmodem_s", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !11, i64 48}
!13 = !{!6, !11, i64 16}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !11, i64 24}


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