; LLVM IR from jgaeddert/liquid-dsp :: src/fft/src (fftf)

; 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.fftplan_s = type { i32, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr, %union.anon }
%union.anon = type { %struct.anon.1 }
%struct.anon.1 = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [85 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @fft_destroy_plan(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.fftplan_s, ptr %4, i32 0, i32 5
  %6 = load i32, ptr %5, align 8, !tbaa !9
  switch i32 %6, label %39 [
    i32 1, label %7
    i32 -1, label %7
    i32 10, label %33
    i32 11, label %33
    i32 12, label %33
    i32 13, label %33
    i32 20, label %33
    i32 21, label %33
    i32 22, label %33
    i32 23, label %33
    i32 30, label %36
    i32 31, label %37
    i32 0, label %38
  ]

7:                                                ; preds = %1, %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.fftplan_s, ptr %8, i32 0, i32 6
  %10 = load i32, ptr %9, align 4, !tbaa !12
  switch i32 %10, label %27 [
    i32 5, label %11
    i32 1, label %14
    i32 2, label %17
    i32 3, label %20
    i32 4, label %23
    i32 0, label %26
  ]

11:                                               ; preds = %7
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = call i32 @fft_destroy_plan_dft(ptr noundef %12)
  store i32 %13, ptr %2, align 4
  br label %45

14:                                               ; preds = %7
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = call i32 @fft_destroy_plan_radix2(ptr noundef %15)
  store i32 %16, ptr %2, align 4
  br label %45

17:                                               ; preds = %7
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call i32 @fft_destroy_plan_mixed_radix(ptr noundef %18)
  store i32 %19, ptr %2, align 4
  br label %45

20:                                               ; preds = %7
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call i32 @fft_destroy_plan_rader(ptr noundef %21)
  store i32 %22, ptr %2, align 4
  br label %45

23:                                               ; preds = %7
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call i32 @fft_destroy_plan_rader2(ptr noundef %24)
  store i32 %25, ptr %2, align 4
  br label %45

26:                                               ; preds = %7
  br label %27

27:                                               ; preds = %26, %7
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.fftplan_s, ptr %29, i32 0, i32 6
  %31 = load i32, ptr %30, align 4, !tbaa !12
  %32 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef @.str, i32 noundef 177, ptr noundef @.str.2, i32 noundef %31)
  store i32 %32, ptr %2, align 4
  br label %45

33:                                               ; preds = %1, %1, %1, %1, %1, %1, %1, %1
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = call i32 @fft_destroy_plan_r2r_1d(ptr noundef %34)
  store i32 %35, ptr %2, align 4
  br label %45

36:                                               ; preds = %1
  store i32 0, ptr %2, align 4
  br label %45

37:                                               ; preds = %1
  store i32 0, ptr %2, align 4
  br label %45

38:                                               ; preds = %1
  br label %39

39:                                               ; preds = %38, %1
  br label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.fftplan_s, ptr %41, i32 0, i32 5
  %43 = load i32, ptr %42, align 8, !tbaa !9
  %44 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef @.str, i32 noundef 199, ptr noundef @.str.3, i32 noundef %43)
  store i32 %44, ptr %2, align 4
  br label %45

45:                                               ; preds = %40, %37, %36, %33, %28, %23, %20, %17, %14, %11
  %46 = load i32, ptr %2, align 4
  ret i32 %46
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_dft(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_radix2(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_mixed_radix(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_rader(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_rader2(ptr noundef) #0

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_r2r_1d(ptr noundef) #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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 32}
!10 = !{!"fftplan_s", !11, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !7, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 36}


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

@.str = external hidden unnamed_addr constant [85 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @fft_destroy_plan(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  %3 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %3, label %21 [
    i32 1, label %4
    i32 -1, label %4
    i32 10, label %19
    i32 11, label %19
    i32 12, label %19
    i32 13, label %19
    i32 20, label %19
    i32 21, label %19
    i32 22, label %19
    i32 23, label %19
    i32 30, label %23
    i32 31, label %23
  ]

4:                                                ; preds = %1, %1
  %5 = getelementptr inbounds i8, ptr %0, i64 36
  %6 = load i32, ptr %5, align 4, !tbaa !11
  switch i32 %6, label %17 [
    i32 5, label %7
    i32 1, label %9
    i32 2, label %11
    i32 3, label %13
    i32 4, label %15
  ]

7:                                                ; preds = %4
  %8 = tail call i32 @fft_destroy_plan_dft(ptr noundef nonnull %0)
  br label %23

9:                                                ; preds = %4
  %10 = tail call i32 @fft_destroy_plan_radix2(ptr noundef nonnull %0)
  br label %23

11:                                               ; preds = %4
  %12 = tail call i32 @fft_destroy_plan_mixed_radix(ptr noundef nonnull %0)
  br label %23

13:                                               ; preds = %4
  %14 = tail call i32 @fft_destroy_plan_rader(ptr noundef nonnull %0)
  br label %23

15:                                               ; preds = %4
  %16 = tail call i32 @fft_destroy_plan_rader2(ptr noundef nonnull %0)
  br label %23

17:                                               ; preds = %4
  %18 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef nonnull @.str, i32 noundef 177, ptr noundef nonnull @.str.2, i32 noundef %6) #2
  br label %23

19:                                               ; preds = %1, %1, %1, %1, %1, %1, %1, %1
  %20 = tail call i32 @fft_destroy_plan_r2r_1d(ptr noundef nonnull %0)
  br label %23

21:                                               ; preds = %1
  %22 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 6, ptr noundef nonnull @.str, i32 noundef 199, ptr noundef nonnull @.str.3, i32 noundef %3) #2
  br label %23

23:                                               ; preds = %1, %1, %21, %19, %17, %15, %13, %11, %9, %7
  %.0 = phi i32 [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ 0, %1 ], [ 0, %1 ]
  ret i32 %.0
}

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

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

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

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

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

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @fft_destroy_plan_r2r_1d(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 = { "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, !7, i64 32}
!6 = !{!"fftplan_s", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !8, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 36}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass