; LLVM IR from jgaeddert/liquid-dsp :: sandbox (fec_spc2216_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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @spc2216_decode(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [16 x i8], align 16
  %6 = alloca [22 x i8], align 16
  %7 = alloca [32 x i8], align 16
  %8 = alloca [44 x i8], align 16
  %9 = alloca i32, align 4
  %10 = alloca [3 x i8], align 1
  %11 = alloca [3 x i8], align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 22, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 44, ptr %8) #4
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds [16 x i8], ptr %5, i64 0, i64 0
  %14 = getelementptr inbounds [22 x i8], ptr %6, i64 0, i64 0
  %15 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  call void @spc2216_unpack(ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr %11) #4
  %16 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %17 = getelementptr inbounds [16 x i8], ptr %5, i64 0, i64 0
  %18 = getelementptr inbounds [44 x i8], ptr %8, i64 0, i64 0
  call void @spc2216_transpose_row(ptr noundef %16, ptr noundef %17, ptr noundef %18)
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %79, %2
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = icmp ult i32 %20, 22
  br i1 %21, label %22, label %82

22:                                               ; preds = %19
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [22 x i8], ptr %6, i64 0, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 0
  store i8 %26, ptr %27, align 1, !tbaa !11
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = mul i32 2, %28
  %30 = add i32 %29, 0
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds [44 x i8], ptr %8, i64 0, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 1
  store i8 %33, ptr %34, align 1, !tbaa !11
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = mul i32 2, %35
  %37 = add i32 %36, 1
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds [44 x i8], ptr %8, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 2
  store i8 %40, ptr %41, align 1, !tbaa !11
  %42 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 0
  %43 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 0
  %44 = call i32 @fec_secded2216_estimate_ehat(ptr noundef %42, ptr noundef %43)
  %45 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 0
  %46 = load i8, ptr %45, align 1, !tbaa !11
  %47 = zext i8 %46 to i32
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [22 x i8], ptr %6, i64 0, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = zext i8 %51 to i32
  %53 = xor i32 %52, %47
  %54 = trunc i32 %53 to i8
  store i8 %54, ptr %50, align 1, !tbaa !11
  %55 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 1
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = zext i8 %56 to i32
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = mul i32 2, %58
  %60 = add i32 %59, 0
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds [44 x i8], ptr %8, i64 0, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !11
  %64 = zext i8 %63 to i32
  %65 = xor i32 %64, %57
  %66 = trunc i32 %65 to i8
  store i8 %66, ptr %62, align 1, !tbaa !11
  %67 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 2
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = zext i8 %68 to i32
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = mul i32 2, %70
  %72 = add i32 %71, 1
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds [44 x i8], ptr %8, i64 0, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !11
  %76 = zext i8 %75 to i32
  %77 = xor i32 %76, %69
  %78 = trunc i32 %77 to i8
  store i8 %78, ptr %74, align 1, !tbaa !11
  br label %79

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

82:                                               ; preds = %19
  %83 = getelementptr inbounds [44 x i8], ptr %8, i64 0, i64 0
  %84 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %85 = getelementptr inbounds [16 x i8], ptr %5, i64 0, i64 0
  call void @spc2216_transpose_col(ptr noundef %83, ptr noundef %84, ptr noundef %85)
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %143, %82
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = icmp ult i32 %87, 16
  br i1 %88, label %89, label %146

89:                                               ; preds = %86
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds [16 x i8], ptr %5, i64 0, i64 %91
  %93 = load i8, ptr %92, align 1, !tbaa !11
  %94 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 0
  store i8 %93, ptr %94, align 1, !tbaa !11
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = mul i32 2, %95
  %97 = add i32 %96, 0
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !11
  %101 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 1
  store i8 %100, ptr %101, align 1, !tbaa !11
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = mul i32 2, %102
  %104 = add i32 %103, 1
  %105 = zext i32 %104 to i64
  %106 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 %105
  %107 = load i8, ptr %106, align 1, !tbaa !11
  %108 = getelementptr inbounds [3 x i8], ptr %10, i64 0, i64 2
  store i8 %107, ptr %108, align 1, !tbaa !11
  %109 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 0
  %110 = load i8, ptr %109, align 1, !tbaa !11
  %111 = zext i8 %110 to i32
  %112 = load i32, ptr %9, align 4, !tbaa !9
  %113 = zext i32 %112 to i64
  %114 = getelementptr inbounds [22 x i8], ptr %6, i64 0, i64 %113
  %115 = load i8, ptr %114, align 1, !tbaa !11
  %116 = zext i8 %115 to i32
  %117 = xor i32 %116, %111
  %118 = trunc i32 %117 to i8
  store i8 %118, ptr %114, align 1, !tbaa !11
  %119 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 1
  %120 = load i8, ptr %119, align 1, !tbaa !11
  %121 = zext i8 %120 to i32
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = mul i32 2, %122
  %124 = add i32 %123, 0
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 %125
  %127 = load i8, ptr %126, align 1, !tbaa !11
  %128 = zext i8 %127 to i32
  %129 = xor i32 %128, %121
  %130 = trunc i32 %129 to i8
  store i8 %130, ptr %126, align 1, !tbaa !11
  %131 = getelementptr inbounds [3 x i8], ptr %11, i64 0, i64 2
  %132 = load i8, ptr %131, align 1, !tbaa !11
  %133 = zext i8 %132 to i32
  %134 = load i32, ptr %9, align 4, !tbaa !9
  %135 = mul i32 2, %134
  %136 = add i32 %135, 1
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 %137
  %139 = load i8, ptr %138, align 1, !tbaa !11
  %140 = zext i8 %139 to i32
  %141 = xor i32 %140, %133
  %142 = trunc i32 %141 to i8
  store i8 %142, ptr %138, align 1, !tbaa !11
  br label %143

143:                                              ; preds = %89
  %144 = load i32, ptr %9, align 4, !tbaa !9
  %145 = add i32 %144, 1
  store i32 %145, ptr %9, align 4, !tbaa !9
  br label %86, !llvm.loop !14

146:                                              ; preds = %86
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %147, ptr align 16 %148, i64 32, i1 false)
  call void @llvm.lifetime.end.p0(i64 3, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 44, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 22, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @spc2216_transpose_row(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @spc2216_unpack(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @spc2216_transpose_col(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #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 = { 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 = !{!"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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @spc2216_decode(ptr noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  %3 = alloca [16 x i8], align 16
  %4 = alloca [22 x i8], align 16
  %5 = alloca [32 x i8], align 16
  %6 = alloca [44 x i8], align 16
  %7 = alloca [3 x i8], align 1
  %8 = alloca [3 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 22, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %6) #4
  call void @spc2216_unpack(ptr noundef %0, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %8) #4
  call void @spc2216_transpose_row(ptr noundef nonnull %5, ptr noundef nonnull %3, ptr noundef nonnull %6)
  %9 = getelementptr inbounds i8, ptr %7, i64 1
  %10 = getelementptr inbounds i8, ptr %7, i64 2
  %11 = getelementptr inbounds i8, ptr %8, i64 1
  %12 = getelementptr inbounds i8, ptr %8, i64 2
  br label %13

13:                                               ; preds = %2, %13
  %indvars.iv = phi i64 [ 0, %2 ], [ %indvars.iv.next, %13 ]
  %14 = getelementptr inbounds [22 x i8], ptr %4, i64 0, i64 %indvars.iv
  %15 = load i8, ptr %14, align 1, !tbaa !5
  store i8 %15, ptr %7, align 1, !tbaa !5
  %16 = shl nuw nsw i64 %indvars.iv, 1
  %17 = getelementptr inbounds [44 x i8], ptr %6, i64 0, i64 %16
  %18 = load i8, ptr %17, align 2, !tbaa !5
  store i8 %18, ptr %9, align 1, !tbaa !5
  %19 = or disjoint i64 %16, 1
  %20 = getelementptr inbounds [44 x i8], ptr %6, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !5
  store i8 %21, ptr %10, align 1, !tbaa !5
  %22 = call i32 @fec_secded2216_estimate_ehat(ptr noundef nonnull %7, ptr noundef nonnull %8) #4
  %23 = load i8, ptr %8, align 1, !tbaa !5
  %24 = load i8, ptr %14, align 1, !tbaa !5
  %25 = xor i8 %24, %23
  store i8 %25, ptr %14, align 1, !tbaa !5
  %26 = load i8, ptr %11, align 1, !tbaa !5
  %27 = load i8, ptr %17, align 2, !tbaa !5
  %28 = xor i8 %27, %26
  store i8 %28, ptr %17, align 2, !tbaa !5
  %29 = load i8, ptr %12, align 1, !tbaa !5
  %30 = load i8, ptr %20, align 1, !tbaa !5
  %31 = xor i8 %30, %29
  store i8 %31, ptr %20, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 22
  br i1 %exitcond.not, label %32, label %13, !llvm.loop !8

32:                                               ; preds = %13
  call void @spc2216_transpose_col(ptr noundef nonnull %6, ptr noundef nonnull %5, ptr noundef nonnull %3)
  %33 = load <2 x i8>, ptr %11, align 1, !tbaa !5
  %34 = shufflevector <2 x i8> %33, <2 x i8> poison, <16 x i32> <i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1>
  %35 = load <16 x i8>, ptr %5, align 16, !tbaa !5
  %36 = xor <16 x i8> %34, %35
  store <16 x i8> %36, ptr %5, align 16, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %5, i64 16
  %38 = load <16 x i8>, ptr %37, align 16, !tbaa !5
  %39 = xor <16 x i8> %34, %38
  store <16 x i8> %39, ptr %37, align 16, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %1, ptr noundef nonnull align 16 dereferenceable(32) %5, i64 32, i1 false)
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 22, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @spc2216_transpose_row(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @spc2216_unpack(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @spc2216_transpose_col(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; 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"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass