; 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_LinearMap = type { %struct.sig_dsp_Signal, %struct.sig_dsp_LinearMap_Inputs, %struct.sig_dsp_LinearMap_Parameters, %struct.sig_dsp_Signal_SingleMonoOutput }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_LinearMap_Inputs = type { ptr }
%struct.sig_dsp_LinearMap_Parameters = type { float, float, float, 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_linearMap(float noundef, float noundef, float noundef, float noundef, float noundef) #1

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

6:                                                ; preds = %47, %1
  %7 = load i64, ptr %4, align 8, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %8, i32 0, i32 0
  %10 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds %struct.sig_AudioSettings, ptr %11, i32 0, i32 2
  %13 = load i64, ptr %12, align 8, !tbaa !18
  %14 = icmp ult i64 %7, %13
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %6
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %17, i32 0, i32 1
  %19 = getelementptr inbounds %struct.sig_dsp_LinearMap_Inputs, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  %21 = load i64, ptr %4, align 8, !tbaa !9
  %22 = getelementptr inbounds float, ptr %20, i64 %21
  %23 = load float, ptr %22, align 4, !tbaa !21
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %24, i32 0, i32 2
  %26 = getelementptr inbounds %struct.sig_dsp_LinearMap_Parameters, ptr %25, i32 0, i32 0
  %27 = load float, ptr %26, align 8, !tbaa !22
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %28, i32 0, i32 2
  %30 = getelementptr inbounds %struct.sig_dsp_LinearMap_Parameters, ptr %29, i32 0, i32 1
  %31 = load float, ptr %30, align 4, !tbaa !23
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %32, i32 0, i32 2
  %34 = getelementptr inbounds %struct.sig_dsp_LinearMap_Parameters, ptr %33, i32 0, i32 2
  %35 = load float, ptr %34, align 8, !tbaa !24
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %36, i32 0, i32 2
  %38 = getelementptr inbounds %struct.sig_dsp_LinearMap_Parameters, ptr %37, i32 0, i32 3
  %39 = load float, ptr %38, align 4, !tbaa !25
  %40 = call float @sig_linearMap(float noundef %23, float noundef %27, float noundef %31, float noundef %35, float noundef %39)
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.sig_dsp_LinearMap, ptr %41, i32 0, i32 3
  %43 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %42, i32 0, i32 0
  %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
  store float %40, ptr %46, align 4, !tbaa !21
  br label %47

47:                                               ; preds = %16
  %48 = load i64, ptr %4, align 8, !tbaa !9
  %49 = add i64 %48, 1
  store i64 %49, ptr %4, align 8, !tbaa !9
  br label %6, !llvm.loop !27

50:                                               ; preds = %15
  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_LinearMap", !13, i64 0, !14, i64 16, !15, i64 24, !17, i64 40}
!13 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!14 = !{!"sig_dsp_LinearMap_Inputs", !6, i64 0}
!15 = !{!"sig_dsp_LinearMap_Parameters", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!16 = !{!"float", !7, i64 0}
!17 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!18 = !{!19, !10, i64 16}
!19 = !{!"sig_AudioSettings", !16, i64 0, !10, i64 8, !10, i64 16}
!20 = !{!12, !6, i64 16}
!21 = !{!16, !16, i64 0}
!22 = !{!12, !16, i64 24}
!23 = !{!12, !16, i64 28}
!24 = !{!12, !16, i64 32}
!25 = !{!12, !16, i64 36}
!26 = !{!12, !6, i64 40}
!27 = distinct !{!27, !28}
!28 = !{!"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_linearMap(float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_LinearMap_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 !15
  %.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 28
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = getelementptr inbounds i8, ptr %0, i64 36
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  br label %11

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

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

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_LinearMap", !7, i64 0, !11, i64 16, !12, i64 24, !14, i64 40}
!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_LinearMap_Inputs", !8, i64 0}
!12 = !{!"sig_dsp_LinearMap_Parameters", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"float", !9, i64 0}
!14 = !{!"sig_dsp_Signal_SingleMonoOutput", !8, i64 0}
!15 = !{!16, !17, i64 16}
!16 = !{!"sig_AudioSettings", !13, i64 0, !17, i64 8, !17, i64 16}
!17 = !{!"long", !9, i64 0}
!18 = !{!6, !8, i64 16}
!19 = !{!13, !13, i64 0}
!20 = !{!6, !13, i64 24}
!21 = !{!6, !13, i64 28}
!22 = !{!6, !13, i64 32}
!23 = !{!6, !13, i64 36}
!24 = !{!6, !8, i64 40}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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