; 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_dsp_Comb = type { %struct.sig_dsp_Signal, %struct.sig_dsp_Comb_Inputs, %struct.sig_dsp_Signal_SingleMonoOutput, ptr, float }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_Comb_Inputs = type { ptr, ptr, ptr, ptr }
%struct.sig_dsp_Signal_SingleMonoOutput = type { ptr }
%struct.sig_AudioSettings = type { float, i64, i64 }
%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: inlinehint nounwind uwtable
declare dso_local float @sig_fmaxf(float noundef, float noundef) #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Comb_generate(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %14, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %108, %1
  %16 = load i64, ptr %4, align 8, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds %struct.sig_AudioSettings, ptr %20, i32 0, i32 2
  %22 = load i64, ptr %21, align 8, !tbaa !17
  %23 = icmp ult i64 %16, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %111

25:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %26, i32 0, i32 3
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  %29 = getelementptr inbounds %struct.sig_DelayLine, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !20
  %31 = getelementptr inbounds %struct.sig_Buffer, ptr %30, i32 0, i32 0
  %32 = load i64, ptr %31, align 8, !tbaa !22
  %33 = uitofp i64 %32 to float
  store float %33, ptr %5, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %34, i32 0, i32 1
  %36 = getelementptr inbounds %struct.sig_dsp_Comb_Inputs, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %38 = load i64, ptr %4, align 8, !tbaa !9
  %39 = getelementptr inbounds float, ptr %37, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !24
  store float %40, ptr %6, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %struct.sig_dsp_Comb_Inputs, ptr %42, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !26
  %45 = load i64, ptr %4, align 8, !tbaa !9
  %46 = getelementptr inbounds float, ptr %44, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !24
  store float %47, ptr %7, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %48, i32 0, i32 1
  %50 = getelementptr inbounds %struct.sig_dsp_Comb_Inputs, ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !27
  %52 = load i64, ptr %4, align 8, !tbaa !9
  %53 = getelementptr inbounds float, ptr %51, i64 %52
  %54 = load float, ptr %53, align 4, !tbaa !24
  store float %54, ptr %8, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %55, i32 0, i32 1
  %57 = getelementptr inbounds %struct.sig_dsp_Comb_Inputs, ptr %56, i32 0, i32 3
  %58 = load ptr, ptr %57, align 8, !tbaa !28
  %59 = load i64, ptr %4, align 8, !tbaa !9
  %60 = getelementptr inbounds float, ptr %58, i64 %59
  %61 = load float, ptr %60, align 4, !tbaa !24
  store float %61, ptr %9, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %62 = load float, ptr %8, align 4, !tbaa !24
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !11
  %67 = getelementptr inbounds %struct.sig_AudioSettings, ptr %66, i32 0, i32 0
  %68 = load float, ptr %67, align 8, !tbaa !29
  %69 = fmul float %62, %68
  store float %69, ptr %10, align 4, !tbaa !24
  %70 = load float, ptr %10, align 4, !tbaa !24
  %71 = load float, ptr %5, align 4, !tbaa !24
  %72 = fcmp oge float %70, %71
  br i1 %72, label %73, label %76

73:                                               ; preds = %25
  %74 = load float, ptr %5, align 4, !tbaa !24
  %75 = fsub float %74, 1.000000e+00
  store float %75, ptr %10, align 4, !tbaa !24
  br label %76

76:                                               ; preds = %73, %25
  %77 = load float, ptr %8, align 4, !tbaa !24
  %78 = call float @sig_fmaxf(float noundef %77, float noundef 0x3EE4F8B580000000)
  store float %78, ptr %8, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %79, i32 0, i32 3
  %81 = load ptr, ptr %80, align 8, !tbaa !19
  %82 = load float, ptr %10, align 4, !tbaa !24
  %83 = call float @sig_DelayLine_linearReadAt(ptr noundef %81, float noundef %82)
  store float %83, ptr %11, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %84 = load float, ptr %11, align 4, !tbaa !24
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %85, i32 0, i32 4
  %87 = load float, ptr %86, align 8, !tbaa !30
  %88 = load float, ptr %9, align 4, !tbaa !24
  %89 = call float @sig_filter_smooth(float noundef %84, float noundef %87, float noundef %88)
  store float %89, ptr %12, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %90 = load float, ptr %6, align 4, !tbaa !24
  %91 = load float, ptr %12, align 4, !tbaa !24
  %92 = load float, ptr %7, align 4, !tbaa !24
  %93 = call float @sig_DelayLine_feedback(float noundef %90, float noundef %91, float noundef %92)
  store float %93, ptr %13, align 4, !tbaa !24
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %94, i32 0, i32 3
  %96 = load ptr, ptr %95, align 8, !tbaa !19
  %97 = load float, ptr %13, align 4, !tbaa !24
  call void @sig_DelayLine_write(ptr noundef %96, float noundef %97)
  %98 = load float, ptr %12, align 4, !tbaa !24
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %99, i32 0, i32 2
  %101 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !31
  %103 = load i64, ptr %4, align 8, !tbaa !9
  %104 = getelementptr inbounds float, ptr %102, i64 %103
  store float %98, ptr %104, align 4, !tbaa !24
  %105 = load float, ptr %12, align 4, !tbaa !24
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.sig_dsp_Comb, ptr %106, i32 0, i32 4
  store float %105, ptr %107, align 8, !tbaa !30
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %108

108:                                              ; preds = %76
  %109 = load i64, ptr %4, align 8, !tbaa !9
  %110 = add i64 %109, 1
  store i64 %110, ptr %4, align 8, !tbaa !9
  br label %15, !llvm.loop !32

111:                                              ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"sig_dsp_Comb", !13, i64 0, !14, i64 16, !15, i64 48, !6, i64 56, !16, i64 64}
!13 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!14 = !{!"sig_dsp_Comb_Inputs", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!18, !10, i64 16}
!18 = !{!"sig_AudioSettings", !16, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!12, !6, i64 56}
!20 = !{!21, !6, i64 0}
!21 = !{!"sig_DelayLine", !6, i64 0, !10, i64 8}
!22 = !{!23, !10, i64 0}
!23 = !{!"sig_Buffer", !10, i64 0, !6, i64 8}
!24 = !{!16, !16, i64 0}
!25 = !{!12, !6, i64 16}
!26 = !{!12, !6, i64 32}
!27 = !{!12, !6, i64 24}
!28 = !{!12, !6, i64 40}
!29 = !{!18, !16, i64 0}
!30 = !{!12, !16, i64 64}
!31 = !{!12, !6, i64 48}
!32 = distinct !{!32, !33}
!33 = !{!"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: inlinehint nounwind uwtable
declare dso_local float @sig_fmaxf(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare dso_local float @sig_filter_smooth(float noundef, float noundef, float noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint nounwind uwtable
declare dso_local void @sig_DelayLine_write(ptr noundef, float noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare dso_local float @sig_DelayLine_feedback(float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Comb_generate(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  %4 = load i64, ptr %3, align 8, !tbaa !14
  %.not = icmp eq i64 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  br label %12

._crit_edge:                                      ; preds = %12, %1
  ret void

12:                                               ; preds = %.lr.ph, %12
  %13 = phi ptr [ %2, %.lr.ph ], [ %44, %12 ]
  %.036 = phi i64 [ 0, %.lr.ph ], [ %43, %12 ]
  %14 = load ptr, ptr %5, align 8, !tbaa !17
  %15 = load ptr, ptr %14, align 8, !tbaa !18
  %16 = load i64, ptr %15, align 8, !tbaa !20
  %17 = uitofp i64 %16 to float
  %18 = load ptr, ptr %6, align 8, !tbaa !22
  %19 = getelementptr inbounds float, ptr %18, i64 %.036
  %20 = load float, ptr %19, align 4, !tbaa !23
  %21 = load ptr, ptr %7, align 8, !tbaa !24
  %22 = getelementptr inbounds float, ptr %21, i64 %.036
  %23 = load float, ptr %22, align 4, !tbaa !23
  %24 = load ptr, ptr %8, align 8, !tbaa !25
  %25 = getelementptr inbounds float, ptr %24, i64 %.036
  %26 = load float, ptr %25, align 4, !tbaa !23
  %27 = load ptr, ptr %9, align 8, !tbaa !26
  %28 = getelementptr inbounds float, ptr %27, i64 %.036
  %29 = load float, ptr %28, align 4, !tbaa !23
  %30 = load float, ptr %13, align 8, !tbaa !27
  %31 = fmul float %26, %30
  %32 = fcmp ult float %31, %17
  %33 = fadd float %17, -1.000000e+00
  %.033 = select i1 %32, float %31, float %33
  %34 = tail call float @sig_fmaxf(float noundef %26, float noundef 0x3EE4F8B580000000)
  %35 = load ptr, ptr %5, align 8, !tbaa !17
  %36 = tail call float @sig_DelayLine_linearReadAt(ptr noundef %35, float noundef %.033)
  %37 = load float, ptr %10, align 8, !tbaa !28
  %38 = tail call float @sig_filter_smooth(float noundef %36, float noundef %37, float noundef %29)
  %39 = tail call float @sig_DelayLine_feedback(float noundef %20, float noundef %38, float noundef %23)
  %40 = load ptr, ptr %5, align 8, !tbaa !17
  tail call void @sig_DelayLine_write(ptr noundef %40, float noundef %39)
  %41 = load ptr, ptr %11, align 8, !tbaa !29
  %42 = getelementptr inbounds float, ptr %41, i64 %.036
  store float %38, ptr %42, align 4, !tbaa !23
  store float %38, ptr %10, align 8, !tbaa !28
  %43 = add nuw i64 %.036, 1
  %44 = load ptr, ptr %0, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load i64, ptr %45, align 8, !tbaa !14
  %47 = icmp ult i64 %43, %46
  br i1 %47, label %12, label %._crit_edge, !llvm.loop !30
}

attributes #0 = { 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 #1 = { 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, !8, i64 0}
!6 = !{!"sig_dsp_Comb", !7, i64 0, !11, i64 16, !12, i64 48, !8, i64 56, !13, i64 64}
!7 = !{!"sig_dsp_Signal", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"sig_dsp_Comb_Inputs", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!12 = !{!"sig_dsp_Signal_SingleMonoOutput", !8, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!15, !16, i64 16}
!15 = !{!"sig_AudioSettings", !13, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"long", !9, i64 0}
!17 = !{!6, !8, i64 56}
!18 = !{!19, !8, i64 0}
!19 = !{!"sig_DelayLine", !8, i64 0, !16, i64 8}
!20 = !{!21, !16, i64 0}
!21 = !{!"sig_Buffer", !16, i64 0, !8, i64 8}
!22 = !{!6, !8, i64 16}
!23 = !{!13, !13, i64 0}
!24 = !{!6, !8, i64 32}
!25 = !{!6, !8, i64 24}
!26 = !{!6, !8, i64 40}
!27 = !{!15, !13, i64 0}
!28 = !{!6, !13, i64 64}
!29 = !{!6, !8, i64 48}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass