; LLVM IR from mlcommons/tiny :: benchmark/reference_submissions/streaming_wakeword/sww_testing_l4r5zi/Core/Src_ (extraction)

; 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_f32 = type { i16, ptr, ptr, i16 }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@arm_cfft_sR_f32_len1024 = external constant %struct.arm_cfft_instance_f32, align 8
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@testOutput = external hidden global [1024 x float], align 16
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test_extraction(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  %4 = alloca [2048 x float], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8192, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 1024, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 1, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %23, %1
  %11 = load i32, ptr %9, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 2048
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %26

14:                                               ; preds = %10
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds float, ptr %15, i64 %17
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 %21
  store float %19, ptr %22, align 4, !tbaa !11
  br label %23

23:                                               ; preds = %14
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %9, align 4, !tbaa !9
  br label %10, !llvm.loop !13

26:                                               ; preds = %13
  %27 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 0
  %28 = load float, ptr %27, align 16, !tbaa !11
  %29 = fpext float %28 to double
  %30 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 1
  %31 = load float, ptr %30, align 4, !tbaa !11
  %32 = fpext float %31 to double
  %33 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 2
  %34 = load float, ptr %33, align 8, !tbaa !11
  %35 = fpext float %34 to double
  %36 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 3
  %37 = load float, ptr %36, align 4, !tbaa !11
  %38 = fpext float %37 to double
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %29, double noundef %32, double noundef %35, double noundef %38)
  %40 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 0
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = trunc i32 %41 to i8
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = trunc i32 %43 to i8
  call void @arm_cfft_f32(ptr noundef @arm_cfft_sR_f32_len1024, ptr noundef %40, i8 noundef zeroext %42, i8 noundef zeroext %44)
  %45 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 0
  %46 = load float, ptr %45, align 16, !tbaa !11
  %47 = fpext float %46 to double
  %48 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 1
  %49 = load float, ptr %48, align 4, !tbaa !11
  %50 = fpext float %49 to double
  %51 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 2
  %52 = load float, ptr %51, align 8, !tbaa !11
  %53 = fpext float %52 to double
  %54 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 3
  %55 = load float, ptr %54, align 4, !tbaa !11
  %56 = fpext float %55 to double
  %57 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 4
  %58 = load float, ptr %57, align 16, !tbaa !11
  %59 = fpext float %58 to double
  %60 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 5
  %61 = load float, ptr %60, align 4, !tbaa !11
  %62 = fpext float %61 to double
  %63 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 6
  %64 = load float, ptr %63, align 8, !tbaa !11
  %65 = fpext float %64 to double
  %66 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 7
  %67 = load float, ptr %66, align 4, !tbaa !11
  %68 = fpext float %67 to double
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %47, double noundef %50, double noundef %53, double noundef %56, double noundef %59, double noundef %62, double noundef %65, double noundef %68)
  %70 = getelementptr inbounds [2048 x float], ptr %4, i64 0, i64 0
  %71 = load i32, ptr %6, align 4, !tbaa !9
  call void @arm_cmplx_mag_f32(ptr noundef %70, ptr noundef @testOutput, i32 noundef %71)
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @print_vals_float(ptr noundef @testOutput, i32 noundef 1024)
  %73 = load i32, ptr %6, align 4, !tbaa !9
  call void @arm_max_f32(ptr noundef @testOutput, i32 noundef %73, ptr noundef %3, ptr noundef %5)
  %74 = load float, ptr %3, align 4, !tbaa !11
  %75 = fpext float %74 to double
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %75, i32 noundef %76)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8192, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

; 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

declare i32 @printf(ptr noundef, ...) #2

declare void @arm_cfft_f32(ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext) #2

declare void @arm_cmplx_mag_f32(ptr noundef, ptr noundef, i32 noundef) #2

declare void @print_vals_float(ptr noundef, i32 noundef) #2

declare void @arm_max_f32(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #2

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 = { "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 = { 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

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

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@arm_cfft_sR_f32_len1024 = external constant %struct.arm_cfft_instance_f32, align 8
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@testOutput = external hidden global [1024 x float], align 16
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test_extraction(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca float, align 4
  %3 = alloca [2048 x float], align 16
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8192, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(8192) %3, ptr noundef nonnull align 4 dereferenceable(8192) %0, i64 8192, i1 false), !tbaa !9
  %5 = load float, ptr %3, align 16, !tbaa !9
  %6 = fpext float %5 to double
  %7 = getelementptr inbounds i8, ptr %3, i64 4
  %8 = load float, ptr %7, align 4, !tbaa !9
  %9 = fpext float %8 to double
  %10 = getelementptr inbounds i8, ptr %3, i64 8
  %11 = load float, ptr %10, align 8, !tbaa !9
  %12 = fpext float %11 to double
  %13 = getelementptr inbounds i8, ptr %3, i64 12
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = fpext float %14 to double
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %6, double noundef %9, double noundef %12, double noundef %15)
  call void @arm_cfft_f32(ptr noundef nonnull @arm_cfft_sR_f32_len1024, ptr noundef nonnull %3, i8 noundef zeroext 0, i8 noundef zeroext 1) #5
  %17 = load float, ptr %3, align 16, !tbaa !9
  %18 = fpext float %17 to double
  %19 = load float, ptr %7, align 4, !tbaa !9
  %20 = fpext float %19 to double
  %21 = load float, ptr %10, align 8, !tbaa !9
  %22 = fpext float %21 to double
  %23 = load float, ptr %13, align 4, !tbaa !9
  %24 = fpext float %23 to double
  %25 = getelementptr inbounds i8, ptr %3, i64 16
  %26 = load float, ptr %25, align 16, !tbaa !9
  %27 = fpext float %26 to double
  %28 = getelementptr inbounds i8, ptr %3, i64 20
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fpext float %29 to double
  %31 = getelementptr inbounds i8, ptr %3, i64 24
  %32 = load float, ptr %31, align 8, !tbaa !9
  %33 = fpext float %32 to double
  %34 = getelementptr inbounds i8, ptr %3, i64 28
  %35 = load float, ptr %34, align 4, !tbaa !9
  %36 = fpext float %35 to double
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %18, double noundef %20, double noundef %22, double noundef %24, double noundef %27, double noundef %30, double noundef %33, double noundef %36)
  call void @arm_cmplx_mag_f32(ptr noundef nonnull %3, ptr noundef nonnull @testOutput, i32 noundef 1024) #5
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @print_vals_float(ptr noundef nonnull @testOutput, i32 noundef 1024) #5
  call void @arm_max_f32(ptr noundef nonnull @testOutput, i32 noundef 1024, ptr noundef nonnull %2, ptr noundef nonnull %4) #5
  %39 = load float, ptr %2, align 4, !tbaa !9
  %40 = fpext float %39 to double
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %40, i32 noundef %41)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8192, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret void
}

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare void @arm_cfft_f32(ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #3

declare void @arm_cmplx_mag_f32(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @print_vals_float(ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @arm_max_f32(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; 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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopIdiomRecognizePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass