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

; Function Attrs: nounwind uwtable
define dso_local i32 @WebRtcAec_FreeAec(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 = icmp eq ptr %4, null
  br i1 %5, label %6, label %7

6:                                                ; preds = %1
  store i32 -1, ptr %2, align 4
  br label %33

7:                                                ; preds = %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.AecCore, ptr %8, i32 0, i32 6
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  call void @WebRtc_FreeBuffer(ptr noundef %10)
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.AecCore, ptr %11, i32 0, i32 7
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  call void @WebRtc_FreeBuffer(ptr noundef %13)
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.AecCore, ptr %14, i32 0, i32 8
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  call void @WebRtc_FreeBuffer(ptr noundef %16)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.AecCore, ptr %17, i32 0, i32 9
  %19 = load ptr, ptr %18, align 8, !tbaa !18
  call void @WebRtc_FreeBuffer(ptr noundef %19)
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.AecCore, ptr %20, i32 0, i32 41
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  call void @WebRtc_FreeBuffer(ptr noundef %22)
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.AecCore, ptr %23, i32 0, i32 42
  %25 = load ptr, ptr %24, align 8, !tbaa !20
  call void @WebRtc_FreeBuffer(ptr noundef %25)
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.AecCore, ptr %26, i32 0, i32 66
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  call void @WebRtc_FreeDelayEstimator(ptr noundef %28)
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.AecCore, ptr %29, i32 0, i32 65
  %31 = load ptr, ptr %30, align 8, !tbaa !22
  call void @WebRtc_FreeDelayEstimatorFarend(ptr noundef %31)
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %32) #3
  store i32 0, ptr %2, align 4
  br label %33

33:                                               ; preds = %7, %6
  %34 = load i32, ptr %2, align 4
  ret i32 %34
}

declare void @WebRtc_FreeBuffer(ptr noundef) #1

declare void @WebRtc_FreeDelayEstimator(ptr noundef) #1

declare void @WebRtc_FreeDelayEstimatorFarend(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(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 = { "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 "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, !6, i64 24}
!10 = !{!"AecCore", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, 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, !12, i64 54640, !12, i64 54644, !12, i64 54648, !11, i64 54652, !11, i64 54656, !12, i64 54660, !12, i64 54664, !11, i64 54668, !7, i64 54672, !11, i64 54928, !13, i64 54932, !13, i64 54934, !13, i64 54936, !11, i64 54940, !6, i64 54944, !6, i64 54952, !11, i64 54960, !11, i64 54964, !11, i64 54968, !11, i64 54972, !12, i64 54976, !12, i64 54980, !11, i64 54984, !14, i64 54988, !14, i64 55016, !14, i64 55044, !14, i64 55072, !11, i64 55100, !11, i64 55104, !15, i64 55108, !15, i64 55144, !15, i64 55180, !15, i64 55216, !11, i64 55252, !11, i64 55256, !12, i64 55260, !7, i64 55264, !11, i64 55564, !6, i64 55568, !6, i64 55576, !11, i64 55584, !11, i64 55588}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"PowerLevel", !12, i64 0, !11, i64 4, !12, i64 8, !12, i64 12, !11, i64 16, !12, i64 20, !12, i64 24}
!15 = !{!"Stats", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !11, i64 28, !11, i64 32}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !6, i64 40}
!18 = !{!10, !6, i64 48}
!19 = !{!10, !6, i64 54944}
!20 = !{!10, !6, i64 54952}
!21 = !{!10, !6, i64 55576}
!22 = !{!10, !6, i64 55568}


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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @WebRtcAec_FreeAec(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %20, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  tail call void @WebRtc_FreeBuffer(ptr noundef %5) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !15
  tail call void @WebRtc_FreeBuffer(ptr noundef %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  tail call void @WebRtc_FreeBuffer(ptr noundef %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load ptr, ptr %10, align 8, !tbaa !17
  tail call void @WebRtc_FreeBuffer(ptr noundef %11) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 54944
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  tail call void @WebRtc_FreeBuffer(ptr noundef %13) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 54952
  %15 = load ptr, ptr %14, align 8, !tbaa !19
  tail call void @WebRtc_FreeBuffer(ptr noundef %15) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 55576
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  tail call void @WebRtc_FreeDelayEstimator(ptr noundef %17) #3
  %18 = getelementptr inbounds i8, ptr %0, i64 55568
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  tail call void @WebRtc_FreeDelayEstimatorFarend(ptr noundef %19) #3
  tail call void @free(ptr noundef nonnull %0) #3
  br label %20

20:                                               ; preds = %1, %3
  %.0 = phi i32 [ 0, %3 ], [ -1, %1 ]
  ret i32 %.0
}

declare void @WebRtc_FreeBuffer(ptr noundef) local_unnamed_addr #1

declare void @WebRtc_FreeDelayEstimator(ptr noundef) local_unnamed_addr #1

declare void @WebRtc_FreeDelayEstimatorFarend(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 = { "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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, !10, i64 24}
!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, !10, i64 32}
!16 = !{!6, !10, i64 40}
!17 = !{!6, !10, i64 48}
!18 = !{!6, !10, i64 54944}
!19 = !{!6, !10, i64 54952}
!20 = !{!6, !10, i64 55576}
!21 = !{!6, !10, i64 55568}


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