; LLVM IR from FedericaPaoli1/stm32-speech-recognition-and-traduction :: Drivers/CMSIS/DSP/Source/TransformFunctions (arm_rfft_init_q15)

; 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.arm_cfft_instance_q15 = type { i16, ptr, ptr, i16 }
%struct.arm_rfft_instance_q15 = type { i32, i8, i8, i32, ptr, ptr, ptr }

@realCoefAQ15 = external constant [8192 x i16], align 16
@realCoefBQ15 = external constant [8192 x i16], align 16
@arm_cfft_sR_q15_len4096 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len2048 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len1024 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len512 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len256 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len128 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len64 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len32 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len16 = external constant %struct.arm_cfft_instance_q15, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @arm_rfft_init_q15(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 -1, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = trunc i32 %10 to i16
  %12 = zext i16 %11 to i32
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %13, i32 0, i32 0
  store i32 %12, ptr %14, align 8, !tbaa !11
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %15, i32 0, i32 4
  store ptr @realCoefAQ15, ptr %16, align 8, !tbaa !13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %17, i32 0, i32 5
  store ptr @realCoefBQ15, ptr %18, align 8, !tbaa !14
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = trunc i32 %19 to i8
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %21, i32 0, i32 1
  store i8 %20, ptr %22, align 4, !tbaa !15
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = trunc i32 %23 to i8
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %25, i32 0, i32 2
  store i8 %24, ptr %26, align 1, !tbaa !16
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !11
  switch i32 %29, label %75 [
    i32 8192, label %30
    i32 4096, label %35
    i32 2048, label %40
    i32 1024, label %45
    i32 512, label %50
    i32 256, label %55
    i32 128, label %60
    i32 64, label %65
    i32 32, label %70
  ]

30:                                               ; preds = %4
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %31, i32 0, i32 3
  store i32 1, ptr %32, align 8, !tbaa !17
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %33, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len4096, ptr %34, align 8, !tbaa !18
  br label %76

35:                                               ; preds = %4
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %36, i32 0, i32 3
  store i32 2, ptr %37, align 8, !tbaa !17
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %38, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len2048, ptr %39, align 8, !tbaa !18
  br label %76

40:                                               ; preds = %4
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %41, i32 0, i32 3
  store i32 4, ptr %42, align 8, !tbaa !17
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %43, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len1024, ptr %44, align 8, !tbaa !18
  br label %76

45:                                               ; preds = %4
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %46, i32 0, i32 3
  store i32 8, ptr %47, align 8, !tbaa !17
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %48, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len512, ptr %49, align 8, !tbaa !18
  br label %76

50:                                               ; preds = %4
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %51, i32 0, i32 3
  store i32 16, ptr %52, align 8, !tbaa !17
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %53, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len256, ptr %54, align 8, !tbaa !18
  br label %76

55:                                               ; preds = %4
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %56, i32 0, i32 3
  store i32 32, ptr %57, align 8, !tbaa !17
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %58, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len128, ptr %59, align 8, !tbaa !18
  br label %76

60:                                               ; preds = %4
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %61, i32 0, i32 3
  store i32 64, ptr %62, align 8, !tbaa !17
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %63, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len64, ptr %64, align 8, !tbaa !18
  br label %76

65:                                               ; preds = %4
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %66, i32 0, i32 3
  store i32 128, ptr %67, align 8, !tbaa !17
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %68, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len32, ptr %69, align 8, !tbaa !18
  br label %76

70:                                               ; preds = %4
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %71, i32 0, i32 3
  store i32 256, ptr %72, align 8, !tbaa !17
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.arm_rfft_instance_q15, ptr %73, i32 0, i32 6
  store ptr @arm_cfft_sR_q15_len16, ptr %74, align 8, !tbaa !18
  br label %76

75:                                               ; preds = %4
  store i32 -1, ptr %9, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %75, %70, %65, %60, %55, %50, %45, %40, %35, %30
  %77 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  ret i32 %77
}

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !7, i64 4, !7, i64 5, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!13 = !{!12, !6, i64 16}
!14 = !{!12, !6, i64 24}
!15 = !{!12, !7, i64 4}
!16 = !{!12, !7, i64 5}
!17 = !{!12, !10, i64 8}
!18 = !{!12, !6, i64 32}


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

%struct.arm_cfft_instance_q15 = type { i16, ptr, ptr, i16 }

@realCoefAQ15 = external constant [8192 x i16], align 16
@realCoefBQ15 = external constant [8192 x i16], align 16
@arm_cfft_sR_q15_len4096 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len2048 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len1024 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len512 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len256 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len128 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len64 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len32 = external constant %struct.arm_cfft_instance_q15, align 8
@arm_cfft_sR_q15_len16 = external constant %struct.arm_cfft_instance_q15, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local range(i32 -1, 1) i32 @arm_rfft_init_q15(ptr nocapture noundef writeonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = and i32 %1, 65535
  store i32 %5, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr @realCoefAQ15, ptr %6, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr @realCoefBQ15, ptr %7, align 8, !tbaa !12
  %8 = trunc i32 %2 to i8
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  store i8 %8, ptr %9, align 4, !tbaa !13
  %10 = trunc i32 %3 to i8
  %11 = getelementptr inbounds i8, ptr %0, i64 5
  store i8 %10, ptr %11, align 1, !tbaa !14
  %trunc = trunc i32 %1 to i16
  switch i16 %trunc, label %22 [
    i16 8192, label %.sink.split
    i16 4096, label %12
    i16 2048, label %13
    i16 1024, label %14
    i16 512, label %15
    i16 256, label %16
    i16 128, label %17
    i16 64, label %18
    i16 32, label %19
  ]

12:                                               ; preds = %4
  br label %.sink.split

13:                                               ; preds = %4
  br label %.sink.split

14:                                               ; preds = %4
  br label %.sink.split

15:                                               ; preds = %4
  br label %.sink.split

16:                                               ; preds = %4
  br label %.sink.split

17:                                               ; preds = %4
  br label %.sink.split

18:                                               ; preds = %4
  br label %.sink.split

19:                                               ; preds = %4
  br label %.sink.split

.sink.split:                                      ; preds = %4, %12, %13, %14, %15, %16, %17, %18, %19
  %.sink = phi i32 [ 256, %19 ], [ 128, %18 ], [ 64, %17 ], [ 32, %16 ], [ 16, %15 ], [ 8, %14 ], [ 4, %13 ], [ 2, %12 ], [ 1, %4 ]
  %arm_cfft_sR_q15_len16.sink = phi ptr [ @arm_cfft_sR_q15_len16, %19 ], [ @arm_cfft_sR_q15_len32, %18 ], [ @arm_cfft_sR_q15_len64, %17 ], [ @arm_cfft_sR_q15_len128, %16 ], [ @arm_cfft_sR_q15_len256, %15 ], [ @arm_cfft_sR_q15_len512, %14 ], [ @arm_cfft_sR_q15_len1024, %13 ], [ @arm_cfft_sR_q15_len2048, %12 ], [ @arm_cfft_sR_q15_len4096, %4 ]
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %.sink, ptr %20, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %arm_cfft_sR_q15_len16.sink, ptr %21, align 8, !tbaa !16
  br label %22

22:                                               ; preds = %.sink.split, %4
  %.0 = phi i32 [ -1, %4 ], [ 0, %.sink.split ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !8, i64 4, !8, i64 5, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !8, i64 4}
!14 = !{!6, !8, i64 5}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !10, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass