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

; 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.fskframesync_s = type { i32, i32, float, i32, ptr, ptr, ptr, ptr, ptr, %struct.framesyncstats_s, ptr, i32, i32, ptr, ptr, ptr, ptr, [3 x float], i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, ptr }
%struct.framesyncstats_s = type { float, float, float, ptr, i32, i32, i32, i32, i32, i32 }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @fskframesync_destroy(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.fskframesync_s, ptr %3, i32 0, i32 38
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = icmp ne i32 %5, 0
  br i1 %6, label %7, label %12

7:                                                ; preds = %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.fskframesync_s, ptr %8, i32 0, i32 39
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = call i32 @windowcf_destroy(ptr noundef %10)
  br label %12

12:                                               ; preds = %7, %1
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.fskframesync_s, ptr %13, i32 0, i32 4
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = call i32 @fskdem_destroy(ptr noundef %15)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.fskframesync_s, ptr %17, i32 0, i32 5
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  %20 = call i32 @fskdem_destroy(ptr noundef %19)
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.fskframesync_s, ptr %21, i32 0, i32 6
  %23 = load ptr, ptr %22, align 8, !tbaa !17
  call void @free(ptr noundef %23) #3
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.fskframesync_s, ptr %24, i32 0, i32 10
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  %27 = call i32 @firpfb_crcf_destroy(ptr noundef %26)
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.fskframesync_s, ptr %28, i32 0, i32 13
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = call i32 @nco_crcf_destroy(ptr noundef %30)
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.fskframesync_s, ptr %32, i32 0, i32 15
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  %35 = call i32 @windowcf_destroy(ptr noundef %34)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.fskframesync_s, ptr %36, i32 0, i32 14
  %38 = load ptr, ptr %37, align 8, !tbaa !21
  %39 = call i32 @firfilt_rrrf_destroy(ptr noundef %38)
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.fskframesync_s, ptr %40, i32 0, i32 16
  %42 = load ptr, ptr %41, align 8, !tbaa !22
  %43 = call i32 @windowf_destroy(ptr noundef %42)
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.fskframesync_s, ptr %44, i32 0, i32 20
  %46 = load ptr, ptr %45, align 8, !tbaa !23
  call void @free(ptr noundef %46) #3
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.fskframesync_s, ptr %47, i32 0, i32 21
  %49 = load ptr, ptr %48, align 8, !tbaa !24
  call void @free(ptr noundef %49) #3
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.fskframesync_s, ptr %50, i32 0, i32 22
  %52 = load ptr, ptr %51, align 8, !tbaa !25
  %53 = call i32 @qpacketmodem_destroy(ptr noundef %52)
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.fskframesync_s, ptr %54, i32 0, i32 28
  %56 = load ptr, ptr %55, align 8, !tbaa !26
  call void @free(ptr noundef %56) #3
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.fskframesync_s, ptr %57, i32 0, i32 29
  %59 = load ptr, ptr %58, align 8, !tbaa !27
  call void @free(ptr noundef %59) #3
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.fskframesync_s, ptr %60, i32 0, i32 30
  %62 = load ptr, ptr %61, align 8, !tbaa !28
  %63 = call i32 @qpacketmodem_destroy(ptr noundef %62)
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %64) #3
  ret i32 0
}

declare i32 @windowcf_destroy(ptr noundef) #2

declare i32 @fskdem_destroy(ptr noundef) #2

declare i32 @firpfb_crcf_destroy(ptr noundef) #2

declare i32 @nco_crcf_destroy(ptr noundef) #2

declare i32 @firfilt_rrrf_destroy(ptr noundef) #2

declare i32 @windowf_destroy(ptr noundef) #2

declare i32 @qpacketmodem_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, !11, i64 276}
!10 = !{!"fskframesync_s", !11, i64 0, !11, i64 4, !12, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !6, i64 104, !11, i64 112, !11, i64 116, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !7, i64 152, !11, i64 164, !11, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !6, i64 280}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44}
!14 = !{!10, !6, i64 280}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 24}
!17 = !{!10, !6, i64 32}
!18 = !{!10, !6, i64 104}
!19 = !{!10, !6, i64 120}
!20 = !{!10, !6, i64 136}
!21 = !{!10, !6, i64 128}
!22 = !{!10, !6, i64 144}
!23 = !{!10, !6, i64 176}
!24 = !{!10, !6, i64 184}
!25 = !{!10, !6, i64 192}
!26 = !{!10, !6, i64 224}
!27 = !{!10, !6, i64 232}
!28 = !{!10, !6, i64 240}


; 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"

; 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 noundef i32 @fskframesync_destroy(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 276
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %8, label %4

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

8:                                                ; preds = %4, %1
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = tail call i32 @fskdem_destroy(ptr noundef %10) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = tail call i32 @fskdem_destroy(ptr noundef %13) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  tail call void @free(ptr noundef %16) #3
  %17 = getelementptr inbounds i8, ptr %0, i64 104
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = tail call i32 @firpfb_crcf_destroy(ptr noundef %18) #3
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = tail call i32 @nco_crcf_destroy(ptr noundef %21) #3
  %23 = getelementptr inbounds i8, ptr %0, i64 136
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = tail call i32 @windowcf_destroy(ptr noundef %24) #3
  %26 = getelementptr inbounds i8, ptr %0, i64 128
  %27 = load ptr, ptr %26, align 8, !tbaa !20
  %28 = tail call i32 @firfilt_rrrf_destroy(ptr noundef %27) #3
  %29 = getelementptr inbounds i8, ptr %0, i64 144
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  %31 = tail call i32 @windowf_destroy(ptr noundef %30) #3
  %32 = getelementptr inbounds i8, ptr %0, i64 176
  %33 = load ptr, ptr %32, align 8, !tbaa !22
  tail call void @free(ptr noundef %33) #3
  %34 = getelementptr inbounds i8, ptr %0, i64 184
  %35 = load ptr, ptr %34, align 8, !tbaa !23
  tail call void @free(ptr noundef %35) #3
  %36 = getelementptr inbounds i8, ptr %0, i64 192
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  %38 = tail call i32 @qpacketmodem_destroy(ptr noundef %37) #3
  %39 = getelementptr inbounds i8, ptr %0, i64 224
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  tail call void @free(ptr noundef %40) #3
  %41 = getelementptr inbounds i8, ptr %0, i64 232
  %42 = load ptr, ptr %41, align 8, !tbaa !26
  tail call void @free(ptr noundef %42) #3
  %43 = getelementptr inbounds i8, ptr %0, i64 240
  %44 = load ptr, ptr %43, align 8, !tbaa !27
  %45 = tail call i32 @qpacketmodem_destroy(ptr noundef %44) #3
  tail call void @free(ptr noundef nonnull %0) #3
  ret i32 0
}

declare i32 @windowcf_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @fskdem_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 i32 @firfilt_rrrf_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @windowf_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @qpacketmodem_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 276}
!6 = !{!"fskframesync_s", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !12, i64 56, !11, i64 104, !7, i64 112, !7, i64 116, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !8, i64 152, !7, i64 164, !7, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !7, i64 200, !7, i64 204, !7, i64 208, !7, i64 212, !7, i64 216, !11, i64 224, !11, i64 232, !11, i64 240, !7, i64 248, !7, i64 252, !7, i64 256, !7, i64 260, !7, i64 264, !7, i64 268, !7, i64 272, !7, i64 276, !11, i64 280}
!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 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !11, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44}
!13 = !{!6, !11, i64 280}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !11, i64 24}
!16 = !{!6, !11, i64 32}
!17 = !{!6, !11, i64 104}
!18 = !{!6, !11, i64 120}
!19 = !{!6, !11, i64 136}
!20 = !{!6, !11, i64 128}
!21 = !{!6, !11, i64 144}
!22 = !{!6, !11, i64 176}
!23 = !{!6, !11, i64 184}
!24 = !{!6, !11, i64 192}
!25 = !{!6, !11, i64 224}
!26 = !{!6, !11, i64 232}
!27 = !{!6, !11, i64 240}


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