; LLVM IR from jgaeddert/liquid-dsp :: src/channel/src (channel_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.channel_cccf_s = type { i32, float, float, float, float, i32, float, float, ptr, i32, ptr, ptr, i32, i32, ptr, float, float }

@.str = external hidden unnamed_addr constant [86 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [58 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

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

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

14:                                               ; preds = %3
  %15 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef @.str, i32 noundef 186, ptr noundef @.str.8, ptr noundef @.str.2)
  store i32 %15, ptr %4, align 4
  br label %114

16:                                               ; preds = %3
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = icmp ugt i32 %17, 1000
  br i1 %18, label %19, label %21

19:                                               ; preds = %16
  %20 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef @.str, i32 noundef 188, ptr noundef @.str.9, ptr noundef @.str.2)
  store i32 %20, ptr %4, align 4
  br label %114

21:                                               ; preds = %16
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.channel_cccf_s, ptr %22, i32 0, i32 9
  store i32 1, ptr %23, align 8, !tbaa !11
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.channel_cccf_s, ptr %24, i32 0, i32 12
  %26 = load i32, ptr %25, align 8, !tbaa !14
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = icmp ne i32 %26, %27
  br i1 %28, label %29, label %39

29:                                               ; preds = %21
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.channel_cccf_s, ptr %30, i32 0, i32 11
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = mul i64 %34, 8
  %36 = call ptr @realloc(ptr noundef %32, i64 noundef %35) #5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.channel_cccf_s, ptr %37, i32 0, i32 11
  store ptr %36, ptr %38, align 8, !tbaa !15
  br label %39

39:                                               ; preds = %29, %21
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.channel_cccf_s, ptr %41, i32 0, i32 12
  store i32 %40, ptr %42, align 8, !tbaa !14
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %91

45:                                               ; preds = %39
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.channel_cccf_s, ptr %46, i32 0, i32 11
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = getelementptr inbounds { float, float }, ptr %48, i64 0
  %50 = getelementptr inbounds { float, float }, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds { float, float }, ptr %49, i32 0, i32 1
  store float 1.000000e+00, ptr %50, align 4
  store float 0.000000e+00, ptr %51, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %52 = call ptr @msequence_create_default(i32 noundef 14)
  store ptr %52, ptr %9, align 8, !tbaa !5
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %85, %45
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.channel_cccf_s, ptr %55, i32 0, i32 12
  %57 = load i32, ptr %56, align 8, !tbaa !14
  %58 = icmp ult i32 %54, %57
  br i1 %58, label %59, label %88

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = call i32 @msequence_generate_symbol(ptr noundef %60, i32 noundef 8)
  %62 = uitofp i32 %61 to float
  %63 = fdiv float %62, 2.560000e+02
  %64 = fsub float %63, 5.000000e-01
  store float %64, ptr %10, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = call i32 @msequence_generate_symbol(ptr noundef %65, i32 noundef 8)
  %67 = uitofp i32 %66 to float
  %68 = fdiv float %67, 2.560000e+02
  %69 = fsub float %68, 5.000000e-01
  store float %69, ptr %11, align 4, !tbaa !16
  %70 = load float, ptr %10, align 4, !tbaa !16
  %71 = load float, ptr %11, align 4, !tbaa !16
  %72 = fmul float 0.000000e+00, %71
  %73 = fmul float 1.000000e+00, %71
  %74 = fadd float %70, %72
  %75 = fmul float %74, 5.000000e-01
  %76 = fmul float %73, 5.000000e-01
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.channel_cccf_s, ptr %77, i32 0, i32 11
  %79 = load ptr, ptr %78, align 8, !tbaa !15
  %80 = load i32, ptr %8, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds { float, float }, ptr %79, i64 %81
  %83 = getelementptr inbounds { float, float }, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds { float, float }, ptr %82, i32 0, i32 1
  store float %75, ptr %83, align 4
  store float %76, ptr %84, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %85

85:                                               ; preds = %59
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = add i32 %86, 1
  store i32 %87, ptr %8, align 4, !tbaa !9
  br label %53, !llvm.loop !17

88:                                               ; preds = %53
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = call i32 @msequence_destroy(ptr noundef %89)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %101

91:                                               ; preds = %39
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.channel_cccf_s, ptr %92, i32 0, i32 11
  %94 = load ptr, ptr %93, align 8, !tbaa !15
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.channel_cccf_s, ptr %96, i32 0, i32 12
  %98 = load i32, ptr %97, align 8, !tbaa !14
  %99 = zext i32 %98 to i64
  %100 = mul i64 %99, 8
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %94, ptr align 4 %95, i64 %100, i1 false)
  br label %101

101:                                              ; preds = %91, %88
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.channel_cccf_s, ptr %102, i32 0, i32 10
  %104 = load ptr, ptr %103, align 8, !tbaa !19
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.channel_cccf_s, ptr %105, i32 0, i32 11
  %107 = load ptr, ptr %106, align 8, !tbaa !15
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.channel_cccf_s, ptr %108, i32 0, i32 12
  %110 = load i32, ptr %109, align 8, !tbaa !14
  %111 = call ptr @firfilt_cccf_recreate(ptr noundef %104, ptr noundef %107, i32 noundef %110)
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.channel_cccf_s, ptr %112, i32 0, i32 10
  store ptr %111, ptr %113, align 8, !tbaa !19
  store i32 0, ptr %4, align 4
  br label %114

114:                                              ; preds = %101, %19, %14
  %115 = load i32, ptr %4, align 4
  ret i32 %115
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #3

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #4

declare ptr @msequence_create_default(i32 noundef) #3

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

declare i32 @msequence_destroy(ptr noundef) #3

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

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


; 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 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [58 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @channel_cccf_add_multipath(ptr nocapture noundef %0, ptr noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp eq i32 %2, 0
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef nonnull @.str, i32 noundef 186, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2) #4
  br label %58

7:                                                ; preds = %3
  %8 = icmp ugt i32 %2, 1000
  br i1 %8, label %9, label %11

9:                                                ; preds = %7
  %10 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef nonnull @.str, i32 noundef 188, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.2) #4
  br label %58

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 1, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 64
  %14 = load i32, ptr %13, align 8, !tbaa !12
  %.not = icmp eq i32 %14, %2
  br i1 %.not, label %21, label %15

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = shl nuw nsw i32 %2, 3
  %19 = zext nneg i32 %18 to i64
  %20 = tail call ptr @realloc(ptr noundef %17, i64 noundef %19) #5
  store ptr %20, ptr %16, align 8, !tbaa !13
  br label %21

21:                                               ; preds = %15, %11
  store i32 %2, ptr %13, align 8, !tbaa !12
  %22 = icmp eq ptr %1, null
  %23 = getelementptr inbounds i8, ptr %0, i64 56
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  br i1 %22, label %25, label %48

25:                                               ; preds = %21
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %24, align 4
  %26 = tail call ptr @msequence_create_default(i32 noundef 14) #4
  %27 = load i32, ptr %13, align 8, !tbaa !12
  %28 = icmp ugt i32 %27, 1
  br i1 %28, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %25, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %25 ]
  %29 = tail call i32 @msequence_generate_symbol(ptr noundef %26, i32 noundef 8) #4
  %30 = uitofp i32 %29 to float
  %31 = fmul float %30, 3.906250e-03
  %32 = fadd float %31, -5.000000e-01
  %33 = tail call i32 @msequence_generate_symbol(ptr noundef %26, i32 noundef 8) #4
  %34 = uitofp i32 %33 to float
  %35 = fmul float %34, 3.906250e-03
  %36 = load ptr, ptr %23, align 8, !tbaa !13
  %37 = getelementptr inbounds { float, float }, ptr %36, i64 %indvars.iv
  %38 = fadd float %35, -5.000000e-01
  %39 = fmul float %38, 0.000000e+00
  %40 = fadd float %32, %39
  %41 = insertelement <2 x float> poison, float %40, i64 0
  %42 = insertelement <2 x float> %41, float %38, i64 1
  %43 = fmul <2 x float> %42, <float 5.000000e-01, float 5.000000e-01>
  store <2 x float> %43, ptr %37, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %44 = load i32, ptr %13, align 8, !tbaa !12
  %45 = zext i32 %44 to i64
  %46 = icmp ult i64 %indvars.iv.next, %45
  br i1 %46, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %25
  %47 = tail call i32 @msequence_destroy(ptr noundef %26) #4
  br label %51

48:                                               ; preds = %21
  %49 = shl nuw nsw i32 %2, 3
  %50 = zext nneg i32 %49 to i64
  tail call void @llvm.memmove.p0.p0.i64(ptr align 4 %24, ptr nonnull align 4 %1, i64 %50, i1 false)
  br label %51

51:                                               ; preds = %48, %._crit_edge
  %52 = getelementptr inbounds i8, ptr %0, i64 48
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = getelementptr inbounds i8, ptr %0, i64 56
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = load i32, ptr %13, align 8, !tbaa !12
  %57 = tail call ptr @firfilt_cccf_recreate(ptr noundef %53, ptr noundef %55, i32 noundef %56) #4
  store ptr %57, ptr %52, align 8, !tbaa !16
  br label %58

58:                                               ; preds = %51, %9, %5
  %.0 = phi i32 [ %6, %5 ], [ %10, %9 ], [ 0, %51 ]
  ret i32 %.0
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #3

declare ptr @msequence_create_default(i32 noundef) local_unnamed_addr #2

declare i32 @msequence_generate_symbol(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @msequence_destroy(ptr noundef) local_unnamed_addr #2

declare ptr @firfilt_cccf_recreate(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

!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 40}
!6 = !{!"channel_cccf_s", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 20, !10, i64 24, !10, i64 28, !11, i64 32, !7, i64 40, !11, i64 48, !11, i64 56, !7, i64 64, !7, i64 68, !11, i64 72, !10, i64 80, !10, i64 84}
!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, !7, i64 64}
!13 = !{!6, !11, i64 56}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!6, !11, i64 48}


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