; LLVM IR from ubaldot/defrecs :: stm32f4x/ADC_Readings/Drivers/CMSIS/DSP/Source/TransformFunctions (f32)

; 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: nounwind uwtable
define dso_local i32 @arm_rfft_fast_init_f32(ptr noundef %0, i16 noundef zeroext %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i16, align 2
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i16 %1, ptr %5, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  store ptr null, ptr %6, align 8, !tbaa !5
  %8 = load i16, ptr %5, align 2, !tbaa !9
  %9 = zext i16 %8 to i32
  switch i32 %9, label %18 [
    i32 4096, label %10
    i32 2048, label %11
    i32 1024, label %12
    i32 512, label %13
    i32 256, label %14
    i32 128, label %15
    i32 64, label %16
    i32 32, label %17
  ]

10:                                               ; preds = %2
  store ptr @arm_rfft_4096_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

11:                                               ; preds = %2
  store ptr @arm_rfft_2048_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

12:                                               ; preds = %2
  store ptr @arm_rfft_1024_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

13:                                               ; preds = %2
  store ptr @arm_rfft_512_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

14:                                               ; preds = %2
  store ptr @arm_rfft_256_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

15:                                               ; preds = %2
  store ptr @arm_rfft_128_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

16:                                               ; preds = %2
  store ptr @arm_rfft_64_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

17:                                               ; preds = %2
  store ptr @arm_rfft_32_fast_init_f32, ptr %6, align 8, !tbaa !5
  br label %19

18:                                               ; preds = %2
  br label %19

19:                                               ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %27

23:                                               ; preds = %19
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call i32 %24(ptr noundef %25)
  store i32 %26, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %27

27:                                               ; preds = %23, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %28 = load i32, ptr %3, align 4
  ret i32 %28
}

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_4096_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_2048_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_1024_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_512_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_256_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_128_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_64_fast_init_f32(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_32_fast_init_f32(ptr noundef) #1

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 = { 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 = !{!"short", !7, i64 0}


; 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
define dso_local i32 @arm_rfft_fast_init_f32(ptr noundef %0, i16 noundef zeroext %1) local_unnamed_addr #0 {
  switch i16 %1, label %12 [
    i16 4096, label %10
    i16 2048, label %3
    i16 1024, label %4
    i16 512, label %5
    i16 256, label %6
    i16 128, label %7
    i16 64, label %8
    i16 32, label %9
  ]

3:                                                ; preds = %2
  br label %10

4:                                                ; preds = %2
  br label %10

5:                                                ; preds = %2
  br label %10

6:                                                ; preds = %2
  br label %10

7:                                                ; preds = %2
  br label %10

8:                                                ; preds = %2
  br label %10

9:                                                ; preds = %2
  br label %10

10:                                               ; preds = %2, %9, %8, %7, %6, %5, %4, %3
  %.0.ph = phi ptr [ @arm_rfft_2048_fast_init_f32, %3 ], [ @arm_rfft_1024_fast_init_f32, %4 ], [ @arm_rfft_512_fast_init_f32, %5 ], [ @arm_rfft_256_fast_init_f32, %6 ], [ @arm_rfft_128_fast_init_f32, %7 ], [ @arm_rfft_64_fast_init_f32, %8 ], [ @arm_rfft_32_fast_init_f32, %9 ], [ @arm_rfft_4096_fast_init_f32, %2 ]
  %11 = tail call i32 %.0.ph(ptr noundef %0) #1
  br label %12

12:                                               ; preds = %2, %10
  %.04 = phi i32 [ %11, %10 ], [ -1, %2 ]
  ret i32 %.04
}

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_4096_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_2048_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_1024_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_512_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_256_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_128_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_64_fast_init_f32(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @arm_rfft_32_fast_init_f32(ptr noundef) local_unnamed_addr #0

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 = { 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)"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass