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

@.str = external hidden unnamed_addr constant [94 x i8], align 1
@liquid_autotest_verbose = external global i32, align 4
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@__const.autotest_repack_bytes_01.input = external hidden unnamed_addr constant [4 x i8], align 1
@__const.autotest_repack_bytes_01.output_test = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [38 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

declare void @liquid_autotest_passed(...) #2

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

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @autotest_repack_bytes_01() #3 {
  %1 = alloca [4 x i8], align 1
  %2 = alloca [6 x i8], align 1
  %3 = alloca [6 x i8], align 1
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %1, ptr align 1 @__const.autotest_repack_bytes_01.input, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 6, ptr %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %2, ptr align 1 @__const.autotest_repack_bytes_01.output_test, i64 6, i1 false)
  call void @llvm.lifetime.start.p0(i64 6, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %5 = getelementptr inbounds [4 x i8], ptr %1, i64 0, i64 0
  %6 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 0
  %7 = call i32 @liquid_repack_bytes(ptr noundef %5, i32 noundef 3, i32 noundef 4, ptr noundef %6, i32 noundef 2, i32 noundef 6, ptr noundef %4)
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = icmp ne i32 %8, 6
  br i1 %9, label %10, label %13

10:                                               ; preds = %0
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = uitofp i32 %11 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 218, ptr noundef @.str.4, double noundef %12, ptr noundef @.str.5, ptr noundef @.str.14, double noundef 6.000000e+00)
  br label %14

13:                                               ; preds = %0
  call void (...) @liquid_autotest_passed()
  br label %14

14:                                               ; preds = %13, %10
  %15 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 0
  %16 = getelementptr inbounds [6 x i8], ptr %2, i64 0, i64 0
  %17 = call i32 @liquid_autotest_same_data(ptr noundef %15, ptr noundef %16, i32 noundef 6)
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %26, label %19

19:                                               ; preds = %14
  call void @liquid_autotest_failed_msg(ptr noundef @.str, i32 noundef 219, ptr noundef @.str.15)
  %20 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 0
  call void @liquid_autotest_print_array(ptr noundef %23, i32 noundef 6)
  %24 = getelementptr inbounds [6 x i8], ptr %2, i64 0, i64 0
  call void @liquid_autotest_print_array(ptr noundef %24, i32 noundef 6)
  br label %25

25:                                               ; preds = %22, %19
  br label %27

26:                                               ; preds = %14
  call void (...) @liquid_autotest_passed()
  br label %27

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

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

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


; 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 [94 x i8], align 1
@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@__const.autotest_repack_bytes_01.input = external hidden unnamed_addr constant [4 x i8], align 1
@__const.autotest_repack_bytes_01.output_test = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [38 x i8], align 1

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_repack_bytes_01() local_unnamed_addr #3 {
  %1 = alloca [4 x i8], align 4
  %2 = alloca [6 x i8], align 1
  %3 = alloca [6 x i8], align 1
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %5 = load i32, ptr @__const.autotest_repack_bytes_01.input, align 1
  store i32 %5, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) %2, ptr noundef nonnull align 1 dereferenceable(6) @__const.autotest_repack_bytes_01.output_test, i64 6, i1 false)
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %6 = call i32 @liquid_repack_bytes(ptr noundef nonnull %1, i32 noundef 3, i32 noundef 4, ptr noundef nonnull %3, i32 noundef 2, i32 noundef 6, ptr noundef nonnull %4) #4
  %7 = load i32, ptr %4, align 4, !tbaa !5
  %.not = icmp eq i32 %7, 6
  br i1 %.not, label %10, label %8

8:                                                ; preds = %0
  %9 = uitofp i32 %7 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 218, ptr noundef nonnull @.str.4, double noundef %9, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.14, double noundef 6.000000e+00) #4
  br label %11

10:                                               ; preds = %0
  call void (...) @liquid_autotest_passed() #4
  br label %11

11:                                               ; preds = %10, %8
  %12 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %3, ptr noundef nonnull %2, i32 noundef 6) #4
  %.not1 = icmp eq i32 %12, 0
  br i1 %.not1, label %13, label %16

13:                                               ; preds = %11
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str, i32 noundef 219, ptr noundef nonnull @.str.15) #4
  %14 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not2 = icmp eq i32 %14, 0
  br i1 %.not2, label %17, label %15

15:                                               ; preds = %13
  call void @liquid_autotest_print_array(ptr noundef nonnull %3, i32 noundef 6) #4
  call void @liquid_autotest_print_array(ptr noundef nonnull %2, i32 noundef 6) #4
  br label %17

16:                                               ; preds = %11
  call void (...) @liquid_autotest_passed() #4
  br label %17

17:                                               ; preds = %13, %15, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void
}

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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SimplifyCFGPass