; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/filter (soloud_fftfilter)

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance13comp2MagPhaseEPfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance16magPhase2MagFreqEPfjfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef, float noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance16magFreq2MagPhaseEPfjfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef, float noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance13magPhase2CompEPfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud17FFTFilterInstance16fftFilterChannelEPfjfdjj(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, i32 noundef %2, float noundef %3, double noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #2 align 2 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca [512 x float], align 16
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store float %3, ptr %11, align 4, !tbaa !11
  store double %4, ptr %12, align 8, !tbaa !13
  store i32 %5, ptr %13, align 4, !tbaa !9
  store i32 %6, ptr %14, align 4, !tbaa !9
  %18 = load ptr, ptr %8, align 8
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = load i32, ptr %10, align 4, !tbaa !9
  call void @_ZN6SoLoud17FFTFilterInstance13comp2MagPhaseEPfj(ptr noundef nonnull align 8 dereferenceable(176) %18, ptr noundef %19, i32 noundef %20)
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = load float, ptr %11, align 4, !tbaa !11
  %24 = load i32, ptr %13, align 4, !tbaa !9
  call void @_ZN6SoLoud17FFTFilterInstance16magPhase2MagFreqEPfjfj(ptr noundef nonnull align 8 dereferenceable(176) %18, ptr noundef %21, i32 noundef %22, float noundef %23, i32 noundef %24)
  call void @llvm.lifetime.start.p0(i64 2048, ptr %15) #5
  %25 = getelementptr inbounds [512 x float], ptr %15, i64 0, i64 0
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = load i32, ptr %10, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = mul i64 4, %28
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 4 %26, i64 %29, i1 false)
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = mul i64 4, %32
  %34 = mul i64 %33, 2
  call void @llvm.memset.p0.i64(ptr align 4 %30, i8 0, i64 %34, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %75, %7
  %36 = load i32, ptr %16, align 4, !tbaa !9
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = udiv i32 %37, 4
  %39 = icmp ult i32 %36, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %78

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %42 = load i32, ptr %16, align 4, !tbaa !9
  %43 = mul i32 %42, 2
  store i32 %43, ptr %17, align 4, !tbaa !9
  %44 = load i32, ptr %17, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = udiv i32 %45, 4
  %47 = icmp ult i32 %44, %46
  br i1 %47, label %48, label %74

48:                                               ; preds = %41
  %49 = load i32, ptr %16, align 4, !tbaa !9
  %50 = mul i32 %49, 2
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds [512 x float], ptr %15, i64 0, i64 %51
  %53 = load float, ptr %52, align 4, !tbaa !11
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = load i32, ptr %17, align 4, !tbaa !9
  %56 = mul i32 %55, 2
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds float, ptr %54, i64 %57
  %59 = load float, ptr %58, align 4, !tbaa !11
  %60 = fadd float %59, %53
  store float %60, ptr %58, align 4, !tbaa !11
  %61 = load i32, ptr %16, align 4, !tbaa !9
  %62 = mul i32 %61, 2
  %63 = add i32 %62, 1
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds [512 x float], ptr %15, i64 0, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !11
  %67 = fmul float %66, 2.000000e+00
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load i32, ptr %17, align 4, !tbaa !9
  %70 = mul i32 %69, 2
  %71 = add i32 %70, 1
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds float, ptr %68, i64 %72
  store float %67, ptr %73, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %48, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %16, align 4, !tbaa !9
  %77 = add i32 %76, 1
  store i32 %77, ptr %16, align 4, !tbaa !9
  br label %35, !llvm.loop !15

78:                                               ; preds = %40
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = load float, ptr %11, align 4, !tbaa !11
  %82 = load i32, ptr %13, align 4, !tbaa !9
  call void @_ZN6SoLoud17FFTFilterInstance16magFreq2MagPhaseEPfjfj(ptr noundef nonnull align 8 dereferenceable(176) %18, ptr noundef %79, i32 noundef %80, float noundef %81, i32 noundef %82)
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load i32, ptr %10, align 4, !tbaa !9
  call void @_ZN6SoLoud17FFTFilterInstance13magPhase2CompEPfj(ptr noundef nonnull align 8 dereferenceable(176) %18, ptr noundef %83, i32 noundef %84)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %15) #5
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance13comp2MagPhaseEPfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance16magPhase2MagFreqEPfjfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef, float noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance16magFreq2MagPhaseEPfjfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef, float noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6SoLoud17FFTFilterInstance13magPhase2CompEPfj(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud17FFTFilterInstance16fftFilterChannelEPfjfdjj(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, i32 noundef %2, float noundef %3, double noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #2 align 2 {
  %8 = alloca [512 x float], align 16
  tail call void @_ZN6SoLoud17FFTFilterInstance13comp2MagPhaseEPfj(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, i32 noundef %2)
  tail call void @_ZN6SoLoud17FFTFilterInstance16magPhase2MagFreqEPfjfj(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, i32 noundef %2, float noundef %3, i32 noundef %5)
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %8) #5
  %9 = zext i32 %2 to i64
  %10 = shl nuw nsw i64 %9, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %8, ptr align 4 %1, i64 %10, i1 false)
  %11 = shl nuw nsw i64 %9, 3
  tail call void @llvm.memset.p0.i64(ptr align 4 %1, i8 0, i64 %11, i1 false)
  %.not = icmp ult i32 %2, 4
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %7
  %12 = lshr i32 %2, 2
  %13 = zext nneg i32 %12 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %29, %7
  tail call void @_ZN6SoLoud17FFTFilterInstance16magFreq2MagPhaseEPfjfj(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, i32 noundef %2, float noundef %3, i32 noundef %5)
  tail call void @_ZN6SoLoud17FFTFilterInstance13magPhase2CompEPfj(ptr noundef nonnull align 8 dereferenceable(176) %0, ptr noundef %1, i32 noundef %2)
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %8) #5
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader, %29
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %29 ]
  %14 = shl nuw nsw i64 %indvars.iv, 1
  %15 = icmp ult i64 %14, %13
  br i1 %15, label %16, label %29

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds [512 x float], ptr %8, i64 0, i64 %14
  %18 = load float, ptr %17, align 8, !tbaa !5
  %19 = shl nuw nsw i64 %indvars.iv, 2
  %20 = getelementptr inbounds float, ptr %1, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !5
  %22 = fadd float %18, %21
  store float %22, ptr %20, align 4, !tbaa !5
  %23 = or disjoint i64 %14, 1
  %24 = getelementptr inbounds [512 x float], ptr %8, i64 0, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = fmul float %25, 2.000000e+00
  %27 = or disjoint i64 %19, 1
  %28 = getelementptr inbounds float, ptr %1, i64 %27
  store float %26, ptr %28, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %16, %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass