; LLVM IR from Ryuk17/SpeechAlgorithms :: WebRTC_ANR/src (noise_suppression)

; 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.NoiseSuppressionC_ = type { i32, i64, i64, i64, i64, float, i32, ptr, [256 x float], [256 x float], [256 x float], i32, [387 x float], [387 x float], [129 x float], [3 x i32], i32, [129 x float], [129 x float], [129 x float], float, float, i32, [128 x i64], [128 x float], i32, [4 x i32], [7 x float], [129 x float], [129 x float], [129 x float], [129 x float], [129 x float], float, [7 x float], [129 x float], float, float, float, [129 x float], float, float, [129 x float], %struct.NSParaExtract_, [1000 x i32], [1000 x i32], [1000 x i32], [129 x float], [2 x [256 x float]] }
%struct.NSParaExtract_ = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @WebRtcNs_set_policy_core(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %15

8:                                                ; preds = %2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %9, i32 0, i32 20
  store float 1.000000e+00, ptr %10, align 4, !tbaa !11
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %11, i32 0, i32 21
  store float 5.000000e-01, ptr %12, align 8, !tbaa !16
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %13, i32 0, i32 22
  store i32 0, ptr %14, align 4, !tbaa !17
  br label %49

15:                                               ; preds = %2
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %18, label %25

18:                                               ; preds = %15
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %19, i32 0, i32 20
  store float 1.000000e+00, ptr %20, align 4, !tbaa !11
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %21, i32 0, i32 21
  store float 2.500000e-01, ptr %22, align 8, !tbaa !16
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %23, i32 0, i32 22
  store i32 1, ptr %24, align 4, !tbaa !17
  br label %48

25:                                               ; preds = %15
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 2
  br i1 %27, label %28, label %35

28:                                               ; preds = %25
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %29, i32 0, i32 20
  store float 0x3FF19999A0000000, ptr %30, align 4, !tbaa !11
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %31, i32 0, i32 21
  store float 1.250000e-01, ptr %32, align 8, !tbaa !16
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %33, i32 0, i32 22
  store i32 1, ptr %34, align 4, !tbaa !17
  br label %47

35:                                               ; preds = %25
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = icmp eq i32 %36, 3
  br i1 %37, label %38, label %45

38:                                               ; preds = %35
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %39, i32 0, i32 20
  store float 1.250000e+00, ptr %40, align 4, !tbaa !11
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %41, i32 0, i32 21
  store float 0x3FB70A3D80000000, ptr %42, align 8, !tbaa !16
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %43, i32 0, i32 22
  store i32 1, ptr %44, align 4, !tbaa !17
  br label %46

45:                                               ; preds = %35
  store i32 -1, ptr %3, align 4
  br label %53

46:                                               ; preds = %38
  br label %47

47:                                               ; preds = %46, %28
  br label %48

48:                                               ; preds = %47, %18
  br label %49

49:                                               ; preds = %48, %8
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.NoiseSuppressionC_, ptr %51, i32 0, i32 6
  store i32 %50, ptr %52, align 4, !tbaa !18
  store i32 0, ptr %3, align 4
  br label %53

53:                                               ; preds = %49, %45
  %54 = load i32, ptr %3, align 4
  ret i32 %54
}

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

!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, !14, i64 8308}
!12 = !{!"NoiseSuppressionC_", !10, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !14, i64 40, !10, i64 44, !6, i64 48, !7, i64 56, !7, i64 1080, !7, i64 2104, !10, i64 3128, !7, i64 3132, !7, i64 4680, !7, i64 6228, !7, i64 6744, !10, i64 6756, !7, i64 6760, !7, i64 7276, !7, i64 7792, !14, i64 8308, !14, i64 8312, !10, i64 8316, !7, i64 8320, !7, i64 9344, !10, i64 9856, !7, i64 9860, !7, i64 9876, !7, i64 9904, !7, i64 10420, !7, i64 10936, !7, i64 11452, !7, i64 11968, !14, i64 12484, !7, i64 12488, !7, i64 12516, !14, i64 13032, !14, i64 13036, !14, i64 13040, !7, i64 13044, !14, i64 13560, !14, i64 13564, !7, i64 13568, !15, i64 14084, !7, i64 14164, !7, i64 18164, !7, i64 22164, !7, i64 26164, !7, i64 26680}
!13 = !{!"long", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"NSParaExtract_", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !14, i64 40, !14, i64 44, !14, i64 48, !14, i64 52, !14, i64 56, !14, i64 60, !14, i64 64, !14, i64 68, !10, i64 72, !10, i64 76}
!16 = !{!12, !14, i64 8312}
!17 = !{!12, !10, i64 8316}
!18 = !{!12, !10, i64 44}


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

@switch.table.WebRtcNs_set_policy_core = private unnamed_addr constant [4 x float] [float 1.000000e+00, float 1.000000e+00, float 0x3FF19999A0000000, float 1.250000e+00], align 4
@switch.table.WebRtcNs_set_policy_core.1 = private unnamed_addr constant [4 x float] [float 5.000000e-01, float 2.500000e-01, float 1.250000e-01, float 0x3FB70A3D80000000], align 4
@switch.table.WebRtcNs_set_policy_core.2 = private unnamed_addr constant [4 x i32] [i32 0, i32 1, i32 1, i32 1], align 4

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local range(i32 -1, 1) i32 @WebRtcNs_set_policy_core(ptr nocapture noundef writeonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp ult i32 %1, 4
  br i1 %3, label %switch.lookup, label %11

switch.lookup:                                    ; preds = %2
  %4 = zext nneg i32 %1 to i64
  %switch.gep = getelementptr inbounds [4 x float], ptr @switch.table.WebRtcNs_set_policy_core, i64 0, i64 %4
  %switch.load = load float, ptr %switch.gep, align 4
  %5 = zext nneg i32 %1 to i64
  %switch.gep24 = getelementptr inbounds [4 x float], ptr @switch.table.WebRtcNs_set_policy_core.1, i64 0, i64 %5
  %switch.load25 = load float, ptr %switch.gep24, align 4
  %6 = zext nneg i32 %1 to i64
  %switch.gep26 = getelementptr inbounds [4 x i32], ptr @switch.table.WebRtcNs_set_policy_core.2, i64 0, i64 %6
  %switch.load27 = load i32, ptr %switch.gep26, align 4
  %7 = getelementptr inbounds i8, ptr %0, i64 8308
  store float %switch.load, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 8312
  store float %switch.load25, ptr %8, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %0, i64 8316
  store i32 %switch.load27, ptr %9, align 4, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %1, ptr %10, align 4, !tbaa !16
  br label %11

11:                                               ; preds = %2, %switch.lookup
  %.0 = phi i32 [ 0, %switch.lookup ], [ -1, %2 ]
  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, !11, i64 8308}
!6 = !{!"NoiseSuppressionC_", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !7, i64 44, !12, i64 48, !8, i64 56, !8, i64 1080, !8, i64 2104, !7, i64 3128, !8, i64 3132, !8, i64 4680, !8, i64 6228, !8, i64 6744, !7, i64 6756, !8, i64 6760, !8, i64 7276, !8, i64 7792, !11, i64 8308, !11, i64 8312, !7, i64 8316, !8, i64 8320, !8, i64 9344, !7, i64 9856, !8, i64 9860, !8, i64 9876, !8, i64 9904, !8, i64 10420, !8, i64 10936, !8, i64 11452, !8, i64 11968, !11, i64 12484, !8, i64 12488, !8, i64 12516, !11, i64 13032, !11, i64 13036, !11, i64 13040, !8, i64 13044, !11, i64 13560, !11, i64 13564, !8, i64 13568, !13, i64 14084, !8, i64 14164, !8, i64 18164, !8, i64 22164, !8, i64 26164, !8, i64 26680}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"NSParaExtract_", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !7, i64 72, !7, i64 76}
!14 = !{!6, !11, i64 8312}
!15 = !{!6, !7, i64 8316}
!16 = !{!6, !7, i64 44}


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