; LLVM IR from software-mansion/react-native-audio-api :: packages/react-native-audio-api/common/cpp/audioapi/dsp (Windows)

; 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"

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK8audioapi3dsp27ApproximateConfinedGaussian5applyEPfi(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1, i32 noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %12 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef 1.000000e+00)
  %13 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef 3.000000e+00)
  %14 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef -1.000000e+00)
  %15 = fadd float %13, %14
  %16 = fdiv float %12, %15
  store float %16, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %17 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef 1.000000e+00)
  %18 = load float, ptr %7, align 4, !tbaa !11
  %19 = fmul float 2.000000e+00, %18
  %20 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef 2.000000e+00)
  %21 = fneg float %19
  %22 = call float @llvm.fmuladd.f32(float %21, float %20, float %17)
  %23 = fdiv float 1.000000e+00, %22
  store float %23, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %56, %3
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %59

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = mul nsw i32 2, %30
  %32 = add nsw i32 %31, 1
  %33 = sitofp i32 %32 to float
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = sitofp i32 %34 to float
  %36 = fdiv float %33, %35
  %37 = fsub float %36, 1.000000e+00
  store float %37, ptr %10, align 4, !tbaa !11
  %38 = load float, ptr %8, align 4, !tbaa !11
  %39 = load float, ptr %10, align 4, !tbaa !11
  %40 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef %39)
  %41 = load float, ptr %7, align 4, !tbaa !11
  %42 = load float, ptr %10, align 4, !tbaa !11
  %43 = fsub float %42, 2.000000e+00
  %44 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef %43)
  %45 = load float, ptr %10, align 4, !tbaa !11
  %46 = fadd float %45, 2.000000e+00
  %47 = call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %11, float noundef %46)
  %48 = fadd float %44, %47
  %49 = fneg float %41
  %50 = call float @llvm.fmuladd.f32(float %49, float %48, float %40)
  %51 = fmul float %38, %50
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds float, ptr %52, i64 %54
  store float %51, ptr %55, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %56

56:                                               ; preds = %29
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %9, align 4, !tbaa !9
  br label %24, !llvm.loop !13

59:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16), float noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK8audioapi3dsp27ApproximateConfinedGaussian5applyEPfi(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr nocapture noundef writeonly %1, i32 noundef %2) unnamed_addr #1 align 2 {
  %4 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef 1.000000e+00)
  %5 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef 3.000000e+00)
  %6 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef -1.000000e+00)
  %7 = fadd float %5, %6
  %8 = fdiv float %4, %7
  %9 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef 1.000000e+00)
  %10 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef 2.000000e+00)
  %11 = fmul float %8, -2.000000e+00
  %12 = tail call float @llvm.fmuladd.f32(float %11, float %10, float %9)
  %13 = fdiv float 1.000000e+00, %12
  %14 = icmp sgt i32 %2, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %15 = uitofp nneg i32 %2 to float
  %16 = fneg float %8
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %17

._crit_edge:                                      ; preds = %17, %3
  ret void

17:                                               ; preds = %.lr.ph, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %17 ]
  %indvars.iv.tr = trunc i64 %indvars.iv to i32
  %18 = shl i32 %indvars.iv.tr, 1
  %19 = or disjoint i32 %18, 1
  %20 = uitofp nneg i32 %19 to float
  %21 = fdiv float %20, %15
  %22 = fadd float %21, -1.000000e+00
  %23 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef %22)
  %24 = fadd float %22, -2.000000e+00
  %25 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef %24)
  %26 = fadd float %22, 2.000000e+00
  %27 = tail call noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16) %0, float noundef %26)
  %28 = fadd float %25, %27
  %29 = tail call float @llvm.fmuladd.f32(float %16, float %28, float %23)
  %30 = fmul float %13, %29
  %31 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  store float %30, ptr %31, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %17, !llvm.loop !9
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK8audioapi3dsp27ApproximateConfinedGaussian11getGaussianEf(ptr noundef nonnull align 8 dereferenceable(16), float noundef) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress 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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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