; LLVM IR from Ryuk17/SpeechAlgorithms :: WebRTC_AEC/src (aec_core)

; 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.AecCore = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, [128 x float], [128 x float], [128 x float], [65 x float], [65 x float], [65 x float], [65 x float], ptr, [2 x [2080 x float]], [2 x [2080 x float]], [65 x [2 x float]], [65 x [2 x float]], [2080 x [2 x float]], [65 x float], [65 x float], [65 x float], [65 x float], float, float, float, i32, i32, float, float, i32, [64 x float], i32, i16, i16, i16, i32, ptr, ptr, i32, i32, i32, i32, float, float, i32, %struct.PowerLevel, %struct.PowerLevel, %struct.PowerLevel, %struct.PowerLevel, i32, i32, %struct.Stats, %struct.Stats, %struct.Stats, %struct.Stats, i32, i32, float, [75 x i32], i32, ptr, ptr, i32, i32 }
%struct.PowerLevel = type { float, i32, float, float, i32, float, float }
%struct.Stats = type { float, float, float, float, float, float, float, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__.WebRtcAec_SetConfigCore = external hidden unnamed_addr constant [55 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
declare hidden void @InitMetrics(ptr noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @WebRtcAec_SetConfigCore(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = 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
  %9 = load i32, ptr %6, align 4, !tbaa !9
  %10 = icmp sge i32 %9, 0
  br i1 %10, label %11, label %15

11:                                               ; preds = %4
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = icmp slt i32 %12, 3
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  br label %16

15:                                               ; preds = %11, %4
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 759, ptr noundef @__PRETTY_FUNCTION__.WebRtcAec_SetConfigCore) #3
  unreachable

16:                                               ; preds = %14
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.AecCore, ptr %18, i32 0, i32 34
  store i32 %17, ptr %19, align 4, !tbaa !11
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.AecCore, ptr %21, i32 0, i32 54
  store i32 %20, ptr %22, align 4, !tbaa !17
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.AecCore, ptr %23, i32 0, i32 54
  %25 = load i32, ptr %24, align 4, !tbaa !17
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %16
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  call void @InitMetrics(ptr noundef %28)
  br label %29

29:                                               ; preds = %27, %16
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.AecCore, ptr %31, i32 0, i32 64
  store i32 %30, ptr %32, align 4, !tbaa !18
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.AecCore, ptr %33, i32 0, i32 64
  %35 = load i32, ptr %34, align 4, !tbaa !18
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %41

37:                                               ; preds = %29
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.AecCore, ptr %38, i32 0, i32 63
  %40 = getelementptr inbounds [75 x i32], ptr %39, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %40, i8 0, i64 300, i1 false)
  br label %41

41:                                               ; preds = %37, %29
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { noreturn 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 = { noreturn 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 54668}
!12 = !{!"AecCore", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !7, i64 568, !7, i64 1080, !7, i64 1592, !7, i64 1852, !7, i64 2112, !7, i64 2372, !6, i64 2632, !7, i64 2640, !7, i64 19280, !7, i64 35920, !7, i64 36440, !7, i64 36960, !7, i64 53600, !7, i64 53860, !7, i64 54120, !7, i64 54380, !13, i64 54640, !13, i64 54644, !13, i64 54648, !10, i64 54652, !10, i64 54656, !13, i64 54660, !13, i64 54664, !10, i64 54668, !7, i64 54672, !10, i64 54928, !14, i64 54932, !14, i64 54934, !14, i64 54936, !10, i64 54940, !6, i64 54944, !6, i64 54952, !10, i64 54960, !10, i64 54964, !10, i64 54968, !10, i64 54972, !13, i64 54976, !13, i64 54980, !10, i64 54984, !15, i64 54988, !15, i64 55016, !15, i64 55044, !15, i64 55072, !10, i64 55100, !10, i64 55104, !16, i64 55108, !16, i64 55144, !16, i64 55180, !16, i64 55216, !10, i64 55252, !10, i64 55256, !13, i64 55260, !7, i64 55264, !10, i64 55564, !6, i64 55568, !6, i64 55576, !10, i64 55584, !10, i64 55588}
!13 = !{!"float", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!"PowerLevel", !13, i64 0, !10, i64 4, !13, i64 8, !13, i64 12, !10, i64 16, !13, i64 20, !13, i64 24}
!16 = !{!"Stats", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !10, i64 28, !10, i64 32}
!17 = !{!12, !10, i64 55100}
!18 = !{!12, !10, i64 55564}


; 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.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__.WebRtcAec_SetConfigCore = external hidden unnamed_addr constant [55 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
declare hidden void @InitMetrics(ptr noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @WebRtcAec_SetConfigCore(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %or.cond = icmp ult i32 %1, 3
  br i1 %or.cond, label %6, label %5

5:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 759, ptr noundef nonnull @__PRETTY_FUNCTION__.WebRtcAec_SetConfigCore) #3
  unreachable

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 54668
  store i32 %1, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 55100
  store i32 %2, ptr %8, align 4, !tbaa !15
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %10, label %9

9:                                                ; preds = %6
  tail call void @InitMetrics(ptr noundef nonnull %0)
  br label %10

10:                                               ; preds = %9, %6
  %11 = getelementptr inbounds i8, ptr %0, i64 55564
  store i32 %3, ptr %11, align 4, !tbaa !16
  %.not12 = icmp eq i32 %3, 0
  br i1 %.not12, label %14, label %12

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 55264
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(300) %13, i8 0, i64 300, i1 false)
  br label %14

14:                                               ; preds = %12, %10
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { noreturn 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 = { noreturn 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 54668}
!6 = !{!"AecCore", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !8, i64 56, !8, i64 568, !8, i64 1080, !8, i64 1592, !8, i64 1852, !8, i64 2112, !8, i64 2372, !10, i64 2632, !8, i64 2640, !8, i64 19280, !8, i64 35920, !8, i64 36440, !8, i64 36960, !8, i64 53600, !8, i64 53860, !8, i64 54120, !8, i64 54380, !11, i64 54640, !11, i64 54644, !11, i64 54648, !7, i64 54652, !7, i64 54656, !11, i64 54660, !11, i64 54664, !7, i64 54668, !8, i64 54672, !7, i64 54928, !12, i64 54932, !12, i64 54934, !12, i64 54936, !7, i64 54940, !10, i64 54944, !10, i64 54952, !7, i64 54960, !7, i64 54964, !7, i64 54968, !7, i64 54972, !11, i64 54976, !11, i64 54980, !7, i64 54984, !13, i64 54988, !13, i64 55016, !13, i64 55044, !13, i64 55072, !7, i64 55100, !7, i64 55104, !14, i64 55108, !14, i64 55144, !14, i64 55180, !14, i64 55216, !7, i64 55252, !7, i64 55256, !11, i64 55260, !8, i64 55264, !7, i64 55564, !10, i64 55568, !10, i64 55576, !7, i64 55584, !7, i64 55588}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"PowerLevel", !11, i64 0, !7, i64 4, !11, i64 8, !11, i64 12, !7, i64 16, !11, i64 20, !11, i64 24}
!14 = !{!"Stats", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !7, i64 28, !7, i64 32}
!15 = !{!6, !7, i64 55100}
!16 = !{!6, !7, i64 55564}


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