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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @fec_secded3932_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 [5 x i8], align 1
  %13 = alloca i32, align 4
  %14 = alloca [4 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
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = urem i32 %15, 4
  store i32 %16, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %17

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

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

35:                                               ; preds = %23
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = add i32 %36, 4
  store i32 %37, ptr %9, align 4, !tbaa !9
  br label %17, !llvm.loop !11

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

41:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 5, ptr %12) #4
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = add i32 %43, 0
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr %42, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !13
  store i8 %47, ptr %12, align 1, !tbaa !13
  %48 = getelementptr inbounds i8, ptr %12, i64 1
  store i8 0, ptr %48, align 1, !tbaa !13
  %49 = getelementptr inbounds i8, ptr %12, i64 2
  store i8 0, ptr %49, align 1, !tbaa !13
  %50 = getelementptr inbounds i8, ptr %12, i64 3
  store i8 0, ptr %50, align 1, !tbaa !13
  %51 = getelementptr inbounds i8, ptr %12, i64 4
  store i8 0, ptr %51, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %69, %41
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !9
  %55 = icmp ult i32 %53, %54
  br i1 %55, label %56, label %72

56:                                               ; preds = %52
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = add i32 %58, %59
  %61 = add i32 %60, 1
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %57, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !13
  %65 = load i32, ptr %13, align 4, !tbaa !9
  %66 = add i32 %65, 1
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds [5 x i8], ptr %12, i64 0, i64 %67
  store i8 %64, ptr %68, align 1, !tbaa !13
  br label %69

69:                                               ; preds = %56
  %70 = load i32, ptr %13, align 4, !tbaa !9
  %71 = add i32 %70, 1
  store i32 %71, ptr %13, align 4, !tbaa !9
  br label %52, !llvm.loop !14

72:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %73 = getelementptr inbounds [5 x i8], ptr %12, i64 0, i64 0
  %74 = getelementptr inbounds [4 x i8], ptr %14, i64 0, i64 0
  %75 = call i32 @fec_secded3932_decode_symbol(ptr noundef %73, ptr noundef %74)
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %91, %72
  %77 = load i32, ptr %13, align 4, !tbaa !9
  %78 = load i32, ptr %11, align 4, !tbaa !9
  %79 = icmp ult i32 %77, %78
  br i1 %79, label %80, label %94

80:                                               ; preds = %76
  %81 = load i32, ptr %13, align 4, !tbaa !9
  %82 = zext i32 %81 to i64
  %83 = getelementptr inbounds [4 x i8], ptr %14, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !13
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = load i32, ptr %9, align 4, !tbaa !9
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = add i32 %86, %87
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds i8, ptr %85, i64 %89
  store i8 %84, ptr %90, align 1, !tbaa !13
  br label %91

91:                                               ; preds = %80
  %92 = load i32, ptr %13, align 4, !tbaa !9
  %93 = add i32 %92, 1
  store i32 %93, ptr %13, align 4, !tbaa !9
  br label %76, !llvm.loop !15

94:                                               ; preds = %76
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = load i32, ptr %9, align 4, !tbaa !9
  %97 = add i32 %96, %95
  store i32 %97, ptr %9, align 4, !tbaa !9
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = add i32 %98, 1
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = add i32 %100, %99
  store i32 %101, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr %12) #4
  br label %102

102:                                              ; preds = %94, %38
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !9
  %105 = call i32 @fec_get_enc_msg_length(i32 noundef 9, i32 noundef %104)
  %106 = icmp eq i32 %103, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %102
  br label %109

108:                                              ; preds = %102
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 352, ptr noundef @__PRETTY_FUNCTION__.fec_secded3932_decode) #5
  unreachable

109:                                              ; preds = %107
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = load i32, ptr %6, align 4, !tbaa !9
  %112 = icmp eq i32 %110, %111
  br i1 %112, label %113, label %114

113:                                              ; preds = %109
  br label %115

114:                                              ; preds = %109
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 353, ptr noundef @__PRETTY_FUNCTION__.fec_secded3932_decode) #5
  unreachable

115:                                              ; preds = %113
  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}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !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"

@.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_secded3932_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_secded3932_decode_symbol(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @fec_secded3932_decode(ptr nocapture noundef readnone %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca [5 x i8], align 1
  %6 = alloca [4 x i8], align 1
  %7 = and i32 %1, 3
  %8 = and i32 %1, -4
  %.not44 = icmp eq i32 %8, 0
  br i1 %.not44, 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 ]
  %.03639 = phi i32 [ 0, %.lr.ph.preheader ], [ %14, %.lr.ph ]
  %10 = zext i32 %.03639 to i64
  %11 = getelementptr inbounds i8, ptr %2, i64 %10
  %12 = getelementptr inbounds i8, ptr %3, i64 %indvars.iv
  %13 = tail call i32 @fec_secded3932_decode_symbol(ptr noundef %11, ptr noundef %12)
  %14 = add i32 %.03639, 5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4
  %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
  %.036.lcssa = phi i32 [ 0, %4 ], [ %14, %._crit_edge.loopexit ]
  %.034.lcssa = phi i32 [ 0, %4 ], [ %16, %._crit_edge.loopexit ]
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %50, label %17

17:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %5) #4
  %18 = zext i32 %.036.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
  %wide.trip.count = zext nneg i32 %7 to i64
  store i32 0, ptr %21, align 1
  %22 = add i32 %.036.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
  %26 = getelementptr inbounds i8, ptr %5, i64 1
  store i8 %25, ptr %26, align 1, !tbaa !7
  %exitcond.not = icmp eq i32 %7, 1
  br i1 %exitcond.not, label %.unr-lcssa, label %27, !llvm.loop !10

27:                                               ; preds = %17
  %28 = add i32 %.036.lcssa, 2
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %2, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !7
  %32 = getelementptr inbounds i8, ptr %5, i64 2
  store i8 %31, ptr %32, align 1, !tbaa !7
  %exitcond.not.1 = icmp eq i32 %7, 2
  br i1 %exitcond.not.1, label %.unr-lcssa, label %33, !llvm.loop !10

33:                                               ; preds = %27
  %34 = add i32 %.036.lcssa, 3
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %2, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !7
  %38 = getelementptr inbounds i8, ptr %5, i64 3
  store i8 %37, ptr %38, align 1, !tbaa !7
  br label %.unr-lcssa

.unr-lcssa:                                       ; preds = %33, %27, %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  %39 = call i32 @fec_secded3932_decode_symbol(ptr noundef nonnull %5, ptr noundef nonnull %6)
  br label %40

40:                                               ; preds = %40, %.unr-lcssa
  %indvars.iv50.epil = phi i64 [ 0, %.unr-lcssa ], [ %indvars.iv.next51.epil, %40 ]
  %epil.iter = phi i64 [ 0, %.unr-lcssa ], [ %epil.iter.next, %40 ]
  %41 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 %indvars.iv50.epil
  %42 = load i8, ptr %41, align 1, !tbaa !7
  %43 = trunc i64 %indvars.iv50.epil to i32
  %44 = add i32 %.034.lcssa, %43
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr %3, i64 %45
  store i8 %42, ptr %46, align 1, !tbaa !7
  %indvars.iv.next51.epil = add nuw nsw i64 %indvars.iv50.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %wide.trip.count
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %40, !llvm.loop !11

.epilog-lcssa:                                    ; preds = %40
  %47 = or disjoint i32 %.034.lcssa, %7
  %48 = add nuw nsw i32 %7, 1
  %49 = add i32 %48, %.036.lcssa
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %5) #4
  br label %50

50:                                               ; preds = %.epilog-lcssa, %._crit_edge
  %.137 = phi i32 [ %49, %.epilog-lcssa ], [ %.036.lcssa, %._crit_edge ]
  %.135 = phi i32 [ %47, %.epilog-lcssa ], [ %.034.lcssa, %._crit_edge ]
  %51 = call i32 @fec_get_enc_msg_length(i32 noundef 9, i32 noundef %1) #4
  %52 = icmp eq i32 %.137, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 352, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_secded3932_decode) #5
  unreachable

54:                                               ; preds = %50
  %55 = icmp eq i32 %.135, %1
  br i1 %55, label %57, label %56

56:                                               ; preds = %54
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 353, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_secded3932_decode) #5
  unreachable

57:                                               ; preds = %54
  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"}
!10 = distinct !{!10, !6}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}


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