; 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_Smooth = type { %struct.sig_dsp_Signal, %struct.sig_dsp_Smooth_Inputs, %struct.sig_dsp_Smooth_Parameters, %struct.sig_dsp_Signal_SingleMonoOutput, float, float, float }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_Smooth_Inputs = type { ptr }
%struct.sig_dsp_Smooth_Parameters = type { float }
%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_smooth(float noundef, float noundef, float noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Smooth_generate(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca i64, align 8
  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_Smooth, ptr %9, i32 0, i32 6
  %11 = load float, ptr %10, align 8, !tbaa !9
  store float %11, ptr %4, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %12, i32 0, i32 4
  %14 = load float, ptr %13, align 8, !tbaa !17
  store float %14, ptr %5, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %15, i32 0, i32 2
  %17 = getelementptr inbounds %struct.sig_dsp_Smooth_Parameters, ptr %16, i32 0, i32 0
  %18 = load float, ptr %17, align 8, !tbaa !18
  store float %18, ptr %6, align 4, !tbaa !16
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %19, i32 0, i32 5
  %21 = load float, ptr %20, align 4, !tbaa !19
  %22 = load float, ptr %6, align 4, !tbaa !16
  %23 = fcmp une float %21, %22
  br i1 %23, label %24, label %38

24:                                               ; preds = %1
  %25 = load float, ptr %6, align 4, !tbaa !16
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !20
  %30 = getelementptr inbounds %struct.sig_AudioSettings, ptr %29, i32 0, i32 0
  %31 = load float, ptr %30, align 8, !tbaa !21
  %32 = call float @sig_filter_smooth_calculateCoefficient(float noundef %25, float noundef %31)
  store float %32, ptr %5, align 4, !tbaa !16
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %33, i32 0, i32 4
  store float %32, ptr %34, align 8, !tbaa !17
  %35 = load float, ptr %6, align 4, !tbaa !16
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %36, i32 0, i32 5
  store float %35, ptr %37, align 4, !tbaa !19
  br label %38

38:                                               ; preds = %24, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !24
  br label %39

39:                                               ; preds = %66, %38
  %40 = load i64, ptr %7, align 8, !tbaa !24
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  %45 = getelementptr inbounds %struct.sig_AudioSettings, ptr %44, i32 0, i32 2
  %46 = load i64, ptr %45, align 8, !tbaa !25
  %47 = icmp ult i64 %40, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %69

49:                                               ; preds = %39
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %50, i32 0, i32 1
  %52 = getelementptr inbounds %struct.sig_dsp_Smooth_Inputs, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !26
  %54 = load i64, ptr %7, align 8, !tbaa !24
  %55 = getelementptr inbounds float, ptr %53, i64 %54
  %56 = load float, ptr %55, align 4, !tbaa !16
  %57 = load float, ptr %4, align 4, !tbaa !16
  %58 = load float, ptr %5, align 4, !tbaa !16
  %59 = call float @sig_filter_smooth(float noundef %56, float noundef %57, float noundef %58)
  store float %59, ptr %4, align 4, !tbaa !16
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %60, i32 0, i32 3
  %62 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !27
  %64 = load i64, ptr %7, align 8, !tbaa !24
  %65 = getelementptr inbounds float, ptr %63, i64 %64
  store float %59, ptr %65, align 4, !tbaa !16
  br label %66

66:                                               ; preds = %49
  %67 = load i64, ptr %7, align 8, !tbaa !24
  %68 = add i64 %67, 1
  store i64 %68, ptr %7, align 8, !tbaa !24
  br label %39, !llvm.loop !28

69:                                               ; preds = %48
  %70 = load float, ptr %4, align 4, !tbaa !16
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.sig_dsp_Smooth, ptr %71, i32 0, i32 6
  store float %70, ptr %72, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  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, !14, i64 48}
!10 = !{!"sig_dsp_Smooth", !11, i64 0, !12, i64 16, !13, i64 24, !15, i64 32, !14, i64 40, !14, i64 44, !14, i64 48}
!11 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!12 = !{!"sig_dsp_Smooth_Inputs", !6, i64 0}
!13 = !{!"sig_dsp_Smooth_Parameters", !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!16 = !{!14, !14, i64 0}
!17 = !{!10, !14, i64 40}
!18 = !{!10, !14, i64 24}
!19 = !{!10, !14, i64 44}
!20 = !{!10, !6, i64 0}
!21 = !{!22, !14, i64 0}
!22 = !{!"sig_AudioSettings", !14, i64 0, !23, i64 8, !23, i64 16}
!23 = !{!"long", !7, i64 0}
!24 = !{!23, !23, i64 0}
!25 = !{!22, !23, i64 16}
!26 = !{!10, !6, i64 16}
!27 = !{!10, !6, i64 32}
!28 = distinct !{!28, !29}
!29 = !{!"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_smooth(float noundef, float noundef, float noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Smooth_generate(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 48
  %3 = load float, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = load float, ptr %4, align 8, !tbaa !15
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load float, ptr %6, align 8, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %0, i64 44
  %9 = load float, ptr %8, align 4, !tbaa !17
  %10 = fcmp une float %9, %7
  br i1 %10, label %11, label %15

11:                                               ; preds = %1
  %12 = load ptr, ptr %0, align 8, !tbaa !18
  %13 = load float, ptr %12, align 8, !tbaa !19
  %14 = tail call float @sig_filter_smooth_calculateCoefficient(float noundef %7, float noundef %13)
  store float %14, ptr %4, align 8, !tbaa !15
  store float %7, ptr %8, align 4, !tbaa !17
  br label %15

15:                                               ; preds = %11, %1
  %.022 = phi float [ %14, %11 ], [ %5, %1 ]
  %16 = load ptr, ptr %0, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load i64, ptr %17, align 8, !tbaa !22
  %.not = icmp eq i64 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  br label %21

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

21:                                               ; preds = %.lr.ph, %21
  %.025 = phi i64 [ 0, %.lr.ph ], [ %28, %21 ]
  %.02124 = phi float [ %3, %.lr.ph ], [ %25, %21 ]
  %22 = load ptr, ptr %19, align 8, !tbaa !23
  %23 = getelementptr inbounds float, ptr %22, i64 %.025
  %24 = load float, ptr %23, align 4, !tbaa !24
  %25 = tail call float @sig_filter_smooth(float noundef %24, float noundef %.02124, float noundef %.022)
  %26 = load ptr, ptr %20, align 8, !tbaa !25
  %27 = getelementptr inbounds float, ptr %26, i64 %.025
  store float %25, ptr %27, align 4, !tbaa !24
  %28 = add nuw i64 %.025, 1
  %29 = load ptr, ptr %0, align 8, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %31 = load i64, ptr %30, align 8, !tbaa !22
  %32 = icmp ult i64 %28, %31
  br i1 %32, label %21, label %._crit_edge, !llvm.loop !26
}

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


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