; 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_r2c_execute(ptr noundef %0, float noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.firhilbf_s, ptr %10, i32 0, i32 12
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %37

14:                                               ; preds = %3
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.firhilbf_s, ptr %15, i32 0, i32 7
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = load float, ptr %5, align 4, !tbaa !9
  %19 = call i32 @windowf_push(ptr noundef %17, float noundef %18)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.firhilbf_s, ptr %20, i32 0, i32 7
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.firhilbf_s, ptr %23, i32 0, i32 4
  %25 = load i32, ptr %24, align 8, !tbaa !15
  %26 = sub i32 %25, 1
  %27 = call i32 @windowf_index(ptr noundef %22, i32 noundef %26, ptr noundef %8)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.firhilbf_s, ptr %28, i32 0, i32 8
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = call i32 @windowf_read(ptr noundef %30, ptr noundef %7)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.firhilbf_s, ptr %32, i32 0, i32 11
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call i32 @dotprod_rrrf_execute(ptr noundef %34, ptr noundef %35, ptr noundef %9)
  br label %60

37:                                               ; preds = %3
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.firhilbf_s, ptr %38, i32 0, i32 8
  %40 = load ptr, ptr %39, align 8, !tbaa !16
  %41 = load float, ptr %5, align 4, !tbaa !9
  %42 = call i32 @windowf_push(ptr noundef %40, float noundef %41)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.firhilbf_s, ptr %43, i32 0, i32 8
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.firhilbf_s, ptr %46, i32 0, i32 4
  %48 = load i32, ptr %47, align 8, !tbaa !15
  %49 = sub i32 %48, 1
  %50 = call i32 @windowf_index(ptr noundef %45, i32 noundef %49, ptr noundef %8)
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.firhilbf_s, ptr %51, i32 0, i32 7
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = call i32 @windowf_read(ptr noundef %53, ptr noundef %7)
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.firhilbf_s, ptr %55, i32 0, i32 11
  %57 = load ptr, ptr %56, align 8, !tbaa !17
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = call i32 @dotprod_rrrf_execute(ptr noundef %57, ptr noundef %58, ptr noundef %9)
  br label %60

60:                                               ; preds = %37, %14
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.firhilbf_s, ptr %61, i32 0, i32 12
  %63 = load i32, ptr %62, align 8, !tbaa !11
  %64 = sub i32 1, %63
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.firhilbf_s, ptr %65, i32 0, i32 12
  store i32 %64, ptr %66, align 8, !tbaa !11
  %67 = load float, ptr %8, align 4, !tbaa !9
  %68 = load float, ptr %9, align 4, !tbaa !9
  %69 = fmul float 0.000000e+00, %68
  %70 = fmul float 1.000000e+00, %68
  %71 = fadd float %67, %69
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds { float, float }, ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds { float, float }, ptr %72, i32 0, i32 1
  store float %71, ptr %73, align 4
  store float %70, ptr %74, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #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"="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 = { 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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !13, i64 88}
!12 = !{!"firhilbf_s", !6, i64 0, !6, i64 8, !13, i64 16, !10, i64 20, !13, i64 24, !6, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !13, i64 88}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 48}
!15 = !{!12, !13, i64 24}
!16 = !{!12, !6, i64 56}
!17 = !{!12, !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: 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_r2c_execute(ptr nocapture noundef %0, float noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  %7 = getelementptr inbounds i8, ptr %0, i64 88
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp eq i32 %8, 0
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  br i1 %9, label %12, label %26

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = tail call i32 @windowf_push(ptr noundef %14, float noundef %1) #3
  %16 = load ptr, ptr %13, align 8, !tbaa !12
  %17 = load i32, ptr %10, align 8, !tbaa !13
  %18 = add i32 %17, -1
  %19 = call i32 @windowf_index(ptr noundef %16, i32 noundef %18, ptr noundef nonnull %5) #3
  %20 = getelementptr inbounds i8, ptr %0, i64 56
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = call i32 @windowf_read(ptr noundef %21, ptr noundef nonnull %4) #3
  %23 = load ptr, ptr %11, align 8, !tbaa !15
  %24 = load ptr, ptr %4, align 8, !tbaa !16
  %25 = call i32 @dotprod_rrrf_execute(ptr noundef %23, ptr noundef %24, ptr noundef nonnull %6) #3
  br label %40

26:                                               ; preds = %3
  %27 = getelementptr inbounds i8, ptr %0, i64 56
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = tail call i32 @windowf_push(ptr noundef %28, float noundef %1) #3
  %30 = load ptr, ptr %27, align 8, !tbaa !14
  %31 = load i32, ptr %10, align 8, !tbaa !13
  %32 = add i32 %31, -1
  %33 = call i32 @windowf_index(ptr noundef %30, i32 noundef %32, ptr noundef nonnull %5) #3
  %34 = getelementptr inbounds i8, ptr %0, i64 48
  %35 = load ptr, ptr %34, align 8, !tbaa !12
  %36 = call i32 @windowf_read(ptr noundef %35, ptr noundef nonnull %4) #3
  %37 = load ptr, ptr %11, align 8, !tbaa !15
  %38 = load ptr, ptr %4, align 8, !tbaa !16
  %39 = call i32 @dotprod_rrrf_execute(ptr noundef %37, ptr noundef %38, ptr noundef nonnull %6) #3
  br label %40

40:                                               ; preds = %26, %12
  %41 = load i32, ptr %7, align 8, !tbaa !5
  %42 = sub i32 1, %41
  store i32 %42, ptr %7, align 8, !tbaa !5
  %43 = load float, ptr %5, align 4, !tbaa !17
  %44 = load float, ptr %6, align 4, !tbaa !17
  %45 = fmul float %44, 0.000000e+00
  %46 = fadd float %43, %45
  %47 = getelementptr inbounds i8, ptr %2, i64 4
  store float %46, ptr %2, align 4
  store float %44, ptr %47, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #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"="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 = { 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, !10, i64 24}
!14 = !{!6, !7, i64 56}
!15 = !{!6, !7, i64 80}
!16 = !{!7, !7, i64 0}
!17 = !{!11, !11, i64 0}


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