; LLVM IR from jgaeddert/liquid-dsp :: src/modem/src (modemcf)

; 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.modemcf_s = type { i32, i32, i32, [8 x float], ptr, i32, { float, float }, { float, float }, %union.anon, ptr, ptr, ptr, i32 }
%union.anon = type { %struct.anon.3 }
%struct.anon.3 = type { i32, [8 x i32], [8 x float], [8 x float], [8 x float], ptr }
%struct.anon.0 = type { float, float, float }
%struct.anon.6 = type { float }

; Function Attrs: nounwind uwtable
define dso_local i32 @modemcf_reset(ptr noundef %0) #0 {
  %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.modemcf_s, ptr %3, i32 0, i32 6
  %5 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %6 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  store float 1.000000e+00, ptr %5, align 4
  store float 0.000000e+00, ptr %6, align 4
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.modemcf_s, ptr %7, i32 0, i32 6
  %9 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %10 = load float, ptr %9, align 4
  %11 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %12 = load float, ptr %11, align 4
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.modemcf_s, ptr %13, i32 0, i32 7
  %15 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds { float, float }, ptr %14, i32 0, i32 1
  store float %10, ptr %15, align 4
  store float %12, ptr %16, align 4
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.modemcf_s, ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = call i32 @liquid_modem_is_dpsk(i32 noundef %19)
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %26

22:                                               ; preds = %1
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.modemcf_s, ptr %23, i32 0, i32 8
  %25 = getelementptr inbounds %struct.anon.0, ptr %24, i32 0, i32 1
  store float 0.000000e+00, ptr %25, align 4, !tbaa !12
  br label %36

26:                                               ; preds = %1
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.modemcf_s, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !9
  %30 = icmp eq i32 %29, 51
  br i1 %30, label %31, label %35

31:                                               ; preds = %26
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.modemcf_s, ptr %32, i32 0, i32 8
  %34 = getelementptr inbounds %struct.anon.6, ptr %33, i32 0, i32 0
  store float 0.000000e+00, ptr %34, align 8, !tbaa !12
  br label %35

35:                                               ; preds = %31, %26
  br label %36

36:                                               ; preds = %35, %22
  ret i32 0
}

declare i32 @liquid_modem_is_dpsk(i32 noundef) #1

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 = { "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 0}
!10 = !{!"modemcf_s", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 12, !6, i64 48, !11, i64 56, !7, i64 60, !7, i64 68, !7, i64 80, !6, i64 224, !6, i64 232, !6, i64 240, !11, i64 248}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, i64 0}


; 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: nounwind uwtable
define dso_local noundef i32 @modemcf_reset(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 60
  store <4 x float> <float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 0.000000e+00>, ptr %2, align 4
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = tail call i32 @liquid_modem_is_dpsk(i32 noundef %3) #2
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %7, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 84
  store float 0.000000e+00, ptr %6, align 4, !tbaa !11
  br label %12

7:                                                ; preds = %1
  %8 = load i32, ptr %0, align 8, !tbaa !5
  %9 = icmp eq i32 %8, 51
  br i1 %9, label %10, label %12

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  store float 0.000000e+00, ptr %11, align 8, !tbaa !11
  br label %12

12:                                               ; preds = %7, %10, %5
  ret i32 0
}

declare i32 @liquid_modem_is_dpsk(i32 noundef) local_unnamed_addr #1

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 = { "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 0}
!6 = !{!"modemcf_s", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12, !10, i64 48, !7, i64 56, !8, i64 60, !8, i64 68, !8, i64 80, !10, i64 224, !10, i64 232, !10, i64 240, !7, i64 248}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!8, !8, i64 0}


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