; LLVM IR from jgaeddert/liquid-dsp :: sandbox (fec_g2412product_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 @g2412p_unpack_symbol(i32 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %22, %2
  %7 = load i32, ptr %5, align 4, !tbaa !5
  %8 = icmp ult i32 %7, 24
  br i1 %8, label %9, label %25

9:                                                ; preds = %6
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = and i32 %10, 1
  %12 = icmp ne i32 %11, 0
  %13 = zext i1 %12 to i64
  %14 = select i1 %12, i32 255, i32 0
  %15 = trunc i32 %14 to i8
  %16 = load ptr, ptr %4, align 8, !tbaa !9
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds i8, ptr %16, i64 %18
  store i8 %15, ptr %19, align 1, !tbaa !11
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = lshr i32 %20, 1
  store i32 %21, ptr %3, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %9
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = add i32 %23, 1
  store i32 %24, ptr %5, align 4, !tbaa !5
  br label %6, !llvm.loop !12

25:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret void
}

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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @g2412p_unpack_symbol(i32 noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = trunc i32 %0 to i8
  %4 = and i8 %3, 1
  %5 = sub nsw i8 0, %4
  store i8 %5, ptr %1, align 1, !tbaa !5
  %6 = insertelement <16 x i32> poison, i32 %0, i64 0
  %7 = shufflevector <16 x i32> %6, <16 x i32> poison, <16 x i32> zeroinitializer
  %8 = shl <16 x i32> %7, <i32 30, i32 29, i32 28, i32 27, i32 26, i32 25, i32 24, i32 23, i32 22, i32 21, i32 20, i32 19, i32 18, i32 17, i32 16, i32 15>
  %9 = getelementptr inbounds i8, ptr %1, i64 1
  %10 = ashr <16 x i32> %8, <i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31>
  %11 = trunc nsw <16 x i32> %10 to <16 x i8>
  store <16 x i8> %11, ptr %9, align 1, !tbaa !5
  %12 = shl i32 %0, 14
  %13 = ashr i32 %12, 31
  %14 = trunc nsw i32 %13 to i8
  %15 = getelementptr inbounds i8, ptr %1, i64 17
  store i8 %14, ptr %15, align 1, !tbaa !5
  %16 = shl i32 %0, 13
  %17 = ashr i32 %16, 31
  %18 = trunc nsw i32 %17 to i8
  %19 = getelementptr inbounds i8, ptr %1, i64 18
  store i8 %18, ptr %19, align 1, !tbaa !5
  %20 = shl i32 %0, 12
  %21 = ashr i32 %20, 31
  %22 = trunc nsw i32 %21 to i8
  %23 = getelementptr inbounds i8, ptr %1, i64 19
  store i8 %22, ptr %23, align 1, !tbaa !5
  %24 = shl i32 %0, 11
  %25 = ashr i32 %24, 31
  %26 = trunc nsw i32 %25 to i8
  %27 = getelementptr inbounds i8, ptr %1, i64 20
  store i8 %26, ptr %27, align 1, !tbaa !5
  %28 = shl i32 %0, 10
  %29 = ashr i32 %28, 31
  %30 = trunc nsw i32 %29 to i8
  %31 = getelementptr inbounds i8, ptr %1, i64 21
  store i8 %30, ptr %31, align 1, !tbaa !5
  %32 = shl i32 %0, 9
  %33 = ashr i32 %32, 31
  %34 = trunc nsw i32 %33 to i8
  %35 = getelementptr inbounds i8, ptr %1, i64 22
  store i8 %34, ptr %35, align 1, !tbaa !5
  %36 = shl i32 %0, 8
  %37 = ashr i32 %36, 31
  %38 = trunc nsw i32 %37 to i8
  %39 = getelementptr inbounds i8, ptr %1, i64 23
  store i8 %38, ptr %39, align 1, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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" }

!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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass