; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (fdelay_rrrf_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
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@__const.autotest_fdelay_rrrf_push_write.buf = external hidden unnamed_addr constant [8 x float], align 16
@.str.26 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.27 = 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

declare i32 @fdelay_rrrf_set_delay(ptr noundef, float noundef) #1

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

declare void @liquid_autotest_passed(...) #1

declare i32 @fdelay_rrrf_destroy(ptr noundef) #1

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

declare ptr @fdelay_rrrf_create_default(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_fdelay_rrrf_push_write() #2 {
  %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 @fdelay_rrrf_create_default(i32 noundef 200)
  store ptr %9, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %10 = call ptr @fdelay_rrrf_create_default(i32 noundef 200)
  store ptr %10, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %1, align 8, !tbaa !5
  %12 = call i32 @fdelay_rrrf_set_delay(ptr noundef %11, float noundef 0x401CE978E0000000)
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = call i32 @fdelay_rrrf_set_delay(ptr noundef %13, float noundef 0x401CE978E0000000)
  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_fdelay_rrrf_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 %15

15:                                               ; preds = %54, %0
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = icmp ult i32 %16, 20
  br i1 %17, label %18, label %57

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

21:                                               ; preds = %32, %18
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp ult i32 %22, %23
  br i1 %24, label %25, label %35

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

32:                                               ; preds = %25
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = add i32 %33, 1
  store i32 %34, ptr %5, align 4, !tbaa !9
  br label %21, !llvm.loop !13

35:                                               ; preds = %21
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds [8 x float], ptr %3, i64 0, i64 0
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = call i32 @fdelay_rrrf_write(ptr noundef %36, ptr noundef %37, i32 noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  %41 = call i32 @fdelay_rrrf_execute(ptr noundef %40, ptr noundef %7)
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = call i32 @fdelay_rrrf_execute(ptr noundef %42, ptr noundef %8)
  %44 = load float, ptr %7, align 4, !tbaa !11
  %45 = load float, ptr %8, align 4, !tbaa !11
  %46 = fcmp une float %44, %45
  br i1 %46, label %47, label %52

47:                                               ; preds = %35
  %48 = load float, ptr %7, align 4, !tbaa !11
  %49 = fpext float %48 to double
  %50 = load float, ptr %8, align 4, !tbaa !11
  %51 = fpext float %50 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 149, ptr noundef @.str.26, double noundef %49, ptr noundef @.str.2, ptr noundef @.str.27, double noundef %51)
  br label %53

52:                                               ; preds = %35
  call void (...) @liquid_autotest_passed()
  br label %53

53:                                               ; preds = %52, %47
  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 %54

54:                                               ; preds = %53
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = add i32 %55, 1
  store i32 %56, ptr %4, align 4, !tbaa !9
  br label %15, !llvm.loop !15

57:                                               ; preds = %15
  %58 = load ptr, ptr %1, align 8, !tbaa !5
  %59 = call i32 @fdelay_rrrf_destroy(ptr noundef %58)
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = call i32 @fdelay_rrrf_destroy(ptr noundef %60)
  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
}

; 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) #3

declare i32 @fdelay_rrrf_push(ptr noundef, float noundef) #1

declare i32 @fdelay_rrrf_write(ptr noundef, ptr noundef, i32 noundef) #1

declare i32 @fdelay_rrrf_execute(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@__const.autotest_fdelay_rrrf_push_write.buf = external hidden unnamed_addr constant [8 x float], align 16
@.str.26 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.27 = 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

declare i32 @fdelay_rrrf_set_delay(ptr noundef, float noundef) local_unnamed_addr #1

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

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

declare i32 @fdelay_rrrf_destroy(ptr noundef) local_unnamed_addr #1

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

declare ptr @fdelay_rrrf_create_default(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_fdelay_rrrf_push_write() local_unnamed_addr #2 {
  %1 = alloca [8 x float], align 16
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = tail call ptr @fdelay_rrrf_create_default(i32 noundef 200) #4
  %5 = tail call ptr @fdelay_rrrf_create_default(i32 noundef 200) #4
  %6 = tail call i32 @fdelay_rrrf_set_delay(ptr noundef %4, float noundef 0x401CE978E0000000) #4
  %7 = tail call i32 @fdelay_rrrf_set_delay(ptr noundef %5, float noundef 0x401CE978E0000000) #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_fdelay_rrrf_push_write.buf, i64 32, i1 false)
  br label %8

8:                                                ; preds = %0, %24
  %.020 = phi i32 [ 0, %0 ], [ %25, %24 ]
  %9 = and i32 %.020, 7
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %8
  %10 = and i32 %.020, 7
  %wide.trip.count = zext nneg i32 %10 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 ]
  %11 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %indvars.iv
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = call i32 @fdelay_rrrf_push(ptr noundef %4, float noundef %12) #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, %8
  %14 = call i32 @fdelay_rrrf_write(ptr noundef %5, ptr noundef nonnull %1, i32 noundef %9) #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
  %15 = call i32 @fdelay_rrrf_execute(ptr noundef %4, ptr noundef nonnull %2) #4
  %16 = call i32 @fdelay_rrrf_execute(ptr noundef %5, ptr noundef nonnull %3) #4
  %17 = load float, ptr %2, align 4, !tbaa !5
  %18 = load float, ptr %3, align 4, !tbaa !5
  %19 = fcmp une float %17, %18
  br i1 %19, label %20, label %23

20:                                               ; preds = %._crit_edge
  %21 = fpext float %17 to double
  %22 = fpext float %18 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 149, ptr noundef nonnull @.str.26, double noundef %21, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.27, double noundef %22) #4
  br label %24

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

24:                                               ; preds = %23, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %25 = add nuw nsw i32 %.020, 1
  %exitcond25.not = icmp eq i32 %25, 20
  br i1 %exitcond25.not, label %26, label %8, !llvm.loop !11

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

; 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) #3

declare i32 @fdelay_rrrf_push(ptr noundef, float noundef) local_unnamed_addr #1

declare i32 @fdelay_rrrf_write(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @fdelay_rrrf_execute(ptr noundef, ptr noundef) local_unnamed_addr #1

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