; LLVM IR from jgaeddert/liquid-dsp :: src/fec/src (fec_secded2216)

; 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 [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__.fec_secded2216_decode = external hidden unnamed_addr constant [79 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

; 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 @fec_secded2216_decode_symbol(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @fec_secded2216_decode(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [3 x i8], align 1
  %13 = alloca [2 x i8], align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = urem i32 %14, 2
  store i32 %15, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %34, %4
  %17 = load i32, ptr %9, align 4, !tbaa !9
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = load i32, ptr %11, align 4, !tbaa !9
  %20 = sub i32 %18, %19
  %21 = icmp ult i32 %17, %20
  br i1 %21, label %22, label %37

22:                                               ; preds = %16
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %27, i64 %29
  %31 = call i32 @fec_secded2216_decode_symbol(ptr noundef %26, ptr noundef %30)
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = add i32 %32, 3
  store i32 %33, ptr %10, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %22
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = add i32 %35, 2
  store i32 %36, ptr %9, align 4, !tbaa !9
  br label %16, !llvm.loop !11

37:                                               ; preds = %16
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %71

40:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 3, ptr %12) #4
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = add i32 %42, 0
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %41, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !13
  store i8 %46, ptr %12, align 1, !tbaa !13
  %47 = getelementptr inbounds i8, ptr %12, i64 1
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = add i32 %49, 1
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds i8, ptr %48, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !13
  store i8 %53, ptr %47, align 1, !tbaa !13
  %54 = getelementptr inbounds i8, ptr %12, i64 2
  store i8 0, ptr %54, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %13) #4
  %55 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  %56 = getelementptr inbounds [2 x i8], ptr %13, i64 0, i64 0
  %57 = call i32 @fec_secded2216_decode_symbol(ptr noundef %55, ptr noundef %56)
  %58 = getelementptr inbounds [2 x i8], ptr %13, i64 0, i64 0
  %59 = load i8, ptr %58, align 1, !tbaa !13
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %60, i64 %62
  store i8 %59, ptr %63, align 1, !tbaa !13
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = add i32 %65, %64
  store i32 %66, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = add i32 %67, 1
  %69 = load i32, ptr %10, align 4, !tbaa !9
  %70 = add i32 %69, %68
  store i32 %70, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr %12) #4
  br label %71

71:                                               ; preds = %40, %37
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = call i32 @fec_get_enc_msg_length(i32 noundef 8, i32 noundef %73)
  %75 = icmp eq i32 %72, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %71
  br label %78

77:                                               ; preds = %71
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 326, ptr noundef @__PRETTY_FUNCTION__.fec_secded2216_decode) #5
  unreachable

78:                                               ; preds = %76
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = icmp eq i32 %79, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %78
  br label %84

83:                                               ; preds = %78
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 327, ptr noundef @__PRETTY_FUNCTION__.fec_secded2216_decode) #5
  unreachable

84:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret i32 0
}

declare i32 @fec_get_enc_msg_length(i32 noundef, i32 noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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 = { noreturn nounwind "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 #4 = { nounwind }
attributes #5 = { noreturn 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}


; 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 [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__.fec_secded2216_decode = external hidden unnamed_addr constant [79 x i8], align 1

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

; Function Attrs: mustprogress 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 @fec_secded2216_decode_symbol(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @fec_secded2216_decode(ptr nocapture noundef readnone %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca [3 x i8], align 1
  %6 = alloca [2 x i8], align 1
  %7 = and i32 %1, 1
  %8 = and i32 %1, -2
  %.not30 = icmp eq i32 %8, 0
  br i1 %.not30, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %4
  %9 = zext i32 %8 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.02427 = phi i32 [ 0, %.lr.ph.preheader ], [ %14, %.lr.ph ]
  %10 = zext i32 %.02427 to i64
  %11 = getelementptr inbounds i8, ptr %2, i64 %10
  %12 = getelementptr inbounds i8, ptr %3, i64 %indvars.iv
  %13 = tail call i32 @fec_secded2216_decode_symbol(ptr noundef %11, ptr noundef %12)
  %14 = add i32 %.02427, 3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %15 = icmp ult i64 %indvars.iv.next, %9
  br i1 %15, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !5

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %16 = trunc nuw i64 %indvars.iv.next to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %4
  %.024.lcssa = phi i32 [ 0, %4 ], [ %14, %._crit_edge.loopexit ]
  %.0.lcssa = phi i32 [ 0, %4 ], [ %16, %._crit_edge.loopexit ]
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %33, label %17

17:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %5) #4
  %18 = zext i32 %.024.lcssa to i64
  %19 = getelementptr inbounds i8, ptr %2, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !7
  store i8 %20, ptr %5, align 1, !tbaa !7
  %21 = getelementptr inbounds i8, ptr %5, i64 1
  %22 = add i32 %.024.lcssa, 1
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %2, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !7
  store i8 %25, ptr %21, align 1, !tbaa !7
  %26 = getelementptr inbounds i8, ptr %5, i64 2
  store i8 0, ptr %26, align 1, !tbaa !7
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) #4
  %27 = call i32 @fec_secded2216_decode_symbol(ptr noundef nonnull %5, ptr noundef nonnull %6)
  %28 = load i8, ptr %6, align 1, !tbaa !7
  %29 = zext i32 %.0.lcssa to i64
  %30 = getelementptr inbounds i8, ptr %3, i64 %29
  store i8 %28, ptr %30, align 1, !tbaa !7
  %31 = or disjoint i32 %.0.lcssa, 1
  %32 = add i32 %.024.lcssa, 2
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %5) #4
  br label %33

33:                                               ; preds = %17, %._crit_edge
  %.125 = phi i32 [ %32, %17 ], [ %.024.lcssa, %._crit_edge ]
  %.1 = phi i32 [ %31, %17 ], [ %.0.lcssa, %._crit_edge ]
  %34 = call i32 @fec_get_enc_msg_length(i32 noundef 8, i32 noundef %1) #4
  %35 = icmp eq i32 %.125, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 326, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_secded2216_decode) #5
  unreachable

37:                                               ; preds = %33
  %38 = icmp eq i32 %.1, %1
  br i1 %38, label %40, label %39

39:                                               ; preds = %37
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 327, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_secded2216_decode) #5
  unreachable

40:                                               ; preds = %37
  ret i32 0
}

declare i32 @fec_get_enc_msg_length(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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


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