; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (filter_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.iirfiltsos_cccf_s = type { [3 x { float, float }], [3 x { float, float }], [3 x { float, float }], [3 x { float, float }], [3 x { float, float }] }

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

; Function Attrs: nounwind uwtable
define dso_local float @iirfiltsos_cccf_groupdelay(ptr noundef %0, float noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca [3 x float], align 4
  %6 = alloca [3 x float], align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %8

8:                                                ; preds = %36, %2
  %9 = load i32, ptr %7, align 4, !tbaa !11
  %10 = icmp ult i32 %9, 3
  br i1 %10, label %11, label %39

11:                                               ; preds = %8
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.iirfiltsos_cccf_s, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %7, align 4, !tbaa !11
  %15 = zext i32 %14 to i64
  %16 = getelementptr inbounds [3 x { float, float }], ptr %13, i64 0, i64 %15
  %17 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %18 = load float, ptr %17, align 4
  %19 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  %20 = load float, ptr %19, align 4
  %21 = load i32, ptr %7, align 4, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 %22
  store float %18, ptr %23, align 4, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.iirfiltsos_cccf_s, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %7, align 4, !tbaa !11
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds [3 x { float, float }], ptr %25, i64 0, i64 %27
  %29 = getelementptr inbounds { float, float }, ptr %28, i32 0, i32 0
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %28, i32 0, i32 1
  %32 = load float, ptr %31, align 4
  %33 = load i32, ptr %7, align 4, !tbaa !11
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [3 x float], ptr %6, i64 0, i64 %34
  store float %30, ptr %35, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %11
  %37 = load i32, ptr %7, align 4, !tbaa !11
  %38 = add i32 %37, 1
  store i32 %38, ptr %7, align 4, !tbaa !11
  br label %8, !llvm.loop !13

39:                                               ; preds = %8
  %40 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 0
  %41 = getelementptr inbounds [3 x float], ptr %6, i64 0, i64 0
  %42 = load float, ptr %4, align 4, !tbaa !9
  %43 = call float @iir_group_delay(ptr noundef %40, i32 noundef 3, ptr noundef %41, i32 noundef 3, float noundef %42)
  %44 = fpext float %43 to double
  %45 = fadd double %44, 2.000000e+00
  %46 = fptrunc double %45 to float
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #3
  ret float %46
}

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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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

declare float @iir_group_delay(ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local float @iirfiltsos_cccf_groupdelay(ptr nocapture noundef readonly %0, float noundef %1) local_unnamed_addr #2 {
  %3 = alloca [3 x float], align 4
  %4 = alloca [3 x float], align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load float, ptr %0, align 4
  store float %6, ptr %3, align 4, !tbaa !5
  %7 = load float, ptr %5, align 4
  store float %7, ptr %4, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load float, ptr %8, align 4
  %10 = getelementptr inbounds i8, ptr %3, i64 4
  store float %9, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = load float, ptr %11, align 4
  %13 = getelementptr inbounds i8, ptr %4, i64 4
  store float %12, ptr %13, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load float, ptr %14, align 4
  %16 = getelementptr inbounds i8, ptr %3, i64 8
  store float %15, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 40
  %18 = load float, ptr %17, align 4
  %19 = getelementptr inbounds i8, ptr %4, i64 8
  store float %18, ptr %19, align 4, !tbaa !5
  %20 = call float @iir_group_delay(ptr noundef nonnull %3, i32 noundef 3, ptr noundef nonnull %4, i32 noundef 3, float noundef %1) #3
  %21 = fadd float %20, 2.000000e+00
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #3
  ret float %21
}

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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass