; LLVM IR from jgaeddert/liquid-dsp :: src/multichannel/src/ofdmframe.common (ofdmframe_validate_sctype)

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

@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [70 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

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

17:                                               ; preds = %65, %5
  %18 = load i32, ptr %15, align 4, !tbaa !9
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = icmp ult i32 %18, %19
  br i1 %20, label %21, label %68

21:                                               ; preds = %17
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = load i32, ptr %15, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds i8, ptr %22, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = zext i8 %26 to i32
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %32

29:                                               ; preds = %21
  %30 = load i32, ptr %12, align 4, !tbaa !9
  %31 = add i32 %30, 1
  store i32 %31, ptr %12, align 4, !tbaa !9
  br label %64

32:                                               ; preds = %21
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load i32, ptr %15, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %33, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !11
  %38 = zext i8 %37 to i32
  %39 = icmp eq i32 %38, 1
  br i1 %39, label %40, label %43

40:                                               ; preds = %32
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = add i32 %41, 1
  store i32 %42, ptr %13, align 4, !tbaa !9
  br label %63

43:                                               ; preds = %32
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i32, ptr %15, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds i8, ptr %44, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = zext i8 %48 to i32
  %50 = icmp eq i32 %49, 2
  br i1 %50, label %51, label %54

51:                                               ; preds = %43
  %52 = load i32, ptr %14, align 4, !tbaa !9
  %53 = add i32 %52, 1
  store i32 %53, ptr %14, align 4, !tbaa !9
  br label %62

54:                                               ; preds = %43
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds i8, ptr %55, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !11
  %60 = zext i8 %59 to i32
  %61 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 293, ptr noundef @.str.9, i32 noundef %60)
  store i32 %61, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %104

62:                                               ; preds = %51
  br label %63

63:                                               ; preds = %62, %40
  br label %64

64:                                               ; preds = %63, %29
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %15, align 4, !tbaa !9
  %67 = add i32 %66, 1
  store i32 %67, ptr %15, align 4, !tbaa !9
  br label %17, !llvm.loop !12

68:                                               ; preds = %17
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = load i32, ptr %14, align 4, !tbaa !9
  %71 = add i32 %69, %70
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %68
  %74 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 299, ptr noundef @.str.10)
  store i32 %74, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %104

75:                                               ; preds = %68
  %76 = load i32, ptr %14, align 4, !tbaa !9
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %80

78:                                               ; preds = %75
  %79 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 301, ptr noundef @.str.11)
  store i32 %79, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %104

80:                                               ; preds = %75
  %81 = load i32, ptr %13, align 4, !tbaa !9
  %82 = icmp ult i32 %81, 2
  br i1 %82, label %83, label %85

83:                                               ; preds = %80
  %84 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 303, ptr noundef @.str.12)
  store i32 %84, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %104

85:                                               ; preds = %80
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %91

88:                                               ; preds = %85
  %89 = load i32, ptr %12, align 4, !tbaa !9
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %89, ptr %90, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %88, %85
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %97

94:                                               ; preds = %91
  %95 = load i32, ptr %13, align 4, !tbaa !9
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %95, ptr %96, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %94, %91
  %98 = load ptr, ptr %11, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %103

100:                                              ; preds = %97
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %101, ptr %102, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %100, %97
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %104

104:                                              ; preds = %103, %83, %78, %73, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  %105 = load i32, ptr %6, align 4
  ret i32 %105
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [70 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ofdmframe_validate_sctype(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef writeonly %2, ptr noundef writeonly %3, ptr noundef writeonly %4) local_unnamed_addr #1 {
  %.not48 = icmp eq i32 %1, 0
  br i1 %.not48, label %._crit_edge.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %wide.trip.count = zext i32 %1 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %17 ]
  %.02744 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %17 ]
  %.02843 = phi i32 [ 0, %.lr.ph.preheader ], [ %.129, %17 ]
  %.03042 = phi i32 [ 0, %.lr.ph.preheader ], [ %.131, %17 ]
  %6 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %7 = load i8, ptr %6, align 1, !tbaa !5
  switch i8 %7, label %14 [
    i8 0, label %8
    i8 1, label %10
    i8 2, label %12
  ]

8:                                                ; preds = %.lr.ph
  %9 = add i32 %.03042, 1
  br label %17

10:                                               ; preds = %.lr.ph
  %11 = add i32 %.02843, 1
  br label %17

12:                                               ; preds = %.lr.ph
  %13 = add i32 %.02744, 1
  br label %17

14:                                               ; preds = %.lr.ph
  %15 = zext i8 %7 to i32
  %16 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 293, ptr noundef nonnull @.str.9, i32 noundef %15) #2
  br label %35

17:                                               ; preds = %8, %12, %10
  %.131 = phi i32 [ %9, %8 ], [ %.03042, %10 ], [ %.03042, %12 ]
  %.129 = phi i32 [ %.02843, %8 ], [ %11, %10 ], [ %.02843, %12 ]
  %.1 = phi i32 [ %.02744, %8 ], [ %.02744, %10 ], [ %13, %12 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !8

._crit_edge:                                      ; preds = %17
  %18 = sub i32 0, %.1
  %19 = icmp eq i32 %.129, %18
  br i1 %19, label %._crit_edge.thread, label %21

._crit_edge.thread:                               ; preds = %5, %._crit_edge
  %20 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 299, ptr noundef nonnull @.str.10) #2
  br label %35

21:                                               ; preds = %._crit_edge
  %22 = icmp eq i32 %.1, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %21
  %24 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 301, ptr noundef nonnull @.str.11) #2
  br label %35

25:                                               ; preds = %21
  %26 = icmp ult i32 %.129, 2
  br i1 %26, label %27, label %29

27:                                               ; preds = %25
  %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) #2
  br label %35

29:                                               ; preds = %25
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %31, label %30

30:                                               ; preds = %29
  store i32 %.131, ptr %2, align 4, !tbaa !10
  br label %31

31:                                               ; preds = %30, %29
  %.not37 = icmp eq ptr %3, null
  br i1 %.not37, label %33, label %32

32:                                               ; preds = %31
  store i32 %.129, ptr %3, align 4, !tbaa !10
  br label %33

33:                                               ; preds = %32, %31
  %.not38 = icmp eq ptr %4, null
  br i1 %.not38, label %35, label %34

34:                                               ; preds = %33
  store i32 %.1, ptr %4, align 4, !tbaa !10
  br label %35

35:                                               ; preds = %33, %34, %27, %23, %._crit_edge.thread, %14
  %.032 = phi i32 [ %16, %14 ], [ %20, %._crit_edge.thread ], [ %24, %23 ], [ %28, %27 ], [ 0, %34 ], [ 0, %33 ]
  ret i32 %.032
}

attributes #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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}


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