; LLVM IR from jgaeddert/liquid-dsp :: src/framing/src (framingcf)

; 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.qsourcecf_s = type { i32, i32, i32, i32, float, float, float, i32, ptr, ptr, float, float, i32, ptr, ptr, ptr, ptr, i32, i64, i32, %union.anon }
%union.anon = type { %struct.anon.1 }
%struct.anon.1 = type { ptr, float, i32, i32, i64, i64 }
%struct.anon.3 = type { ptr }
%struct.anon.4 = type { ptr, ptr, i32, i32, i32 }
%struct.anon.5 = type { ptr, [2 x { float, float }], i32 }

@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [44 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @qsourcecf_destroy(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.qsourcecf_s, ptr %4, i32 0, i32 19
  %6 = load i32, ptr %5, align 8, !tbaa !9
  switch i32 %6, label %35 [
    i32 0, label %37
    i32 1, label %37
    i32 2, label %37
    i32 3, label %7
    i32 4, label %37
    i32 5, label %13
    i32 6, label %19
    i32 7, label %29
  ]

7:                                                ; preds = %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.qsourcecf_s, ptr %8, i32 0, i32 20
  %10 = getelementptr inbounds %struct.anon.1, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = call i32 @nco_crcf_destroy(ptr noundef %11)
  br label %37

13:                                               ; preds = %1
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.qsourcecf_s, ptr %14, i32 0, i32 20
  %16 = getelementptr inbounds %struct.anon.3, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = call i32 @symstreamcf_destroy(ptr noundef %17)
  br label %37

19:                                               ; preds = %1
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.qsourcecf_s, ptr %20, i32 0, i32 20
  %22 = getelementptr inbounds %struct.anon.4, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = call i32 @fskmod_destroy(ptr noundef %23)
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.qsourcecf_s, ptr %25, i32 0, i32 20
  %27 = getelementptr inbounds %struct.anon.4, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  call void @free(ptr noundef %28) #3
  br label %37

29:                                               ; preds = %1
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.qsourcecf_s, ptr %30, i32 0, i32 20
  %32 = getelementptr inbounds %struct.anon.5, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !14
  %34 = call i32 @gmskmod_destroy(ptr noundef %33)
  br label %37

35:                                               ; preds = %1
  %36 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str.31, i32 noundef 215, ptr noundef @.str.38, ptr noundef @.str.2)
  store i32 %36, ptr %2, align 4
  br label %60

37:                                               ; preds = %29, %19, %13, %7, %1, %1, %1, %1
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.qsourcecf_s, ptr %38, i32 0, i32 13
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  call void @free(ptr noundef %40) #3
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.qsourcecf_s, ptr %41, i32 0, i32 14
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  call void @free(ptr noundef %43) #3
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.qsourcecf_s, ptr %44, i32 0, i32 15
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  call void @free(ptr noundef %46) #3
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.qsourcecf_s, ptr %47, i32 0, i32 16
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  %50 = call i32 @firpfbch2_crcf_destroy(ptr noundef %49)
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.qsourcecf_s, ptr %51, i32 0, i32 8
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = call i32 @resamp_crcf_destroy(ptr noundef %53)
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.qsourcecf_s, ptr %55, i32 0, i32 9
  %57 = load ptr, ptr %56, align 8, !tbaa !20
  %58 = call i32 @nco_crcf_destroy(ptr noundef %57)
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %59) #3
  store i32 0, ptr %2, align 4
  br label %60

60:                                               ; preds = %37, %35
  %61 = load i32, ptr %2, align 4
  ret i32 %61
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

declare i32 @firpfbch2_crcf_destroy(ptr noundef) #2

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

declare i32 @nco_crcf_destroy(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @symstreamcf_destroy(ptr noundef) #0

declare i32 @fskmod_destroy(ptr noundef) #2

declare i32 @gmskmod_destroy(ptr noundef) #2

declare i32 @resamp_crcf_destroy(ptr noundef) #2

attributes #0 = { 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 #1 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 112}
!10 = !{!"qsourcecf_s", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !11, i64 28, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !11, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !13, i64 104, !11, i64 112, !7, i64 120}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !6, i64 64}
!16 = !{!10, !6, i64 72}
!17 = !{!10, !6, i64 80}
!18 = !{!10, !6, i64 88}
!19 = !{!10, !6, i64 32}
!20 = !{!10, !6, i64 40}


; 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.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [44 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @qsourcecf_destroy(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 112
  %3 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %3, label %22 [
    i32 0, label %24
    i32 1, label %24
    i32 2, label %24
    i32 3, label %4
    i32 4, label %24
    i32 5, label %8
    i32 6, label %12
    i32 7, label %18
  ]

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  %6 = load ptr, ptr %5, align 8, !tbaa !13
  %7 = tail call i32 @nco_crcf_destroy(ptr noundef %6) #3
  br label %24

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 120
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = tail call i32 @symstreamcf_destroy(ptr noundef %10)
  br label %24

12:                                               ; preds = %1
  %13 = getelementptr inbounds i8, ptr %0, i64 120
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = tail call i32 @fskmod_destroy(ptr noundef %14) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 128
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  tail call void @free(ptr noundef %17) #3
  br label %24

18:                                               ; preds = %1
  %19 = getelementptr inbounds i8, ptr %0, i64 120
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = tail call i32 @gmskmod_destroy(ptr noundef %20) #3
  br label %24

22:                                               ; preds = %1
  %23 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str.31, i32 noundef 215, ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.2) #3
  br label %40

24:                                               ; preds = %18, %12, %8, %4, %1, %1, %1, %1
  %25 = getelementptr inbounds i8, ptr %0, i64 64
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  tail call void @free(ptr noundef %26) #3
  %27 = getelementptr inbounds i8, ptr %0, i64 72
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  tail call void @free(ptr noundef %28) #3
  %29 = getelementptr inbounds i8, ptr %0, i64 80
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  tail call void @free(ptr noundef %30) #3
  %31 = getelementptr inbounds i8, ptr %0, i64 88
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  %33 = tail call i32 @firpfbch2_crcf_destroy(ptr noundef %32) #3
  %34 = getelementptr inbounds i8, ptr %0, i64 32
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  %36 = tail call i32 @resamp_crcf_destroy(ptr noundef %35) #3
  %37 = getelementptr inbounds i8, ptr %0, i64 40
  %38 = load ptr, ptr %37, align 8, !tbaa !19
  %39 = tail call i32 @nco_crcf_destroy(ptr noundef %38) #3
  tail call void @free(ptr noundef nonnull %0) #3
  br label %40

40:                                               ; preds = %24, %22
  %.0 = phi i32 [ %23, %22 ], [ 0, %24 ]
  ret i32 %.0
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

declare i32 @firpfbch2_crcf_destroy(ptr noundef) local_unnamed_addr #2

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

declare i32 @nco_crcf_destroy(ptr noundef) local_unnamed_addr #2

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

declare i32 @fskmod_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @gmskmod_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @resamp_crcf_destroy(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nounwind willreturn allockind("free") 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 #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 112}
!6 = !{!"qsourcecf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 28, !11, i64 32, !11, i64 40, !10, i64 48, !10, i64 52, !7, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !7, i64 96, !12, i64 104, !7, i64 112, !8, i64 120}
!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 = !{!"long", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !11, i64 64}
!15 = !{!6, !11, i64 72}
!16 = !{!6, !11, i64 80}
!17 = !{!6, !11, i64 88}
!18 = !{!6, !11, i64 32}
!19 = !{!6, !11, i64 40}


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