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

@ofdmflexframegenprops_default = external hidden global %struct.ofdmflexframegenprops_s, align 4
@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [67 x i8], align 1

; 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) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @ofdmflexframegen_setprops(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %11

8:                                                ; preds = %2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = call i32 @ofdmflexframegen_setprops(ptr noundef %9, ptr noundef @ofdmflexframegenprops_default)
  store i32 %10, ptr %3, align 4
  br label %48

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.ofdmflexframegenprops_s, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %21, label %16

16:                                               ; preds = %11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ofdmflexframegenprops_s, ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = icmp uge i32 %19, 7
  br i1 %20, label %21, label %23

21:                                               ; preds = %16, %11
  %22 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 303, ptr noundef @.str.12)
  store i32 %22, ptr %3, align 4
  br label %48

23:                                               ; preds = %16
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ofdmflexframegenprops_s, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !12
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %33, label %28

28:                                               ; preds = %23
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ofdmflexframegenprops_s, ptr %29, i32 0, i32 2
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %28, %23
  %34 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 305, ptr noundef @.str.13)
  store i32 %34, ptr %3, align 4
  br label %48

35:                                               ; preds = %28
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ofdmflexframegenprops_s, ptr %36, i32 0, i32 3
  %38 = load i32, ptr %37, align 4, !tbaa !14
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 307, ptr noundef @.str.14)
  store i32 %41, ptr %3, align 4
  br label %48

42:                                               ; preds = %35
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ofdmflexframegen_s, ptr %43, i32 0, i32 38
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memmove.p0.p0.i64(ptr align 8 %44, ptr align 4 %45, i64 16, i1 false)
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = call i32 @ofdmflexframegen_reconfigure(ptr noundef %46)
  store i32 %47, ptr %3, align 4
  br label %48

48:                                               ; preds = %42, %40, %33, %21, %8
  %49 = load i32, ptr %3, align 4
  ret i32 %49
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @ofdmflexframegen_reconfigure(ptr noundef) #1

attributes #0 = { nocallback nofree 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" }

!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 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !11, i64 12}


; 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"

%struct.ofdmflexframegenprops_s = type { i32, i32, i32, i32 }

@ofdmflexframegenprops_default = external hidden local_unnamed_addr global %struct.ofdmflexframegenprops_s, align 4
@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [67 x i8], align 1

; 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) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @ofdmflexframegen_setprops(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #1 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %4, label %24

4:                                                ; preds = %2
  %5 = load i32, ptr @ofdmflexframegenprops_default, align 4, !tbaa !5
  %6 = add i32 %5, -7
  %or.cond.i = icmp ult i32 %6, -6
  br i1 %or.cond.i, label %7, label %9

7:                                                ; preds = %4
  %8 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 303, ptr noundef nonnull @.str.12) #4
  br label %ofdmflexframegen_setprops.exit

9:                                                ; preds = %4
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @ofdmflexframegenprops_default, i64 4), align 4, !tbaa !10
  %11 = icmp eq i32 %10, 0
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @ofdmflexframegenprops_default, i64 8), align 4
  %13 = icmp eq i32 %12, 0
  %or.cond13 = select i1 %11, i1 true, i1 %13
  br i1 %or.cond13, label %14, label %16

14:                                               ; preds = %9
  %15 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 305, ptr noundef nonnull @.str.13) #4
  br label %ofdmflexframegen_setprops.exit

16:                                               ; preds = %9
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @ofdmflexframegenprops_default, i64 12), align 4, !tbaa !11
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %16
  %20 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 307, ptr noundef nonnull @.str.14) #4
  br label %ofdmflexframegen_setprops.exit

21:                                               ; preds = %16
  %22 = getelementptr inbounds i8, ptr %0, i64 216
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(16) @ofdmflexframegenprops_default, i64 16, i1 false)
  %23 = tail call i32 @ofdmflexframegen_reconfigure(ptr noundef %0)
  br label %ofdmflexframegen_setprops.exit

24:                                               ; preds = %2
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = add i32 %25, -7
  %or.cond = icmp ult i32 %26, -6
  br i1 %or.cond, label %27, label %29

27:                                               ; preds = %24
  %28 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 303, ptr noundef nonnull @.str.12) #4
  br label %ofdmflexframegen_setprops.exit

29:                                               ; preds = %24
  %30 = getelementptr inbounds i8, ptr %1, i64 4
  %31 = load i32, ptr %30, align 4, !tbaa !10
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %37, label %33

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %1, i64 8
  %35 = load i32, ptr %34, align 4, !tbaa !12
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %39

37:                                               ; preds = %33, %29
  %38 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 305, ptr noundef nonnull @.str.13) #4
  br label %ofdmflexframegen_setprops.exit

39:                                               ; preds = %33
  %40 = getelementptr inbounds i8, ptr %1, i64 12
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %39
  %44 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 307, ptr noundef nonnull @.str.14) #4
  br label %ofdmflexframegen_setprops.exit

45:                                               ; preds = %39
  %46 = getelementptr inbounds i8, ptr %0, i64 216
  tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull align 4 dereferenceable(16) %1, i64 16, i1 false)
  %47 = tail call i32 @ofdmflexframegen_reconfigure(ptr noundef %0)
  br label %ofdmflexframegen_setprops.exit

ofdmflexframegen_setprops.exit:                   ; preds = %21, %19, %14, %7, %45, %43, %37, %27
  %.0 = phi i32 [ %28, %27 ], [ %38, %37 ], [ %44, %43 ], [ %47, %45 ], [ %8, %7 ], [ %15, %14 ], [ %20, %19 ], [ %23, %21 ]
  ret i32 %.0
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

attributes #0 = { mustprogress nocallback nofree 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 12}
!12 = !{!6, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InlinerPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass