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

; 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 [83 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [63 x i8], align 1
@__PRETTY_FUNCTION__.fec_hamming128_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_hamming128_decode_symbol(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @fec_hamming128_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 i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  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
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = urem i32 %17, 2
  store i32 %18, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %79, %4
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = sub i32 %21, %22
  %24 = icmp ult i32 %20, %23
  br i1 %24, label %25, label %82

25:                                               ; preds = %19
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load i32, ptr %10, align 4, !tbaa !9
  %28 = add i32 %27, 0
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %26, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !11
  store i8 %31, ptr %12, align 1, !tbaa !11
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = add i32 %33, 1
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %32, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !11
  store i8 %37, ptr %13, align 1, !tbaa !11
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = add i32 %39, 2
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr %38, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !11
  store i8 %43, ptr %14, align 1, !tbaa !11
  %44 = load i8, ptr %12, align 1, !tbaa !11
  %45 = zext i8 %44 to i32
  %46 = shl i32 %45, 4
  %47 = and i32 %46, 4080
  %48 = load i8, ptr %13, align 1, !tbaa !11
  %49 = zext i8 %48 to i32
  %50 = ashr i32 %49, 4
  %51 = and i32 %50, 15
  %52 = or i32 %47, %51
  store i32 %52, ptr %15, align 4, !tbaa !9
  %53 = load i8, ptr %13, align 1, !tbaa !11
  %54 = zext i8 %53 to i32
  %55 = shl i32 %54, 8
  %56 = and i32 %55, 3840
  %57 = load i8, ptr %14, align 1, !tbaa !11
  %58 = zext i8 %57 to i32
  %59 = and i32 %58, 255
  %60 = or i32 %56, %59
  store i32 %60, ptr %16, align 4, !tbaa !9
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = call i32 @fec_hamming128_decode_symbol(i32 noundef %61)
  %63 = trunc i32 %62 to i8
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = add i32 %65, 0
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %64, i64 %67
  store i8 %63, ptr %68, align 1, !tbaa !11
  %69 = load i32, ptr %16, align 4, !tbaa !9
  %70 = call i32 @fec_hamming128_decode_symbol(i32 noundef %69)
  %71 = trunc i32 %70 to i8
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = add i32 %73, 1
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds i8, ptr %72, i64 %75
  store i8 %71, ptr %76, align 1, !tbaa !11
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = add i32 %77, 3
  store i32 %78, ptr %10, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %25
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = add i32 %80, 2
  store i32 %81, ptr %9, align 4, !tbaa !9
  br label %19, !llvm.loop !12

82:                                               ; preds = %19
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %117

85:                                               ; preds = %82
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = load i32, ptr %10, align 4, !tbaa !9
  %88 = add i32 %87, 0
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds i8, ptr %86, i64 %89
  %91 = load i8, ptr %90, align 1, !tbaa !11
  store i8 %91, ptr %12, align 1, !tbaa !11
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = add i32 %93, 1
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds i8, ptr %92, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !11
  store i8 %97, ptr %13, align 1, !tbaa !11
  %98 = load i8, ptr %12, align 1, !tbaa !11
  %99 = zext i8 %98 to i32
  %100 = shl i32 %99, 4
  %101 = and i32 %100, 4080
  %102 = load i8, ptr %13, align 1, !tbaa !11
  %103 = zext i8 %102 to i32
  %104 = ashr i32 %103, 4
  %105 = and i32 %104, 15
  %106 = or i32 %101, %105
  store i32 %106, ptr %15, align 4, !tbaa !9
  %107 = load i32, ptr %15, align 4, !tbaa !9
  %108 = call i32 @fec_hamming128_decode_symbol(i32 noundef %107)
  %109 = trunc i32 %108 to i8
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = add i32 %111, 1
  store i32 %112, ptr %9, align 4, !tbaa !9
  %113 = zext i32 %111 to i64
  %114 = getelementptr inbounds i8, ptr %110, i64 %113
  store i8 %109, ptr %114, align 1, !tbaa !11
  %115 = load i32, ptr %10, align 4, !tbaa !9
  %116 = add i32 %115, 2
  store i32 %116, ptr %10, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %85, %82
  %118 = load i32, ptr %10, align 4, !tbaa !9
  %119 = load i32, ptr %6, align 4, !tbaa !9
  %120 = call i32 @fec_get_enc_msg_length(i32 noundef 6, i32 noundef %119)
  %121 = icmp eq i32 %118, %120
  br i1 %121, label %122, label %123

122:                                              ; preds = %117
  br label %124

123:                                              ; preds = %117
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str, i32 noundef 282, ptr noundef @__PRETTY_FUNCTION__.fec_hamming128_decode) #5
  unreachable

124:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  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 = !{!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 [83 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [63 x i8], align 1
@__PRETTY_FUNCTION__.fec_hamming128_decode = external hidden unnamed_addr constant [79 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @fec_hamming128_decode(ptr nocapture noundef readnone %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = and i32 %1, 1
  %6 = and i32 %1, -2
  %.not38 = icmp eq i32 %6, 0
  br i1 %.not38, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %4
  %7 = zext i32 %6 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 ]
  %.03435 = phi i32 [ 0, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %8 = zext i32 %.03435 to i64
  %9 = getelementptr inbounds i8, ptr %2, i64 %8
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = add i32 %.03435, 1
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %2, i64 %12
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = add i32 %.03435, 2
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %2, i64 %16
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = zext i8 %10 to i32
  %20 = shl nuw nsw i32 %19, 4
  %21 = zext i8 %14 to i32
  %22 = lshr i32 %21, 4
  %23 = or disjoint i32 %22, %20
  %24 = shl nuw nsw i32 %21, 8
  %25 = and i32 %24, 3840
  %26 = zext i8 %18 to i32
  %27 = or disjoint i32 %25, %26
  %28 = tail call i32 @fec_hamming128_decode_symbol(i32 noundef %23)
  %29 = trunc i32 %28 to i8
  %30 = getelementptr inbounds i8, ptr %3, i64 %indvars.iv
  store i8 %29, ptr %30, align 1, !tbaa !5
  %31 = tail call i32 @fec_hamming128_decode_symbol(i32 noundef %27)
  %32 = trunc i32 %31 to i8
  %33 = or disjoint i64 %indvars.iv, 1
  %34 = getelementptr inbounds i8, ptr %3, i64 %33
  store i8 %32, ptr %34, align 1, !tbaa !5
  %35 = add i32 %.03435, 3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %36 = icmp ult i64 %indvars.iv.next, %7
  br i1 %36, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !8

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %37 = and i64 %indvars.iv.next, 4294967294
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %4
  %.034.lcssa = phi i32 [ 0, %4 ], [ %35, %._crit_edge.loopexit ]
  %.0.lcssa = phi i64 [ 0, %4 ], [ %37, %._crit_edge.loopexit ]
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %55, label %38

38:                                               ; preds = %._crit_edge
  %39 = zext i32 %.034.lcssa to i64
  %40 = getelementptr inbounds i8, ptr %2, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !5
  %42 = add i32 %.034.lcssa, 1
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds i8, ptr %2, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !5
  %46 = zext i8 %41 to i32
  %47 = shl nuw nsw i32 %46, 4
  %48 = lshr i8 %45, 4
  %49 = zext nneg i8 %48 to i32
  %50 = or disjoint i32 %47, %49
  %51 = tail call i32 @fec_hamming128_decode_symbol(i32 noundef %50)
  %52 = trunc i32 %51 to i8
  %53 = getelementptr inbounds i8, ptr %3, i64 %.0.lcssa
  store i8 %52, ptr %53, align 1, !tbaa !5
  %54 = add i32 %.034.lcssa, 2
  br label %55

55:                                               ; preds = %38, %._crit_edge
  %.1 = phi i32 [ %54, %38 ], [ %.034.lcssa, %._crit_edge ]
  %56 = tail call i32 @fec_get_enc_msg_length(i32 noundef 6, i32 noundef %1) #3
  %57 = icmp eq i32 %.1, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str, i32 noundef 282, ptr noundef nonnull @__PRETTY_FUNCTION__.fec_hamming128_decode) #4
  unreachable

59:                                               ; preds = %55
  ret i32 0
}

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

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

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 = { "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 = { 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 #3 = { nounwind }
attributes #4 = { 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,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass