; 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_Allpass = type { %struct.sig_dsp_Signal, %struct.sig_dsp_Allpass_Inputs, %struct.sig_dsp_Signal_SingleMonoOutput, ptr }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_Allpass_Inputs = type { 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_DelayLine_linearAllpass(ptr noundef, float noundef, float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Allpass_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
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %10, 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 %11

11:                                               ; preds = %94, %1
  %12 = load i64, ptr %4, align 8, !tbaa !9
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.sig_dsp_Allpass, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct.sig_AudioSettings, ptr %16, i32 0, i32 2
  %18 = load i64, ptr %17, align 8, !tbaa !16
  %19 = icmp ult i64 %12, %18
  br i1 %19, label %21, label %20

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

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

62:                                               ; preds = %21
  %63 = load float, ptr %5, align 4, !tbaa !24
  %64 = fsub float %63, 1.000000e+00
  store float %64, ptr %9, align 4, !tbaa !24
  br label %65

65:                                               ; preds = %62, %21
  %66 = load float, ptr %7, align 4, !tbaa !24
  %67 = fcmp ole float %66, 0.000000e+00
  br i1 %67, label %71, label %68

68:                                               ; preds = %65
  %69 = load float, ptr %8, align 4, !tbaa !24
  %70 = fcmp ole float %69, 0.000000e+00
  br i1 %70, label %71, label %79

71:                                               ; preds = %68, %65
  %72 = load float, ptr %6, align 4, !tbaa !24
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.sig_dsp_Allpass, ptr %73, i32 0, i32 2
  %75 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !29
  %77 = load i64, ptr %4, align 8, !tbaa !9
  %78 = getelementptr inbounds float, ptr %76, i64 %77
  store float %72, ptr %78, align 4, !tbaa !24
  br label %93

79:                                               ; preds = %68
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.sig_dsp_Allpass, ptr %80, i32 0, i32 3
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  %83 = load float, ptr %6, align 4, !tbaa !24
  %84 = load float, ptr %9, align 4, !tbaa !24
  %85 = load float, ptr %8, align 4, !tbaa !24
  %86 = call float @sig_DelayLine_linearAllpass(ptr noundef %82, float noundef %83, float noundef %84, float noundef %85)
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.sig_dsp_Allpass, ptr %87, i32 0, i32 2
  %89 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !29
  %91 = load i64, ptr %4, align 8, !tbaa !9
  %92 = getelementptr inbounds float, ptr %90, i64 %91
  store float %86, ptr %92, align 4, !tbaa !24
  br label %93

93:                                               ; preds = %79, %71
  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 %94

94:                                               ; preds = %93
  %95 = load i64, ptr %4, align 8, !tbaa !9
  %96 = add i64 %95, 1
  store i64 %96, ptr %4, align 8, !tbaa !9
  br label %11, !llvm.loop !30

97:                                               ; preds = %20
  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_Allpass", !13, i64 0, !14, i64 16, !15, i64 40, !6, i64 48}
!13 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!14 = !{!"sig_dsp_Allpass_Inputs", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!16 = !{!17, !10, i64 16}
!17 = !{!"sig_AudioSettings", !18, i64 0, !10, i64 8, !10, i64 16}
!18 = !{!"float", !7, i64 0}
!19 = !{!12, !6, i64 48}
!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 = !{!18, !18, i64 0}
!25 = !{!12, !6, i64 16}
!26 = !{!12, !6, i64 24}
!27 = !{!12, !6, i64 32}
!28 = !{!17, !18, i64 0}
!29 = !{!12, !6, i64 40}
!30 = distinct !{!30, !31}
!31 = !{!"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_DelayLine_linearAllpass(ptr noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Allpass_generate(ptr nocapture noundef readonly %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 !13
  %.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 16
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  br label %10

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

10:                                               ; preds = %.lr.ph, %38
  %11 = phi ptr [ %2, %.lr.ph ], [ %39, %38 ]
  %.02731 = phi i64 [ 0, %.lr.ph ], [ %40, %38 ]
  %12 = load ptr, ptr %5, align 8, !tbaa !17
  %13 = getelementptr inbounds float, ptr %12, i64 %.02731
  %14 = load float, ptr %13, align 4, !tbaa !18
  %15 = load ptr, ptr %6, align 8, !tbaa !19
  %16 = getelementptr inbounds float, ptr %15, i64 %.02731
  %17 = load float, ptr %16, align 4, !tbaa !18
  %18 = load ptr, ptr %7, align 8, !tbaa !20
  %19 = getelementptr inbounds float, ptr %18, i64 %.02731
  %20 = load float, ptr %19, align 4, !tbaa !18
  %21 = fcmp ole float %17, 0.000000e+00
  %22 = fcmp ole float %20, 0.000000e+00
  %or.cond = select i1 %21, i1 true, i1 %22
  br i1 %or.cond, label %23, label %26

23:                                               ; preds = %10
  %24 = load ptr, ptr %9, align 8, !tbaa !21
  %25 = getelementptr inbounds float, ptr %24, i64 %.02731
  store float %14, ptr %25, align 4, !tbaa !18
  br label %38

26:                                               ; preds = %10
  %27 = load float, ptr %11, align 8, !tbaa !22
  %28 = fmul float %17, %27
  %29 = load ptr, ptr %8, align 8, !tbaa !23
  %30 = load ptr, ptr %29, align 8, !tbaa !24
  %31 = load i64, ptr %30, align 8, !tbaa !26
  %32 = uitofp i64 %31 to float
  %33 = fcmp ult float %28, %32
  %34 = fadd float %32, -1.000000e+00
  %.0 = select i1 %33, float %28, float %34
  %35 = tail call float @sig_DelayLine_linearAllpass(ptr noundef nonnull %29, float noundef %14, float noundef %.0, float noundef %20)
  %36 = load ptr, ptr %9, align 8, !tbaa !21
  %37 = getelementptr inbounds float, ptr %36, i64 %.02731
  store float %35, ptr %37, align 4, !tbaa !18
  %.pre = load ptr, ptr %0, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %26, %23
  %39 = phi ptr [ %.pre, %26 ], [ %11, %23 ]
  %40 = add nuw i64 %.02731, 1
  %41 = getelementptr inbounds i8, ptr %39, i64 16
  %42 = load i64, ptr %41, align 8, !tbaa !13
  %43 = icmp ult i64 %40, %42
  br i1 %43, label %10, label %._crit_edge, !llvm.loop !28
}

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_Allpass", !7, i64 0, !11, i64 16, !12, i64 40, !8, i64 48}
!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_Allpass_Inputs", !8, i64 0, !8, i64 8, !8, i64 16}
!12 = !{!"sig_dsp_Signal_SingleMonoOutput", !8, i64 0}
!13 = !{!14, !16, i64 16}
!14 = !{!"sig_AudioSettings", !15, i64 0, !16, i64 8, !16, i64 16}
!15 = !{!"float", !9, i64 0}
!16 = !{!"long", !9, i64 0}
!17 = !{!6, !8, i64 16}
!18 = !{!15, !15, i64 0}
!19 = !{!6, !8, i64 24}
!20 = !{!6, !8, i64 32}
!21 = !{!6, !8, i64 40}
!22 = !{!14, !15, i64 0}
!23 = !{!6, !8, i64 48}
!24 = !{!25, !8, i64 0}
!25 = !{!"sig_DelayLine", !8, i64 0, !16, i64 8}
!26 = !{!27, !16, i64 0}
!27 = !{!"sig_Buffer", !16, i64 0, !8, i64 8}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


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