; LLVM IR from jgaeddert/liquid-dsp :: src/math/tests (polynomial_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"

@liquid_autotest_verbose = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.autotest_poly_expandbinomial_n6.c_test = external hidden unnamed_addr constant [7 x float], align 16
@.str.33 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [36 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 @printf(ptr noundef, ...) #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_passed(...) #2

; Function Attrs: nounwind uwtable
define dso_local void @autotest_poly_expandbinomial_n6() #3 {
  %1 = alloca i32, align 4
  %2 = alloca [7 x float], align 16
  %3 = alloca [7 x float], align 16
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 6, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 28, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 28, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.autotest_poly_expandbinomial_n6.c_test, i64 28, i1 false)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = getelementptr inbounds [7 x float], ptr %2, i64 0, i64 0
  %7 = call i32 @polyf_expandbinomial(i32 noundef %5, ptr noundef %6)
  %8 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %30

10:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = add i32 %11, 1
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.33, i32 noundef %12)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %25, %10
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = icmp ule i32 %15, %16
  br i1 %17, label %18, label %28

18:                                               ; preds = %14
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds [7 x float], ptr %2, i64 0, i64 %20
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = fpext float %22 to double
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.34, double noundef %23)
  br label %25

25:                                               ; preds = %18
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = add i32 %26, 1
  store i32 %27, ptr %4, align 4, !tbaa !5
  br label %14, !llvm.loop !11

28:                                               ; preds = %14
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %30

30:                                               ; preds = %28, %0
  %31 = getelementptr inbounds [7 x float], ptr %2, i64 0, i64 0
  %32 = getelementptr inbounds [7 x float], ptr %3, i64 0, i64 0
  %33 = call i32 @liquid_autotest_same_data(ptr noundef %31, ptr noundef %32, i32 noundef 28)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %42, label %35

35:                                               ; preds = %30
  call void @liquid_autotest_failed_msg(ptr noundef @.str.2, i32 noundef 318, ptr noundef @.str.35)
  %36 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = getelementptr inbounds [7 x float], ptr %2, i64 0, i64 0
  call void @liquid_autotest_print_array(ptr noundef %39, i32 noundef 28)
  %40 = getelementptr inbounds [7 x float], ptr %3, i64 0, i64 0
  call void @liquid_autotest_print_array(ptr noundef %40, i32 noundef 28)
  br label %41

41:                                               ; preds = %38, %35
  br label %43

42:                                               ; preds = %30
  call void (...) @liquid_autotest_passed()
  br label %43

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

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

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

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

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.autotest_poly_expandbinomial_n6.c_test = external hidden unnamed_addr constant [7 x float], align 16
@.str.33 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [36 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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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_passed(...) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @autotest_poly_expandbinomial_n6() local_unnamed_addr #4 {
  %1 = alloca [7 x float], align 16
  %2 = alloca [7 x float], align 16
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(28) %2, ptr noundef nonnull align 16 dereferenceable(28) @__const.autotest_poly_expandbinomial_n6.c_test, i64 28, i1 false)
  %3 = call i32 @polyf_expandbinomial(i32 noundef 6, ptr noundef nonnull %1) #5
  %4 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %35, label %5

5:                                                ; preds = %0
  %6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.33, i32 noundef 7)
  %7 = load float, ptr %1, align 16, !tbaa !9
  %8 = fpext float %7 to double
  %9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %8)
  %10 = getelementptr inbounds i8, ptr %1, i64 4
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = fpext float %11 to double
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %12)
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load float, ptr %14, align 8, !tbaa !9
  %16 = fpext float %15 to double
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %16)
  %18 = getelementptr inbounds i8, ptr %1, i64 12
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = fpext float %19 to double
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %20)
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = load float, ptr %22, align 16, !tbaa !9
  %24 = fpext float %23 to double
  %25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %24)
  %26 = getelementptr inbounds i8, ptr %1, i64 20
  %27 = load float, ptr %26, align 4, !tbaa !9
  %28 = fpext float %27 to double
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %28)
  %30 = getelementptr inbounds i8, ptr %1, i64 24
  %31 = load float, ptr %30, align 8, !tbaa !9
  %32 = fpext float %31 to double
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, double noundef %32)
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %35

35:                                               ; preds = %5, %0
  %36 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef 28) #5
  %.not6 = icmp eq i32 %36, 0
  br i1 %.not6, label %37, label %40

37:                                               ; preds = %35
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str.2, i32 noundef 318, ptr noundef nonnull @.str.35) #5
  %38 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not7 = icmp eq i32 %38, 0
  br i1 %.not7, label %41, label %39

39:                                               ; preds = %37
  call void @liquid_autotest_print_array(ptr noundef nonnull %1, i32 noundef 28) #5
  call void @liquid_autotest_print_array(ptr noundef nonnull %2, i32 noundef 28) #5
  br label %41

40:                                               ; preds = %35
  call void (...) @liquid_autotest_passed() #5
  br label %41

41:                                               ; preds = %37, %39, %40
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #5
  ret void
}

declare i32 @polyf_expandbinomial(i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

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

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


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