; 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
define dso_local i32 @ofdmframegen_write_S0a(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %7

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

17:                                               ; preds = %7
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ofdmframegen_s, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = add i32 %18, %21
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ofdmframegen_s, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !14
  %26 = mul i32 2, %25
  %27 = sub i32 %22, %26
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ofdmframegen_s, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !11
  %31 = urem i32 %27, %30
  store i32 %31, ptr %6, align 4, !tbaa !9
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ofdmframegen_s, ptr %32, i32 0, i32 16
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds { float, float }, ptr %34, i64 %36
  %38 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 4
  %40 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 1
  %41 = load float, ptr %40, align 4
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds { float, float }, ptr %42, i64 %44
  %46 = getelementptr inbounds { float, float }, ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds { float, float }, ptr %45, i32 0, i32 1
  store float %39, ptr %46, align 4
  store float %41, ptr %47, align 4
  br label %48

48:                                               ; preds = %17
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = add i32 %49, 1
  store i32 %50, ptr %5, align 4, !tbaa !9
  br label %7, !llvm.loop !16

51:                                               ; preds = %7
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %78, %51
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ofdmframegen_s, ptr %54, i32 0, i32 3
  %56 = load i32, ptr %55, align 8, !tbaa !18
  %57 = icmp ult i32 %53, %56
  br i1 %57, label %58, label %81

58:                                               ; preds = %52
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ofdmframegen_s, ptr %59, i32 0, i32 4
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = load i32, ptr %5, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %61, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !20
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load i32, ptr %5, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds { float, float }, ptr %66, i64 %68
  %70 = getelementptr inbounds { float, float }, ptr %69, i32 0, i32 0
  %71 = load float, ptr %70, align 4
  %72 = getelementptr inbounds { float, float }, ptr %69, i32 0, i32 1
  %73 = load float, ptr %72, align 4
  %74 = fmul float %71, %65
  %75 = fmul float %73, %65
  %76 = getelementptr inbounds { float, float }, ptr %69, i32 0, i32 0
  %77 = getelementptr inbounds { float, float }, ptr %69, i32 0, i32 1
  store float %74, ptr %76, align 4
  store float %75, ptr %77, align 4
  br label %78

78:                                               ; preds = %58
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = add i32 %79, 1
  store i32 %80, ptr %5, align 4, !tbaa !9
  br label %52, !llvm.loop !21

81:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i32 0
}

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 = { 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, !10, i64 4}
!15 = !{!12, !6, i64 96}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!12, !10, i64 16}
!19 = !{!12, !6, i64 24}
!20 = !{!13, !13, i64 0}
!21 = distinct !{!21, !17}


; 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: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local noundef i32 @ofdmframegen_write_S0a(ptr nocapture noundef readonly %0, ptr nocapture noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 4
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %5 = load i32, ptr %3, align 4, !tbaa !12
  %6 = sub i32 0, %4
  %.not = icmp eq i32 %5, %6
  br i1 %.not, label %.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  br label %11

.preheader:                                       ; preds = %11, %2
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load i32, ptr %8, align 8, !tbaa !13
  %.not22 = icmp eq i32 %9, 0
  br i1 %.not22, label %._crit_edge, label %.lr.ph20

.lr.ph20:                                         ; preds = %.preheader
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  br label %29

11:                                               ; preds = %.lr.ph, %11
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %11 ]
  %12 = phi i32 [ %5, %.lr.ph ], [ %25, %11 ]
  %13 = phi i32 [ %4, %.lr.ph ], [ %24, %11 ]
  %14 = trunc nuw i64 %indvars.iv to i32
  %15 = add i32 %13, %14
  %16 = shl i32 %12, 1
  %17 = sub i32 %15, %16
  %18 = urem i32 %17, %13
  %19 = load ptr, ptr %7, align 8, !tbaa !14
  %20 = zext i32 %18 to i64
  %21 = getelementptr inbounds { float, float }, ptr %19, i64 %20
  %22 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv
  %23 = load <2 x float>, ptr %21, align 4
  store <2 x float> %23, ptr %22, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr %0, align 8, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !12
  %26 = add i32 %25, %24
  %27 = zext i32 %26 to i64
  %28 = icmp ult i64 %indvars.iv.next, %27
  br i1 %28, label %11, label %.preheader, !llvm.loop !15

29:                                               ; preds = %.lr.ph20, %29
  %indvars.iv24 = phi i64 [ 0, %.lr.ph20 ], [ %indvars.iv.next25, %29 ]
  %30 = load ptr, ptr %10, align 8, !tbaa !17
  %31 = getelementptr inbounds float, ptr %30, i64 %indvars.iv24
  %32 = load float, ptr %31, align 4, !tbaa !18
  %33 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv24
  %34 = load <2 x float>, ptr %33, align 4
  %35 = insertelement <2 x float> poison, float %32, i64 0
  %36 = shufflevector <2 x float> %35, <2 x float> poison, <2 x i32> zeroinitializer
  %37 = fmul <2 x float> %36, %34
  store <2 x float> %37, ptr %33, align 4
  %indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
  %38 = load i32, ptr %8, align 8, !tbaa !13
  %39 = zext i32 %38 to i64
  %40 = icmp ult i64 %indvars.iv.next25, %39
  br i1 %40, label %29, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %29, %.preheader
  ret i32 0
}

attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) 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" }

!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, !7, i64 4}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !10, i64 96}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!6, !10, i64 24}
!18 = !{!11, !11, i64 0}
!19 = distinct !{!19, !16}


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