; LLVM IR from jgaeddert/liquid-dsp :: sandbox (fec_secded_punctured_test)

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

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

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

10:                                               ; preds = %31, %3
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = icmp ult i32 %11, 9
  br i1 %12, label %13, label %34

13:                                               ; preds = %10
  %14 = load i32, ptr %7, align 4, !tbaa !9
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = icmp ule i32 %14, %15
  br i1 %16, label %17, label %24

17:                                               ; preds = %13
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %18, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = zext i8 %22 to i32
  br label %25

24:                                               ; preds = %13
  br label %25

25:                                               ; preds = %24, %17
  %26 = phi i32 [ %23, %17 ], [ 0, %24 ]
  %27 = trunc i32 %26 to i8
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [9 x i8], ptr %8, i64 0, i64 %29
  store i8 %27, ptr %30, align 1, !tbaa !11
  br label %31

31:                                               ; preds = %25
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = add i32 %32, 1
  store i32 %33, ptr %7, align 4, !tbaa !9
  br label %10, !llvm.loop !12

34:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %35 = getelementptr inbounds [9 x i8], ptr %8, i64 0, i64 0
  %36 = getelementptr inbounds [8 x i8], ptr %9, i64 0, i64 0
  %37 = call i32 @fec_secded7264_decode_symbol(ptr noundef %35, ptr noundef %36)
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %51, %34
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = icmp ult i32 %39, %40
  br i1 %41, label %42, label %54

42:                                               ; preds = %38
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds [8 x i8], ptr %9, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !11
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %47, i64 %49
  store i8 %46, ptr %50, align 1, !tbaa !11
  br label %51

51:                                               ; preds = %42
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = add i32 %52, 1
  store i32 %53, ptr %7, align 4, !tbaa !9
  br label %38, !llvm.loop !14

54:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 9, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret void
}

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

declare i32 @fec_secded7264_decode_symbol(ptr noundef, ptr noundef) #2

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 = { 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"}
!14 = distinct !{!14, !13}


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

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

; Function Attrs: nounwind uwtable
define dso_local void @secded7264_decode_symbol_punctured(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca [9 x i8], align 1
  %5 = alloca [8 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %4) #4
  %6 = zext i32 %2 to i64
  %7 = load i8, ptr %0, align 1, !tbaa !5
  store i8 %7, ptr %4, align 1, !tbaa !5
  %.not.1 = icmp eq i32 %2, 0
  br i1 %.not.1, label %.thread, label %9

.thread:                                          ; preds = %3
  %8 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 0, ptr %8, align 1, !tbaa !5
  br label %.thread19

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %0, i64 1
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 %11, ptr %12, align 1, !tbaa !5
  %.not.2 = icmp eq i32 %2, 1
  br i1 %.not.2, label %.thread19, label %14

.thread19:                                        ; preds = %.thread, %9
  %13 = getelementptr inbounds i8, ptr %4, i64 2
  store i8 0, ptr %13, align 1, !tbaa !5
  br label %.thread22

14:                                               ; preds = %9
  %15 = getelementptr inbounds i8, ptr %0, i64 2
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %4, i64 2
  store i8 %16, ptr %17, align 1, !tbaa !5
  %.not.3 = icmp ult i32 %2, 3
  br i1 %.not.3, label %.thread22, label %19

.thread22:                                        ; preds = %.thread19, %14
  %18 = getelementptr inbounds i8, ptr %4, i64 3
  store i8 0, ptr %18, align 1, !tbaa !5
  br label %.thread25

19:                                               ; preds = %14
  %20 = getelementptr inbounds i8, ptr %0, i64 3
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %4, i64 3
  store i8 %21, ptr %22, align 1, !tbaa !5
  %.not.4 = icmp eq i32 %2, 3
  br i1 %.not.4, label %.thread25, label %24

.thread25:                                        ; preds = %.thread22, %19
  %23 = getelementptr inbounds i8, ptr %4, i64 4
  store i8 0, ptr %23, align 1, !tbaa !5
  br label %.thread28

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %0, i64 4
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %4, i64 4
  store i8 %26, ptr %27, align 1, !tbaa !5
  %.not.5 = icmp ult i32 %2, 5
  br i1 %.not.5, label %.thread28, label %29

.thread28:                                        ; preds = %.thread25, %24
  %28 = getelementptr inbounds i8, ptr %4, i64 5
  store i8 0, ptr %28, align 1, !tbaa !5
  br label %.thread31

29:                                               ; preds = %24
  %30 = getelementptr inbounds i8, ptr %0, i64 5
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %4, i64 5
  store i8 %31, ptr %32, align 1, !tbaa !5
  %.not.6 = icmp eq i32 %2, 5
  br i1 %.not.6, label %.thread31, label %34

.thread31:                                        ; preds = %.thread28, %29
  %33 = getelementptr inbounds i8, ptr %4, i64 6
  store i8 0, ptr %33, align 1, !tbaa !5
  br label %47

34:                                               ; preds = %29
  %35 = getelementptr inbounds i8, ptr %0, i64 6
  %36 = load i8, ptr %35, align 1, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %4, i64 6
  store i8 %36, ptr %37, align 1, !tbaa !5
  %.not.7 = icmp ult i32 %2, 7
  br i1 %.not.7, label %47, label %38

38:                                               ; preds = %34
  %39 = getelementptr inbounds i8, ptr %0, i64 7
  %40 = load i8, ptr %39, align 1, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %4, i64 7
  store i8 %40, ptr %41, align 1, !tbaa !5
  %.not.8 = icmp eq i32 %2, 7
  br i1 %.not.8, label %.thread37, label %42

42:                                               ; preds = %38
  %43 = getelementptr inbounds i8, ptr %0, i64 8
  %44 = load i8, ptr %43, align 1, !tbaa !5
  br label %.thread37

.thread37:                                        ; preds = %42, %38
  %.ph = phi i8 [ 0, %38 ], [ %44, %42 ]
  %45 = getelementptr inbounds i8, ptr %4, i64 8
  store i8 %.ph, ptr %45, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %46 = call i32 @fec_secded7264_decode_symbol(ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  br label %.lr.ph.preheader

47:                                               ; preds = %.thread31, %34
  %48 = getelementptr inbounds i8, ptr %4, i64 7
  store i8 0, ptr %48, align 1, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %4, i64 8
  store i8 0, ptr %49, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %50 = call i32 @fec_secded7264_decode_symbol(ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  %.not14 = icmp eq i32 %2, 0
  br i1 %.not14, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.thread37, %47
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %1, ptr nonnull align 1 %5, i64 %6, i1 false), !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %4) #4
  ret void
}

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

declare i32 @fec_secded7264_decode_symbol(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass