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

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

; Function Attrs: nounwind uwtable
define dso_local <2 x float> @dsssframegen_generate_symbol(ptr noundef %0) #1 {
  %2 = alloca { float, float }, align 4
  %3 = alloca ptr, align 8
  %4 = alloca { float, float }, align 4
  %5 = alloca { float, float }, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca { float, float }, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.dsssframegen_s, ptr %8, i32 0, i32 25
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %15, label %12

12:                                               ; preds = %1
  %13 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %14 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float 0.000000e+00, ptr %13, align 4
  store float 0.000000e+00, ptr %14, align 4
  br label %60

15:                                               ; preds = %1
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.dsssframegen_s, ptr %16, i32 0, i32 27
  %18 = load i32, ptr %17, align 8, !tbaa !14
  switch i32 %18, label %55 [
    i32 0, label %19
    i32 1, label %28
    i32 2, label %37
    i32 3, label %46
  ]

19:                                               ; preds = %15
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = call <2 x float> @dsssframegen_generate_preamble(ptr noundef %20)
  store <2 x float> %21, ptr %4, align 4
  %22 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %23 = load float, ptr %22, align 4
  %24 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %25 = load float, ptr %24, align 4
  %26 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %27 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float %23, ptr %26, align 4
  store float %25, ptr %27, align 4
  br label %60

28:                                               ; preds = %15
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = call <2 x float> @dsssframegen_generate_header(ptr noundef %29)
  store <2 x float> %30, ptr %5, align 4
  %31 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %32 = load float, ptr %31, align 4
  %33 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %34 = load float, ptr %33, align 4
  %35 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %36 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float %32, ptr %35, align 4
  store float %34, ptr %36, align 4
  br label %60

37:                                               ; preds = %15
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = call <2 x float> @dsssframegen_generate_payload(ptr noundef %38)
  store <2 x float> %39, ptr %6, align 4
  %40 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %41 = load float, ptr %40, align 4
  %42 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %43 = load float, ptr %42, align 4
  %44 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %45 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float %41, ptr %44, align 4
  store float %43, ptr %45, align 4
  br label %60

46:                                               ; preds = %15
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = call <2 x float> @dsssframegen_generate_tail(ptr noundef %47)
  store <2 x float> %48, ptr %7, align 4
  %49 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %50 = load float, ptr %49, align 4
  %51 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %52 = load float, ptr %51, align 4
  %53 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %54 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float %50, ptr %53, align 4
  store float %52, ptr %54, align 4
  br label %60

55:                                               ; preds = %15
  %56 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str, i32 noundef 369, ptr noundef @.str.10)
  br label %57

57:                                               ; preds = %55
  %58 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
  store float 0.000000e+00, ptr %58, align 4
  store float 0.000000e+00, ptr %59, align 4
  br label %60

60:                                               ; preds = %57, %46, %37, %28, %19, %12
  %61 = load <2 x float>, ptr %2, align 4
  ret <2 x float> %61
}

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_preamble(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_header(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_payload(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_tail(ptr noundef) #1

attributes #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 uwtable "min-legal-vector-width"="64" "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" }

!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 184}
!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, !11, 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 [85 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [67 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local <2 x float> @dsssframegen_generate_symbol(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 184
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %17, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 192
  %6 = load i32, ptr %5, align 8, !tbaa !13
  switch i32 %6, label %15 [
    i32 0, label %7
    i32 1, label %9
    i32 2, label %11
    i32 3, label %13
  ]

7:                                                ; preds = %4
  %8 = tail call <2 x float> @dsssframegen_generate_preamble(ptr noundef nonnull %0)
  br label %17

9:                                                ; preds = %4
  %10 = tail call <2 x float> @dsssframegen_generate_header(ptr noundef nonnull %0)
  br label %17

11:                                               ; preds = %4
  %12 = tail call <2 x float> @dsssframegen_generate_payload(ptr noundef nonnull %0)
  br label %17

13:                                               ; preds = %4
  %14 = tail call <2 x float> @dsssframegen_generate_tail(ptr noundef nonnull %0)
  br label %17

15:                                               ; preds = %4
  %16 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 369, ptr noundef nonnull @.str.10) #2
  br label %17

17:                                               ; preds = %1, %15, %13, %11, %9, %7
  %.sroa.09.0 = phi <2 x float> [ zeroinitializer, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ zeroinitializer, %1 ]
  ret <2 x float> %.sroa.09.0
}

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_preamble(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_header(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_payload(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @dsssframegen_generate_tail(ptr noundef) local_unnamed_addr #1

attributes #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 uwtable "min-legal-vector-width"="64" "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 = { 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 184}
!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, !7, i64 192}


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