; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_crcf)

; 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.symsync_crcf_s = type { i32, i32, i32, i32, i32, float, float, float, float, float, i32, float, float, [3 x float], [3 x float], ptr, float, i32, ptr, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @symsync_crcf_reset(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.symsync_crcf_s, ptr %3, i32 0, i32 18
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = call i32 @firpfb_crcf_reset(ptr noundef %5)
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.symsync_crcf_s, ptr %7, i32 0, i32 1
  %9 = load i32, ptr %8, align 4, !tbaa !13
  %10 = uitofp i32 %9 to float
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.symsync_crcf_s, ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !14
  %14 = uitofp i32 %13 to float
  %15 = fdiv float %10, %14
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.symsync_crcf_s, ptr %16, i32 0, i32 5
  store float %15, ptr %17, align 4, !tbaa !15
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.symsync_crcf_s, ptr %18, i32 0, i32 5
  %20 = load float, ptr %19, align 4, !tbaa !15
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.symsync_crcf_s, ptr %21, i32 0, i32 6
  store float %20, ptr %22, align 8, !tbaa !16
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.symsync_crcf_s, ptr %23, i32 0, i32 10
  store i32 0, ptr %24, align 8, !tbaa !17
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.symsync_crcf_s, ptr %25, i32 0, i32 9
  store float 0.000000e+00, ptr %26, align 4, !tbaa !18
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.symsync_crcf_s, ptr %27, i32 0, i32 7
  store float 0.000000e+00, ptr %28, align 4, !tbaa !19
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.symsync_crcf_s, ptr %29, i32 0, i32 8
  store float 0.000000e+00, ptr %30, align 8, !tbaa !20
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.symsync_crcf_s, ptr %31, i32 0, i32 11
  store float 0.000000e+00, ptr %32, align 4, !tbaa !21
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.symsync_crcf_s, ptr %33, i32 0, i32 12
  store float 0.000000e+00, ptr %34, align 8, !tbaa !22
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.symsync_crcf_s, ptr %35, i32 0, i32 3
  store i32 0, ptr %36, align 4, !tbaa !23
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.symsync_crcf_s, ptr %37, i32 0, i32 15
  %39 = load ptr, ptr %38, align 8, !tbaa !24
  %40 = call i32 @iirfiltsos_rrrf_reset(ptr noundef %39)
  ret i32 %40
}

declare i32 @iirfiltsos_rrrf_reset(ptr noundef) #1

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

!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 96}
!10 = !{!"symsync_crcf_s", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !11, i64 40, !12, i64 44, !12, i64 48, !7, i64 52, !7, i64 64, !6, i64 80, !12, i64 88, !11, i64 92, !6, i64 96, !6, i64 104}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !12, i64 20}
!16 = !{!10, !12, i64 24}
!17 = !{!10, !11, i64 40}
!18 = !{!10, !12, i64 36}
!19 = !{!10, !12, i64 28}
!20 = !{!10, !12, i64 32}
!21 = !{!10, !12, i64 44}
!22 = !{!10, !12, i64 48}
!23 = !{!10, !11, i64 12}
!24 = !{!10, !6, i64 80}


; 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 i32 @firpfb_crcf_reset(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @symsync_crcf_reset(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 96
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call i32 @firpfb_crcf_reset(ptr noundef %3)
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !12
  %7 = uitofp i32 %6 to float
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !13
  %10 = uitofp i32 %9 to float
  %11 = fdiv float %7, %10
  %12 = getelementptr inbounds i8, ptr %0, i64 20
  store float %11, ptr %12, align 4, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  store float %11, ptr %13, align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %0, i64 28
  %15 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 0, ptr %15, align 4, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %14, i8 0, i64 24, i1 false)
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = tail call i32 @iirfiltsos_rrrf_reset(ptr noundef %17) #3
  ret i32 %18
}

declare i32 @iirfiltsos_rrrf_reset(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
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 96}
!6 = !{!"symsync_crcf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 44, !10, i64 48, !8, i64 52, !8, i64 64, !11, i64 80, !10, i64 88, !7, i64 92, !11, i64 96, !11, i64 104}
!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 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 20}
!15 = !{!6, !10, i64 24}
!16 = !{!6, !7, i64 12}
!17 = !{!6, !11, i64 80}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass