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

; 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.dsssframegen_s = type { i32, i32, float, ptr, [2 x { float, float }], %struct.dsssframegenprops_s, %struct.dsssframegenprops_s, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, i32, i32, i32, { float, float }, i32, i32, i32 }
%struct.dsssframegenprops_s = type { i32, i32, i32 }

@.str = external hidden unnamed_addr constant [85 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @dsssframegen_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 162, ptr noundef @.str.1)
  store i32 %7, ptr %2, align 4
  br label %40

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.dsssframegen_s, ptr %9, i32 0, i32 3
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = call i32 @firinterp_crcf_destroy(ptr noundef %11)
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.dsssframegen_s, ptr %13, i32 0, i32 13
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = call i32 @qpacketmodem_destroy(ptr noundef %15)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.dsssframegen_s, ptr %17, i32 0, i32 17
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = call i32 @qpacketmodem_destroy(ptr noundef %19)
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.dsssframegen_s, ptr %21, i32 0, i32 8
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  call void @synth_crcf_destroy(ptr noundef %23)
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.dsssframegen_s, ptr %24, i32 0, i32 9
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  call void @synth_crcf_destroy(ptr noundef %26)
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.dsssframegen_s, ptr %27, i32 0, i32 7
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  call void @free(ptr noundef %29) #3
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.dsssframegen_s, ptr %30, i32 0, i32 10
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  call void @free(ptr noundef %32) #3
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.dsssframegen_s, ptr %33, i32 0, i32 15
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  call void @free(ptr noundef %35) #3
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.dsssframegen_s, ptr %36, i32 0, i32 19
  %38 = load ptr, ptr %37, align 8, !tbaa !21
  call void @free(ptr noundef %38) #3
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %39) #3
  store i32 0, ptr %2, align 4
  br label %40

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

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

declare i32 @firinterp_crcf_destroy(ptr noundef) #2

declare i32 @qpacketmodem_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 16}
!10 = !{!"dsssframegen_s", !11, i64 0, !11, i64 4, !12, i64 8, !6, i64 16, !7, i64 24, !13, i64 40, !13, i64 52, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !6, i64 104, !11, i64 112, !6, i64 120, !11, i64 128, !6, i64 136, !11, i64 144, !6, i64 152, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !7, i64 176, !11, i64 184, !11, i64 188, !11, i64 192}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!14 = !{!10, !6, i64 104}
!15 = !{!10, !6, i64 136}
!16 = !{!10, !6, i64 72}
!17 = !{!10, !6, i64 80}
!18 = !{!10, !6, i64 64}
!19 = !{!10, !6, i64 88}
!20 = !{!10, !6, i64 120}
!21 = !{!10, !6, i64 152}


; 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 [85 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [44 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 @dsssframegen_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 162, ptr noundef nonnull @.str.1) #3
  br label %27

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call i32 @firinterp_crcf_destroy(ptr noundef %7) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 104
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = tail call i32 @qpacketmodem_destroy(ptr noundef %10) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 136
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = tail call i32 @qpacketmodem_destroy(ptr noundef %13) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 72
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  tail call void @synth_crcf_destroy(ptr noundef %16) #3
  %17 = getelementptr inbounds i8, ptr %0, i64 80
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  tail call void @synth_crcf_destroy(ptr noundef %18) #3
  %19 = getelementptr inbounds i8, ptr %0, i64 64
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  tail call void @free(ptr noundef %20) #3
  %21 = getelementptr inbounds i8, ptr %0, i64 88
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  tail call void @free(ptr noundef %22) #3
  %23 = getelementptr inbounds i8, ptr %0, i64 120
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  tail call void @free(ptr noundef %24) #3
  %25 = getelementptr inbounds i8, ptr %0, i64 152
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @free(ptr noundef %26) #3
  tail call void @free(ptr noundef nonnull %0) #3
  br label %27

27:                                               ; 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 @firinterp_crcf_destroy(ptr noundef) local_unnamed_addr #2

declare i32 @qpacketmodem_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, !11, i64 16}
!6 = !{!"dsssframegen_s", !7, i64 0, !7, i64 4, !10, i64 8, !11, i64 16, !8, i64 24, !12, i64 40, !12, i64 52, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !7, i64 96, !7, i64 100, !11, i64 104, !7, i64 112, !11, i64 120, !7, i64 128, !11, i64 136, !7, i64 144, !11, i64 152, !7, i64 160, !7, i64 164, !7, i64 168, !7, i64 172, !8, i64 176, !7, i64 184, !7, i64 188, !7, i64 192}
!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 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!13 = !{!6, !11, i64 104}
!14 = !{!6, !11, i64 136}
!15 = !{!6, !11, i64 72}
!16 = !{!6, !11, i64 80}
!17 = !{!6, !11, i64 64}
!18 = !{!6, !11, i64 88}
!19 = !{!6, !11, i64 120}
!20 = !{!6, !11, i64 152}


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