; LLVM IR from jgaeddert/liquid-dsp :: src/framing/src (ofdmflexframegen)

; 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.ofdmflexframegen_s = type { i32, i32, i32, ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ofdmflexframegenprops_s, %struct.ofdmflexframegenprops_s }
%struct.ofdmflexframegenprops_s = type { i32, i32, i32, i32 }

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

6:                                                ; preds = %80, %1
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = icmp ult i32 %7, %10
  br i1 %11, label %12, label %83

12:                                               ; preds = %6
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds i8, ptr %15, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !15
  %20 = zext i8 %19 to i32
  store i32 %20, ptr %4, align 4, !tbaa !9
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 2
  br i1 %22, label %23, label %70

23:                                               ; preds = %12
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %24, i32 0, i32 37
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %27, i32 0, i32 31
  %29 = load i32, ptr %28, align 4, !tbaa !17
  %30 = icmp ult i32 %26, %29
  br i1 %30, label %31, label %53

31:                                               ; preds = %23
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %32, i32 0, i32 27
  %34 = load ptr, ptr %33, align 8, !tbaa !18
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %35, i32 0, i32 29
  %37 = load ptr, ptr %36, align 8, !tbaa !19
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %38, i32 0, i32 37
  %40 = load i32, ptr %39, align 4, !tbaa !16
  %41 = add i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !16
  %42 = zext i32 %40 to i64
  %43 = getelementptr inbounds i8, ptr %37, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !15
  %45 = zext i8 %44 to i32
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %46, i32 0, i32 10
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds { float, float }, ptr %48, i64 %50
  %52 = call i32 @modemcf_modulate(ptr noundef %34, i32 noundef %45, ptr noundef %51)
  br label %69

53:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %54, i32 0, i32 27
  %56 = load ptr, ptr %55, align 8, !tbaa !18
  %57 = call i32 @modemcf_gen_rand_sym(ptr noundef %56)
  store i32 %57, ptr %5, align 4, !tbaa !9
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %58, i32 0, i32 27
  %60 = load ptr, ptr %59, align 8, !tbaa !18
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %62, i32 0, i32 10
  %64 = load ptr, ptr %63, align 8, !tbaa !20
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds { float, float }, ptr %64, i64 %66
  %68 = call i32 @modemcf_modulate(ptr noundef %60, i32 noundef %61, ptr noundef %67)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %69

69:                                               ; preds = %53, %31
  br label %79

70:                                               ; preds = %12
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %71, i32 0, i32 10
  %73 = load ptr, ptr %72, align 8, !tbaa !20
  %74 = load i32, ptr %3, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds { float, float }, ptr %73, i64 %75
  %77 = getelementptr inbounds { float, float }, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds { float, float }, ptr %76, i32 0, i32 1
  store float 0.000000e+00, ptr %77, align 4
  store float 0.000000e+00, ptr %78, align 4
  br label %79

79:                                               ; preds = %70, %69
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %3, align 4, !tbaa !9
  %82 = add i32 %81, 1
  store i32 %82, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !21

83:                                               ; preds = %6
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %84, i32 0, i32 13
  %86 = load ptr, ptr %85, align 8, !tbaa !23
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %87, i32 0, i32 10
  %89 = load ptr, ptr %88, align 8, !tbaa !20
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %90, i32 0, i32 11
  %92 = load ptr, ptr %91, align 8, !tbaa !24
  %93 = call i32 @ofdmframegen_writesymbol(ptr noundef %86, ptr noundef %89, ptr noundef %92)
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %94, i32 0, i32 32
  %96 = load i32, ptr %95, align 8, !tbaa !25
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %97, i32 0, i32 15
  %99 = load i32, ptr %98, align 4, !tbaa !26
  %100 = icmp eq i32 %96, %99
  br i1 %100, label %101, label %104

101:                                              ; preds = %83
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %102, i32 0, i32 33
  store i32 5, ptr %103, align 4, !tbaa !27
  br label %104

104:                                              ; preds = %101, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

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

declare i32 @modemcf_gen_rand_sym(ptr noundef) #2

declare i32 @ofdmframegen_writesymbol(ptr noundef, ptr noundef, 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 = !{!"ofdmflexframegen_s", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !6, i64 48, !6, i64 56, !10, i64 64, !6, i64 72, !10, i64 80, !10, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !13, i64 216, !13, i64 232}
!13 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!14 = !{!12, !6, i64 16}
!15 = !{!7, !7, i64 0}
!16 = !{!12, !10, i64 212}
!17 = !{!12, !10, i64 188}
!18 = !{!12, !6, i64 160}
!19 = !{!12, !6, i64 176}
!20 = !{!12, !6, i64 48}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!12, !6, i64 72}
!24 = !{!12, !6, i64 56}
!25 = !{!12, !10, i64 192}
!26 = !{!12, !10, i64 84}
!27 = !{!12, !10, i64 196}


; 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 @ofdmflexframegen_gen_payload(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  %5 = getelementptr inbounds i8, ptr %0, i64 212
  %6 = getelementptr inbounds i8, ptr %0, i64 188
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  br label %9

9:                                                ; preds = %.lr.ph, %38
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %38 ]
  %10 = load ptr, ptr %3, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %10, i64 %indvars.iv
  %12 = load i8, ptr %11, align 1, !tbaa !13
  %13 = icmp eq i8 %12, 2
  br i1 %13, label %14, label %35

14:                                               ; preds = %9
  %15 = load i32, ptr %5, align 4, !tbaa !14
  %16 = load i32, ptr %6, align 4, !tbaa !15
  %17 = icmp ult i32 %15, %16
  %18 = load ptr, ptr %7, align 8, !tbaa !16
  br i1 %17, label %19, label %29

19:                                               ; preds = %14
  %20 = load ptr, ptr %8, align 8, !tbaa !17
  %21 = add nuw i32 %15, 1
  store i32 %21, ptr %5, align 4, !tbaa !14
  %22 = zext i32 %15 to i64
  %23 = getelementptr inbounds i8, ptr %20, i64 %22
  %24 = load i8, ptr %23, align 1, !tbaa !13
  %25 = zext i8 %24 to i32
  %26 = load ptr, ptr %4, align 8, !tbaa !18
  %27 = getelementptr inbounds { float, float }, ptr %26, i64 %indvars.iv
  %28 = tail call i32 @modemcf_modulate(ptr noundef %18, i32 noundef %25, ptr noundef %27) #2
  br label %38

29:                                               ; preds = %14
  %30 = tail call i32 @modemcf_gen_rand_sym(ptr noundef %18) #2
  %31 = load ptr, ptr %7, align 8, !tbaa !16
  %32 = load ptr, ptr %4, align 8, !tbaa !18
  %33 = getelementptr inbounds { float, float }, ptr %32, i64 %indvars.iv
  %34 = tail call i32 @modemcf_modulate(ptr noundef %31, i32 noundef %30, ptr noundef %33) #2
  br label %38

35:                                               ; preds = %9
  %36 = load ptr, ptr %4, align 8, !tbaa !18
  %37 = getelementptr inbounds { float, float }, ptr %36, i64 %indvars.iv
  store <2 x float> zeroinitializer, ptr %37, align 4
  br label %38

38:                                               ; preds = %35, %29, %19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = load i32, ptr %0, align 8, !tbaa !5
  %40 = zext i32 %39 to i64
  %41 = icmp ult i64 %indvars.iv.next, %40
  br i1 %41, label %9, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %38, %1
  %42 = getelementptr inbounds i8, ptr %0, i64 72
  %43 = load ptr, ptr %42, align 8, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %0, i64 48
  %45 = load ptr, ptr %44, align 8, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %0, i64 56
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = tail call i32 @ofdmframegen_writesymbol(ptr noundef %43, ptr noundef %45, ptr noundef %47) #2
  %49 = getelementptr inbounds i8, ptr %0, i64 192
  %50 = load i32, ptr %49, align 8, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %0, i64 84
  %52 = load i32, ptr %51, align 4, !tbaa !24
  %53 = icmp eq i32 %50, %52
  br i1 %53, label %54, label %56

54:                                               ; preds = %._crit_edge
  %55 = getelementptr inbounds i8, ptr %0, i64 196
  store i32 5, ptr %55, align 4, !tbaa !25
  br label %56

56:                                               ; preds = %54, %._crit_edge
  ret i32 0
}

declare i32 @modemcf_modulate(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @modemcf_gen_rand_sym(ptr noundef) local_unnamed_addr #1

declare i32 @ofdmframegen_writesymbol(ptr noundef, ptr noundef, 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 = !{!"ofdmflexframegen_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, !10, i64 48, !10, i64 56, !7, i64 64, !10, i64 72, !7, i64 80, !7, i64 84, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !7, i64 184, !7, i64 188, !7, i64 192, !7, i64 196, !7, i64 200, !7, i64 204, !7, i64 208, !7, i64 212, !11, i64 216, !11, i64 232}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!12 = !{!6, !10, i64 16}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !7, i64 212}
!15 = !{!6, !7, i64 188}
!16 = !{!6, !10, i64 160}
!17 = !{!6, !10, i64 176}
!18 = !{!6, !10, i64 48}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !10, i64 72}
!22 = !{!6, !10, i64 56}
!23 = !{!6, !7, i64 192}
!24 = !{!6, !7, i64 84}
!25 = !{!6, !7, i64 196}


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