; LLVM IR from lichen-community-systems/signaletic :: libsignaletic/src (libsignaletic)

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

%struct.sig_DelayLine = type { ptr, i64 }
%struct.sig_Buffer = type { i64, ptr }

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: inlinehint nounwind uwtable
declare dso_local float @sig_DelayLine_cubicReadAt(ptr noundef, float noundef) #2

; Function Attrs: inlinehint nounwind uwtable
define dso_local float @sig_DelayLine_cubicReadAtTimes(ptr noundef %0, float noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, float noundef %5, float noundef %6) #2 {
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca i64, align 8
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i64 %4, ptr %12, align 8, !tbaa !11
  store float %5, ptr %13, align 4, !tbaa !9
  store float %6, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store float 0.000000e+00, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store i64 0, ptr %16, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %69, %7
  %24 = load i64, ptr %16, align 8, !tbaa !11
  %25 = load i64, ptr %12, align 8, !tbaa !11
  %26 = icmp ult i64 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %72

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = load i64, ptr %16, align 8, !tbaa !11
  %31 = getelementptr inbounds float, ptr %29, i64 %30
  %32 = load float, ptr %31, align 4, !tbaa !9
  store float %32, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %33 = load float, ptr %17, align 4, !tbaa !9
  %34 = load float, ptr %14, align 4, !tbaa !9
  %35 = fmul float %33, %34
  store float %35, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = load i64, ptr %16, align 8, !tbaa !11
  %38 = getelementptr inbounds float, ptr %36, i64 %37
  %39 = load float, ptr %38, align 4, !tbaa !9
  store float %39, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %40 = load float, ptr %17, align 4, !tbaa !9
  %41 = fcmp ole float %40, 0.000000e+00
  br i1 %41, label %42, label %44

42:                                               ; preds = %28
  %43 = load float, ptr %9, align 4, !tbaa !9
  store float %43, ptr %20, align 4, !tbaa !9
  br label %64

44:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %45 = load float, ptr %18, align 4, !tbaa !9
  %46 = load float, ptr %13, align 4, !tbaa !9
  %47 = fmul float %45, %46
  store float %47, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.sig_DelayLine, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = getelementptr inbounds %struct.sig_Buffer, ptr %50, i32 0, i32 0
  %52 = load i64, ptr %51, align 8, !tbaa !15
  %53 = uitofp i64 %52 to float
  store float %53, ptr %22, align 4, !tbaa !9
  %54 = load float, ptr %21, align 4, !tbaa !9
  %55 = load float, ptr %22, align 4, !tbaa !9
  %56 = fcmp oge float %54, %55
  br i1 %56, label %57, label %60

57:                                               ; preds = %44
  %58 = load float, ptr %22, align 4, !tbaa !9
  %59 = fsub float %58, 1.000000e+00
  store float %59, ptr %21, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %57, %44
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load float, ptr %21, align 4, !tbaa !9
  %63 = call float @sig_DelayLine_cubicReadAt(ptr noundef %61, float noundef %62)
  store float %63, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  br label %64

64:                                               ; preds = %60, %42
  %65 = load float, ptr %20, align 4, !tbaa !9
  %66 = load float, ptr %19, align 4, !tbaa !9
  %67 = load float, ptr %15, align 4, !tbaa !9
  %68 = call float @llvm.fmuladd.f32(float %65, float %66, float %67)
  store float %68, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %69

69:                                               ; preds = %64
  %70 = load i64, ptr %16, align 8, !tbaa !11
  %71 = add i64 %70, 1
  store i64 %71, ptr %16, align 8, !tbaa !11
  br label %23, !llvm.loop !17

72:                                               ; preds = %27
  %73 = load float, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  ret float %73
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { inlinehint 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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"sig_DelayLine", !6, i64 0, !12, i64 8}
!15 = !{!16, !12, i64 0}
!16 = !{!"sig_Buffer", !12, i64 0, !6, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"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"

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: inlinehint nounwind uwtable
declare dso_local float @sig_DelayLine_cubicReadAt(ptr noundef, float noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
define dso_local float @sig_DelayLine_cubicReadAtTimes(ptr noundef %0, float noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, i64 noundef %4, float noundef %5, float noundef %6) local_unnamed_addr #1 {
  %.not = icmp eq i64 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %22, %7
  %.0.lcssa = phi float [ 0.000000e+00, %7 ], [ %23, %22 ]
  ret float %.0.lcssa

.lr.ph:                                           ; preds = %7, %22
  %.028 = phi float [ %23, %22 ], [ 0.000000e+00, %7 ]
  %.02427 = phi i64 [ %24, %22 ], [ 0, %7 ]
  %8 = getelementptr inbounds float, ptr %2, i64 %.02427
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = getelementptr inbounds float, ptr %3, i64 %.02427
  %11 = load float, ptr %10, align 4, !tbaa !5
  %12 = fcmp ugt float %9, 0.000000e+00
  br i1 %12, label %13, label %22

13:                                               ; preds = %.lr.ph
  %14 = fmul float %9, %6
  %15 = fmul float %14, %5
  %16 = load ptr, ptr %0, align 8, !tbaa !9
  %17 = load i64, ptr %16, align 8, !tbaa !13
  %18 = uitofp i64 %17 to float
  %19 = fcmp ult float %15, %18
  %20 = fadd float %18, -1.000000e+00
  %.022 = select i1 %19, float %15, float %20
  %21 = tail call float @sig_DelayLine_cubicReadAt(ptr noundef nonnull %0, float noundef %.022)
  br label %22

22:                                               ; preds = %.lr.ph, %13
  %.023 = phi float [ %21, %13 ], [ %1, %.lr.ph ]
  %23 = tail call float @llvm.fmuladd.f32(float %.023, float %11, float %.028)
  %24 = add nuw i64 %.02427, 1
  %exitcond.not = icmp eq i64 %24, %4
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15
}

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

!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 = !{!10, !11, i64 0}
!10 = !{!"sig_DelayLine", !11, i64 0, !12, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"sig_Buffer", !12, i64 0, !11, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass