; LLVM IR from jgaeddert/liquid-dsp :: src/multichannel/src (firpfbch_cccf)

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

; 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

; Function Attrs: nounwind uwtable
define dso_local i32 @firpfbch_cccf_synthesizer_execute(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca { float, float }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %10, i32 0, i32 10
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %17 = zext i32 %16 to i64
  %18 = mul i64 %17, 8
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %12, ptr align 4 %13, i64 %18, i1 false)
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %19, i32 0, i32 8
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = call i32 @fft_execute(ptr noundef %21)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i32 0, ptr %7, align 4, !tbaa !14
  br label %23

23:                                               ; preds = %72, %3
  %24 = load i32, ptr %7, align 4, !tbaa !14
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !12
  %28 = icmp ult i32 %24, %27
  br i1 %28, label %29, label %75

29:                                               ; preds = %23
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %30, i32 0, i32 6
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = load i32, ptr %7, align 4, !tbaa !14
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds ptr, ptr %32, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %37, i32 0, i32 9
  %39 = load ptr, ptr %38, align 8, !tbaa !16
  %40 = load i32, ptr %7, align 4, !tbaa !14
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds { float, float }, ptr %39, i64 %41
  %43 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 0
  %44 = load float, ptr %43, align 4
  %45 = getelementptr inbounds { float, float }, ptr %42, i32 0, i32 1
  %46 = load float, ptr %45, align 4
  %47 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %48 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %44, ptr %47, align 4
  store float %46, ptr %48, align 4
  %49 = load <2 x float>, ptr %9, align 4
  %50 = call i32 @windowcf_push(ptr noundef %36, <2 x float> noundef %49)
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %51, i32 0, i32 6
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load i32, ptr %7, align 4, !tbaa !14
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds ptr, ptr %53, i64 %55
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = call i32 @windowcf_read(ptr noundef %57, ptr noundef %8)
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.firpfbch_cccf_s, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !17
  %62 = load i32, ptr %7, align 4, !tbaa !14
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds ptr, ptr %61, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = load i32, ptr %7, align 4, !tbaa !14
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds { float, float }, ptr %67, i64 %69
  %71 = call i32 @dotprod_cccf_execute(ptr noundef %65, ptr noundef %66, ptr noundef %70)
  br label %72

72:                                               ; preds = %29
  %73 = load i32, ptr %7, align 4, !tbaa !14
  %74 = add i32 %73, 1
  store i32 %74, ptr %7, align 4, !tbaa !14
  br label %23, !llvm.loop !18

75:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 0
}

; 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) #2

declare i32 @fft_execute(ptr noundef) #3

declare i32 @windowcf_push(ptr noundef, <2 x float> noundef) #3

declare i32 @windowcf_read(ptr noundef, ptr noundef) #3

declare i32 @dotprod_cccf_execute(ptr noundef, ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 #4 = { 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 64}
!10 = !{!"firpfbch_cccf_s", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !6, i64 48}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 56}
!17 = !{!10, !6, i64 24}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; 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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @firpfbch_cccf_synthesizer_execute(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca ptr, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !11
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 3
  tail call void @llvm.memmove.p0.p0.i64(ptr align 4 %6, ptr align 4 %1, i64 %10, i1 false)
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = tail call i32 @fft_execute(ptr noundef %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %14 = load i32, ptr %7, align 4, !tbaa !11
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  br label %18

18:                                               ; preds = %.lr.ph, %18
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %18 ]
  %19 = load ptr, ptr %15, align 8, !tbaa !13
  %20 = getelementptr inbounds ptr, ptr %19, i64 %indvars.iv
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = load ptr, ptr %16, align 8, !tbaa !15
  %23 = getelementptr inbounds { float, float }, ptr %22, i64 %indvars.iv
  %24 = load <2 x float>, ptr %23, align 4
  %25 = call i32 @windowcf_push(ptr noundef %21, <2 x float> noundef %24) #4
  %26 = load ptr, ptr %15, align 8, !tbaa !13
  %27 = getelementptr inbounds ptr, ptr %26, i64 %indvars.iv
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = call i32 @windowcf_read(ptr noundef %28, ptr noundef nonnull %4) #4
  %30 = load ptr, ptr %17, align 8, !tbaa !16
  %31 = getelementptr inbounds ptr, ptr %30, i64 %indvars.iv
  %32 = load ptr, ptr %31, align 8, !tbaa !14
  %33 = load ptr, ptr %4, align 8, !tbaa !14
  %34 = getelementptr inbounds { float, float }, ptr %2, i64 %indvars.iv
  %35 = call i32 @dotprod_cccf_execute(ptr noundef %32, ptr noundef %33, ptr noundef %34) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr %7, align 4, !tbaa !11
  %37 = zext i32 %36 to i64
  %38 = icmp ult i64 %indvars.iv.next, %37
  br i1 %38, label %18, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %18, %3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i32 0
}

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

declare i32 @fft_execute(ptr noundef) local_unnamed_addr #3

declare i32 @windowcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #3

declare i32 @windowcf_read(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @dotprod_cccf_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 #4 = { 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 64}
!6 = !{!"firpfbch_cccf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !10, i64 48}
!13 = !{!6, !10, i64 32}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 56}
!16 = !{!6, !10, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass