; LLVM IR from jgaeddert/liquid-dsp :: src/framing/src (framingcf)

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @symstreamcf_fill_buffer(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca { float, float }, align 4
  %5 = alloca { float, float }, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.symstreamcf_s, ptr %6, i32 0, i32 5
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = call i32 @modemcf_gen_rand_sym(ptr noundef %8)
  store i32 %9, ptr %3, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.symstreamcf_s, ptr %10, i32 0, i32 5
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = load i32, ptr %3, align 4, !tbaa !13
  %14 = call i32 @modemcf_modulate(ptr noundef %12, i32 noundef %13, ptr noundef %4)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.symstreamcf_s, ptr %15, i32 0, i32 6
  %17 = load float, ptr %16, align 8, !tbaa !14
  %18 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %19 = load float, ptr %18, align 4
  %20 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %21 = load float, ptr %20, align 4
  %22 = fmul float %19, %17
  %23 = fmul float %21, %17
  %24 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %25 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float %22, ptr %24, align 4
  store float %23, ptr %25, align 4
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.symstreamcf_s, ptr %26, i32 0, i32 7
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %32 = load float, ptr %31, align 4
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.symstreamcf_s, ptr %33, i32 0, i32 8
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  %36 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %37 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %30, ptr %36, align 4
  store float %32, ptr %37, align 4
  %38 = load <2 x float>, ptr %5, align 4
  %39 = call i32 @firinterp_crcf_execute(ptr noundef %28, <2 x float> noundef %38, ptr noundef %35)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

declare i32 @modemcf_gen_rand_sym(ptr noundef) #1

declare i32 @firinterp_crcf_execute(ptr noundef, <2 x float> 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"="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 }

!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 24}
!10 = !{!"symstreamcf_s", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 12, !11, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !6, i64 48, !11, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !12, i64 32}
!15 = !{!10, !6, i64 40}
!16 = !{!10, !6, 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: 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 @modemcf_modulate(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @symstreamcf_fill_buffer(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = alloca { float, float }, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call i32 @modemcf_gen_rand_sym(ptr noundef %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = call i32 @modemcf_modulate(ptr noundef %6, i32 noundef %5, ptr noundef nonnull %2) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = load float, ptr %8, align 8, !tbaa !12
  %10 = load <2 x float>, ptr %2, align 8
  %11 = insertelement <2 x float> poison, float %9, i64 0
  %12 = shufflevector <2 x float> %11, <2 x float> poison, <2 x i32> zeroinitializer
  %13 = fmul <2 x float> %12, %10
  store <2 x float> %13, ptr %2, align 8
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %0, i64 48
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = call i32 @firinterp_crcf_execute(ptr noundef %15, <2 x float> noundef %13, ptr noundef %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret i32 0
}

declare i32 @modemcf_gen_rand_sym(ptr noundef) local_unnamed_addr #1

declare i32 @firinterp_crcf_execute(ptr noundef, <2 x float> 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"="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 }

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


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