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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @fec_secded2216_compute_parity(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @fec_secded2216_encode_symbol(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @fec_secded2216_encode(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %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 [2 x i8], align 1
  %13 = alloca [3 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 = %57, %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 %60

22:                                               ; preds = %16
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  %27 = call zeroext i8 @fec_secded2216_compute_parity(ptr noundef %26)
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = add i32 %29, 0
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %28, i64 %31
  store i8 %27, ptr %32, align 1, !tbaa !11
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = add i32 %34, 0
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %33, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !11
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = add i32 %40, 1
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds i8, ptr %39, i64 %42
  store i8 %38, ptr %43, align 1, !tbaa !11
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = add i32 %45, 1
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr %44, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = add i32 %51, 2
  %53 = zext i32 %52 to i64
  %54 = getelementptr inbounds i8, ptr %50, i64 %53
  store i8 %49, ptr %54, align 1, !tbaa !11
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = add i32 %55, 3
  store i32 %56, ptr %10, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %22
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = add i32 %58, 2
  store i32 %59, ptr %9, align 4, !tbaa !9
  br label %16, !llvm.loop !12

60:                                               ; preds = %16
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %94

63:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #4
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds i8, ptr %64, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !11
  store i8 %68, ptr %12, align 1, !tbaa !11
  %69 = getelementptr inbounds i8, ptr %12, i64 1
  store i8 0, ptr %69, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 3, ptr %13) #4
  %70 = getelementptr inbounds [2 x i8], ptr %12, i64 0, i64 0
  %71 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 0
  %72 = call i32 @fec_secded2216_encode_symbol(ptr noundef %70, ptr noundef %71)
  %73 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 0
  %74 = load i8, ptr %73, align 1, !tbaa !11
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = add i32 %76, 0
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %75, i64 %78
  store i8 %74, ptr %79, align 1, !tbaa !11
  %80 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 1
  %81 = load i8, ptr %80, align 1, !tbaa !11
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = add i32 %83, 1
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %82, i64 %85
  store i8 %81, ptr %86, align 1, !tbaa !11
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = load i32, ptr %9, align 4, !tbaa !9
  %89 = add i32 %88, %87
  store i32 %89, ptr %9, align 4, !tbaa !9
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = add i32 %90, 1
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = add i32 %92, %91
  store i32 %93, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 3, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #4
  br label %94

94:                                               ; preds = %63, %60
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = call i32 @fec_get_enc_msg_length(i32 noundef 8, i32 noundef %96)
  %98 = icmp eq i32 %95, %97
  br i1 %98, label %99, label %100

99:                                               ; preds = %94
  br label %101

100:                                              ; preds = %94
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 276, ptr noundef @__PRETTY_FUNCTION__.fec_secded2216_encode) #5
  unreachable

101:                                              ; preds = %99
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = load i32, ptr %6, align 4, !tbaa !9
  %104 = icmp eq i32 %102, %103
  br i1 %104, label %105, label %106

105:                                              ; preds = %101
  br label %107

106:                                              ; preds = %101
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 277, ptr noundef @__PRETTY_FUNCTION__.fec_secded2216_encode) #5
  unreachable

107:                                              ; preds = %105
  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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!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 [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@__PRETTY_FUNCTION__.fec_secded2216_encode = external hidden unnamed_addr constant [79 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @fec_secded2216_compute_parity(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @fec_secded2216_encode_symbol(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @fec_secded2216_encode(ptr nocapture noundef readnone %0, i32 noundef %1, ptr noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = alloca [2 x i8], align 1
  %6 = alloca [3 x i8], align 1
  %7 = and i32 %1, 1
  %8 = and i32 %1, -2
  %.not38 = icmp eq i32 %8, 0
  br i1 %.not38, 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 ]
  %.03235 = phi i32 [ 0, %.lr.ph.preheader ], [ %24, %.lr.ph ]
  %10 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  %11 = tail call zeroext i8 @fec_secded2216_compute_parity(ptr noundef %10)
  %12 = zext i32 %.03235 to i64
  %13 = getelementptr inbounds i8, ptr %3, i64 %12
  store i8 %11, ptr %13, align 1, !tbaa !5
  %14 = load i8, ptr %10, align 1, !tbaa !5
  %15 = add i32 %.03235, 1
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %3, i64 %16
  store i8 %14, ptr %17, align 1, !tbaa !5
  %18 = or disjoint i64 %indvars.iv, 1
  %19 = getelementptr inbounds i8, ptr %2, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !5
  %21 = add i32 %.03235, 2
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %3, i64 %22
  store i8 %20, ptr %23, align 1, !tbaa !5
  %24 = add i32 %.03235, 3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %25 = icmp ult i64 %indvars.iv.next, %9
  br i1 %25, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !8

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %4
  %.032.lcssa = phi i32 [ 0, %4 ], [ %24, %._crit_edge.loopexit ]
  %.0.lcssa = phi i32 [ 0, %4 ], [ %26, %._crit_edge.loopexit ]
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %43, label %27

27:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #4
  %28 = zext i32 %.0.lcssa to i64
  %29 = getelementptr inbounds i8, ptr %2, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !5
  store i8 %30, ptr %5, align 1, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %5, i64 1
  store i8 0, ptr %31, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %6) #4
  %32 = call i32 @fec_secded2216_encode_symbol(ptr noundef nonnull %5, ptr noundef nonnull %6)
  %33 = load i8, ptr %6, align 1, !tbaa !5
  %34 = zext i32 %.032.lcssa to i64
  %35 = getelementptr inbounds i8, ptr %3, i64 %34
  store i8 %33, ptr %35, align 1, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %6, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !5
  %38 = add i32 %.032.lcssa, 1
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %3, i64 %39
  store i8 %37, ptr %40, align 1, !tbaa !5
  %41 = or disjoint i32 %.0.lcssa, 1
  %42 = add i32 %.032.lcssa, 2
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #4
  br label %43

43:                                               ; preds = %27, %._crit_edge
  %.133 = phi i32 [ %42, %27 ], [ %.032.lcssa, %._crit_edge ]
  %.1 = phi i32 [ %41, %27 ], [ %.0.lcssa, %._crit_edge ]
  %44 = call i32 @fec_get_enc_msg_length(i32 noundef 8, i32 noundef %1) #4
  %45 = icmp eq i32 %.133, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %43
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 276, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_secded2216_encode) #5
  unreachable

47:                                               ; preds = %43
  %48 = icmp eq i32 %.1, %1
  br i1 %48, label %50, label %49

49:                                               ; preds = %47
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 277, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_secded2216_encode) #5
  unreachable

50:                                               ; preds = %47
  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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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