; LLVM IR from jgaeddert/liquid-dsp :: src/multichannel/src (ofdmframesync)

; 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.ofdmframesync_s = type { i32, i32, i32, ptr, i32, i32, i32, i32, i32, i32, float, float, float, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, float, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, float, float, i32, i32, i32, { float, float }, { float, float }, float, float, ptr, ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @ofdmframesync_execute(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca { float, float }, align 4
  %10 = alloca { float, float }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %78, %3
  %12 = load i32, ptr %7, align 4, !tbaa !9
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = icmp ult i32 %12, %13
  br i1 %14, label %15, label %81

15:                                               ; preds = %11
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds { float, float }, ptr %16, i64 %18
  %20 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 4
  %22 = getelementptr inbounds { float, float }, ptr %19, i32 0, i32 1
  %23 = load float, ptr %22, align 4
  %24 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %25 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %21, ptr %24, align 4
  store float %23, ptr %25, align 4
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ofdmframesync_s, ptr %26, i32 0, i32 28
  %28 = load i32, ptr %27, align 8, !tbaa !11
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %46

30:                                               ; preds = %15
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ofdmframesync_s, ptr %31, i32 0, i32 29
  %33 = load ptr, ptr %32, align 8, !tbaa !14
  %34 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %35 = load float, ptr %34, align 4
  %36 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %37 = load float, ptr %36, align 4
  %38 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 0
  %39 = getelementptr inbounds { float, float }, ptr %9, i32 0, i32 1
  store float %35, ptr %38, align 4
  store float %37, ptr %39, align 4
  %40 = load <2 x float>, ptr %9, align 4
  %41 = call i32 @nco_crcf_mix_down(ptr noundef %33, <2 x float> noundef %40, ptr noundef %8)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ofdmframesync_s, ptr %42, i32 0, i32 29
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  %45 = call i32 @nco_crcf_step(ptr noundef %44)
  br label %46

46:                                               ; preds = %30, %15
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ofdmframesync_s, ptr %47, i32 0, i32 16
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %51 = load float, ptr %50, align 4
  %52 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  %53 = load float, ptr %52, align 4
  %54 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %55 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %51, ptr %54, align 4
  store float %53, ptr %55, align 4
  %56 = load <2 x float>, ptr %10, align 4
  %57 = call i32 @windowcf_push(ptr noundef %49, <2 x float> noundef %56)
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ofdmframesync_s, ptr %58, i32 0, i32 28
  %60 = load i32, ptr %59, align 8, !tbaa !11
  switch i32 %60, label %76 [
    i32 0, label %61
    i32 1, label %64
    i32 2, label %67
    i32 3, label %70
    i32 4, label %73
  ]

61:                                               ; preds = %46
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = call i32 @ofdmframesync_execute_seekplcp(ptr noundef %62)
  br label %77

64:                                               ; preds = %46
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = call i32 @ofdmframesync_execute_S0a(ptr noundef %65)
  br label %77

67:                                               ; preds = %46
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = call i32 @ofdmframesync_execute_S0b(ptr noundef %68)
  br label %77

70:                                               ; preds = %46
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = call i32 @ofdmframesync_execute_S1(ptr noundef %71)
  br label %77

73:                                               ; preds = %46
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = call i32 @ofdmframesync_execute_rxsymbols(ptr noundef %74)
  br label %77

76:                                               ; preds = %46
  br label %77

77:                                               ; preds = %76, %73, %70, %67, %64, %61
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = add i32 %79, 1
  store i32 %80, ptr %7, align 4, !tbaa !9
  br label %11, !llvm.loop !16

81:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 0
}

declare i32 @nco_crcf_mix_down(ptr noundef, <2 x float> noundef, ptr noundef) #2

declare i32 @nco_crcf_step(ptr noundef) #2

declare i32 @windowcf_push(ptr noundef, <2 x float> noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_seekplcp(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_S0a(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_S0b(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_S1(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_rxsymbols(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 #4 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 184}
!12 = !{!"ofdmframesync_s", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !13, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !10, i64 184, !6, i64 192, !6, i64 200, !13, i64 208, !13, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !7, i64 228, !7, i64 236, !13, i64 244, !13, i64 248, !6, i64 256, !6, i64 264}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 192}
!15 = !{!12, !6, i64 88}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @ofdmframesync_execute(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca { float, float }, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %.not18 = icmp eq i32 %2, 0
  br i1 %.not18, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 184
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  %7 = getelementptr inbounds i8, ptr %0, i64 88
  %wide.trip.count = zext i32 %2 to i64
  br label %8

8:                                                ; preds = %.lr.ph, %33
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %33 ]
  %9 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv
  %10 = load <2 x float>, ptr %9, align 4
  store <2 x float> %10, ptr %4, align 8
  %11 = load i32, ptr %5, align 8, !tbaa !5
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %18, label %12

12:                                               ; preds = %8
  %13 = load ptr, ptr %6, align 8, !tbaa !12
  %14 = call i32 @nco_crcf_mix_down(ptr noundef %13, <2 x float> noundef %10, ptr noundef nonnull %4) #4
  %15 = load ptr, ptr %6, align 8, !tbaa !12
  %16 = call i32 @nco_crcf_step(ptr noundef %15) #4
  %17 = load <2 x float>, ptr %4, align 8
  br label %18

18:                                               ; preds = %12, %8
  %19 = phi <2 x float> [ %17, %12 ], [ %10, %8 ]
  %20 = load ptr, ptr %7, align 8, !tbaa !13
  %21 = call i32 @windowcf_push(ptr noundef %20, <2 x float> noundef %19) #4
  %22 = load i32, ptr %5, align 8, !tbaa !5
  switch i32 %22, label %33 [
    i32 0, label %23
    i32 1, label %25
    i32 2, label %27
    i32 3, label %29
    i32 4, label %31
  ]

23:                                               ; preds = %18
  %24 = call i32 @ofdmframesync_execute_seekplcp(ptr noundef nonnull %0)
  br label %33

25:                                               ; preds = %18
  %26 = call i32 @ofdmframesync_execute_S0a(ptr noundef nonnull %0)
  br label %33

27:                                               ; preds = %18
  %28 = call i32 @ofdmframesync_execute_S0b(ptr noundef nonnull %0)
  br label %33

29:                                               ; preds = %18
  %30 = call i32 @ofdmframesync_execute_S1(ptr noundef nonnull %0)
  br label %33

31:                                               ; preds = %18
  %32 = call i32 @ofdmframesync_execute_rxsymbols(ptr noundef nonnull %0)
  br label %33

33:                                               ; preds = %23, %25, %27, %29, %31, %18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %8, !llvm.loop !14

._crit_edge:                                      ; preds = %33, %3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i32 0
}

declare i32 @nco_crcf_mix_down(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #2

declare i32 @nco_crcf_step(ptr noundef) local_unnamed_addr #2

declare i32 @windowcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_seekplcp(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_S0a(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_S0b(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_S1(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_execute_rxsymbols(ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 #4 = { 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 = !{!"ofdmframesync_s", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !11, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !7, i64 184, !10, i64 192, !10, i64 200, !11, i64 208, !11, i64 212, !7, i64 216, !7, i64 220, !7, i64 224, !8, i64 228, !8, i64 236, !11, i64 244, !11, i64 248, !10, i64 256, !10, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 192}
!13 = !{!6, !10, i64 88}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass