; 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.1 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [39 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @dds_cccf_copy(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %10

8:                                                ; preds = %1
  %9 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.1, i32 noundef 149, ptr noundef @.str.7, ptr noundef @.str.3)
  store ptr %9, ptr %2, align 8
  br label %108

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %11 = call noalias ptr @malloc(i64 noundef 112) #6
  store ptr %11, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memmove.p0.p0.i64(ptr align 8 %12, ptr align 8 %13, i64 112, i1 false)
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.dds_cccf_s, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = zext i32 %16 to i64
  %18 = mul i64 %17, 8
  %19 = call noalias ptr @malloc(i64 noundef %18) #6
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.dds_cccf_s, ptr %20, i32 0, i32 5
  store ptr %19, ptr %21, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !14
  br label %22

22:                                               ; preds = %43, %10
  %23 = load i32, ptr %5, align 4, !tbaa !14
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.dds_cccf_s, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !9
  %27 = icmp ult i32 %23, %26
  br i1 %27, label %28, label %46

28:                                               ; preds = %22
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.dds_cccf_s, ptr %29, i32 0, i32 5
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = load i32, ptr %5, align 4, !tbaa !14
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds ptr, ptr %31, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = call ptr @resamp2_cccf_copy(ptr noundef %35)
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.dds_cccf_s, ptr %37, i32 0, i32 5
  %39 = load ptr, ptr %38, align 8, !tbaa !13
  %40 = load i32, ptr %5, align 4, !tbaa !14
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds ptr, ptr %39, i64 %41
  store ptr %36, ptr %42, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %28
  %44 = load i32, ptr %5, align 4, !tbaa !14
  %45 = add i32 %44, 1
  store i32 %45, ptr %5, align 4, !tbaa !14
  br label %22, !llvm.loop !15

46:                                               ; preds = %22
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.dds_cccf_s, ptr %47, i32 0, i32 6
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.dds_cccf_s, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !9
  %53 = call ptr @liquid_malloc_copy(ptr noundef %49, i32 noundef %52, i32 noundef 4)
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.dds_cccf_s, ptr %54, i32 0, i32 6
  store ptr %53, ptr %55, align 8, !tbaa !17
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.dds_cccf_s, ptr %56, i32 0, i32 7
  %58 = load ptr, ptr %57, align 8, !tbaa !18
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.dds_cccf_s, ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 8, !tbaa !9
  %62 = call ptr @liquid_malloc_copy(ptr noundef %58, i32 noundef %61, i32 noundef 4)
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.dds_cccf_s, ptr %63, i32 0, i32 7
  store ptr %62, ptr %64, align 8, !tbaa !18
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.dds_cccf_s, ptr %65, i32 0, i32 8
  %67 = load ptr, ptr %66, align 8, !tbaa !19
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.dds_cccf_s, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 8, !tbaa !9
  %71 = call ptr @liquid_malloc_copy(ptr noundef %67, i32 noundef %70, i32 noundef 4)
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.dds_cccf_s, ptr %72, i32 0, i32 8
  store ptr %71, ptr %73, align 8, !tbaa !19
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.dds_cccf_s, ptr %74, i32 0, i32 9
  %76 = load ptr, ptr %75, align 8, !tbaa !20
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.dds_cccf_s, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 8, !tbaa !9
  %80 = call ptr @liquid_malloc_copy(ptr noundef %76, i32 noundef %79, i32 noundef 4)
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.dds_cccf_s, ptr %81, i32 0, i32 9
  store ptr %80, ptr %82, align 8, !tbaa !20
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.dds_cccf_s, ptr %83, i32 0, i32 11
  %85 = load ptr, ptr %84, align 8, !tbaa !21
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.dds_cccf_s, ptr %86, i32 0, i32 10
  %88 = load i32, ptr %87, align 8, !tbaa !22
  %89 = call ptr @liquid_malloc_copy(ptr noundef %85, i32 noundef %88, i32 noundef 8)
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.dds_cccf_s, ptr %90, i32 0, i32 11
  store ptr %89, ptr %91, align 8, !tbaa !21
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.dds_cccf_s, ptr %92, i32 0, i32 12
  %94 = load ptr, ptr %93, align 8, !tbaa !23
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.dds_cccf_s, ptr %95, i32 0, i32 10
  %97 = load i32, ptr %96, align 8, !tbaa !22
  %98 = call ptr @liquid_malloc_copy(ptr noundef %94, i32 noundef %97, i32 noundef 8)
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.dds_cccf_s, ptr %99, i32 0, i32 12
  store ptr %98, ptr %100, align 8, !tbaa !23
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.dds_cccf_s, ptr %101, i32 0, i32 13
  %103 = load ptr, ptr %102, align 8, !tbaa !24
  %104 = call ptr @nco_crcf_copy(ptr noundef %103)
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.dds_cccf_s, ptr %105, i32 0, i32 13
  store ptr %104, ptr %106, align 8, !tbaa !24
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %107, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %108

108:                                              ; preds = %46, %8
  %109 = load ptr, ptr %2, align 8
  ret ptr %109
}

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @resamp2_cccf_copy(ptr noundef) #3

declare ptr @liquid_malloc_copy(ptr noundef, i32 noundef, i32 noundef) #2

declare ptr @nco_crcf_copy(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 0}
!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, !6, i64 24}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!10, !6, i64 32}
!18 = !{!10, !6, i64 40}
!19 = !{!10, !6, i64 48}
!20 = !{!10, !6, i64 56}
!21 = !{!10, !6, i64 72}
!22 = !{!10, !11, i64 64}
!23 = !{!10, !6, i64 80}
!24 = !{!10, !6, i64 88}


; 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.1 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @dds_cccf_copy(ptr noundef readonly %0) local_unnamed_addr #2 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %3, label %5

3:                                                ; preds = %1
  %4 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.1, i32 noundef 149, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.3) #4
  br label %50

5:                                                ; preds = %1
  %6 = tail call noalias dereferenceable_or_null(112) ptr @malloc(i64 noundef 112) #5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(112) %6, ptr noundef nonnull align 8 dereferenceable(112) %0, i64 112, i1 false)
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 3
  %10 = tail call noalias ptr @malloc(i64 noundef %9) #5
  %11 = getelementptr inbounds i8, ptr %6, i64 24
  store ptr %10, ptr %11, align 8, !tbaa !12
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  br label %13

13:                                               ; preds = %.lr.ph, %13
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %13 ]
  %14 = load ptr, ptr %12, align 8, !tbaa !12
  %15 = getelementptr inbounds ptr, ptr %14, i64 %indvars.iv
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = tail call ptr @resamp2_cccf_copy(ptr noundef %16)
  %18 = getelementptr inbounds ptr, ptr %10, i64 %indvars.iv
  store ptr %17, ptr %18, align 8, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %8
  br i1 %exitcond.not, label %._crit_edge, label %13, !llvm.loop !14

._crit_edge:                                      ; preds = %13, %5
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = tail call ptr @liquid_malloc_copy(ptr noundef %20, i32 noundef %7, i32 noundef 4) #4
  %22 = getelementptr inbounds i8, ptr %6, i64 32
  store ptr %21, ptr %22, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = tail call ptr @liquid_malloc_copy(ptr noundef %24, i32 noundef %7, i32 noundef 4) #4
  %26 = getelementptr inbounds i8, ptr %6, i64 40
  store ptr %25, ptr %26, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %0, i64 48
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = tail call ptr @liquid_malloc_copy(ptr noundef %28, i32 noundef %7, i32 noundef 4) #4
  %30 = getelementptr inbounds i8, ptr %6, i64 48
  store ptr %29, ptr %30, align 8, !tbaa !18
  %31 = getelementptr inbounds i8, ptr %0, i64 56
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %33 = tail call ptr @liquid_malloc_copy(ptr noundef %32, i32 noundef %7, i32 noundef 4) #4
  %34 = getelementptr inbounds i8, ptr %6, i64 56
  store ptr %33, ptr %34, align 8, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %0, i64 72
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  %37 = getelementptr inbounds i8, ptr %0, i64 64
  %38 = load i32, ptr %37, align 8, !tbaa !21
  %39 = tail call ptr @liquid_malloc_copy(ptr noundef %36, i32 noundef %38, i32 noundef 8) #4
  %40 = getelementptr inbounds i8, ptr %6, i64 72
  store ptr %39, ptr %40, align 8, !tbaa !20
  %41 = getelementptr inbounds i8, ptr %0, i64 80
  %42 = load ptr, ptr %41, align 8, !tbaa !22
  %43 = load i32, ptr %37, align 8, !tbaa !21
  %44 = tail call ptr @liquid_malloc_copy(ptr noundef %42, i32 noundef %43, i32 noundef 8) #4
  %45 = getelementptr inbounds i8, ptr %6, i64 80
  store ptr %44, ptr %45, align 8, !tbaa !22
  %46 = getelementptr inbounds i8, ptr %0, i64 88
  %47 = load ptr, ptr %46, align 8, !tbaa !23
  %48 = tail call ptr @nco_crcf_copy(ptr noundef %47) #4
  %49 = getelementptr inbounds i8, ptr %6, i64 88
  store ptr %48, ptr %49, align 8, !tbaa !23
  br label %50

50:                                               ; preds = %._crit_edge, %3
  %.033 = phi ptr [ %4, %3 ], [ %6, %._crit_edge ]
  ret ptr %.033
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @resamp2_cccf_copy(ptr noundef) local_unnamed_addr #2

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

declare ptr @nco_crcf_copy(ptr noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }

!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 0}
!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, !11, i64 24}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!6, !11, i64 32}
!17 = !{!6, !11, i64 40}
!18 = !{!6, !11, i64 48}
!19 = !{!6, !11, i64 56}
!20 = !{!6, !11, i64 72}
!21 = !{!6, !7, i64 64}
!22 = !{!6, !11, i64 80}
!23 = !{!6, !11, i64 88}


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