; LLVM IR from Ryuk17/SpeechAlgorithms :: WebRTC_AGC/src (WebRTC_AGC)

; 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.timeval = type { i64, i64 }
%struct.WebRtcAgcConfig = type { i16, i16, i8 }

@main.runtime = external hidden global float, align 4
@main.avg = external hidden global float, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.timeval, align 8
  %7 = alloca %struct.timeval, align 8
  %8 = alloca [128 x i8], align 16
  %9 = alloca [128 x i8], align 16
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %struct.WebRtcAgcConfig, align 2
  %23 = alloca i48, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i8, align 1
  %28 = alloca i16, align 2
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %29 = call noalias ptr @calloc(i64 noundef 160, i64 noundef 2) #7
  store ptr %29, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %30 = call noalias ptr @calloc(i64 noundef 160, i64 noundef 2) #7
  store ptr %30, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %31 = getelementptr inbounds [128 x i8], ptr %8, i64 0, i64 0
  %32 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %31, ptr noundef @.str, ptr noundef @.str.1) #6
  %33 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %34 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %33, ptr noundef @.str, ptr noundef @.str.2) #6
  %35 = getelementptr inbounds [128 x i8], ptr %8, i64 0, i64 0
  %36 = call noalias ptr @fopen(ptr noundef %35, ptr noundef @.str.3)
  store ptr %36, ptr %12, align 8, !tbaa !9
  %37 = load ptr, ptr %12, align 8, !tbaa !9
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %41

39:                                               ; preds = %2
  %40 = getelementptr inbounds [128 x i8], ptr %8, i64 0, i64 0
  call void @perror(ptr noundef %40)
  br label %41

41:                                               ; preds = %39, %2
  %42 = getelementptr inbounds [128 x i8], ptr %8, i64 0, i64 0
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %42)
  %44 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %45 = call noalias ptr @fopen(ptr noundef %44, ptr noundef @.str.5)
  store ptr %45, ptr %13, align 8, !tbaa !9
  %46 = load ptr, ptr %13, align 8, !tbaa !9
  %47 = icmp eq ptr %46, null
  br i1 %47, label %48, label %50

48:                                               ; preds = %41
  %49 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  call void @perror(ptr noundef %49)
  br label %50

50:                                               ; preds = %48, %41
  %51 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %51)
  %53 = load ptr, ptr %10, align 8, !tbaa !9
  %54 = load ptr, ptr %12, align 8, !tbaa !9
  %55 = call i64 @fread(ptr noundef %53, i64 noundef 1, i64 noundef 44, ptr noundef %54)
  %56 = load ptr, ptr %10, align 8, !tbaa !9
  %57 = load ptr, ptr %13, align 8, !tbaa !9
  %58 = call i64 @fwrite(ptr noundef %56, i64 noundef 1, i64 noundef 44, ptr noundef %57)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 16000, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %59 = call ptr @WebRtcAgc_Create()
  store ptr %59, ptr %17, align 8, !tbaa !9
  %60 = load ptr, ptr %17, align 8, !tbaa !9
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %64

62:                                               ; preds = %50
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %148

64:                                               ; preds = %50
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 255, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 2, ptr %21, align 4, !tbaa !5
  %66 = load ptr, ptr %17, align 8, !tbaa !9
  %67 = load i32, ptr %19, align 4, !tbaa !5
  %68 = load i32, ptr %20, align 4, !tbaa !5
  %69 = load i32, ptr %21, align 4, !tbaa !5
  %70 = trunc i32 %69 to i16
  %71 = load i32, ptr %16, align 4, !tbaa !5
  %72 = call i32 @WebRtcAgc_Init(ptr noundef %66, i32 noundef %67, i32 noundef %68, i16 noundef signext %70, i32 noundef %71)
  store i32 %72, ptr %14, align 4, !tbaa !5
  %73 = load i32, ptr %14, align 4, !tbaa !5
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %64
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %147

77:                                               ; preds = %64
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  call void @llvm.lifetime.start.p0(i64 6, ptr %22) #6
  %79 = getelementptr inbounds %struct.WebRtcAgcConfig, ptr %22, i32 0, i32 1
  store i16 9, ptr %79, align 2, !tbaa !11
  %80 = getelementptr inbounds %struct.WebRtcAgcConfig, ptr %22, i32 0, i32 2
  store i8 1, ptr %80, align 2, !tbaa !14
  %81 = getelementptr inbounds %struct.WebRtcAgcConfig, ptr %22, i32 0, i32 0
  store i16 3, ptr %81, align 2, !tbaa !15
  %82 = load ptr, ptr %17, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 2 %22, i64 6, i1 false)
  %83 = load i48, ptr %23, align 8
  %84 = call i32 @WebRtcAgc_set_config(ptr noundef %82, i48 %83)
  store i32 %84, ptr %14, align 4, !tbaa !5
  %85 = load i32, ptr %14, align 4, !tbaa !5
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %89

87:                                               ; preds = %77
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %146

89:                                               ; preds = %77
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  store i64 1, ptr %24, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 0, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  store i32 0, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #6
  store i8 1, ptr %27, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 2, ptr %28) #6
  store i16 0, ptr %28, align 2, !tbaa !19
  br label %91

91:                                               ; preds = %133, %89
  %92 = load ptr, ptr %10, align 8, !tbaa !9
  %93 = load ptr, ptr %12, align 8, !tbaa !9
  %94 = call i64 @fread(ptr noundef %92, i64 noundef 2, i64 noundef 160, ptr noundef %93)
  %95 = icmp ne i64 %94, 0
  br i1 %95, label %96, label %137

96:                                               ; preds = %91
  %97 = load i32, ptr %15, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %15, align 4, !tbaa !5
  %99 = call i32 @gettimeofday(ptr noundef %6, ptr noundef null) #6
  %100 = load ptr, ptr %17, align 8, !tbaa !9
  %101 = load i64, ptr %24, align 8, !tbaa !16
  %102 = load i32, ptr %25, align 4, !tbaa !5
  %103 = load i16, ptr %28, align 2, !tbaa !19
  %104 = call i32 @WebRtcAgc_Process(ptr noundef %100, ptr noundef %10, i64 noundef %101, i64 noundef 160, ptr noundef %11, i32 noundef %102, ptr noundef %26, i16 noundef signext %103, ptr noundef %27)
  store i32 %104, ptr %14, align 4, !tbaa !5
  %105 = call i32 @gettimeofday(ptr noundef %7, ptr noundef null) #6
  %106 = getelementptr inbounds %struct.timeval, ptr %7, i32 0, i32 0
  %107 = load i64, ptr %106, align 8, !tbaa !20
  %108 = getelementptr inbounds %struct.timeval, ptr %6, i32 0, i32 0
  %109 = load i64, ptr %108, align 8, !tbaa !20
  %110 = sub nsw i64 %107, %109
  %111 = mul nsw i64 1000000, %110
  %112 = getelementptr inbounds %struct.timeval, ptr %7, i32 0, i32 1
  %113 = load i64, ptr %112, align 8, !tbaa !22
  %114 = add nsw i64 %111, %113
  %115 = getelementptr inbounds %struct.timeval, ptr %6, i32 0, i32 1
  %116 = load i64, ptr %115, align 8, !tbaa !22
  %117 = sub nsw i64 %114, %116
  %118 = sitofp i64 %117 to float
  %119 = load float, ptr @main.runtime, align 4, !tbaa !23
  %120 = fadd float %119, %118
  store float %120, ptr @main.runtime, align 4, !tbaa !23
  %121 = load i32, ptr %15, align 4, !tbaa !5
  %122 = srem i32 %121, 100
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %133

124:                                              ; preds = %96
  %125 = load float, ptr @main.runtime, align 4, !tbaa !23
  %126 = load i32, ptr %15, align 4, !tbaa !5
  %127 = sitofp i32 %126 to float
  %128 = fdiv float %125, %127
  store float %128, ptr @main.avg, align 4, !tbaa !23
  %129 = load float, ptr @main.avg, align 4, !tbaa !23
  %130 = fdiv float %129, 1.000000e+03
  %131 = fpext float %130 to double
  %132 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, double noundef %131)
  br label %133

133:                                              ; preds = %124, %96
  %134 = load ptr, ptr %11, align 8, !tbaa !9
  %135 = load ptr, ptr %13, align 8, !tbaa !9
  %136 = call i64 @fwrite(ptr noundef %134, i64 noundef 2, i64 noundef 160, ptr noundef %135)
  br label %91, !llvm.loop !25

137:                                              ; preds = %91
  %138 = load ptr, ptr %17, align 8, !tbaa !9
  call void @WebRtcAgc_Free(ptr noundef %138)
  %139 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %139) #6
  %140 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %140) #6
  %141 = load ptr, ptr %12, align 8, !tbaa !9
  %142 = call i32 @fclose(ptr noundef %141)
  %143 = load ptr, ptr %13, align 8, !tbaa !9
  %144 = call i32 @fclose(ptr noundef %143)
  %145 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %146

146:                                              ; preds = %137, %87
  call void @llvm.lifetime.end.p0(i64 6, ptr %22) #6
  br label %147

147:                                              ; preds = %146, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %148

148:                                              ; preds = %147, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  %149 = load i32, ptr %3, align 4
  ret i32 %149
}

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #3

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

declare void @perror(ptr noundef) #4

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

declare ptr @WebRtcAgc_Create() #4

declare i32 @WebRtcAgc_Init(ptr noundef, i32 noundef, i32 noundef, i16 noundef signext, i32 noundef) #4

declare i32 @WebRtcAgc_set_config(ptr noundef, i48) #4

; 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) #5

; Function Attrs: nounwind
declare i32 @gettimeofday(ptr noundef, ptr noundef) #3

declare i32 @WebRtcAgc_Process(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef, i16 noundef signext, ptr noundef) #4

declare void @WebRtcAgc_Free(ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

declare i32 @fclose(ptr noundef) #4

; 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 allocsize(0,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 #3 = { 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 #4 = { "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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 2}
!12 = !{!"", !13, i64 0, !13, i64 2, !7, i64 4}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !7, i64 4}
!15 = !{!12, !13, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!13, !13, i64 0}
!20 = !{!21, !17, i64 0}
!21 = !{!"timeval", !17, i64 0, !17, i64 8}
!22 = !{!21, !17, i64 8}
!23 = !{!24, !24, i64 0}
!24 = !{!"float", !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"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.timeval = type { i64, i64 }

@main.runtime = external hidden local_unnamed_addr global float, align 4
@main.avg = external hidden local_unnamed_addr global float, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca %struct.timeval, align 8
  %4 = alloca %struct.timeval, align 8
  %5 = alloca [128 x i8], align 16
  %6 = alloca [128 x i8], align 16
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %11 = tail call noalias dereferenceable_or_null(320) ptr @calloc(i64 noundef 160, i64 noundef 2) #7
  store ptr %11, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %12 = tail call noalias dereferenceable_or_null(320) ptr @calloc(i64 noundef 160, i64 noundef 2) #7
  store ptr %12, ptr %8, align 8, !tbaa !5
  %13 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.1) #6
  %14 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.2) #6
  %15 = call noalias ptr @fopen(ptr noundef nonnull %5, ptr noundef nonnull @.str.3)
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %2
  call void @perror(ptr noundef nonnull %5) #8
  br label %18

18:                                               ; preds = %17, %2
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %5)
  %20 = call noalias ptr @fopen(ptr noundef nonnull %6, ptr noundef nonnull @.str.5)
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  call void @perror(ptr noundef nonnull %6) #8
  br label %23

23:                                               ; preds = %22, %18
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %6)
  %25 = call i64 @fread(ptr noundef %11, i64 noundef 1, i64 noundef 44, ptr noundef %15)
  %26 = call i64 @fwrite(ptr noundef %11, i64 noundef 1, i64 noundef 44, ptr noundef %20)
  %27 = call ptr @WebRtcAgc_Create() #6
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %23
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %80

31:                                               ; preds = %23
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %33 = call i32 @WebRtcAgc_Init(ptr noundef nonnull %27, i32 noundef 0, i32 noundef 255, i16 noundef signext 2, i32 noundef 16000) #6
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %36, label %34

34:                                               ; preds = %31
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %80

36:                                               ; preds = %31
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %38 = call i32 @WebRtcAgc_set_config(ptr noundef nonnull %27, i48 4295557123) #6
  %.not28 = icmp eq i32 %38, 0
  br i1 %.not28, label %41, label %39

39:                                               ; preds = %36
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %80

41:                                               ; preds = %36
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #6
  store i8 1, ptr %10, align 1, !tbaa !11
  %43 = call i64 @fread(ptr noundef %11, i64 noundef 2, i64 noundef 160, ptr noundef %15)
  %.not2930 = icmp eq i64 %43, 0
  br i1 %.not2930, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %41
  %44 = getelementptr inbounds i8, ptr %4, i64 8
  %45 = getelementptr inbounds i8, ptr %3, i64 8
  br label %46

46:                                               ; preds = %.lr.ph, %70
  %.02631 = phi i32 [ 0, %.lr.ph ], [ %47, %70 ]
  %47 = add nuw nsw i32 %.02631, 1
  %48 = call i32 @gettimeofday(ptr noundef nonnull %3, ptr noundef null) #6
  %49 = call i32 @WebRtcAgc_Process(ptr noundef nonnull %27, ptr noundef nonnull %7, i64 noundef 1, i64 noundef 160, ptr noundef nonnull %8, i32 noundef 0, ptr noundef nonnull %9, i16 noundef signext 0, ptr noundef nonnull %10) #6
  %50 = call i32 @gettimeofday(ptr noundef nonnull %4, ptr noundef null) #6
  %51 = load i64, ptr %4, align 8, !tbaa !12
  %52 = load i64, ptr %3, align 8, !tbaa !12
  %53 = sub nsw i64 %51, %52
  %54 = mul nsw i64 %53, 1000000
  %55 = load i64, ptr %44, align 8, !tbaa !15
  %56 = add nsw i64 %54, %55
  %57 = load i64, ptr %45, align 8, !tbaa !15
  %58 = sub i64 %56, %57
  %59 = sitofp i64 %58 to float
  %60 = load float, ptr @main.runtime, align 4, !tbaa !16
  %61 = fadd float %60, %59
  store float %61, ptr @main.runtime, align 4, !tbaa !16
  %62 = urem i32 %47, 100
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %70

64:                                               ; preds = %46
  %65 = uitofp nneg i32 %47 to float
  %66 = fdiv float %61, %65
  store float %66, ptr @main.avg, align 4, !tbaa !16
  %67 = fdiv float %66, 1.000000e+03
  %68 = fpext float %67 to double
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, double noundef %68)
  br label %70

70:                                               ; preds = %64, %46
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = call i64 @fwrite(ptr noundef %71, i64 noundef 2, i64 noundef 160, ptr noundef %20)
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = call i64 @fread(ptr noundef %73, i64 noundef 2, i64 noundef 160, ptr noundef %15)
  %.not29 = icmp eq i64 %74, 0
  br i1 %.not29, label %._crit_edge, label %46, !llvm.loop !18

._crit_edge:                                      ; preds = %70, %41
  call void @WebRtcAgc_Free(ptr noundef nonnull %27) #6
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %75) #6
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %76) #6
  %77 = call i32 @fclose(ptr noundef %15)
  %78 = call i32 @fclose(ptr noundef %20)
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %80

80:                                               ; preds = %34, %._crit_edge, %39, %29
  %.2 = phi i32 [ -1, %29 ], [ -1, %34 ], [ -1, %39 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  ret i32 %.2
}

; 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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

declare ptr @WebRtcAgc_Create() local_unnamed_addr #4

declare i32 @WebRtcAgc_Init(ptr noundef, i32 noundef, i32 noundef, i16 noundef signext, i32 noundef) local_unnamed_addr #4

declare i32 @WebRtcAgc_set_config(ptr noundef, i48) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @gettimeofday(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

declare i32 @WebRtcAgc_Process(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef, i16 noundef signext, ptr noundef) local_unnamed_addr #4

declare void @WebRtcAgc_Free(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 = { 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 #4 = { "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }
attributes #8 = { cold }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"timeval", !14, i64 0, !14, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !14, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass