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

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.120 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.122 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.123 = external hidden unnamed_addr constant [66 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
declare dso_local ptr @firpfb_cccf_create(i32 noundef, ptr noundef, i32 noundef) #3

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

13:                                               ; preds = %4
  %14 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.120, i32 noundef 59, ptr noundef @.str.121, ptr noundef @.str.3)
  store ptr %14, ptr %5, align 8
  br label %56

15:                                               ; preds = %4
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %15
  %19 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.120, i32 noundef 61, ptr noundef @.str.122, ptr noundef @.str.3)
  store ptr %19, ptr %5, align 8
  br label %56

20:                                               ; preds = %15
  %21 = load i32, ptr %8, align 4, !tbaa !5
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.120, i32 noundef 63, ptr noundef @.str.123, ptr noundef @.str.3)
  store ptr %24, ptr %5, align 8
  br label %56

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %26 = call noalias ptr @malloc(i64 noundef 24) #5
  store ptr %26, ptr %10, align 8, !tbaa !9
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %28, i32 0, i32 0
  store i32 %27, ptr %29, align 8, !tbaa !11
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = load ptr, ptr %10, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %31, i32 0, i32 1
  store i32 %30, ptr %32, align 4, !tbaa !13
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = load ptr, ptr %10, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %34, i32 0, i32 2
  store i32 %33, ptr %35, align 8, !tbaa !14
  %36 = load ptr, ptr %10, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %36, i32 0, i32 3
  store i32 1, ptr %37, align 4, !tbaa !15
  %38 = load ptr, ptr %10, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 8, !tbaa !11
  %41 = load ptr, ptr %9, align 8, !tbaa !9
  %42 = load ptr, ptr %10, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %43, align 8, !tbaa !11
  %45 = mul i32 2, %44
  %46 = load ptr, ptr %10, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %46, i32 0, i32 2
  %48 = load i32, ptr %47, align 8, !tbaa !14
  %49 = mul i32 %45, %48
  %50 = call ptr @firpfb_cccf_create(i32 noundef %40, ptr noundef %41, i32 noundef %49)
  %51 = load ptr, ptr %10, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct.rresamp_cccf_s, ptr %51, i32 0, i32 4
  store ptr %50, ptr %52, align 8, !tbaa !16
  %53 = load ptr, ptr %10, align 8, !tbaa !9
  %54 = call i32 @rresamp_cccf_reset(ptr noundef %53)
  %55 = load ptr, ptr %10, align 8, !tbaa !9
  store ptr %55, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %56

56:                                               ; preds = %25, %23, %18, %13
  %57 = load ptr, ptr %5, align 8
  ret ptr %57
}

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

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 = { 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"rresamp_cccf_s", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !10, i64 16}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = !{!12, !6, i64 12}
!16 = !{!12, !10, i64 16}


; 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.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.120 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.122 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.123 = external hidden unnamed_addr constant [66 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
declare dso_local ptr @firpfb_cccf_create(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @rresamp_cccf_create(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = icmp eq i32 %0, 0
  br i1 %5, label %6, label %8

6:                                                ; preds = %4
  %7 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.120, i32 noundef 59, ptr noundef nonnull @.str.121, ptr noundef nonnull @.str.3) #3
  br label %26

8:                                                ; preds = %4
  %9 = icmp eq i32 %1, 0
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.120, i32 noundef 61, ptr noundef nonnull @.str.122, ptr noundef nonnull @.str.3) #3
  br label %26

12:                                               ; preds = %8
  %13 = icmp eq i32 %2, 0
  br i1 %13, label %14, label %16

14:                                               ; preds = %12
  %15 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.120, i32 noundef 63, ptr noundef nonnull @.str.123, ptr noundef nonnull @.str.3) #3
  br label %26

16:                                               ; preds = %12
  %17 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #4
  store i32 %0, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  store i32 %1, ptr %18, align 4, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %17, i64 8
  store i32 %2, ptr %19, align 8, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %17, i64 12
  store i32 1, ptr %20, align 4, !tbaa !13
  %21 = shl i32 %0, 1
  %22 = mul i32 %21, %2
  %23 = tail call ptr @firpfb_cccf_create(i32 noundef %0, ptr noundef %3, i32 noundef %22)
  %24 = getelementptr inbounds i8, ptr %17, i64 16
  store ptr %23, ptr %24, align 8, !tbaa !14
  %25 = tail call i32 @rresamp_cccf_reset(ptr noundef nonnull %17)
  br label %26

26:                                               ; preds = %16, %14, %10, %6
  %.0 = phi ptr [ %7, %6 ], [ %11, %10 ], [ %15, %14 ], [ %17, %16 ]
  ret ptr %.0
}

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

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 = { nounwind }
attributes #4 = { 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 = !{!"rresamp_cccf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16}
!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, !7, i64 8}
!13 = !{!6, !7, i64 12}
!14 = !{!6, !10, i64 16}


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