; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/core/soloud_fft.ll (ZN7fftimpl7cftrec4EiPf)

; 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: mustprogress uwtable
declare dso_local void @_ZN7fftimpl7cftmdl1EiPf(i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7fftimpl7cfttreeEiiiPf(i32 noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7fftimpl7cftleafEiiPf(i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fftimpl7cftrec4EiPf(i32 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  %9 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %9, ptr %8, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %13, %2
  %11 = load i32, ptr %8, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 512
  br i1 %12, label %13, label %23

13:                                               ; preds = %10
  %14 = load i32, ptr %8, align 4, !tbaa !5
  %15 = ashr i32 %14, 2
  store i32 %15, ptr %8, align 4, !tbaa !5
  %16 = load i32, ptr %8, align 4, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !9
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !5
  %20 = sub nsw i32 %18, %19
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds float, ptr %17, i64 %21
  call void @_ZN7fftimpl7cftmdl1EiPf(i32 noundef %16, ptr noundef %22)
  br label %10, !llvm.loop !11

23:                                               ; preds = %10
  %24 = load i32, ptr %8, align 4, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !9
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = sub nsw i32 %26, %27
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds float, ptr %25, i64 %29
  call void @_ZN7fftimpl7cftleafEiiPf(i32 noundef %24, i32 noundef 1, ptr noundef %30)
  store i32 0, ptr %7, align 4, !tbaa !5
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = load i32, ptr %8, align 4, !tbaa !5
  %33 = sub nsw i32 %31, %32
  store i32 %33, ptr %6, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %53, %23
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %37, label %57

37:                                               ; preds = %34
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %7, align 4, !tbaa !5
  %40 = load i32, ptr %8, align 4, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = load ptr, ptr %4, align 8, !tbaa !9
  %44 = call noundef i32 @_ZN7fftimpl7cfttreeEiiiPf(i32 noundef %40, i32 noundef %41, i32 noundef %42, ptr noundef %43)
  store i32 %44, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = load ptr, ptr %4, align 8, !tbaa !9
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = sub nsw i32 %48, %49
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds float, ptr %47, i64 %51
  call void @_ZN7fftimpl7cftleafEiiPf(i32 noundef %45, i32 noundef %46, ptr noundef %52)
  br label %53

53:                                               ; preds = %37
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sub nsw i32 %55, %54
  store i32 %56, ptr %6, align 4, !tbaa !5
  br label %34, !llvm.loop !13

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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 uwtable
declare dso_local void @_ZN7fftimpl7cftmdl1EiPf(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7fftimpl7cfttreeEiiiPf(i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7fftimpl7cftleafEiiPf(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7fftimpl7cftrec4EiPf(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = icmp sgt i32 %0, 512
  br i1 %3, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.027 = phi i32 [ %4, %.lr.ph ], [ %0, %2 ]
  %4 = lshr i32 %.027, 2
  %5 = sub nsw i32 %0, %4
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds float, ptr %1, i64 %6
  tail call void @_ZN7fftimpl7cftmdl1EiPf(i32 noundef %4, ptr noundef %7)
  %8 = icmp ugt i32 %.027, 2051
  br i1 %8, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %2
  %.0.lcssa = phi i32 [ %0, %2 ], [ %4, %.lr.ph ]
  %9 = sub nsw i32 %0, %.0.lcssa
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds float, ptr %1, i64 %10
  tail call void @_ZN7fftimpl7cftleafEiiPf(i32 noundef %.0.lcssa, i32 noundef 1, ptr noundef %11)
  %12 = icmp sgt i32 %9, 0
  br i1 %12, label %.lr.ph31, label %._crit_edge32

.lr.ph31:                                         ; preds = %._crit_edge, %.lr.ph31
  %.02529 = phi i32 [ %13, %.lr.ph31 ], [ 0, %._crit_edge ]
  %.02628 = phi i32 [ %15, %.lr.ph31 ], [ %9, %._crit_edge ]
  %13 = add nuw nsw i32 %.02529, 1
  %14 = tail call noundef i32 @_ZN7fftimpl7cfttreeEiiiPf(i32 noundef %.0.lcssa, i32 noundef %.02628, i32 noundef %13, ptr noundef %1)
  %15 = sub nsw i32 %.02628, %.0.lcssa
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds float, ptr %1, i64 %16
  tail call void @_ZN7fftimpl7cftleafEiiPf(i32 noundef %.0.lcssa, i32 noundef %14, ptr noundef %17)
  %18 = icmp sgt i32 %15, 0
  br i1 %18, label %.lr.ph31, label %._crit_edge32, !llvm.loop !7

._crit_edge32:                                    ; preds = %.lr.ph31, %._crit_edge
  ret void
}

attributes #0 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass