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

; 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.dsssframesync_s = type { ptr, ptr, %struct.framesyncstats_s, %struct.framedatastats_s, i32, i32, float, ptr, float, float, float, float, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, ptr, ptr, i32, %struct.flexframegenprops_s, ptr, i32, ptr, i32, i32, ptr, i32, i32, ptr, i32, ptr, i32, ptr, i32, i32, i32, i32 }
%struct.framesyncstats_s = type { float, float, float, ptr, i32, i32, i32, i32, i32, i32 }
%struct.framedatastats_s = type { i32, i32, i32, i64 }
%struct.flexframegenprops_s = type { i32, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [86 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [45 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @dsssframesync_destroy(ptr noundef %0) #1 {
  %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 = icmp eq ptr %4, null
  br i1 %5, label %6, label %8

6:                                                ; preds = %1
  %7 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 2, ptr noundef @.str, i32 noundef 169, ptr noundef @.str.1)
  store i32 %7, ptr %2, align 4
  br label %58

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.dsssframesync_s, ptr %9, i32 0, i32 18
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %11) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.dsssframesync_s, ptr %12, i32 0, i32 19
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  call void @free(ptr noundef %14) #3
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.dsssframesync_s, ptr %15, i32 0, i32 24
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  call void @free(ptr noundef %17) #3
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.dsssframesync_s, ptr %18, i32 0, i32 29
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  call void @free(ptr noundef %20) #3
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.dsssframesync_s, ptr %21, i32 0, i32 32
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  call void @free(ptr noundef %23) #3
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.dsssframesync_s, ptr %24, i32 0, i32 36
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  call void @free(ptr noundef %26) #3
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.dsssframesync_s, ptr %27, i32 0, i32 26
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  %30 = call i32 @qpacketmodem_destroy(ptr noundef %29)
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.dsssframesync_s, ptr %31, i32 0, i32 34
  %33 = load ptr, ptr %32, align 8, !tbaa !23
  %34 = call i32 @qpacketmodem_destroy(ptr noundef %33)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.dsssframesync_s, ptr %35, i32 0, i32 7
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  %38 = call i32 @qdetector_cccf_destroy(ptr noundef %37)
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.dsssframesync_s, ptr %39, i32 0, i32 14
  %41 = load ptr, ptr %40, align 8, !tbaa !25
  %42 = call i32 @firpfb_crcf_destroy(ptr noundef %41)
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.dsssframesync_s, ptr %43, i32 0, i32 12
  %45 = load ptr, ptr %44, align 8, !tbaa !26
  %46 = call i32 @nco_crcf_destroy(ptr noundef %45)
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.dsssframesync_s, ptr %47, i32 0, i32 13
  %49 = load ptr, ptr %48, align 8, !tbaa !27
  %50 = call i32 @nco_crcf_destroy(ptr noundef %49)
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.dsssframesync_s, ptr %51, i32 0, i32 20
  %53 = load ptr, ptr %52, align 8, !tbaa !28
  call void @synth_crcf_destroy(ptr noundef %53)
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.dsssframesync_s, ptr %54, i32 0, i32 21
  %56 = load ptr, ptr %55, align 8, !tbaa !29
  call void @synth_crcf_destroy(ptr noundef %56)
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %57) #3
  store i32 0, ptr %2, align 4
  br label %58

58:                                               ; preds = %8, %6
  %59 = load i32, ptr %2, align 4
  ret i32 %59
}

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

declare i32 @qpacketmodem_destroy(ptr noundef) #2

declare i32 @qdetector_cccf_destroy(ptr noundef) #2

declare i32 @firpfb_crcf_destroy(ptr noundef) #2

declare i32 @nco_crcf_destroy(ptr noundef) #2

declare void @synth_crcf_destroy(ptr noundef) #2

attributes #0 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 168}
!10 = !{!"dsssframesync_s", !6, i64 0, !6, i64 8, !11, i64 16, !14, i64 64, !13, i64 88, !13, i64 92, !12, i64 96, !6, i64 104, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !6, i64 128, !6, i64 136, !6, i64 144, !13, i64 152, !13, i64 156, !13, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !13, i64 200, !16, i64 204, !6, i64 224, !13, i64 232, !6, i64 240, !13, i64 248, !13, i64 252, !6, i64 256, !13, i64 264, !13, i64 268, !6, i64 272, !13, i64 280, !6, i64 288, !13, i64 296, !6, i64 304, !13, i64 312, !13, i64 316, !13, i64 320, !13, i64 324}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44}
!12 = !{!"float", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !15, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!17 = !{!10, !6, i64 176}
!18 = !{!10, !6, i64 224}
!19 = !{!10, !6, i64 256}
!20 = !{!10, !6, i64 272}
!21 = !{!10, !6, i64 304}
!22 = !{!10, !6, i64 240}
!23 = !{!10, !6, i64 288}
!24 = !{!10, !6, i64 104}
!25 = !{!10, !6, i64 144}
!26 = !{!10, !6, i64 128}
!27 = !{!10, !6, i64 136}
!28 = !{!10, !6, i64 184}
!29 = !{!10, !6, i64 192}


; 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.1 = external hidden unnamed_addr constant [45 x i8], align 1

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

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

3:                                                ; preds = %1
  %4 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 2, ptr noundef nonnull @.str, i32 noundef 169, ptr noundef nonnull @.str.1) #3
  br label %40

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 168
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void @free(ptr noundef %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  tail call void @free(ptr noundef %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 224
  %11 = load ptr, ptr %10, align 8, !tbaa !17
  tail call void @free(ptr noundef %11) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 256
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  tail call void @free(ptr noundef %13) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 272
  %15 = load ptr, ptr %14, align 8, !tbaa !19
  tail call void @free(ptr noundef %15) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 304
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  tail call void @free(ptr noundef %17) #3
  %18 = getelementptr inbounds i8, ptr %0, i64 240
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = tail call i32 @qpacketmodem_destroy(ptr noundef %19) #3
  %21 = getelementptr inbounds i8, ptr %0, i64 288
  %22 = load ptr, ptr %21, align 8, !tbaa !22
  %23 = tail call i32 @qpacketmodem_destroy(ptr noundef %22) #3
  %24 = getelementptr inbounds i8, ptr %0, i64 104
  %25 = load ptr, ptr %24, align 8, !tbaa !23
  %26 = tail call i32 @qdetector_cccf_destroy(ptr noundef %25) #3
  %27 = getelementptr inbounds i8, ptr %0, i64 144
  %28 = load ptr, ptr %27, align 8, !tbaa !24
  %29 = tail call i32 @firpfb_crcf_destroy(ptr noundef %28) #3
  %30 = getelementptr inbounds i8, ptr %0, i64 128
  %31 = load ptr, ptr %30, align 8, !tbaa !25
  %32 = tail call i32 @nco_crcf_destroy(ptr noundef %31) #3
  %33 = getelementptr inbounds i8, ptr %0, i64 136
  %34 = load ptr, ptr %33, align 8, !tbaa !26
  %35 = tail call i32 @nco_crcf_destroy(ptr noundef %34) #3
  %36 = getelementptr inbounds i8, ptr %0, i64 184
  %37 = load ptr, ptr %36, align 8, !tbaa !27
  tail call void @synth_crcf_destroy(ptr noundef %37) #3
  %38 = getelementptr inbounds i8, ptr %0, i64 192
  %39 = load ptr, ptr %38, align 8, !tbaa !28
  tail call void @synth_crcf_destroy(ptr noundef %39) #3
  tail call void @free(ptr noundef nonnull %0) #3
  br label %40

40:                                               ; preds = %5, %3
  %.0 = phi i32 [ %4, %3 ], [ 0, %5 ]
  ret i32 %.0
}

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

declare i32 @qpacketmodem_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @qdetector_cccf_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @firpfb_crcf_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @nco_crcf_destroy(ptr noundef) local_unnamed_addr #2

declare void @synth_crcf_destroy(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #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 168}
!6 = !{!"dsssframesync_s", !7, i64 0, !7, i64 8, !10, i64 16, !13, i64 64, !12, i64 88, !12, i64 92, !11, i64 96, !7, i64 104, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !7, i64 128, !7, i64 136, !7, i64 144, !12, i64 152, !12, i64 156, !12, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !12, i64 200, !15, i64 204, !7, i64 224, !12, i64 232, !7, i64 240, !12, i64 248, !12, i64 252, !7, i64 256, !12, i64 264, !12, i64 268, !7, i64 272, !12, i64 280, !7, i64 288, !12, i64 296, !7, i64 304, !12, i64 312, !12, i64 316, !12, i64 320, !12, i64 324}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44}
!11 = !{!"float", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !14, i64 16}
!14 = !{!"long", !8, i64 0}
!15 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!16 = !{!6, !7, i64 176}
!17 = !{!6, !7, i64 224}
!18 = !{!6, !7, i64 256}
!19 = !{!6, !7, i64 272}
!20 = !{!6, !7, i64 304}
!21 = !{!6, !7, i64 240}
!22 = !{!6, !7, i64 288}
!23 = !{!6, !7, i64 104}
!24 = !{!6, !7, i64 144}
!25 = !{!6, !7, i64 128}
!26 = !{!6, !7, i64 136}
!27 = !{!6, !7, i64 184}
!28 = !{!6, !7, i64 192}


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