; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_reset(ptr noundef) #2

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

13:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ofdmframesync_s, ptr %14, i32 0, i32 16
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = call i32 @windowcf_read(ptr noundef %16, ptr noundef %3)
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ofdmframesync_s, ptr %18, i32 0, i32 15
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ofdmframesync_s, ptr %22, i32 0, i32 2
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ofdmframesync_s, ptr %25, i32 0, i32 35
  %27 = load i32, ptr %26, align 8, !tbaa !16
  %28 = sub i32 %24, %27
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds { float, float }, ptr %21, i64 %29
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ofdmframesync_s, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !17
  %34 = zext i32 %33 to i64
  %35 = mul i64 %34, 8
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %20, ptr align 4 %30, i64 %35, i1 false)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ofdmframesync_s, ptr %36, i32 0, i32 13
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = call i32 @fft_execute(ptr noundef %38)
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = call i32 @ofdmframesync_rxsymbol(ptr noundef %40)
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ofdmframesync_s, ptr %42, i32 0, i32 40
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %69

46:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ofdmframesync_s, ptr %47, i32 0, i32 40
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ofdmframesync_s, ptr %50, i32 0, i32 14
  %52 = load ptr, ptr %51, align 8, !tbaa !20
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ofdmframesync_s, ptr %53, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ofdmframesync_s, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !17
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ofdmframesync_s, ptr %59, i32 0, i32 41
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = call i32 %49(ptr noundef %52, ptr noundef %55, i32 noundef %58, ptr noundef %61)
  store i32 %62, ptr %4, align 4, !tbaa !23
  %63 = load i32, ptr %4, align 4, !tbaa !23
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %46
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = call i32 @ofdmframesync_reset(ptr noundef %66)
  br label %68

68:                                               ; preds = %65, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %69

69:                                               ; preds = %68, %13
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ofdmframesync_s, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !17
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.ofdmframesync_s, ptr %73, i32 0, i32 2
  %75 = load i32, ptr %74, align 8, !tbaa !15
  %76 = add i32 %72, %75
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ofdmframesync_s, ptr %77, i32 0, i32 33
  store i32 %76, ptr %78, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %79

79:                                               ; preds = %69, %1
  ret i32 0
}

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

declare i32 @fft_execute(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmframesync_rxsymbol(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 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 #5 = { 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, !6, i64 88}
!14 = !{!10, !6, i64 80}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !11, i64 224}
!17 = !{!10, !11, i64 0}
!18 = !{!10, !6, i64 64}
!19 = !{!10, !6, i64 256}
!20 = !{!10, !6, i64 72}
!21 = !{!10, !6, i64 16}
!22 = !{!10, !6, i64 264}
!23 = !{!11, !11, 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: 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #1

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

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

7:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  %10 = call i32 @windowcf_read(ptr noundef %9, ptr noundef nonnull %2) #5
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = load ptr, ptr %2, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 224
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %18 = sub i32 %15, %17
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds { float, float }, ptr %13, i64 %19
  %21 = load i32, ptr %0, align 8, !tbaa !17
  %22 = zext i32 %21 to i64
  %23 = shl nuw nsw i64 %22, 3
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %12, ptr align 4 %20, i64 %23, i1 false)
  %24 = getelementptr inbounds i8, ptr %0, i64 64
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = call i32 @fft_execute(ptr noundef %25) #5
  %27 = call i32 @ofdmframesync_rxsymbol(ptr noundef nonnull %0)
  %28 = getelementptr inbounds i8, ptr %0, i64 256
  %29 = load ptr, ptr %28, align 8, !tbaa !19
  %.not = icmp eq ptr %29, null
  br i1 %.not, label %41, label %30

30:                                               ; preds = %7
  %31 = getelementptr inbounds i8, ptr %0, i64 72
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  %33 = getelementptr inbounds i8, ptr %0, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !21
  %35 = load i32, ptr %0, align 8, !tbaa !17
  %36 = getelementptr inbounds i8, ptr %0, i64 264
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = call i32 %29(ptr noundef %32, ptr noundef %34, i32 noundef %35, ptr noundef %37) #5
  %.not19 = icmp eq i32 %38, 0
  br i1 %.not19, label %41, label %39

39:                                               ; preds = %30
  %40 = call i32 @ofdmframesync_reset(ptr noundef nonnull %0)
  br label %41

41:                                               ; preds = %30, %39, %7
  %42 = load i32, ptr %0, align 8, !tbaa !17
  %43 = load i32, ptr %14, align 8, !tbaa !15
  %44 = add i32 %43, %42
  store i32 %44, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br label %45

45:                                               ; preds = %41, %1
  ret i32 0
}

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

declare i32 @fft_execute(ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 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 #5 = { 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, !10, i64 88}
!13 = !{!6, !10, i64 80}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !7, i64 224}
!17 = !{!6, !7, i64 0}
!18 = !{!6, !10, i64 64}
!19 = !{!6, !10, i64 256}
!20 = !{!6, !10, i64 72}
!21 = !{!6, !10, i64 16}
!22 = !{!6, !10, i64 264}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass