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

; 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 @windowf_push(ptr noundef, float noundef) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @firhilbf_c2r_execute(ptr noundef %0, <2 x float> noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca { float, float }, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  store <2 x float> %1, ptr %5, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.firhilbf_s, ptr %12, i32 0, i32 12
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %50

16:                                               ; preds = %4
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.firhilbf_s, ptr %17, i32 0, i32 7
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %21 = load float, ptr %20, align 4
  %22 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %23 = load float, ptr %22, align 4
  %24 = call i32 @windowf_push(ptr noundef %19, float noundef %21)
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.firhilbf_s, ptr %25, i32 0, i32 8
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %29 = load float, ptr %28, align 4
  %30 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %31 = load float, ptr %30, align 4
  %32 = call i32 @windowf_push(ptr noundef %27, float noundef %31)
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.firhilbf_s, ptr %33, i32 0, i32 7
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.firhilbf_s, ptr %36, i32 0, i32 4
  %38 = load i32, ptr %37, align 8, !tbaa !15
  %39 = sub i32 %38, 1
  %40 = call i32 @windowf_index(ptr noundef %35, i32 noundef %39, ptr noundef %10)
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.firhilbf_s, ptr %41, i32 0, i32 10
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  %44 = call i32 @windowf_read(ptr noundef %43, ptr noundef %9)
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.firhilbf_s, ptr %45, i32 0, i32 11
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = call i32 @dotprod_rrrf_execute(ptr noundef %47, ptr noundef %48, ptr noundef %11)
  br label %84

50:                                               ; preds = %4
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.firhilbf_s, ptr %51, i32 0, i32 9
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  %54 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %55 = load float, ptr %54, align 4
  %56 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %57 = load float, ptr %56, align 4
  %58 = call i32 @windowf_push(ptr noundef %53, float noundef %55)
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.firhilbf_s, ptr %59, i32 0, i32 10
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  %62 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %63 = load float, ptr %62, align 4
  %64 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %65 = load float, ptr %64, align 4
  %66 = call i32 @windowf_push(ptr noundef %61, float noundef %65)
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.firhilbf_s, ptr %67, i32 0, i32 9
  %69 = load ptr, ptr %68, align 8, !tbaa !18
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.firhilbf_s, ptr %70, i32 0, i32 4
  %72 = load i32, ptr %71, align 8, !tbaa !15
  %73 = sub i32 %72, 1
  %74 = call i32 @windowf_index(ptr noundef %69, i32 noundef %73, ptr noundef %10)
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.firhilbf_s, ptr %75, i32 0, i32 8
  %77 = load ptr, ptr %76, align 8, !tbaa !14
  %78 = call i32 @windowf_read(ptr noundef %77, ptr noundef %9)
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.firhilbf_s, ptr %79, i32 0, i32 11
  %81 = load ptr, ptr %80, align 8, !tbaa !17
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = call i32 @dotprod_rrrf_execute(ptr noundef %81, ptr noundef %82, ptr noundef %11)
  br label %84

84:                                               ; preds = %50, %16
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.firhilbf_s, ptr %85, i32 0, i32 12
  %87 = load i32, ptr %86, align 8, !tbaa !9
  %88 = sub i32 1, %87
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.firhilbf_s, ptr %89, i32 0, i32 12
  store i32 %88, ptr %90, align 8, !tbaa !9
  %91 = load float, ptr %10, align 4, !tbaa !19
  %92 = load float, ptr %11, align 4, !tbaa !19
  %93 = fadd float %91, %92
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  store float %93, ptr %94, align 4, !tbaa !19
  %95 = load float, ptr %10, align 4, !tbaa !19
  %96 = load float, ptr %11, align 4, !tbaa !19
  %97 = fsub float %95, %96
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  store float %97, ptr %98, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret i32 0
}

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, !11, i64 88}
!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, !6, i64 48}
!14 = !{!10, !6, i64 56}
!15 = !{!10, !11, i64 24}
!16 = !{!10, !6, i64 72}
!17 = !{!10, !6, i64 80}
!18 = !{!10, !6, i64 64}
!19 = !{!12, !12, i64 0}


; 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 @windowf_push(ptr noundef, float noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @firhilbf_c2r_execute(ptr nocapture noundef %0, <2 x float> noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = icmp eq i32 %9, 0
  %.sroa.0.0.vec.extract = extractelement <2 x float> %1, i64 0
  %.sroa.0.4.vec.extract24 = extractelement <2 x float> %1, i64 1
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  br i1 %10, label %13, label %30

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %0, i64 48
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = tail call i32 @windowf_push(ptr noundef %15, float noundef %.sroa.0.0.vec.extract) #3
  %17 = getelementptr inbounds i8, ptr %0, i64 56
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  %19 = tail call i32 @windowf_push(ptr noundef %18, float noundef %.sroa.0.4.vec.extract24) #3
  %20 = load ptr, ptr %14, align 8, !tbaa !12
  %21 = load i32, ptr %11, align 8, !tbaa !14
  %22 = add i32 %21, -1
  %23 = call i32 @windowf_index(ptr noundef %20, i32 noundef %22, ptr noundef nonnull %6) #3
  %24 = getelementptr inbounds i8, ptr %0, i64 72
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = call i32 @windowf_read(ptr noundef %25, ptr noundef nonnull %5) #3
  %27 = load ptr, ptr %12, align 8, !tbaa !16
  %28 = load ptr, ptr %5, align 8, !tbaa !17
  %29 = call i32 @dotprod_rrrf_execute(ptr noundef %27, ptr noundef %28, ptr noundef nonnull %7) #3
  br label %47

30:                                               ; preds = %4
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %33 = tail call i32 @windowf_push(ptr noundef %32, float noundef %.sroa.0.0.vec.extract) #3
  %34 = getelementptr inbounds i8, ptr %0, i64 72
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = tail call i32 @windowf_push(ptr noundef %35, float noundef %.sroa.0.4.vec.extract24) #3
  %37 = load ptr, ptr %31, align 8, !tbaa !18
  %38 = load i32, ptr %11, align 8, !tbaa !14
  %39 = add i32 %38, -1
  %40 = call i32 @windowf_index(ptr noundef %37, i32 noundef %39, ptr noundef nonnull %6) #3
  %41 = getelementptr inbounds i8, ptr %0, i64 56
  %42 = load ptr, ptr %41, align 8, !tbaa !13
  %43 = call i32 @windowf_read(ptr noundef %42, ptr noundef nonnull %5) #3
  %44 = load ptr, ptr %12, align 8, !tbaa !16
  %45 = load ptr, ptr %5, align 8, !tbaa !17
  %46 = call i32 @dotprod_rrrf_execute(ptr noundef %44, ptr noundef %45, ptr noundef nonnull %7) #3
  br label %47

47:                                               ; preds = %30, %13
  %48 = load i32, ptr %8, align 8, !tbaa !5
  %49 = sub i32 1, %48
  store i32 %49, ptr %8, align 8, !tbaa !5
  %50 = load float, ptr %6, align 4, !tbaa !19
  %51 = load float, ptr %7, align 4, !tbaa !19
  %52 = fadd float %50, %51
  store float %52, ptr %2, align 4, !tbaa !19
  %53 = fsub float %50, %51
  store float %53, ptr %3, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i32 0
}

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, !10, i64 88}
!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, !7, i64 48}
!13 = !{!6, !7, i64 56}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !7, i64 72}
!16 = !{!6, !7, i64 80}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !7, i64 64}
!19 = !{!11, !11, i64 0}


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