; LLVM IR from TobiasKozel/VAE :: external/portaudio/qa/loopback/src (paqa)

; 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.TestParameters_s = type { %struct.PaStreamParameters, %struct.PaStreamParameters, double, i32, i32, i32, double, double, i64, i32 }
%struct.PaStreamParameters = type { i32, i32, i64, double, ptr }
%struct.LoopbackContext_s = type { [8 x %struct.PaQaSineGenerator_s], [8 x %struct.PaQaRecording_s], double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32 }
%struct.PaQaSineGenerator_s = type { double, double, double, double }
%struct.PaQaRecording_s = type { i32, ptr, i32, i32 }
%struct.PaDeviceInfo = type { i32, ptr, i32, i32, i32, double, double, double, double, double }

@g_testsPassed = external dso_local global i32, align 4
@g_testsFailed = external dso_local global i32, align 4
@.str.8 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [59 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaQa_RunLoopback(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaQa_CheckForClippedLoopback(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaQa_MeasureBackgroundNoise(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @PaQa_CheckForLoopBack(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.TestParameters_s, align 8
  %9 = alloca %struct.LoopbackContext_s, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  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
  call void @llvm.lifetime.start.p0(i64 120, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 528, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = call ptr @Pa_GetDeviceInfo(i32 noundef %23)
  store ptr %24, ptr %10, align 8, !tbaa !5
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %29

27:                                               ; preds = %3
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 -9996, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

29:                                               ; preds = %3
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.PaDeviceInfo, ptr %30, i32 0, i32 3
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = icmp slt i32 %32, 2
  br i1 %33, label %34, label %35

34:                                               ; preds = %29
  store i32 0, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

35:                                               ; preds = %29
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = call ptr @Pa_GetDeviceInfo(i32 noundef %36)
  store ptr %37, ptr %11, align 8, !tbaa !5
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 -9996, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

42:                                               ; preds = %35
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.PaDeviceInfo, ptr %43, i32 0, i32 4
  %45 = load i32, ptr %44, align 8, !tbaa !14
  %46 = icmp slt i32 %45, 2
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  store i32 0, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

48:                                               ; preds = %42
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.PaDeviceInfo, ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.PaDeviceInfo, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, ptr noundef %51, ptr noundef %54)
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.PaDeviceInfo, ptr %56, i32 0, i32 5
  %58 = load double, ptr %57, align 8, !tbaa !16
  %59 = fmul double %58, 1.000000e+03
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.PaDeviceInfo, ptr %60, i32 0, i32 7
  %62 = load double, ptr %61, align 8, !tbaa !17
  %63 = fmul double %62, 1.000000e+03
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, double noundef %59, double noundef %63)
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.PaDeviceInfo, ptr %65, i32 0, i32 6
  %67 = load double, ptr %66, align 8, !tbaa !18
  %68 = fmul double %67, 1.000000e+03
  %69 = load ptr, ptr %11, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.PaDeviceInfo, ptr %69, i32 0, i32 8
  %71 = load double, ptr %70, align 8, !tbaa !19
  %72 = fmul double %71, 1.000000e+03
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, double noundef %68, double noundef %72)
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = load i32, ptr %7, align 4, !tbaa !9
  call void @PaQa_SetDefaultTestParameters(ptr noundef %8, i32 noundef %74, i32 noundef %75)
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  call void @PaQa_OverrideTestParameters(ptr noundef %8, ptr noundef %76)
  %77 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %78 = load double, ptr %77, align 8, !tbaa !20
  %79 = fmul double 8.000000e-01, %78
  %80 = fptosi double %79 to i32
  %81 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 5
  store i32 %80, ptr %81, align 8, !tbaa !24
  %82 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 7
  %83 = load double, ptr %82, align 8, !tbaa !25
  %84 = fdiv double %83, 4.000000e+00
  store double %84, ptr %13, align 8, !tbaa !26
  %85 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 0
  %86 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %87 = load double, ptr %86, align 8, !tbaa !20
  %88 = call i32 @Pa_IsFormatSupported(ptr noundef %85, ptr noundef null, double noundef %87)
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %92

90:                                               ; preds = %48
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

92:                                               ; preds = %48
  %93 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 1
  %94 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %95 = load double, ptr %94, align 8, !tbaa !20
  %96 = call i32 @Pa_IsFormatSupported(ptr noundef null, ptr noundef %93, double noundef %95)
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %100

98:                                               ; preds = %92
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

100:                                              ; preds = %92
  %101 = call i32 @PaQa_SetupLoopbackContext(ptr noundef %9, ptr noundef %8)
  %102 = load i32, ptr %6, align 4, !tbaa !9
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = icmp eq i32 %102, %103
  br i1 %104, label %105, label %109

105:                                              ; preds = %100
  %106 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 9
  %107 = load i32, ptr %106, align 8, !tbaa !27
  %108 = and i32 %107, -2
  store i32 %108, ptr %106, align 8, !tbaa !27
  br label %111

109:                                              ; preds = %100
  %110 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 9
  store i32 1, ptr %110, align 8, !tbaa !27
  br label %111

111:                                              ; preds = %109, %105
  %112 = call i32 @PaQa_RunLoopback(ptr noundef %9)
  store i32 %112, ptr %12, align 4, !tbaa !9
  %113 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 4
  %114 = load volatile i32, ptr %113, align 8, !tbaa !28
  %115 = icmp sgt i32 %114, 1
  br i1 %115, label %120, label %116

116:                                              ; preds = %111
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef @.str.16, i32 noundef 1220, ptr noundef @.str.17)
  %118 = load i32, ptr @g_testsFailed, align 4, !tbaa !9
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr @g_testsFailed, align 4, !tbaa !9
  br label %221

120:                                              ; preds = %111
  %121 = load i32, ptr @g_testsPassed, align 4, !tbaa !9
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr @g_testsPassed, align 4, !tbaa !9
  br label %123

123:                                              ; preds = %120
  %124 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 5
  %125 = load i32, ptr %124, align 8, !tbaa !24
  %126 = sdiv i32 %125, 2
  store i32 %126, ptr %15, align 4, !tbaa !9
  %127 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 5
  %128 = load i32, ptr %127, align 8, !tbaa !24
  %129 = sdiv i32 %128, 2
  store i32 %129, ptr %16, align 4, !tbaa !9
  %130 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 1
  %131 = getelementptr inbounds [8 x %struct.PaQaRecording_s], ptr %130, i64 0, i64 0
  %132 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 0
  %133 = getelementptr inbounds [8 x %struct.PaQaSineGenerator_s], ptr %132, i64 0, i64 0
  %134 = getelementptr inbounds %struct.PaQaSineGenerator_s, ptr %133, i32 0, i32 2
  %135 = load double, ptr %134, align 8, !tbaa !30
  %136 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %137 = load double, ptr %136, align 8, !tbaa !20
  %138 = load i32, ptr %15, align 4, !tbaa !9
  %139 = load i32, ptr %16, align 4, !tbaa !9
  %140 = call double @PaQa_CorrelateSine(ptr noundef %131, double noundef %135, double noundef %137, i32 noundef %138, i32 noundef %139, ptr noundef null)
  store double %140, ptr %17, align 8, !tbaa !26
  %141 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 1
  %142 = getelementptr inbounds [8 x %struct.PaQaRecording_s], ptr %141, i64 0, i64 1
  %143 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 0
  %144 = getelementptr inbounds [8 x %struct.PaQaSineGenerator_s], ptr %143, i64 0, i64 1
  %145 = getelementptr inbounds %struct.PaQaSineGenerator_s, ptr %144, i32 0, i32 2
  %146 = load double, ptr %145, align 8, !tbaa !30
  %147 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %148 = load double, ptr %147, align 8, !tbaa !20
  %149 = load i32, ptr %15, align 4, !tbaa !9
  %150 = load i32, ptr %16, align 4, !tbaa !9
  %151 = call double @PaQa_CorrelateSine(ptr noundef %142, double noundef %146, double noundef %148, i32 noundef %149, i32 noundef %150, ptr noundef null)
  store double %151, ptr %18, align 8, !tbaa !26
  %152 = load double, ptr %17, align 8, !tbaa !26
  %153 = load double, ptr %18, align 8, !tbaa !26
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef %152, double noundef %153)
  %155 = load double, ptr %17, align 8, !tbaa !26
  %156 = load double, ptr %13, align 8, !tbaa !26
  %157 = fcmp ogt double %155, %156
  br i1 %157, label %158, label %162

158:                                              ; preds = %123
  %159 = load double, ptr %18, align 8, !tbaa !26
  %160 = load double, ptr %13, align 8, !tbaa !26
  %161 = fcmp ogt double %159, %160
  br label %162

162:                                              ; preds = %158, %123
  %163 = phi i1 [ false, %123 ], [ %161, %158 ]
  %164 = zext i1 %163 to i32
  store i32 %164, ptr %14, align 4, !tbaa !9
  %165 = load i32, ptr %14, align 4, !tbaa !9
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %200, label %167

167:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %168 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 1
  %169 = getelementptr inbounds [8 x %struct.PaQaRecording_s], ptr %168, i64 0, i64 0
  %170 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 0
  %171 = getelementptr inbounds [8 x %struct.PaQaSineGenerator_s], ptr %170, i64 0, i64 1
  %172 = getelementptr inbounds %struct.PaQaSineGenerator_s, ptr %171, i32 0, i32 2
  %173 = load double, ptr %172, align 8, !tbaa !30
  %174 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %175 = load double, ptr %174, align 8, !tbaa !20
  %176 = load i32, ptr %15, align 4, !tbaa !9
  %177 = load i32, ptr %16, align 4, !tbaa !9
  %178 = call double @PaQa_CorrelateSine(ptr noundef %169, double noundef %173, double noundef %175, i32 noundef %176, i32 noundef %177, ptr noundef null)
  store double %178, ptr %20, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %179 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 1
  %180 = getelementptr inbounds [8 x %struct.PaQaRecording_s], ptr %179, i64 0, i64 1
  %181 = getelementptr inbounds %struct.LoopbackContext_s, ptr %9, i32 0, i32 0
  %182 = getelementptr inbounds [8 x %struct.PaQaSineGenerator_s], ptr %181, i64 0, i64 0
  %183 = getelementptr inbounds %struct.PaQaSineGenerator_s, ptr %182, i32 0, i32 2
  %184 = load double, ptr %183, align 8, !tbaa !30
  %185 = getelementptr inbounds %struct.TestParameters_s, ptr %8, i32 0, i32 2
  %186 = load double, ptr %185, align 8, !tbaa !20
  %187 = load i32, ptr %15, align 4, !tbaa !9
  %188 = load i32, ptr %16, align 4, !tbaa !9
  %189 = call double @PaQa_CorrelateSine(ptr noundef %180, double noundef %184, double noundef %186, i32 noundef %187, i32 noundef %188, ptr noundef null)
  store double %189, ptr %21, align 8, !tbaa !26
  %190 = load double, ptr %20, align 8, !tbaa !26
  %191 = load double, ptr %13, align 8, !tbaa !26
  %192 = fcmp ogt double %190, %191
  br i1 %192, label %193, label %199

193:                                              ; preds = %167
  %194 = load double, ptr %21, align 8, !tbaa !26
  %195 = load double, ptr %13, align 8, !tbaa !26
  %196 = fcmp ogt double %194, %195
  br i1 %196, label %197, label %199

197:                                              ; preds = %193
  %198 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  br label %199

199:                                              ; preds = %197, %193, %167
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  br label %219

200:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  store double 0.000000e+00, ptr %22, align 8, !tbaa !26
  %201 = call i32 @PaQa_CheckForClippedLoopback(ptr noundef %9)
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %204

203:                                              ; preds = %200
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %204

204:                                              ; preds = %203, %200
  %205 = call i32 @PaQa_MeasureBackgroundNoise(ptr noundef %9, ptr noundef %22)
  store i32 %205, ptr %12, align 4, !tbaa !9
  %206 = load double, ptr %22, align 8, !tbaa !26
  %207 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, double noundef %206)
  %208 = load i32, ptr %12, align 4, !tbaa !9
  %209 = icmp ne i32 %208, 0
  br i1 %209, label %210, label %212

210:                                              ; preds = %204
  %211 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %218

212:                                              ; preds = %204
  %213 = load double, ptr %22, align 8, !tbaa !26
  %214 = fcmp ogt double %213, 4.000000e-04
  br i1 %214, label %215, label %217

215:                                              ; preds = %212
  %216 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %217

217:                                              ; preds = %215, %212
  br label %218

218:                                              ; preds = %217, %210
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  br label %219

219:                                              ; preds = %218, %199
  call void @PaQa_TeardownLoopbackContext(ptr noundef %9)
  %220 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %220, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

221:                                              ; preds = %116
  call void @PaQa_TeardownLoopbackContext(ptr noundef %9)
  %222 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %222, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %223

223:                                              ; preds = %221, %219, %98, %90, %47, %40, %34, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 528, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 120, ptr %8) #3
  %224 = load i32, ptr %4, align 4
  ret i32 %224
}

declare ptr @Pa_GetDeviceInfo(i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @PaQa_SetDefaultTestParameters(ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @PaQa_OverrideTestParameters(ptr noundef, ptr noundef) #2

declare i32 @Pa_IsFormatSupported(ptr noundef, ptr noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @PaQa_SetupLoopbackContext(ptr noundef, ptr noundef) #2

declare double @PaQa_CorrelateSine(ptr noundef, double noundef, double noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @PaQa_TeardownLoopbackContext(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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, !10, i64 20}
!12 = !{!"PaDeviceInfo", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 24}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !13, i64 32}
!17 = !{!12, !13, i64 48}
!18 = !{!12, !13, i64 40}
!19 = !{!12, !13, i64 56}
!20 = !{!21, !13, i64 64}
!21 = !{!"TestParameters_s", !22, i64 0, !22, i64 32, !13, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !13, i64 88, !13, i64 96, !23, i64 104, !10, i64 112}
!22 = !{!"PaStreamParameters", !10, i64 0, !10, i64 4, !23, i64 8, !13, i64 16, !6, i64 24}
!23 = !{!"long", !7, i64 0}
!24 = !{!21, !10, i64 80}
!25 = !{!21, !13, i64 96}
!26 = !{!13, !13, i64 0}
!27 = !{!21, !10, i64 112}
!28 = !{!29, !10, i64 464}
!29 = !{!"LoopbackContext_s", !7, i64 0, !7, i64 256, !13, i64 448, !13, i64 456, !10, i64 464, !10, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !10, i64 488, !10, i64 492, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !6, i64 512, !10, i64 520}
!30 = !{!31, !13, i64 16}
!31 = !{!"PaQaSineGenerator_s", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}


; 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.TestParameters_s = type { %struct.PaStreamParameters, %struct.PaStreamParameters, double, i32, i32, i32, double, double, i64, i32 }
%struct.PaStreamParameters = type { i32, i32, i64, double, ptr }
%struct.LoopbackContext_s = type { [8 x %struct.PaQaSineGenerator_s], [8 x %struct.PaQaRecording_s], double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32 }
%struct.PaQaSineGenerator_s = type { double, double, double, double }
%struct.PaQaRecording_s = type { i32, ptr, i32, i32 }

@g_testsPassed = external dso_local local_unnamed_addr global i32, align 4
@g_testsFailed = external dso_local local_unnamed_addr global i32, align 4
@.str.8 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [59 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaQa_RunLoopback(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaQa_CheckForClippedLoopback(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaQa_MeasureBackgroundNoise(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @PaQa_CheckForLoopBack(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.TestParameters_s, align 8
  %5 = alloca %struct.LoopbackContext_s, align 8
  %6 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 528, ptr nonnull %5) #4
  %7 = tail call ptr @Pa_GetDeviceInfo(i32 noundef %1) #4
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %11

9:                                                ; preds = %3
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %116

11:                                               ; preds = %3
  %12 = getelementptr inbounds i8, ptr %7, i64 20
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 2
  br i1 %14, label %116, label %15

15:                                               ; preds = %11
  %16 = tail call ptr @Pa_GetDeviceInfo(i32 noundef %2) #4
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %20

18:                                               ; preds = %15
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %116

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %16, i64 24
  %22 = load i32, ptr %21, align 8, !tbaa !12
  %23 = icmp slt i32 %22, 2
  br i1 %23, label %116, label %24

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %16, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %7, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, ptr noundef %26, ptr noundef %28)
  %30 = getelementptr inbounds i8, ptr %7, i64 32
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = fmul double %31, 1.000000e+03
  %33 = getelementptr inbounds i8, ptr %7, i64 48
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = fmul double %34, 1.000000e+03
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, double noundef %32, double noundef %35)
  %37 = getelementptr inbounds i8, ptr %16, i64 40
  %38 = load double, ptr %37, align 8, !tbaa !16
  %39 = fmul double %38, 1.000000e+03
  %40 = getelementptr inbounds i8, ptr %16, i64 56
  %41 = load double, ptr %40, align 8, !tbaa !17
  %42 = fmul double %41, 1.000000e+03
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, double noundef %39, double noundef %42)
  call void @PaQa_SetDefaultTestParameters(ptr noundef nonnull %4, i32 noundef %1, i32 noundef %2)
  call void @PaQa_OverrideTestParameters(ptr noundef nonnull %4, ptr noundef %0)
  %44 = getelementptr inbounds i8, ptr %4, i64 64
  %45 = load double, ptr %44, align 8, !tbaa !18
  %46 = fmul double %45, 8.000000e-01
  %47 = fptosi double %46 to i32
  %48 = getelementptr inbounds i8, ptr %4, i64 80
  store i32 %47, ptr %48, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %4, i64 96
  %50 = load double, ptr %49, align 8, !tbaa !23
  %51 = fmul double %50, 2.500000e-01
  %52 = call i32 @Pa_IsFormatSupported(ptr noundef nonnull %4, ptr noundef null, double noundef %45) #4
  %.not = icmp eq i32 %52, 0
  br i1 %.not, label %55, label %53

53:                                               ; preds = %24
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %116

55:                                               ; preds = %24
  %56 = getelementptr inbounds i8, ptr %4, i64 32
  %57 = load double, ptr %44, align 8, !tbaa !18
  %58 = call i32 @Pa_IsFormatSupported(ptr noundef null, ptr noundef nonnull %56, double noundef %57) #4
  %.not43 = icmp eq i32 %58, 0
  br i1 %.not43, label %61, label %59

59:                                               ; preds = %55
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  br label %116

61:                                               ; preds = %55
  %62 = call i32 @PaQa_SetupLoopbackContext(ptr noundef nonnull %5, ptr noundef nonnull %4)
  %63 = icmp eq i32 %1, %2
  %64 = getelementptr inbounds i8, ptr %4, i64 112
  %65 = load i32, ptr %64, align 8
  %66 = and i32 %65, -2
  %.sink = select i1 %63, i32 %66, i32 1
  store i32 %.sink, ptr %64, align 8, !tbaa !24
  %67 = call i32 @PaQa_RunLoopback(ptr noundef nonnull %5)
  %68 = getelementptr inbounds i8, ptr %5, i64 464
  %69 = load volatile i32, ptr %68, align 8, !tbaa !25
  %70 = icmp sgt i32 %69, 1
  br i1 %70, label %75, label %71

71:                                               ; preds = %61
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef nonnull @.str.16, i32 noundef 1220, ptr noundef nonnull @.str.17)
  %73 = load i32, ptr @g_testsFailed, align 4, !tbaa !27
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr @g_testsFailed, align 4, !tbaa !27
  call void @PaQa_TeardownLoopbackContext(ptr noundef nonnull %5)
  br label %116

75:                                               ; preds = %61
  %76 = load i32, ptr @g_testsPassed, align 4, !tbaa !27
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr @g_testsPassed, align 4, !tbaa !27
  %78 = load i32, ptr %48, align 8, !tbaa !22
  %79 = sdiv i32 %78, 2
  %80 = getelementptr inbounds i8, ptr %5, i64 256
  %81 = getelementptr inbounds i8, ptr %5, i64 16
  %82 = load double, ptr %81, align 8, !tbaa !28
  %83 = load double, ptr %44, align 8, !tbaa !18
  %84 = call double @PaQa_CorrelateSine(ptr noundef nonnull %80, double noundef %82, double noundef %83, i32 noundef %79, i32 noundef %79, ptr noundef null) #4
  %85 = getelementptr inbounds i8, ptr %5, i64 280
  %86 = getelementptr inbounds i8, ptr %5, i64 48
  %87 = load double, ptr %86, align 8, !tbaa !28
  %88 = load double, ptr %44, align 8, !tbaa !18
  %89 = call double @PaQa_CorrelateSine(ptr noundef nonnull %85, double noundef %87, double noundef %88, i32 noundef %79, i32 noundef %79, ptr noundef null) #4
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, double noundef %84, double noundef %89)
  %91 = fcmp ogt double %84, %51
  %92 = fcmp ogt double %89, %51
  %93 = and i1 %91, %92
  br i1 %93, label %105, label %94

94:                                               ; preds = %75
  %95 = load double, ptr %86, align 8, !tbaa !28
  %96 = load double, ptr %44, align 8, !tbaa !18
  %97 = call double @PaQa_CorrelateSine(ptr noundef nonnull %80, double noundef %95, double noundef %96, i32 noundef %79, i32 noundef %79, ptr noundef null) #4
  %98 = load double, ptr %81, align 8, !tbaa !28
  %99 = load double, ptr %44, align 8, !tbaa !18
  %100 = call double @PaQa_CorrelateSine(ptr noundef nonnull %85, double noundef %98, double noundef %99, i32 noundef %79, i32 noundef %79, ptr noundef null) #4
  %101 = fcmp ogt double %97, %51
  %102 = fcmp ogt double %100, %51
  %or.cond = select i1 %101, i1 %102, i1 false
  br i1 %or.cond, label %103, label %115

103:                                              ; preds = %94
  %104 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  br label %115

105:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  store double 0.000000e+00, ptr %6, align 8, !tbaa !30
  %106 = call i32 @PaQa_CheckForClippedLoopback(ptr noundef nonnull %5)
  %107 = call i32 @PaQa_MeasureBackgroundNoise(ptr noundef nonnull %5, ptr noundef nonnull %6)
  %108 = load double, ptr %6, align 8, !tbaa !30
  %109 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, double noundef %108)
  %.not45 = icmp eq i32 %107, 0
  br i1 %.not45, label %110, label %.sink.split

110:                                              ; preds = %105
  %.not44 = icmp eq i32 %106, 0
  %spec.select = zext i1 %.not44 to i32
  %111 = load double, ptr %6, align 8, !tbaa !30
  %112 = fcmp ogt double %111, 4.000000e-04
  br i1 %112, label %.sink.split, label %114

.sink.split:                                      ; preds = %110, %105
  %.str.22.sink = phi ptr [ @.str.21, %105 ], [ @.str.22, %110 ]
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.22.sink)
  br label %114

114:                                              ; preds = %.sink.split, %110
  %.1 = phi i32 [ %spec.select, %110 ], [ 0, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %115

115:                                              ; preds = %94, %103, %114
  %.2 = phi i32 [ %.1, %114 ], [ 0, %103 ], [ 0, %94 ]
  call void @PaQa_TeardownLoopbackContext(ptr noundef nonnull %5)
  br label %116

116:                                              ; preds = %20, %11, %71, %115, %59, %53, %18, %9
  %.0 = phi i32 [ -9996, %9 ], [ -9996, %18 ], [ 0, %53 ], [ 0, %59 ], [ %.2, %115 ], [ %67, %71 ], [ 0, %11 ], [ 0, %20 ]
  call void @llvm.lifetime.end.p0(i64 528, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %4) #4
  ret i32 %.0
}

declare ptr @Pa_GetDeviceInfo(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @PaQa_SetDefaultTestParameters(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @PaQa_OverrideTestParameters(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @Pa_IsFormatSupported(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @PaQa_SetupLoopbackContext(ptr noundef, ptr noundef) local_unnamed_addr #2

declare double @PaQa_CorrelateSine(ptr noundef, double noundef, double noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 20}
!6 = !{!"PaDeviceInfo", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !11, i64 32}
!15 = !{!6, !11, i64 48}
!16 = !{!6, !11, i64 40}
!17 = !{!6, !11, i64 56}
!18 = !{!19, !11, i64 64}
!19 = !{!"TestParameters_s", !20, i64 0, !20, i64 32, !11, i64 64, !7, i64 72, !7, i64 76, !7, i64 80, !11, i64 88, !11, i64 96, !21, i64 104, !7, i64 112}
!20 = !{!"PaStreamParameters", !7, i64 0, !7, i64 4, !21, i64 8, !11, i64 16, !10, i64 24}
!21 = !{!"long", !8, i64 0}
!22 = !{!19, !7, i64 80}
!23 = !{!19, !11, i64 96}
!24 = !{!19, !7, i64 112}
!25 = !{!26, !7, i64 464}
!26 = !{!"LoopbackContext_s", !8, i64 0, !8, i64 256, !11, i64 448, !11, i64 456, !7, i64 464, !7, i64 468, !7, i64 472, !7, i64 476, !7, i64 480, !7, i64 484, !7, i64 488, !7, i64 492, !7, i64 496, !7, i64 500, !7, i64 504, !7, i64 508, !10, i64 512, !7, i64 520}
!27 = !{!7, !7, i64 0}
!28 = !{!29, !11, i64 16}
!29 = !{!"PaQaSineGenerator_s", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!30 = !{!11, !11, i64 0}


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