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

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

@.str.65 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [2 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #3

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

declare ptr @windowf_copy(ptr noundef) #2

declare ptr @dotprod_rrrf_copy(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @firhilbf_copy(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %9

7:                                                ; preds = %1
  %8 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.65, i32 noundef 115, ptr noundef @.str.67, ptr noundef @.str.68)
  store ptr %8, ptr %2, align 8
  br label %71

9:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %10 = call noalias ptr @malloc(i64 noundef 96) #6
  store ptr %10, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memmove.p0.p0.i64(ptr align 8 %11, ptr align 8 %12, i64 96, i1 false)
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.firhilbf_s, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.firhilbf_s, ptr %16, i32 0, i32 2
  %18 = load i32, ptr %17, align 8, !tbaa !13
  %19 = call ptr @liquid_malloc_copy(ptr noundef %15, i32 noundef %18, i32 noundef 4)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.firhilbf_s, ptr %20, i32 0, i32 0
  store ptr %19, ptr %21, align 8, !tbaa !9
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.firhilbf_s, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.firhilbf_s, ptr %25, i32 0, i32 2
  %27 = load i32, ptr %26, align 8, !tbaa !13
  %28 = call ptr @liquid_malloc_copy(ptr noundef %24, i32 noundef %27, i32 noundef 8)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.firhilbf_s, ptr %29, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !14
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.firhilbf_s, ptr %31, i32 0, i32 5
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.firhilbf_s, ptr %34, i32 0, i32 6
  %36 = load i32, ptr %35, align 8, !tbaa !16
  %37 = call ptr @liquid_malloc_copy(ptr noundef %33, i32 noundef %36, i32 noundef 4)
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.firhilbf_s, ptr %38, i32 0, i32 5
  store ptr %37, ptr %39, align 8, !tbaa !15
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.firhilbf_s, ptr %40, i32 0, i32 7
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  %43 = call ptr @windowf_copy(ptr noundef %42)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.firhilbf_s, ptr %44, i32 0, i32 7
  store ptr %43, ptr %45, align 8, !tbaa !17
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.firhilbf_s, ptr %46, i32 0, i32 8
  %48 = load ptr, ptr %47, align 8, !tbaa !18
  %49 = call ptr @windowf_copy(ptr noundef %48)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.firhilbf_s, ptr %50, i32 0, i32 8
  store ptr %49, ptr %51, align 8, !tbaa !18
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.firhilbf_s, ptr %52, i32 0, i32 9
  %54 = load ptr, ptr %53, align 8, !tbaa !19
  %55 = call ptr @windowf_copy(ptr noundef %54)
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.firhilbf_s, ptr %56, i32 0, i32 9
  store ptr %55, ptr %57, align 8, !tbaa !19
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.firhilbf_s, ptr %58, i32 0, i32 10
  %60 = load ptr, ptr %59, align 8, !tbaa !20
  %61 = call ptr @windowf_copy(ptr noundef %60)
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.firhilbf_s, ptr %62, i32 0, i32 10
  store ptr %61, ptr %63, align 8, !tbaa !20
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.firhilbf_s, ptr %64, i32 0, i32 11
  %66 = load ptr, ptr %65, align 8, !tbaa !21
  %67 = call ptr @dotprod_rrrf_copy(ptr noundef %66)
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.firhilbf_s, ptr %68, i32 0, i32 11
  store ptr %67, ptr %69, align 8, !tbaa !21
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %70, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %71

71:                                               ; preds = %9, %7
  %72 = load ptr, ptr %2, align 8
  ret ptr %72
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 0}
!10 = !{!"firhilbf_s", !6, i64 0, !6, i64 8, !11, i64 16, !12, i64 20, !11, i64 24, !6, i64 32, !11, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !11, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !6, i64 8}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !11, i64 40}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !6, i64 56}
!19 = !{!10, !6, i64 64}
!20 = !{!10, !6, i64 72}
!21 = !{!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"

@.str.65 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

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

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

declare ptr @windowf_copy(ptr noundef) local_unnamed_addr #1

declare ptr @dotprod_rrrf_copy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @firhilbf_copy(ptr noundef readonly %0) local_unnamed_addr #2 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %3, label %5

3:                                                ; preds = %1
  %4 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.65, i32 noundef 115, ptr noundef nonnull @.str.67, ptr noundef nonnull @.str.68) #4
  br label %42

5:                                                ; preds = %1
  %6 = tail call noalias dereferenceable_or_null(96) ptr @malloc(i64 noundef 96) #5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(96) %6, ptr noundef nonnull align 8 dereferenceable(96) %0, i64 96, i1 false)
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = tail call ptr @liquid_malloc_copy(ptr noundef %7, i32 noundef %9, i32 noundef 4) #4
  store ptr %10, ptr %6, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = load i32, ptr %8, align 8, !tbaa !12
  %14 = tail call ptr @liquid_malloc_copy(ptr noundef %12, i32 noundef %13, i32 noundef 8) #4
  %15 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %14, ptr %15, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = load i32, ptr %18, align 8, !tbaa !15
  %20 = tail call ptr @liquid_malloc_copy(ptr noundef %17, i32 noundef %19, i32 noundef 4) #4
  %21 = getelementptr inbounds i8, ptr %6, i64 32
  store ptr %20, ptr %21, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = tail call ptr @windowf_copy(ptr noundef %23) #4
  %25 = getelementptr inbounds i8, ptr %6, i64 48
  store ptr %24, ptr %25, align 8, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %0, i64 56
  %27 = load ptr, ptr %26, align 8, !tbaa !17
  %28 = tail call ptr @windowf_copy(ptr noundef %27) #4
  %29 = getelementptr inbounds i8, ptr %6, i64 56
  store ptr %28, ptr %29, align 8, !tbaa !17
  %30 = getelementptr inbounds i8, ptr %0, i64 64
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %32 = tail call ptr @windowf_copy(ptr noundef %31) #4
  %33 = getelementptr inbounds i8, ptr %6, i64 64
  store ptr %32, ptr %33, align 8, !tbaa !18
  %34 = getelementptr inbounds i8, ptr %0, i64 72
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  %36 = tail call ptr @windowf_copy(ptr noundef %35) #4
  %37 = getelementptr inbounds i8, ptr %6, i64 72
  store ptr %36, ptr %37, align 8, !tbaa !19
  %38 = getelementptr inbounds i8, ptr %0, i64 80
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %40 = tail call ptr @dotprod_rrrf_copy(ptr noundef %39) #4
  %41 = getelementptr inbounds i8, ptr %6, i64 80
  store ptr %40, ptr %41, align 8, !tbaa !20
  br label %42

42:                                               ; preds = %5, %3
  %.0 = phi ptr [ %4, %3 ], [ %6, %5 ]
  ret ptr %.0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }

!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 0}
!6 = !{!"firhilbf_s", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 20, !10, i64 24, !7, i64 32, !10, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !10, i64 88}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 32}
!15 = !{!6, !10, i64 40}
!16 = !{!6, !7, i64 48}
!17 = !{!6, !7, i64 56}
!18 = !{!6, !7, i64 64}
!19 = !{!6, !7, i64 72}
!20 = !{!6, !7, i64 80}


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