; 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_S0a(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca { float, float }, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.ofdmframesync_s, ptr %6, i32 0, i32 33
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = add i32 %8, 1
  store i32 %9, ptr %7, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.ofdmframesync_s, ptr %10, i32 0, i32 33
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ofdmframesync_s, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 4, !tbaa !13
  %16 = icmp ult i32 %12, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %1
  store i32 0, ptr %2, align 4
  br label %62

18:                                               ; preds = %1
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ofdmframesync_s, ptr %19, i32 0, i32 33
  store i32 0, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ofdmframesync_s, ptr %21, i32 0, i32 16
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = call i32 @windowcf_read(ptr noundef %23, ptr noundef %4)
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ofdmframesync_s, ptr %27, i32 0, i32 2
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds { float, float }, ptr %26, i64 %30
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ofdmframesync_s, ptr %32, i32 0, i32 22
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = call i32 @ofdmframesync_estimate_gain_S0(ptr noundef %25, ptr noundef %31, ptr noundef %34)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ofdmframesync_s, ptr %37, i32 0, i32 22
  %39 = load ptr, ptr %38, align 8, !tbaa !16
  %40 = call i32 @ofdmframesync_S0_metrics(ptr noundef %36, ptr noundef %39, ptr noundef %5)
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ofdmframesync_s, ptr %41, i32 0, i32 21
  %43 = load float, ptr %42, align 8, !tbaa !17
  %44 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %45 = load float, ptr %44, align 4
  %46 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %47 = load float, ptr %46, align 4
  %48 = fmul float %45, %43
  %49 = fmul float %47, %43
  %50 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %51 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %48, ptr %50, align 4
  store float %49, ptr %51, align 4
  %52 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %53 = load float, ptr %52, align 4
  %54 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %55 = load float, ptr %54, align 4
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ofdmframesync_s, ptr %56, i32 0, i32 36
  %58 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 1
  store float %53, ptr %58, align 4
  store float %55, ptr %59, align 4
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.ofdmframesync_s, ptr %60, i32 0, i32 28
  store i32 2, ptr %61, align 8, !tbaa !18
  store i32 0, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %62

62:                                               ; preds = %18, %17
  %63 = load i32, ptr %2, align 4
  ret i32 %63
}

declare i32 @windowcf_read(ptr noundef, ptr noundef) #2

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

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

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


; 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_S0a(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca ptr, align 8
  %3 = alloca { float, float }, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 216
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = add i32 %5, 1
  store i32 %6, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !12
  %9 = icmp ult i32 %6, %8
  br i1 %9, label %32, label %10

10:                                               ; preds = %1
  store i32 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = call i32 @windowcf_read(ptr noundef %12, ptr noundef nonnull %2) #4
  %14 = load ptr, ptr %2, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds { float, float }, ptr %14, i64 %17
  %19 = getelementptr inbounds i8, ptr %0, i64 136
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = call i32 @ofdmframesync_estimate_gain_S0(ptr noundef nonnull %0, ptr noundef %18, ptr noundef %20)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %22 = load ptr, ptr %19, align 8, !tbaa !16
  %23 = call i32 @ofdmframesync_S0_metrics(ptr noundef nonnull %0, ptr noundef %22, ptr noundef nonnull %3)
  %24 = getelementptr inbounds i8, ptr %0, i64 128
  %25 = load float, ptr %24, align 8, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %0, i64 228
  %27 = load <2 x float>, ptr %3, align 8
  %28 = insertelement <2 x float> poison, float %25, i64 0
  %29 = shufflevector <2 x float> %28, <2 x float> poison, <2 x i32> zeroinitializer
  %30 = fmul <2 x float> %29, %27
  store <2 x float> %30, ptr %26, align 4
  %31 = getelementptr inbounds i8, ptr %0, i64 184
  store i32 2, ptr %31, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %32

32:                                               ; preds = %1, %10
  ret i32 0
}

declare i32 @windowcf_read(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_S0_metrics(ptr noundef, ptr noundef, 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"="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 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 #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 216}
!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, !7, i64 4}
!13 = !{!6, !10, i64 88}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !10, i64 136}
!17 = !{!6, !11, i64 128}
!18 = !{!6, !7, i64 184}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass