; 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_Dust = type { %struct.sig_dsp_Signal, %struct.sig_dsp_Dust_Inputs, %struct.sig_dsp_Dust_Parameters, %struct.sig_dsp_Signal_SingleMonoOutput, float, float, float, float }
%struct.sig_dsp_Signal = type { ptr, ptr }
%struct.sig_dsp_Dust_Inputs = type { ptr }
%struct.sig_dsp_Dust_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_randf() #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Dust_generate(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i64, align 8
  %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 4, ptr %4) #3
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %11, i32 0, i32 2
  %13 = getelementptr inbounds %struct.sig_dsp_Dust_Parameters, ptr %12, i32 0, i32 0
  %14 = load float, ptr %13, align 8, !tbaa !9
  %15 = fcmp ogt float %14, 0.000000e+00
  %16 = zext i1 %15 to i64
  %17 = select i1 %15, float 2.000000e+00, float 1.000000e+00
  store float %17, ptr %4, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %18, i32 0, i32 2
  %20 = getelementptr inbounds %struct.sig_dsp_Dust_Parameters, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 8, !tbaa !9
  %22 = fcmp ogt float %21, 0.000000e+00
  %23 = zext i1 %22 to i64
  %24 = select i1 %22, float 1.000000e+00, float 0.000000e+00
  store float %24, ptr %5, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !17
  br label %25

25:                                               ; preds = %99, %1
  %26 = load i64, ptr %6, align 8, !tbaa !17
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds %struct.sig_dsp_Signal, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = getelementptr inbounds %struct.sig_AudioSettings, ptr %30, i32 0, i32 2
  %32 = load i64, ptr %31, align 8, !tbaa !20
  %33 = icmp ult i64 %26, %32
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds %struct.sig_dsp_Dust_Inputs, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !22
  %40 = load i64, ptr %6, align 8, !tbaa !17
  %41 = getelementptr inbounds float, ptr %39, i64 %40
  %42 = load float, ptr %41, align 4, !tbaa !16
  store float %42, ptr %7, align 4, !tbaa !16
  %43 = load float, ptr %7, align 4, !tbaa !16
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %44, i32 0, i32 5
  %46 = load float, ptr %45, align 4, !tbaa !23
  %47 = fcmp une float %43, %46
  br i1 %47, label %48, label %74

48:                                               ; preds = %35
  %49 = load float, ptr %7, align 4, !tbaa !16
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %50, i32 0, i32 5
  store float %49, ptr %51, align 4, !tbaa !23
  %52 = load float, ptr %7, align 4, !tbaa !16
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %53, i32 0, i32 4
  %55 = load float, ptr %54, align 8, !tbaa !24
  %56 = fmul float %52, %55
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %57, i32 0, i32 6
  store float %56, ptr %58, align 8, !tbaa !25
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %59, i32 0, i32 6
  %61 = load float, ptr %60, align 8, !tbaa !25
  %62 = fcmp ogt float %61, 0.000000e+00
  br i1 %62, label %63, label %69

63:                                               ; preds = %48
  %64 = load float, ptr %4, align 4, !tbaa !16
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %65, i32 0, i32 6
  %67 = load float, ptr %66, align 8, !tbaa !25
  %68 = fdiv float %64, %67
  br label %70

69:                                               ; preds = %48
  br label %70

70:                                               ; preds = %69, %63
  %71 = phi float [ %68, %63 ], [ 0.000000e+00, %69 ]
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %72, i32 0, i32 7
  store float %71, ptr %73, align 4, !tbaa !26
  br label %74

74:                                               ; preds = %70, %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %75 = call float @sig_randf()
  store float %75, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %76 = load float, ptr %8, align 4, !tbaa !16
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %77, i32 0, i32 6
  %79 = load float, ptr %78, align 8, !tbaa !25
  %80 = fcmp olt float %76, %79
  br i1 %80, label %81, label %89

81:                                               ; preds = %74
  %82 = load float, ptr %8, align 4, !tbaa !16
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %83, i32 0, i32 7
  %85 = load float, ptr %84, align 4, !tbaa !26
  %86 = load float, ptr %5, align 4, !tbaa !16
  %87 = fneg float %86
  %88 = call float @llvm.fmuladd.f32(float %82, float %85, float %87)
  br label %90

89:                                               ; preds = %74
  br label %90

90:                                               ; preds = %89, %81
  %91 = phi float [ %88, %81 ], [ 0.000000e+00, %89 ]
  store float %91, ptr %9, align 4, !tbaa !16
  %92 = load float, ptr %9, align 4, !tbaa !16
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.sig_dsp_Dust, ptr %93, i32 0, i32 3
  %95 = getelementptr inbounds %struct.sig_dsp_Signal_SingleMonoOutput, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !27
  %97 = load i64, ptr %6, align 8, !tbaa !17
  %98 = getelementptr inbounds float, ptr %96, i64 %97
  store float %92, ptr %98, align 4, !tbaa !16
  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
  br label %99

99:                                               ; preds = %90
  %100 = load i64, ptr %6, align 8, !tbaa !17
  %101 = add i64 %100, 1
  store i64 %101, ptr %6, align 8, !tbaa !17
  br label %25, !llvm.loop !28

102:                                              ; preds = %34
  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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 24}
!10 = !{!"sig_dsp_Dust", !11, i64 0, !12, i64 16, !13, i64 24, !15, i64 32, !14, i64 40, !14, i64 44, !14, i64 48, !14, i64 52}
!11 = !{!"sig_dsp_Signal", !6, i64 0, !6, i64 8}
!12 = !{!"sig_dsp_Dust_Inputs", !6, i64 0}
!13 = !{!"sig_dsp_Dust_Parameters", !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"sig_dsp_Signal_SingleMonoOutput", !6, i64 0}
!16 = !{!14, !14, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!10, !6, i64 0}
!20 = !{!21, !18, i64 16}
!21 = !{!"sig_AudioSettings", !14, i64 0, !18, i64 8, !18, i64 16}
!22 = !{!10, !6, i64 16}
!23 = !{!10, !14, i64 44}
!24 = !{!10, !14, i64 40}
!25 = !{!10, !14, i64 48}
!26 = !{!10, !14, i64 52}
!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: nounwind uwtable
declare dso_local float @sig_randf() local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
define dso_local void @sig_dsp_Dust_generate(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load float, ptr %2, align 8, !tbaa !5
  %4 = fcmp ogt float %3, 0.000000e+00
  %5 = select i1 %4, float 2.000000e+00, float 1.000000e+00
  %6 = load ptr, ptr %0, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  %8 = load i64, ptr %7, align 8, !tbaa !16
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = getelementptr inbounds i8, ptr %0, i64 44
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = getelementptr inbounds i8, ptr %0, i64 52
  %14 = select i1 %4, float -1.000000e+00, float -0.000000e+00
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  br label %16

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

16:                                               ; preds = %.lr.ph, %35
  %.029 = phi i64 [ 0, %.lr.ph ], [ %39, %35 ]
  %17 = load ptr, ptr %9, align 8, !tbaa !19
  %18 = getelementptr inbounds float, ptr %17, i64 %.029
  %19 = load float, ptr %18, align 4, !tbaa !20
  %20 = load float, ptr %10, align 4, !tbaa !21
  %21 = fcmp une float %19, %20
  br i1 %21, label %22, label %28

22:                                               ; preds = %16
  store float %19, ptr %10, align 4, !tbaa !21
  %23 = load float, ptr %11, align 8, !tbaa !22
  %24 = fmul float %19, %23
  store float %24, ptr %12, align 8, !tbaa !23
  %25 = fcmp ogt float %24, 0.000000e+00
  %26 = fdiv float %5, %24
  %27 = select i1 %25, float %26, float 0.000000e+00
  store float %27, ptr %13, align 4, !tbaa !24
  br label %28

28:                                               ; preds = %22, %16
  %29 = tail call float @sig_randf()
  %30 = load float, ptr %12, align 8, !tbaa !23
  %31 = fcmp olt float %29, %30
  br i1 %31, label %32, label %35

32:                                               ; preds = %28
  %33 = load float, ptr %13, align 4, !tbaa !24
  %34 = tail call float @llvm.fmuladd.f32(float %29, float %33, float %14)
  br label %35

35:                                               ; preds = %28, %32
  %36 = phi float [ %34, %32 ], [ 0.000000e+00, %28 ]
  %37 = load ptr, ptr %15, align 8, !tbaa !25
  %38 = getelementptr inbounds float, ptr %37, i64 %.029
  store float %36, ptr %38, align 4, !tbaa !20
  %39 = add nuw i64 %.029, 1
  %40 = load ptr, ptr %0, align 8, !tbaa !15
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load i64, ptr %41, align 8, !tbaa !16
  %43 = icmp ult i64 %39, %42
  br i1 %43, label %16, label %._crit_edge, !llvm.loop !26
}

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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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


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