; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firfilt_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.6 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@__const.autotest_firfilt_push_write.buf = external hidden unnamed_addr constant [8 x float], align 16
@.str.31 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [3 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

; 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

declare void @liquid_autotest_passed(...) #2

; Function Attrs: nounwind uwtable
define dso_local void @autotest_firfilt_push_write() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca [8 x float], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %9 = call ptr @firfilt_rrrf_create_kaiser(i32 noundef 51, float noundef 0x3FC99999A0000000, float noundef 6.000000e+01, float noundef 0.000000e+00)
  store ptr %9, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %10 = call ptr @firfilt_rrrf_create_kaiser(i32 noundef 51, float noundef 0x3FC99999A0000000, float noundef 6.000000e+01, float noundef 0.000000e+00)
  store ptr %10, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.autotest_firfilt_push_write.buf, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %50, %0
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = icmp ult i32 %12, 20
  br i1 %13, label %14, label %53

14:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = urem i32 %15, 8
  store i32 %16, ptr %6, align 4, !tbaa !9
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %28, %14
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = icmp ult i32 %18, %19
  br i1 %20, label %21, label %31

21:                                               ; preds = %17
  %22 = load ptr, ptr %1, align 8, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [8 x float], ptr %3, i64 0, i64 %24
  %26 = load float, ptr %25, align 4, !tbaa !11
  %27 = call i32 @firfilt_rrrf_push(ptr noundef %22, float noundef %26)
  br label %28

28:                                               ; preds = %21
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = add i32 %29, 1
  store i32 %30, ptr %5, align 4, !tbaa !9
  br label %17, !llvm.loop !13

31:                                               ; preds = %17
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds [8 x float], ptr %3, i64 0, i64 0
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = call i32 @firfilt_rrrf_write(ptr noundef %32, ptr noundef %33, i32 noundef %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %36 = load ptr, ptr %1, align 8, !tbaa !5
  %37 = call i32 @firfilt_rrrf_execute(ptr noundef %36, ptr noundef %7)
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = call i32 @firfilt_rrrf_execute(ptr noundef %38, ptr noundef %8)
  %40 = load float, ptr %7, align 4, !tbaa !11
  %41 = load float, ptr %8, align 4, !tbaa !11
  %42 = fcmp une float %40, %41
  br i1 %42, label %43, label %48

43:                                               ; preds = %31
  %44 = load float, ptr %7, align 4, !tbaa !11
  %45 = fpext float %44 to double
  %46 = load float, ptr %8, align 4, !tbaa !11
  %47 = fpext float %46 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.6, i32 noundef 214, ptr noundef @.str.31, double noundef %45, ptr noundef @.str.8, ptr noundef @.str.32, double noundef %47)
  br label %49

48:                                               ; preds = %31
  call void (...) @liquid_autotest_passed()
  br label %49

49:                                               ; preds = %48, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %50

50:                                               ; preds = %49
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = add i32 %51, 1
  store i32 %52, ptr %4, align 4, !tbaa !9
  br label %11, !llvm.loop !15

53:                                               ; preds = %11
  %54 = load ptr, ptr %1, align 8, !tbaa !5
  %55 = call i32 @firfilt_rrrf_destroy(ptr noundef %54)
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = call i32 @firfilt_rrrf_destroy(ptr noundef %56)
  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 32, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

declare ptr @firfilt_rrrf_create_kaiser(i32 noundef, float noundef, float noundef, float noundef) #2

declare i32 @firfilt_rrrf_push(ptr noundef, float noundef) #2

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

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

declare i32 @firfilt_rrrf_destroy(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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.6 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@__const.autotest_firfilt_push_write.buf = external hidden unnamed_addr constant [8 x float], align 16
@.str.31 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [3 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: 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

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_firfilt_push_write() local_unnamed_addr #3 {
  %1 = alloca [8 x float], align 16
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = tail call ptr @firfilt_rrrf_create_kaiser(i32 noundef 51, float noundef 0x3FC99999A0000000, float noundef 6.000000e+01, float noundef 0.000000e+00) #4
  %5 = tail call ptr @firfilt_rrrf_create_kaiser(i32 noundef 51, float noundef 0x3FC99999A0000000, float noundef 6.000000e+01, float noundef 0.000000e+00) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %1, ptr noundef nonnull align 16 dereferenceable(32) @__const.autotest_firfilt_push_write.buf, i64 32, i1 false)
  br label %6

6:                                                ; preds = %0, %22
  %.018 = phi i32 [ 0, %0 ], [ %23, %22 ]
  %7 = and i32 %.018, 7
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %6
  %8 = and i32 %.018, 7
  %wide.trip.count = zext nneg i32 %8 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %9 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %indvars.iv
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = call i32 @firfilt_rrrf_push(ptr noundef %4, float noundef %10) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %6
  %12 = call i32 @firfilt_rrrf_write(ptr noundef %5, ptr noundef nonnull %1, i32 noundef %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %13 = call i32 @firfilt_rrrf_execute(ptr noundef %4, ptr noundef nonnull %2) #4
  %14 = call i32 @firfilt_rrrf_execute(ptr noundef %5, ptr noundef nonnull %3) #4
  %15 = load float, ptr %2, align 4, !tbaa !5
  %16 = load float, ptr %3, align 4, !tbaa !5
  %17 = fcmp une float %15, %16
  br i1 %17, label %18, label %21

18:                                               ; preds = %._crit_edge
  %19 = fpext float %15 to double
  %20 = fpext float %16 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.6, i32 noundef 214, ptr noundef nonnull @.str.31, double noundef %19, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.32, double noundef %20) #4
  br label %22

21:                                               ; preds = %._crit_edge
  call void (...) @liquid_autotest_passed() #4
  br label %22

22:                                               ; preds = %21, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %23 = add nuw nsw i32 %.018, 1
  %exitcond23.not = icmp eq i32 %23, 20
  br i1 %exitcond23.not, label %24, label %6, !llvm.loop !11

24:                                               ; preds = %22
  %25 = call i32 @firfilt_rrrf_destroy(ptr noundef %4) #4
  %26 = call i32 @firfilt_rrrf_destroy(ptr noundef %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #4
  ret void
}

declare ptr @firfilt_rrrf_create_kaiser(i32 noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

declare i32 @firfilt_rrrf_push(ptr noundef, float noundef) local_unnamed_addr #2

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

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

declare i32 @firfilt_rrrf_destroy(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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass