; 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_LinearToFreq = type { %struct.sig_dsp_Signal, %struct.sig_dsp_LinearToFreq_Inputs, %struct.sig_dsp_LinearToFreq_Parameters, %struct.sig_dsp_Signal_SingleMonoOutput }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_LinearToFreq_Inputs = type { ptr }
%struct.sig_dsp_LinearToFreq_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: nounwind uwtable
declare dso_local float @sig_linearToFreq(float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_LinearToFreq_generate(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca i64, align 8
  %8 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.sig_dsp_LinearToFreq, ptr %10, i32 0, i32 1
  %12 = getelementptr inbounds %struct.sig_dsp_LinearToFreq_Inputs, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %13, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.sig_dsp_LinearToFreq, ptr %14, i32 0, i32 3
  %16 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  store ptr %17, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.sig_dsp_LinearToFreq, ptr %18, i32 0, i32 2
  %20 = getelementptr inbounds %struct.sig_dsp_LinearToFreq_Parameters, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 8, !tbaa !17
  store float %21, ptr %6, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  store i64 0, ptr %7, align 8, !tbaa !19
  br label %22

22:                                               ; preds = %43, %1
  %23 = load i64, ptr %7, align 8, !tbaa !19
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.sig_dsp_LinearToFreq, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !21
  %28 = getelementptr inbounds %struct.sig_AudioSettings, ptr %27, i32 0, i32 2
  %29 = load i64, ptr %28, align 8, !tbaa !22
  %30 = icmp ult i64 %23, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  br label %46

32:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load i64, ptr %7, align 8, !tbaa !19
  %35 = getelementptr inbounds float, ptr %33, i64 %34
  %36 = load float, ptr %35, align 4, !tbaa !18
  store float %36, ptr %8, align 4, !tbaa !18
  %37 = load float, ptr %8, align 4, !tbaa !18
  %38 = load float, ptr %6, align 4, !tbaa !18
  %39 = call float @sig_linearToFreq(float noundef %37, float noundef %38)
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i64, ptr %7, align 8, !tbaa !19
  %42 = getelementptr inbounds float, ptr %40, i64 %41
  store float %39, ptr %42, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  br label %43

43:                                               ; preds = %32
  %44 = load i64, ptr %7, align 8, !tbaa !19
  %45 = add i64 %44, 1
  store i64 %45, ptr %7, align 8, !tbaa !19
  br label %22, !llvm.loop !24

46:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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, !6, i64 16}
!10 = !{!"sig_dsp_LinearToFreq", !11, i64 0, !12, i64 16, !13, i64 24, !15, i64 32}
!11 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!12 = !{!"sig_dsp_LinearToFreq_Inputs", !6, i64 0}
!13 = !{!"sig_dsp_LinearToFreq_Parameters", !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !14, i64 24}
!18 = !{!14, !14, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!10, !6, i64 0}
!22 = !{!23, !20, i64 16}
!23 = !{!"sig_AudioSettings", !14, i64 0, !20, i64 8, !20, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"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: nounwind uwtable
declare dso_local float @sig_linearToFreq(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_LinearToFreq_generate(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = load ptr, ptr %4, align 8, !tbaa !15
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load float, ptr %6, align 8, !tbaa !16
  %8 = load ptr, ptr %0, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  %10 = load i64, ptr %9, align 8, !tbaa !18
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  ret void

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.012 = phi i64 [ %15, %.lr.ph ], [ 0, %1 ]
  %11 = getelementptr inbounds float, ptr %3, i64 %.012
  %12 = load float, ptr %11, align 4, !tbaa !21
  %13 = tail call float @sig_linearToFreq(float noundef %12, float noundef %7)
  %14 = getelementptr inbounds float, ptr %5, i64 %.012
  store float %13, ptr %14, align 4, !tbaa !21
  %15 = add nuw i64 %.012, 1
  %16 = load ptr, ptr %0, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load i64, ptr %17, align 8, !tbaa !18
  %19 = icmp ult i64 %15, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !22
}

attributes #0 = { 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 16}
!6 = !{!"sig_dsp_LinearToFreq", !7, i64 0, !11, i64 16, !12, i64 24, !14, i64 32}
!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_LinearToFreq_Inputs", !8, i64 0}
!12 = !{!"sig_dsp_LinearToFreq_Parameters", !13, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!"sig_dsp_Signal_SingleMonoOutput", !8, i64 0}
!15 = !{!6, !8, i64 32}
!16 = !{!6, !13, i64 24}
!17 = !{!6, !8, i64 0}
!18 = !{!19, !20, i64 16}
!19 = !{!"sig_AudioSettings", !13, i64 0, !20, i64 8, !20, i64 16}
!20 = !{!"long", !9, i64 0}
!21 = !{!13, !13, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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