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

; 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.ofdmframegen_s = type { i32, i32, ptr, i32, ptr, ptr, i32, i32, i32, i32, i32, float, ptr, ptr, ptr, ptr, ptr, ptr, 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
declare dso_local i32 @ofdmframegen_gensymbol(ptr noundef, ptr noundef) #1

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

10:                                               ; preds = %93, %3
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.ofdmframegen_s, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = icmp ult i32 %11, %14
  br i1 %15, label %16, label %96

16:                                               ; preds = %10
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ofdmframegen_s, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = udiv i32 %20, 2
  %22 = add i32 %17, %21
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ofdmframegen_s, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = urem i32 %22, %25
  store i32 %26, ptr %8, align 4, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ofdmframegen_s, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %29, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !15
  %34 = zext i8 %33 to i32
  store i32 %34, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %46

37:                                               ; preds = %16
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ofdmframegen_s, ptr %38, i32 0, i32 13
  %40 = load ptr, ptr %39, align 8, !tbaa !16
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds { float, float }, ptr %40, i64 %42
  %44 = getelementptr inbounds { float, float }, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds { float, float }, ptr %43, i32 0, i32 1
  store float 0.000000e+00, ptr %44, align 4
  store float 0.000000e+00, ptr %45, align 4
  br label %92

46:                                               ; preds = %16
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = icmp eq i32 %47, 1
  br i1 %48, label %49, label %69

49:                                               ; preds = %46
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ofdmframegen_s, ptr %50, i32 0, i32 19
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  %53 = call i32 @msequence_advance(ptr noundef %52)
  %54 = icmp ne i32 %53, 0
  %55 = zext i1 %54 to i64
  %56 = select i1 %54, float 1.000000e+00, float -1.000000e+00
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ofdmframegen_s, ptr %57, i32 0, i32 11
  %59 = load float, ptr %58, align 4, !tbaa !18
  %60 = fmul float %56, %59
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ofdmframegen_s, ptr %61, i32 0, i32 13
  %63 = load ptr, ptr %62, align 8, !tbaa !16
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds { float, float }, ptr %63, i64 %65
  %67 = getelementptr inbounds { float, float }, ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds { float, float }, ptr %66, i32 0, i32 1
  store float %60, ptr %67, align 4
  store float 0.000000e+00, ptr %68, align 4
  br label %91

69:                                               ; preds = %46
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds { float, float }, ptr %70, i64 %72
  %74 = getelementptr inbounds { float, float }, ptr %73, i32 0, i32 0
  %75 = load float, ptr %74, align 4
  %76 = getelementptr inbounds { float, float }, ptr %73, i32 0, i32 1
  %77 = load float, ptr %76, align 4
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ofdmframegen_s, ptr %78, i32 0, i32 11
  %80 = load float, ptr %79, align 4, !tbaa !18
  %81 = fmul float %75, %80
  %82 = fmul float %77, %80
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ofdmframegen_s, ptr %83, i32 0, i32 13
  %85 = load ptr, ptr %84, align 8, !tbaa !16
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds { float, float }, ptr %85, i64 %87
  %89 = getelementptr inbounds { float, float }, ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds { float, float }, ptr %88, i32 0, i32 1
  store float %81, ptr %89, align 4
  store float %82, ptr %90, align 4
  br label %91

91:                                               ; preds = %69, %49
  br label %92

92:                                               ; preds = %91, %37
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %7, align 4, !tbaa !9
  %95 = add i32 %94, 1
  store i32 %95, ptr %7, align 4, !tbaa !9
  br label %10, !llvm.loop !19

96:                                               ; preds = %10
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.ofdmframegen_s, ptr %97, i32 0, i32 12
  %99 = load ptr, ptr %98, align 8, !tbaa !21
  %100 = call i32 @fft_execute(ptr noundef %99)
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = call i32 @ofdmframegen_gensymbol(ptr noundef %101, ptr noundef %102)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %103
}

declare i32 @msequence_advance(ptr noundef) #2

declare i32 @fft_execute(ptr noundef) #2

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 }

!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 0}
!12 = !{!"ofdmframegen_s", !10, i64 0, !10, i64 4, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !13, i64 60, !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 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!12, !6, i64 72}
!17 = !{!12, !6, i64 120}
!18 = !{!12, !13, i64 60}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !6, i64 64}


; 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
declare dso_local i32 @ofdmframegen_gensymbol(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @ofdmframegen_writesymbol(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %.not26 = icmp eq i32 %4, 0
  br i1 %.not26, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = getelementptr inbounds i8, ptr %0, i64 120
  %7 = getelementptr inbounds i8, ptr %0, i64 60
  %8 = getelementptr inbounds i8, ptr %0, i64 72
  br label %9

9:                                                ; preds = %.lr.ph, %32
  %10 = phi i32 [ %4, %.lr.ph ], [ %37, %32 ]
  %.025 = phi i32 [ 0, %.lr.ph ], [ %36, %32 ]
  %11 = lshr i32 %10, 1
  %12 = add i32 %11, %.025
  %13 = urem i32 %12, %10
  %14 = load ptr, ptr %5, align 8, !tbaa !12
  %15 = zext i32 %13 to i64
  %16 = getelementptr inbounds i8, ptr %14, i64 %15
  %17 = load i8, ptr %16, align 1, !tbaa !13
  switch i8 %17, label %25 [
    i8 0, label %32
    i8 1, label %18
  ]

18:                                               ; preds = %9
  %19 = load ptr, ptr %6, align 8, !tbaa !14
  %20 = tail call i32 @msequence_advance(ptr noundef %19) #2
  %.not = icmp eq i32 %20, 0
  %21 = load float, ptr %7, align 4, !tbaa !15
  %22 = fneg float %21
  %23 = select i1 %.not, float %22, float %21
  %24 = insertelement <2 x float> <float poison, float 0.000000e+00>, float %23, i64 0
  br label %32

25:                                               ; preds = %9
  %26 = getelementptr inbounds { float, float }, ptr %1, i64 %15
  %27 = load <2 x float>, ptr %26, align 4
  %28 = load float, ptr %7, align 4, !tbaa !15
  %29 = insertelement <2 x float> poison, float %28, i64 0
  %30 = shufflevector <2 x float> %29, <2 x float> poison, <2 x i32> zeroinitializer
  %31 = fmul <2 x float> %27, %30
  br label %32

32:                                               ; preds = %9, %25, %18
  %33 = phi <2 x float> [ %31, %25 ], [ %24, %18 ], [ zeroinitializer, %9 ]
  %34 = load ptr, ptr %8, align 8, !tbaa !16
  %35 = getelementptr inbounds { float, float }, ptr %34, i64 %15
  store <2 x float> %33, ptr %35, align 4
  %36 = add nuw i32 %.025, 1
  %37 = load i32, ptr %0, align 8, !tbaa !5
  %38 = icmp ult i32 %36, %37
  br i1 %38, label %9, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %32, %3
  %39 = getelementptr inbounds i8, ptr %0, i64 64
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = tail call i32 @fft_execute(ptr noundef %40) #2
  %42 = tail call i32 @ofdmframegen_gensymbol(ptr noundef nonnull %0, ptr noundef %2)
  ret i32 %42
}

declare i32 @msequence_advance(ptr noundef) local_unnamed_addr #1

declare i32 @fft_execute(ptr 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 = !{!"ofdmframegen_s", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !11, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120}
!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 8}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !10, i64 120}
!15 = !{!6, !11, i64 60}
!16 = !{!6, !10, i64 72}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !10, i64 64}


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