; 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_OnePole = type { %struct.sig_dsp_Signal, %struct.sig_dsp_OnePole_Inputs, %struct.sig_dsp_OnePole_Parameters, %struct.sig_dsp_Signal_SingleMonoOutput, float, float, i32, float, float }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_OnePole_Inputs = type { ptr, ptr }
%struct.sig_dsp_OnePole_Parameters = type { i32 }
%struct.sig_dsp_Signal_SingleMonoOutput = type { ptr }
%struct.sig_AudioSettings = type { float, i64, i64 }

; 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_filter_onepole(float noundef, float noundef, float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_OnePole_generate(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca i64, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %8, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %9, i32 0, i32 8
  %11 = load float, ptr %10, align 8, !tbaa !9
  store float %11, ptr %4, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 0, ptr %5, align 8, !tbaa !18
  br label %12

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

21:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %74

22:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %23, i32 0, i32 1
  %25 = getelementptr inbounds %struct.sig_dsp_OnePole_Inputs, ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !23
  %27 = load i64, ptr %5, align 8, !tbaa !18
  %28 = getelementptr inbounds float, ptr %26, i64 %27
  %29 = load float, ptr %28, align 4, !tbaa !17
  store float %29, ptr %6, align 4, !tbaa !17
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %30, i32 0, i32 7
  %32 = load float, ptr %31, align 4, !tbaa !24
  %33 = load float, ptr %6, align 4, !tbaa !17
  %34 = fcmp une float %32, %33
  br i1 %34, label %44, label %35

35:                                               ; preds = %22
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %36, i32 0, i32 6
  %38 = load i32, ptr %37, align 8, !tbaa !25
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %39, i32 0, i32 2
  %41 = getelementptr inbounds %struct.sig_dsp_OnePole_Parameters, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !26
  %43 = icmp ne i32 %38, %42
  br i1 %43, label %44, label %47

44:                                               ; preds = %35, %22
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load float, ptr %6, align 4, !tbaa !17
  call void @sig_dsp_OnePole_recalculateCoefficients(ptr noundef %45, float noundef %46)
  br label %47

47:                                               ; preds = %44, %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %48, i32 0, i32 1
  %50 = getelementptr inbounds %struct.sig_dsp_OnePole_Inputs, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !27
  %52 = load i64, ptr %5, align 8, !tbaa !18
  %53 = getelementptr inbounds float, ptr %51, i64 %52
  %54 = load float, ptr %53, align 4, !tbaa !17
  %55 = load float, ptr %4, align 4, !tbaa !17
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %56, i32 0, i32 4
  %58 = load float, ptr %57, align 8, !tbaa !28
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %59, i32 0, i32 5
  %61 = load float, ptr %60, align 4, !tbaa !29
  %62 = call float @sig_filter_onepole(float noundef %54, float noundef %55, float noundef %58, float noundef %61)
  store float %62, ptr %7, align 4, !tbaa !17
  %63 = load float, ptr %7, align 4, !tbaa !17
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %64, i32 0, i32 3
  %66 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !30
  %68 = load i64, ptr %5, align 8, !tbaa !18
  %69 = getelementptr inbounds float, ptr %67, i64 %68
  store float %63, ptr %69, align 4, !tbaa !17
  %70 = load float, ptr %7, align 4, !tbaa !17
  store float %70, ptr %4, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %71

71:                                               ; preds = %47
  %72 = load i64, ptr %5, align 8, !tbaa !18
  %73 = add i64 %72, 1
  store i64 %73, ptr %5, align 8, !tbaa !18
  br label %12, !llvm.loop !31

74:                                               ; preds = %21
  %75 = load float, ptr %4, align 4, !tbaa !17
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.sig_dsp_OnePole, ptr %76, i32 0, i32 8
  store float %75, ptr %77, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

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

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, !16, i64 64}
!10 = !{!"sig_dsp_OnePole", !11, i64 0, !12, i64 16, !13, i64 32, !15, i64 40, !16, i64 48, !16, i64 52, !14, i64 56, !16, i64 60, !16, i64 64}
!11 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!12 = !{!"sig_dsp_OnePole_Inputs", !6, i64 0, !6, i64 8}
!13 = !{!"sig_dsp_OnePole_Parameters", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!16, !16, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!10, !6, i64 0}
!21 = !{!22, !19, i64 16}
!22 = !{!"sig_AudioSettings", !16, i64 0, !19, i64 8, !19, i64 16}
!23 = !{!10, !6, i64 24}
!24 = !{!10, !16, i64 60}
!25 = !{!10, !14, i64 56}
!26 = !{!10, !14, i64 32}
!27 = !{!10, !6, i64 16}
!28 = !{!10, !16, i64 48}
!29 = !{!10, !16, i64 52}
!30 = !{!10, !6, i64 40}
!31 = distinct !{!31, !32}
!32 = !{!"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_filter_onepole(float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0

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

.lr.ph:                                           ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = getelementptr inbounds i8, ptr %0, i64 60
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = getelementptr inbounds i8, ptr %0, i64 52
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  br label %15

._crit_edge:                                      ; preds = %25, %1
  %.0.lcssa = phi float [ %3, %1 ], [ %31, %25 ]
  store float %.0.lcssa, ptr %2, align 8, !tbaa !5
  ret void

15:                                               ; preds = %.lr.ph, %25
  %.025 = phi float [ %3, %.lr.ph ], [ %31, %25 ]
  %.02324 = phi i64 [ 0, %.lr.ph ], [ %34, %25 ]
  %16 = load ptr, ptr %8, align 8, !tbaa !20
  %17 = getelementptr inbounds float, ptr %16, i64 %.02324
  %18 = load float, ptr %17, align 4, !tbaa !21
  %19 = load float, ptr %9, align 4, !tbaa !22
  %20 = fcmp une float %19, %18
  br i1 %20, label %24, label %21

21:                                               ; preds = %15
  %22 = load i32, ptr %10, align 8, !tbaa !23
  %23 = load i32, ptr %11, align 8, !tbaa !24
  %.not = icmp eq i32 %22, %23
  br i1 %.not, label %25, label %24

24:                                               ; preds = %21, %15
  tail call void @sig_dsp_OnePole_recalculateCoefficients(ptr noundef nonnull %0, float noundef %18)
  br label %25

25:                                               ; preds = %24, %21
  %26 = load ptr, ptr %7, align 8, !tbaa !25
  %27 = getelementptr inbounds float, ptr %26, i64 %.02324
  %28 = load float, ptr %27, align 4, !tbaa !21
  %29 = load float, ptr %12, align 8, !tbaa !26
  %30 = load float, ptr %13, align 4, !tbaa !27
  %31 = tail call float @sig_filter_onepole(float noundef %28, float noundef %.025, float noundef %29, float noundef %30)
  %32 = load ptr, ptr %14, align 8, !tbaa !28
  %33 = getelementptr inbounds float, ptr %32, i64 %.02324
  store float %31, ptr %33, align 4, !tbaa !21
  %34 = add nuw i64 %.02324, 1
  %35 = load ptr, ptr %0, align 8, !tbaa !16
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = load i64, ptr %36, align 8, !tbaa !17
  %38 = icmp ult i64 %34, %37
  br i1 %38, label %15, label %._crit_edge, !llvm.loop !29
}

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

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, !15, i64 64}
!6 = !{!"sig_dsp_OnePole", !7, i64 0, !11, i64 16, !12, i64 32, !14, i64 40, !15, i64 48, !15, i64 52, !13, i64 56, !15, i64 60, !15, 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_OnePole_Inputs", !8, i64 0, !8, i64 8}
!12 = !{!"sig_dsp_OnePole_Parameters", !13, i64 0}
!13 = !{!"int", !9, i64 0}
!14 = !{!"sig_dsp_Signal_SingleMonoOutput", !8, i64 0}
!15 = !{!"float", !9, i64 0}
!16 = !{!6, !8, i64 0}
!17 = !{!18, !19, i64 16}
!18 = !{!"sig_AudioSettings", !15, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"long", !9, i64 0}
!20 = !{!6, !8, i64 24}
!21 = !{!15, !15, i64 0}
!22 = !{!6, !15, i64 60}
!23 = !{!6, !13, i64 56}
!24 = !{!6, !13, i64 32}
!25 = !{!6, !8, i64 16}
!26 = !{!6, !15, i64 48}
!27 = !{!6, !15, i64 52}
!28 = !{!6, !8, i64 40}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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