; 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: nounwind uwtable
define dso_local i32 @ofdmframesync_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.ofdmframesync_s, ptr %3, i32 0, i32 29
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = call i32 @nco_crcf_reset(ptr noundef %5)
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.ofdmframesync_s, ptr %7, i32 0, i32 30
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = call i32 @msequence_reset(ptr noundef %9)
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ofdmframesync_s, ptr %11, i32 0, i32 33
  store i32 0, ptr %12, align 8, !tbaa !14
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ofdmframesync_s, ptr %13, i32 0, i32 34
  store i32 0, ptr %14, align 4, !tbaa !15
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ofdmframesync_s, ptr %15, i32 0, i32 36
  %17 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds { float, float }, ptr %16, i32 0, i32 1
  store float 0.000000e+00, ptr %17, align 4
  store float 0.000000e+00, ptr %18, align 4
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ofdmframesync_s, ptr %19, i32 0, i32 37
  %21 = getelementptr inbounds { float, float }, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds { float, float }, ptr %20, i32 0, i32 1
  store float 0.000000e+00, ptr %21, align 4
  store float 0.000000e+00, ptr %22, align 4
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ofdmframesync_s, ptr %23, i32 0, i32 31
  store float 0.000000e+00, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ofdmframesync_s, ptr %25, i32 0, i32 32
  store float 0.000000e+00, ptr %26, align 4, !tbaa !17
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ofdmframesync_s, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !18
  %30 = icmp ugt i32 %29, 44
  br i1 %30, label %31, label %32

31:                                               ; preds = %1
  br label %39

32:                                               ; preds = %1
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ofdmframesync_s, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !18
  %36 = sub i32 44, %35
  %37 = uitofp i32 %36 to float
  %38 = call float @llvm.fmuladd.f32(float 0x3F847AE140000000, float %37, float 0x3FD6666660000000)
  br label %39

39:                                               ; preds = %32, %31
  %40 = phi float [ 0x3FD6666660000000, %31 ], [ %38, %32 ]
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ofdmframesync_s, ptr %41, i32 0, i32 38
  store float %40, ptr %42, align 4, !tbaa !19
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ofdmframesync_s, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !18
  %46 = icmp ugt i32 %45, 44
  br i1 %46, label %47, label %48

47:                                               ; preds = %39
  br label %55

48:                                               ; preds = %39
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ofdmframesync_s, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 8, !tbaa !18
  %52 = sub i32 44, %51
  %53 = uitofp i32 %52 to float
  %54 = call float @llvm.fmuladd.f32(float 0x3F847AE140000000, float %53, float 0x3FD3333340000000)
  br label %55

55:                                               ; preds = %48, %47
  %56 = phi float [ 0x3FD3333340000000, %47 ], [ %54, %48 ]
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ofdmframesync_s, ptr %57, i32 0, i32 39
  store float %56, ptr %58, align 8, !tbaa !20
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ofdmframesync_s, ptr %59, i32 0, i32 28
  store i32 0, ptr %60, align 8, !tbaa !21
  ret i32 0
}

declare i32 @nco_crcf_reset(ptr noundef) #1

declare i32 @msequence_reset(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 192}
!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, !6, i64 200}
!14 = !{!10, !11, i64 216}
!15 = !{!10, !11, i64 220}
!16 = !{!10, !12, i64 208}
!17 = !{!10, !12, i64 212}
!18 = !{!10, !11, i64 0}
!19 = !{!10, !12, i64 244}
!20 = !{!10, !12, i64 248}
!21 = !{!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: nounwind uwtable
define dso_local noundef i32 @ofdmframesync_reset(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 192
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call i32 @nco_crcf_reset(ptr noundef %3) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 200
  %6 = load ptr, ptr %5, align 8, !tbaa !12
  %7 = tail call i32 @msequence_reset(ptr noundef %6) #4
  %8 = getelementptr inbounds i8, ptr %0, i64 228
  %9 = getelementptr inbounds i8, ptr %0, i64 208
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %9, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  %10 = load i32, ptr %0, align 8, !tbaa !13
  %11 = icmp ugt i32 %10, 44
  %12 = sub nuw nsw i32 44, %10
  %13 = uitofp nneg i32 %12 to float
  %14 = getelementptr inbounds i8, ptr %0, i64 244
  %15 = insertelement <2 x float> poison, float %13, i64 0
  %16 = shufflevector <2 x float> %15, <2 x float> poison, <2 x i32> zeroinitializer
  %17 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %16, <2 x float> <float 0x3F847AE140000000, float 0x3F847AE140000000>, <2 x float> <float 0x3FD6666660000000, float 0x3FD3333340000000>)
  %18 = insertelement <2 x i1> poison, i1 %11, i64 0
  %19 = shufflevector <2 x i1> %18, <2 x i1> poison, <2 x i32> zeroinitializer
  %20 = select <2 x i1> %19, <2 x float> <float 0x3FD6666660000000, float 0x3FD3333340000000>, <2 x float> %17
  store <2 x float> %20, ptr %14, align 4, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %0, i64 184
  store i32 0, ptr %21, align 8, !tbaa !15
  ret i32 0
}

declare i32 @nco_crcf_reset(ptr noundef) local_unnamed_addr #1

declare i32 @msequence_reset(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 192}
!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 200}
!13 = !{!6, !7, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !7, i64 184}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass