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

@.str.8 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @dds_cccf_print(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.dds_cccf_s, ptr %4, i32 0, i32 4
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.dds_cccf_s, ptr %7, i32 0, i32 1
  %9 = load float, ptr %8, align 4, !tbaa !13
  %10 = fpext float %9 to double
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.dds_cccf_s, ptr %11, i32 0, i32 2
  %13 = load float, ptr %12, align 8, !tbaa !14
  %14 = fpext float %13 to double
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.dds_cccf_s, ptr %15, i32 0, i32 13
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = call float @nco_crcf_get_frequency(ptr noundef %17)
  %19 = fpext float %18 to double
  %20 = fdiv double %19, 0x401921FB54442D18
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.dds_cccf_s, ptr %21, i32 0, i32 3
  %23 = load float, ptr %22, align 4, !tbaa !16
  %24 = fpext float %23 to double
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.dds_cccf_s, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !17
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %6, double noundef %10, double noundef %14, double noundef %20, double noundef %24, i32 noundef %27)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !18
  br label %29

29:                                               ; preds = %60, %1
  %30 = load i32, ptr %3, align 4, !tbaa !18
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.dds_cccf_s, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !17
  %34 = icmp ult i32 %30, %33
  br i1 %34, label %35, label %63

35:                                               ; preds = %29
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.dds_cccf_s, ptr %36, i32 0, i32 6
  %38 = load ptr, ptr %37, align 8, !tbaa !19
  %39 = load i32, ptr %3, align 4, !tbaa !18
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds float, ptr %38, i64 %40
  %42 = load float, ptr %41, align 4, !tbaa !20
  %43 = fpext float %42 to double
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.dds_cccf_s, ptr %44, i32 0, i32 7
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  %47 = load i32, ptr %3, align 4, !tbaa !18
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds float, ptr %46, i64 %48
  %50 = load float, ptr %49, align 4, !tbaa !20
  %51 = fpext float %50 to double
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.dds_cccf_s, ptr %52, i32 0, i32 9
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  %55 = load i32, ptr %3, align 4, !tbaa !18
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %54, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !18
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, double noundef %43, double noundef %51, i32 noundef %58)
  br label %60

60:                                               ; preds = %35
  %61 = load i32, ptr %3, align 4, !tbaa !18
  %62 = add i32 %61, 1
  store i32 %62, ptr %3, align 4, !tbaa !18
  br label %29, !llvm.loop !23

63:                                               ; preds = %29
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

declare float @nco_crcf_get_frequency(ptr noundef) #1

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

@.str.8 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @dds_cccf_print(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load float, ptr %4, align 4, !tbaa !12
  %6 = fpext float %5 to double
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load float, ptr %7, align 8, !tbaa !13
  %9 = fpext float %8 to double
  %10 = getelementptr inbounds i8, ptr %0, i64 88
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = tail call float @nco_crcf_get_frequency(ptr noundef %11) #3
  %13 = fpext float %12 to double
  %14 = fdiv double %13, 0x401921FB54442D18
  %15 = getelementptr inbounds i8, ptr %0, i64 12
  %16 = load float, ptr %15, align 4, !tbaa !15
  %17 = fpext float %16 to double
  %18 = load i32, ptr %0, align 8, !tbaa !16
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %3, double noundef %6, double noundef %9, double noundef %14, double noundef %17, i32 noundef %18)
  %20 = load i32, ptr %0, align 8, !tbaa !16
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  %23 = getelementptr inbounds i8, ptr %0, i64 56
  br label %24

24:                                               ; preds = %.lr.ph, %24
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %24 ]
  %25 = load ptr, ptr %21, align 8, !tbaa !17
  %26 = getelementptr inbounds float, ptr %25, i64 %indvars.iv
  %27 = load float, ptr %26, align 4, !tbaa !18
  %28 = fpext float %27 to double
  %29 = load ptr, ptr %22, align 8, !tbaa !19
  %30 = getelementptr inbounds float, ptr %29, i64 %indvars.iv
  %31 = load float, ptr %30, align 4, !tbaa !18
  %32 = fpext float %31 to double
  %33 = load ptr, ptr %23, align 8, !tbaa !20
  %34 = getelementptr inbounds i32, ptr %33, i64 %indvars.iv
  %35 = load i32, ptr %34, align 4, !tbaa !21
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, double noundef %28, double noundef %32, i32 noundef %35)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i32, ptr %0, align 8, !tbaa !16
  %38 = zext i32 %37 to i64
  %39 = icmp ult i64 %indvars.iv.next, %38
  br i1 %39, label %24, label %._crit_edge, !llvm.loop !22

._crit_edge:                                      ; preds = %24, %1
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  ret i32 0
}

declare float @nco_crcf_get_frequency(ptr noundef) local_unnamed_addr #2

attributes #0 = { nofree nounwind "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 = { 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 #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 = { 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, !7, i64 16}
!6 = !{!"dds_cccf_s", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !7, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !7, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !10, i64 96, !8, i64 100}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !10, i64 4}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !11, i64 88}
!15 = !{!6, !10, i64 12}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !11, i64 32}
!18 = !{!10, !10, i64 0}
!19 = !{!6, !11, i64 40}
!20 = !{!6, !11, i64 56}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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