; LLVM IR from jgaeddert/liquid-dsp :: src/utility/tests (pack_bytes_autotest)

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

@__const.autotest_pack_array.sym_size = external hidden unnamed_addr constant [9 x i32], align 16
@__const.autotest_pack_array.input = external hidden unnamed_addr constant [9 x i8], align 1
@__const.autotest_pack_array.output_test = external hidden unnamed_addr constant [4 x i8], align 1
@__const.autotest_pack_array.output = external hidden unnamed_addr constant [4 x i8], align 1
@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@liquid_autotest_verbose = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @autotest_pack_array() #0 {
  %1 = alloca [9 x i32], align 16
  %2 = alloca [9 x i8], align 1
  %3 = alloca [4 x i8], align 1
  %4 = alloca [4 x i8], align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 36, ptr %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const.autotest_pack_array.sym_size, i64 36, i1 false)
  call void @llvm.lifetime.start.p0(i64 9, ptr %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %2, ptr align 1 @__const.autotest_pack_array.input, i64 9, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %3, ptr align 1 @__const.autotest_pack_array.output_test, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %4, ptr align 1 @__const.autotest_pack_array.output, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %28, %0
  %8 = load i32, ptr %6, align 4, !tbaa !5
  %9 = icmp ult i32 %8, 9
  br i1 %9, label %10, label %31

10:                                               ; preds = %7
  %11 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %14 = zext i32 %13 to i64
  %15 = getelementptr inbounds [9 x i32], ptr %1, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = load i32, ptr %6, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds [9 x i8], ptr %2, i64 0, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = call i32 @liquid_pack_array(ptr noundef %11, i32 noundef 4, i32 noundef %12, i32 noundef %16, i8 noundef zeroext %20)
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds [9 x i32], ptr %1, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = add i32 %26, %25
  store i32 %27, ptr %5, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %10
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = add i32 %29, 1
  store i32 %30, ptr %6, align 4, !tbaa !5
  br label %7, !llvm.loop !10

31:                                               ; preds = %7
  %32 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %33 = getelementptr inbounds [4 x i8], ptr %3, i64 0, i64 0
  %34 = call i32 @liquid_autotest_same_data(ptr noundef %32, ptr noundef %33, i32 noundef 4)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %43, label %36

36:                                               ; preds = %31
  call void @liquid_autotest_failed_msg(ptr noundef @.str, i32 noundef 57, ptr noundef @.str.1)
  %37 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %36
  %40 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  call void @liquid_autotest_print_array(ptr noundef %40, i32 noundef 4)
  %41 = getelementptr inbounds [4 x i8], ptr %3, i64 0, i64 0
  call void @liquid_autotest_print_array(ptr noundef %41, i32 noundef 4)
  br label %42

42:                                               ; preds = %39, %36
  br label %44

43:                                               ; preds = %31
  call void (...) @liquid_autotest_passed()
  br label %44

44:                                               ; preds = %43, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 9, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 36, ptr %1) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #2

declare i32 @liquid_pack_array(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext) #3

declare i32 @liquid_autotest_same_data(ptr noundef, ptr noundef, i32 noundef) #3

declare void @liquid_autotest_failed_msg(ptr noundef, i32 noundef, ptr noundef) #3

declare void @liquid_autotest_print_array(ptr noundef, i32 noundef) #3

declare void @liquid_autotest_passed(...) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 }

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"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"

@__const.autotest_pack_array.sym_size = external hidden unnamed_addr constant [9 x i32], align 16
@__const.autotest_pack_array.input = external hidden unnamed_addr constant [9 x i8], align 1
@__const.autotest_pack_array.output_test = external hidden unnamed_addr constant [4 x i8], align 1
@__const.autotest_pack_array.output = external hidden unnamed_addr constant [4 x i8], align 1
@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @autotest_pack_array() local_unnamed_addr #0 {
  %1 = alloca [4 x i8], align 4
  %2 = alloca [4 x i8], align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  %3 = load i32, ptr @__const.autotest_pack_array.output_test, align 1
  store i32 %3, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  %4 = load i32, ptr @__const.autotest_pack_array.output, align 1
  store i32 %4, ptr %2, align 4
  %5 = load i32, ptr @__const.autotest_pack_array.sym_size, align 16, !tbaa !5
  %6 = load i8, ptr @__const.autotest_pack_array.input, align 1, !tbaa !9
  %7 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef 0, i32 noundef %5, i8 noundef zeroext %6) #3
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 4), align 4, !tbaa !5
  %9 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 1), align 1, !tbaa !9
  %10 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %5, i32 noundef %8, i8 noundef zeroext %9) #3
  %11 = add i32 %8, %5
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 8), align 8, !tbaa !5
  %13 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 2), align 1, !tbaa !9
  %14 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %11, i32 noundef %12, i8 noundef zeroext %13) #3
  %15 = add i32 %12, %11
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 12), align 4, !tbaa !5
  %17 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 3), align 1, !tbaa !9
  %18 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %15, i32 noundef %16, i8 noundef zeroext %17) #3
  %19 = add i32 %16, %15
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 16), align 16, !tbaa !5
  %21 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 4), align 1, !tbaa !9
  %22 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %19, i32 noundef %20, i8 noundef zeroext %21) #3
  %23 = add i32 %20, %19
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 20), align 4, !tbaa !5
  %25 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 5), align 1, !tbaa !9
  %26 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %23, i32 noundef %24, i8 noundef zeroext %25) #3
  %27 = add i32 %24, %23
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 24), align 8, !tbaa !5
  %29 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 6), align 1, !tbaa !9
  %30 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %27, i32 noundef %28, i8 noundef zeroext %29) #3
  %31 = add i32 %28, %27
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 28), align 4, !tbaa !5
  %33 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 7), align 1, !tbaa !9
  %34 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %31, i32 noundef %32, i8 noundef zeroext %33) #3
  %35 = add i32 %32, %31
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.sym_size, i64 32), align 16, !tbaa !5
  %37 = load i8, ptr getelementptr inbounds (i8, ptr @__const.autotest_pack_array.input, i64 8), align 1, !tbaa !9
  %38 = call i32 @liquid_pack_array(ptr noundef nonnull %2, i32 noundef 4, i32 noundef %35, i32 noundef %36, i8 noundef zeroext %37) #3
  %39 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %2, ptr noundef nonnull %1, i32 noundef 4) #3
  %.not = icmp eq i32 %39, 0
  br i1 %.not, label %40, label %43

40:                                               ; preds = %0
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str, i32 noundef 57, ptr noundef nonnull @.str.1) #3
  %41 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not8 = icmp eq i32 %41, 0
  br i1 %.not8, label %44, label %42

42:                                               ; preds = %40
  call void @liquid_autotest_print_array(ptr noundef nonnull %2, i32 noundef 4) #3
  call void @liquid_autotest_print_array(ptr noundef nonnull %1, i32 noundef 4) #3
  br label %44

43:                                               ; preds = %0
  call void (...) @liquid_autotest_passed() #3
  br label %44

44:                                               ; preds = %40, %42, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  ret void
}

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

declare i32 @liquid_pack_array(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #2

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

declare void @liquid_autotest_failed_msg(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @liquid_autotest_print_array(ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @liquid_autotest_passed(...) local_unnamed_addr #2

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass